OpenOCD
|
Go to the source code of this file.
Data Structures | |
struct | jim_getopt_info |
A TCL -ish GetOpt like code. More... | |
struct | jim_nvp |
Name Value Pairs, aka: NVP. More... | |
Functions | |
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. More... | |
int | jim_get_nvp (Jim_Interp *interp, Jim_Obj *objptr, const struct jim_nvp *nvp_table, const struct jim_nvp **result) |
void | jim_getopt_debug (struct jim_getopt_info *goi) |
Debug - Dump parameters to stderr. More... | |
int | jim_getopt_double (struct jim_getopt_info *goi, double *puthere) |
Remove argv[0] as double. More... | |
int | jim_getopt_enum (struct jim_getopt_info *goi, const char *const *lookup, int *puthere) |
Remove argv[0] as Enum. More... | |
int | jim_getopt_nvp (struct jim_getopt_info *goi, const struct jim_nvp *lookup, struct jim_nvp **puthere) |
Remove argv[0] as NVP. More... | |
void | jim_getopt_nvp_unknown (struct jim_getopt_info *goi, const struct jim_nvp *lookup, int hadprefix) |
Create an appropriate error message for an NVP. More... | |
int | jim_getopt_obj (struct jim_getopt_info *goi, Jim_Obj **puthere) |
Remove argv[0] from the list. More... | |
int | jim_getopt_setup (struct jim_getopt_info *goi, Jim_Interp *interp, int argc, Jim_Obj *const *argv) |
GetOpt - how to. More... | |
int | jim_getopt_string (struct jim_getopt_info *goi, const char **puthere, int *len) |
Remove argv[0] as string. More... | |
int | jim_getopt_wide (struct jim_getopt_info *goi, jim_wide *puthere) |
Remove argv[0] as wide. More... | |
int | jim_nvp_name2value (Jim_Interp *interp, const struct jim_nvp *nvp_table, const char *name, struct jim_nvp **result) |
int | jim_nvp_name2value_nocase (Jim_Interp *interp, const struct jim_nvp *nvp_table, const char *name, struct jim_nvp **result) |
struct jim_nvp * | jim_nvp_name2value_nocase_simple (const struct jim_nvp *nvp_table, const char *name) |
int | jim_nvp_name2value_obj (Jim_Interp *interp, const struct jim_nvp *nvp_table, Jim_Obj *name_obj, struct jim_nvp **result) |
int | jim_nvp_name2value_obj_nocase (Jim_Interp *interp, const struct jim_nvp *nvp_table, Jim_Obj *name_obj, struct jim_nvp **result) |
struct jim_nvp * | jim_nvp_name2value_simple (const struct jim_nvp *nvp_table, const char *name) |
int | jim_nvp_value2name (Jim_Interp *interp, const struct jim_nvp *nvp_table, int value, struct jim_nvp **result) |
int | jim_nvp_value2name_obj (Jim_Interp *interp, const struct jim_nvp *nvp_table, Jim_Obj *value_obj, struct jim_nvp **result) |
struct jim_nvp * | jim_nvp_value2name_simple (const struct jim_nvp *nvp_table, int v) |
void | jim_set_result_nvp_unknown (Jim_Interp *interp, Jim_Obj *param_name, Jim_Obj *param_value, const struct jim_nvp *nvp_table) |
prints a nice 'unknown' parameter error message to the 'result' More... | |
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.
interp | - the interpreter |
argc | - arg count |
argv | - the objects |
Note, next call to this function will free the old (last) string.
For example might want do this:
Definition at line 301 of file jim-nvp.c.
References NULL.
int jim_get_nvp | ( | Jim_Interp * | interp, |
Jim_Obj * | objptr, | ||
const struct jim_nvp * | nvp_table, | ||
const struct jim_nvp ** | result | ||
) |
Definition at line 27 of file jim-nvp.c.
References jim_nvp_name2value_obj(), and jim_nvp::name.
void jim_getopt_debug | ( | struct jim_getopt_info * | goi | ) |
Debug - Dump parameters to stderr.
goi | - current parameters |
Definition at line 159 of file jim-nvp.c.
References jim_getopt_info::argc, and jim_getopt_info::argv.
int jim_getopt_double | ( | struct jim_getopt_info * | goi, |
double * | puthere | ||
) |
Remove argv[0] as double.
goi | - get opt info |
puthere | - where param is put. |
Definition at line 204 of file jim-nvp.c.
References jim_getopt_info::interp, and jim_getopt_obj().
int jim_getopt_enum | ( | struct jim_getopt_info * | goi, |
const char *const * | lookup, | ||
int * | puthere | ||
) |
Remove argv[0] as Enum.
goi | - get opt info |
lookup | - lookup table. |
puthere | - where param is put. |
Definition at line 261 of file jim-nvp.c.
References jim_getopt_info::interp, and jim_getopt_obj().
int jim_getopt_nvp | ( | struct jim_getopt_info * | goi, |
const struct jim_nvp * | lookup, | ||
struct jim_nvp ** | puthere | ||
) |
Remove argv[0] as NVP.
goi | - get opt info |
lookup | - nvp lookup table |
puthere | - where param is put. |
Definition at line 237 of file jim-nvp.c.
References jim_getopt_info::interp, jim_getopt_obj(), and jim_nvp_name2value_obj().
Referenced by arm_tpiu_swo_configure(), dap_configure(), jim_target_invoke_event(), and target_configure().
void jim_getopt_nvp_unknown | ( | struct jim_getopt_info * | goi, |
const struct jim_nvp * | lookup, | ||
int | hadprefix | ||
) |
Create an appropriate error message for an NVP.
goi | - options info |
lookup | - the NVP table that was used. |
hadprefix | - 0 or 1 if the option had a prefix. |
This function will set the "interp->result" to a human readable error message listing the available options.
This function assumes the previous option argv[-1] is the unknown string.
If this option had some prefix, then pass "hadprefix = 1" else pass "hadprefix = 0"
Example:
Definition at line 253 of file jim-nvp.c.
References jim_getopt_info::argv, jim_getopt_info::interp, jim_set_result_nvp_unknown(), and NULL.
Referenced by arm_tpiu_swo_configure(), dap_configure(), jim_target_invoke_event(), and target_configure().
int jim_getopt_obj | ( | struct jim_getopt_info * | goi, |
Jim_Obj ** | puthere | ||
) |
Remove argv[0] from the list.
goi | - get opt info |
puthere | - where param is put |
Definition at line 169 of file jim-nvp.c.
References jim_getopt_info::argc, jim_getopt_info::argv, and NULL.
Referenced by aarch64_jim_configure(), adiv5_jim_spot_configure(), arm_tpiu_swo_configure(), cti_create(), dap_configure(), dap_create(), jim_arm_tpiu_swo_create(), jim_getopt_double(), jim_getopt_enum(), jim_getopt_nvp(), jim_getopt_string(), jim_getopt_wide(), target_configure(), and target_create().
int jim_getopt_setup | ( | struct jim_getopt_info * | goi, |
Jim_Interp * | interp, | ||
int | argc, | ||
Jim_Obj *const * | argv | ||
) |
GetOpt - how to.
Example (short and incomplete):
Setup GETOPT
goi | - get opt info to be initialized |
interp | - jim interp |
argc | - argc count. |
argv | - argv (will be copied) |
Definition at line 149 of file jim-nvp.c.
References jim_getopt_info::argc, jim_getopt_info::argv, and jim_getopt_info::interp.
Referenced by jim_arm_tpiu_swo_configure(), jim_arm_tpiu_swo_create(), jim_cti_create(), jim_dap_create(), jim_target_configure(), jim_target_create(), and jim_target_invoke_event().
int jim_getopt_string | ( | struct jim_getopt_info * | goi, |
const char ** | puthere, | ||
int * | len | ||
) |
Remove argv[0] as string.
goi | - get opt info |
puthere | - where param is put |
len | - return its length |
Definition at line 188 of file jim-nvp.c.
References jim_getopt_obj().
Referenced by arm_tpiu_swo_configure(), rtos_create(), stm8_jim_configure(), target_configure(), and target_create().
int jim_getopt_wide | ( | struct jim_getopt_info * | goi, |
jim_wide * | puthere | ||
) |
Remove argv[0] as wide.
goi | - get opt info |
puthere | - where param is put. |
Definition at line 222 of file jim-nvp.c.
References jim_getopt_info::interp, and jim_getopt_obj().
Referenced by adiv5_jim_spot_configure(), arm_tpiu_swo_configure(), dap_configure(), stm8_jim_configure(), and target_configure().
int jim_nvp_name2value | ( | Jim_Interp * | interp, |
const struct jim_nvp * | nvp_table, | ||
const char * | name, | ||
struct jim_nvp ** | result | ||
) |
Definition at line 71 of file jim-nvp.c.
References jim_nvp_name2value_simple(), jim_nvp::name, and name.
Referenced by jim_nvp_name2value_obj().
int jim_nvp_name2value_nocase | ( | Jim_Interp * | interp, |
const struct jim_nvp * | nvp_table, | ||
const char * | name, | ||
struct jim_nvp ** | result | ||
) |
Definition at line 96 of file jim-nvp.c.
References jim_nvp_name2value_nocase_simple(), jim_nvp::name, and name.
Referenced by jim_nvp_name2value_obj_nocase().
struct jim_nvp* jim_nvp_name2value_nocase_simple | ( | const struct jim_nvp * | nvp_table, |
const char * | name | ||
) |
Definition at line 56 of file jim-nvp.c.
References jim_nvp::name, and name.
Referenced by jim_nvp_name2value_nocase().
int jim_nvp_name2value_obj | ( | Jim_Interp * | interp, |
const struct jim_nvp * | nvp_table, | ||
Jim_Obj * | name_obj, | ||
struct jim_nvp ** | result | ||
) |
Definition at line 66 of file jim-nvp.c.
References jim_nvp_name2value().
Referenced by aarch64_jim_configure(), adiv5_jim_spot_configure(), jim_get_nvp(), and jim_getopt_nvp().
int jim_nvp_name2value_obj_nocase | ( | Jim_Interp * | interp, |
const struct jim_nvp * | nvp_table, | ||
Jim_Obj * | name_obj, | ||
struct jim_nvp ** | result | ||
) |
Definition at line 88 of file jim-nvp.c.
References jim_nvp_name2value_nocase().
Definition at line 46 of file jim-nvp.c.
References jim_nvp::name, and name.
Referenced by jim_nvp_name2value().
int jim_nvp_value2name | ( | Jim_Interp * | interp, |
const struct jim_nvp * | nvp_table, | ||
int | value, | ||
struct jim_nvp ** | result | ||
) |
Definition at line 134 of file jim-nvp.c.
References jim_nvp_value2name_simple(), jim_nvp::name, and jim_nvp::value.
Referenced by arm_tpiu_swo_configure(), and jim_nvp_value2name_obj().
int jim_nvp_value2name_obj | ( | Jim_Interp * | interp, |
const struct jim_nvp * | nvp_table, | ||
Jim_Obj * | value_obj, | ||
struct jim_nvp ** | result | ||
) |
Definition at line 112 of file jim-nvp.c.
References jim_nvp_value2name().
Definition at line 124 of file jim-nvp.c.
References jim_nvp::name, and jim_nvp::value.
Referenced by arm_tpiu_swo_handle_event(), COMMAND_HANDLER(), jim_nvp_value2name(), target_configure(), and target_event_name().
void jim_set_result_nvp_unknown | ( | Jim_Interp * | interp, |
Jim_Obj * | param_name, | ||
Jim_Obj * | param_value, | ||
const struct jim_nvp * | nvp_table | ||
) |