28 Jim_Obj *objptr,
const struct jim_nvp *nvp_table,
const struct jim_nvp **result)
104 *puthere = (
struct jim_nvp *)p;
117 e = Jim_GetWide(interp, o, &w);
151 memset(p, 0,
sizeof(*p));
163 fprintf(stderr,
"---args---\n");
164 for (x = 0; x < p->
argc; x++)
165 fprintf(stderr,
"%2d) %s\n", x, Jim_String(p->
argv[x]));
166 fprintf(stderr,
"-------\n");
196 cp = Jim_GetString(o, len);
215 r = Jim_GetDouble(goi->
interp, o, puthere);
217 Jim_SetResultFormatted(goi->
interp,
"not a number: %#s", o);
233 r = Jim_GetWide(goi->
interp, o, puthere);
271 e = Jim_GetEnum(goi->
interp, o, lookup, puthere,
"option", JIM_ERRMSG);
276 Jim_Obj *param_name, Jim_Obj *param_value,
const struct jim_nvp *
nvp)
279 Jim_SetResultFormatted(interp,
280 "%#s: Unknown: %#s, try one of: ",
284 Jim_SetResultFormatted(interp,
"Unknown param: %#s, try one of: ", param_value);
296 Jim_AppendStrings(interp, Jim_GetResult(interp), a, b,
NULL);
303 static Jim_Obj *debug_string_obj;
307 if (debug_string_obj)
308 Jim_FreeObj(interp, debug_string_obj);
310 debug_string_obj = Jim_NewEmptyStringObj(interp);
311 for (x = 0; x < argc; x++)
312 Jim_AppendStrings(interp, debug_string_obj, Jim_String(argv[x]),
" ",
NULL);
314 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.
Name Value Pairs, aka: NVP.