27 Jim_Obj *objptr,
const struct jim_nvp *nvp_table,
const struct jim_nvp **result)
103 *puthere = (
struct jim_nvp *)p;
116 e = Jim_GetWide(interp, o, &w);
150 memset(p, 0,
sizeof(*p));
162 fprintf(stderr,
"---args---\n");
163 for (x = 0; x < p->
argc; x++)
164 fprintf(stderr,
"%2d) %s\n", x, Jim_String(p->
argv[x]));
165 fprintf(stderr,
"-------\n");
195 cp = Jim_GetString(o, len);
214 r = Jim_GetDouble(goi->
interp, o, puthere);
216 Jim_SetResultFormatted(goi->
interp,
"not a number: %#s", o);
232 r = Jim_GetWide(goi->
interp, o, puthere);
270 e = Jim_GetEnum(goi->
interp, o, lookup, puthere,
"option", JIM_ERRMSG);
275 Jim_Obj *param_name, Jim_Obj *param_value,
const struct jim_nvp *nvp)
278 Jim_SetResultFormatted(interp,
279 "%#s: Unknown: %#s, try one of: ",
283 Jim_SetResultFormatted(interp,
"Unknown param: %#s, try one of: ", param_value);
288 if ((nvp + 1)->
name) {
295 Jim_AppendStrings(interp, Jim_GetResult(interp), a, b,
NULL);
302 static Jim_Obj *debug_string_obj;
306 if (debug_string_obj)
307 Jim_FreeObj(interp, debug_string_obj);
309 debug_string_obj = Jim_NewEmptyStringObj(interp);
310 for (x = 0; x < argc; x++)
311 Jim_AppendStrings(interp, debug_string_obj, Jim_String(argv[x]),
" ",
NULL);
313 return Jim_String(debug_string_obj);
int jim_nvp_value2name_obj(Jim_Interp *interp, const struct jim_nvp *p, Jim_Obj *o, struct jim_nvp **result)
int jim_nvp_name2value_obj_nocase(Jim_Interp *interp, const struct jim_nvp *p, Jim_Obj *o, struct jim_nvp **puthere)
int jim_getopt_wide(struct jim_getopt_info *goi, jim_wide *puthere)
Remove argv[0] as wide.
int jim_getopt_setup(struct jim_getopt_info *p, Jim_Interp *interp, int argc, Jim_Obj *const *argv)
GetOpt - how to.
int jim_get_nvp(Jim_Interp *interp, Jim_Obj *objptr, const struct jim_nvp *nvp_table, const struct jim_nvp **result)
int jim_nvp_name2value_nocase(Jim_Interp *interp, const struct jim_nvp *_p, const char *name, struct jim_nvp **puthere)
struct jim_nvp * jim_nvp_name2value_simple(const struct jim_nvp *p, const char *name)
int jim_getopt_string(struct jim_getopt_info *goi, const char **puthere, int *len)
Remove argv[0] as string.
struct jim_nvp * jim_nvp_name2value_nocase_simple(const struct jim_nvp *p, const char *name)
int jim_getopt_enum(struct jim_getopt_info *goi, const char *const *lookup, int *puthere)
Remove argv[0] as Enum.
int jim_getopt_nvp(struct jim_getopt_info *goi, const struct jim_nvp *nvp, struct jim_nvp **puthere)
Remove argv[0] as NVP.
int jim_nvp_name2value(Jim_Interp *interp, const struct jim_nvp *_p, const char *name, struct jim_nvp **result)
void jim_getopt_nvp_unknown(struct jim_getopt_info *goi, const struct jim_nvp *nvptable, int hadprefix)
Create an appropriate error message for an NVP.
int jim_nvp_name2value_obj(Jim_Interp *interp, const struct jim_nvp *p, Jim_Obj *o, struct jim_nvp **result)
void jim_getopt_debug(struct jim_getopt_info *p)
Debug - Dump parameters to stderr.
int jim_getopt_obj(struct jim_getopt_info *goi, Jim_Obj **puthere)
Remove argv[0] from the list.
struct jim_nvp * jim_nvp_value2name_simple(const struct jim_nvp *p, int value)
const char * jim_debug_argv_string(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
Debug: convert argc/argv into a printable string for printf() debug.
int jim_nvp_value2name(Jim_Interp *interp, const struct jim_nvp *_p, int value, struct jim_nvp **result)
void jim_set_result_nvp_unknown(Jim_Interp *interp, Jim_Obj *param_name, Jim_Obj *param_value, const struct jim_nvp *nvp)
prints a nice 'unknown' parameter error message to the 'result'
int jim_getopt_double(struct jim_getopt_info *goi, double *puthere)
Remove argv[0] as double.
A TCL -ish GetOpt like code.
Name Value Pairs, aka: NVP.