- fprintf (stream, _("\n\
-The following ARC specific disassembler options are supported for use \n\
-with -M switch (multiple options should be separated by commas):\n"));
-
- fprintf (stream, _("\
- dsp Recognize DSP instructions.\n"));
- fprintf (stream, _("\
- spfp Recognize FPX SP instructions.\n"));
- fprintf (stream, _("\
- dpfp Recognize FPX DP instructions.\n"));
- fprintf (stream, _("\
- quarkse_em Recognize FPU QuarkSE-EM instructions.\n"));
- fprintf (stream, _("\
- fpuda Recognize double assist FPU instructions.\n"));
- fprintf (stream, _("\
- fpus Recognize single precision FPU instructions.\n"));
- fprintf (stream, _("\
- fpud Recognize double precision FPU instructions.\n"));
+ const disasm_options_and_args_t *opts_and_args;
+ const disasm_option_arg_t *args;
+ const disasm_options_t *opts;
+ size_t i, j;
+ size_t max_len = 0;
+
+ opts_and_args = disassembler_options_arc ();
+ opts = &opts_and_args->options;
+ args = opts_and_args->args;
+
+ fprintf (stream, _("\nThe following ARC specific disassembler options are"
+ " supported for use \nwith the -M switch (multiple"
+ " options should be separated by commas):\n"));
+
+ /* Find the maximum length for printing options (and their arg name). */
+ for (i = 0; opts->name[i] != NULL; ++i)
+ {
+ size_t len = strlen (opts->name[i]);
+ len += (opts->arg[i]) ? strlen (opts->arg[i]->name) : 0;
+ max_len = (len > max_len) ? len : max_len;
+ }
+
+ /* Print the options, their arg and description, if any. */
+ for (i = 0, ++max_len; opts->name[i] != NULL; ++i)
+ {
+ fprintf (stream, " %s", opts->name[i]);
+ if (opts->arg[i] != NULL)
+ fprintf (stream, "%s", opts->arg[i]->name);
+ if (opts->description[i] != NULL)
+ {
+ size_t len = strlen (opts->name[i]);
+ len += (opts->arg[i]) ? strlen (opts->arg[i]->name) : 0;
+ fprintf (stream,
+ "%*c %s", (int) (max_len - len), ' ', opts->description[i]);
+ }
+ fprintf (stream, _("\n"));
+ }
+
+ /* Print the possible values of an argument. */
+ for (i = 0; args[i].name != NULL; ++i)
+ {
+ size_t len = 3;
+ fprintf (stream, _("\n\
+ For the options above, the following values are supported for \"%s\":\n "),
+ args[i].name);
+ for (j = 0; args[i].values[j] != NULL; ++j)
+ {
+ fprintf (stream, " %s", args[i].values[j]);
+ len += strlen (args[i].values[j]) + 1;
+ /* reset line if printed too long. */
+ if (len >= 78)
+ {
+ fprintf (stream, _("\n "));
+ len = 3;
+ }
+ }
+ fprintf (stream, _("\n"));
+ }
+
+ fprintf (stream, _("\n"));