Rizin
unix-like reverse engineering framework and cli tools
cmd_descs_generate Namespace Reference

Classes

class  Arg
 
class  Detail
 
class  CmdDesc
 

Functions

def _escape (s)
 
def strornull (s)
 
def strip (s)
 
def format_detail_entry (c)
 
def createcd_typegroup (cd)
 
def createcd (cd)
 
def arg2decl (cd)
 
def detail2decl (cd)
 
def handler2decl (cd, cd_type, handler_name)
 

Variables

string CMDDESCS_C_TEMPLATE
 
string CMDDESCS_H_TEMPLATE
 
tuple DESC_HELP_DETAIL_ENTRY_TEMPLATE
 
string DESC_HELP_DETAIL_ENTRIES_TEMPLATE
 
string DESC_HELP_DETAIL_TEMPLATE = """\t{{ .name = {name}, .entries = {entries} }}"""
 
string DESC_HELP_DETAILS_TEMPLATE
 
string DECL_DESC_HELP_DETAILS_TEMPLATE = "static const RzCmdDescDetail {cname}[{size}];"
 
string DESC_HELP_ARG_CHOICES = "static const char *{cname}[] = {{ {choices} }};\n"
 
string DESC_HELP_ARG_UNION_CHOICES = "\t\t.choices = {choices},\n"
 
string DESC_HELP_ARG_UNION_CHOICES_CB = "\t\t.choices_cb = {choices_cb},\n"
 
string DESC_HELP_ARG_TEMPLATE_FLAGS = "\t\t.flags = {flags},\n"
 
string DESC_HELP_ARG_TEMPLATE_OPTIONAL = "\t\t.optional = {optional},\n"
 
string DESC_HELP_ARG_TEMPLATE_NO_SPACE = "\t\t.no_space = {no_space},\n"
 
string DESC_HELP_ARG_TEMPLATE_DEFAULT_VALUE = "\t\t.default_value = {default_value},\n"
 
string DESC_HELP_ARG_TEMPLATE
 
string DESC_HELP_ARGS_TEMPLATE
 
string DECL_DESC_HELP_ARGS_TEMPLATE = "static const RzCmdDescArg {cname}[{size}];"
 
string DESC_HELP_TEMPLATE_DESCRIPTION = "\t.description = {description},\n"
 
string DESC_HELP_TEMPLATE_ARGS_STR = "\t.args_str = {args_str},\n"
 
string DESC_HELP_TEMPLATE_USAGE = "\t.usage = {usage},\n"
 
string DESC_HELP_TEMPLATE_SORT_SUBCOMMANDS = "\t.sort_subcommands = {sort_subcommands},\n"
 
string DESC_HELP_TEMPLATE_OPTIONS = "\t.options = {options},\n"
 
string DESC_HELP_TEMPLATE_DETAILS = "\t.details = {details},\n"
 
string DESC_HELP_TEMPLATE_DETAILS_CB = "\t.details_cb = {details_cb},\n"
 
string DESC_HELP_TEMPLATE_ARGS = "\t.args = {args},\n"
 
string DESC_HELP_TEMPLATE
 
string DEFINE_OLDINPUT_TEMPLATE
 
string DEFINE_ARGV_TEMPLATE
 
string DEFINE_ARGV_MODES_TEMPLATE
 
string DEFINE_ARGV_STATE_TEMPLATE
 
string DEFINE_GROUP_TEMPLATE
 
string DEFINE_GROUP_MODES_TEMPLATE
 
string DEFINE_GROUP_STATE_TEMPLATE
 
string DEFINE_INNER_TEMPLATE
 
string DEFINE_FAKE_TEMPLATE
 
string SET_DEFAULT_MODE_TEMPLATE
 
 parser
 
 type
 
 str
 
 required
 
 False
 
 help
 
 True
 
 nargs
 
 args = parser.parse_args()
 
list commands_yml_arr = [yaml.safe_load(f) for f in args.yaml_files]
 
dictionary commands_yml = {c["name"]: c["commands"] for c in commands_yml_arr}
 
 root_cd = CmdDesc(commands_yml, None)
 
list root_cds = [CmdDesc(commands_yml, c, root_cd) for c in commands_yml["root"]]
 
list arg_decls = [arg2decl(cd) for cd in CmdDesc.c_args.values()]
 
list detail_decls = [detail2decl(cd) for cd in CmdDesc.c_details.values()]
 
list helps = [str(cd) for cd in root_cds]
 
list init_code = [createcd(cd) for cd in root_cds]
 
string cf_text
 
 encoding
 
 handlers_decls
 
string hf_text
 

Function Documentation

◆ _escape()

def cmd_descs_generate._escape (   s)
private

Definition at line 140 of file cmd_descs_generate.py.

140 def _escape(s):
141  return s.replace("\\", "\\\\").replace('"', '\\"')
142 
143 
int replace(char *string, const char *token, const char *fmt,...)
Definition: tms320_dasm.c:325

References replace().

Referenced by strornull().

◆ arg2decl()

def cmd_descs_generate.arg2decl (   cd)

Definition at line 734 of file cmd_descs_generate.py.

734 def arg2decl(cd):
735  return DECL_DESC_HELP_ARGS_TEMPLATE.format(
736  cname=CmdDesc.get_arg_cname(cd), size=len(cd.args) + 1
737  )
738 
739 
size_t len
Definition: 6502dis.c:15

References len.

◆ createcd()

def cmd_descs_generate.createcd (   cd)

Definition at line 659 of file cmd_descs_generate.py.

659 def createcd(cd):
660  formatted_string = None
661 
662  if cd.type == CD_TYPE_ARGV:
663  formatted_string = DEFINE_ARGV_TEMPLATE.format(
664  cname=cd.cname,
665  parent_cname=cd.parent.cname,
666  name=strornull(cd.name),
667  handler_cname=cd.get_handler_cname(),
668  help_cname=cd.get_help_cname(),
669  )
670  elif cd.type == CD_TYPE_ARGV_MODES:
671  formatted_string = DEFINE_ARGV_MODES_TEMPLATE.format(
672  cname=cd.cname,
673  parent_cname=cd.parent.cname,
674  name=strornull(cd.name),
675  modes=" | ".join(cd.modes),
676  handler_cname=cd.get_handler_cname(),
677  help_cname=cd.get_help_cname(),
678  )
679  if cd.default_mode is not None:
680  formatted_string += SET_DEFAULT_MODE_TEMPLATE.format(
681  cname=cd.cname,
682  default_mode=cd.default_mode,
683  )
684  elif cd.type == CD_TYPE_ARGV_STATE:
685  formatted_string = DEFINE_ARGV_STATE_TEMPLATE.format(
686  cname=cd.cname,
687  parent_cname=cd.parent.cname,
688  name=strornull(cd.name),
689  modes=" | ".join(cd.modes),
690  handler_cname=cd.get_handler_cname(),
691  help_cname=cd.get_help_cname(),
692  )
693  if cd.default_mode is not None:
694  formatted_string += SET_DEFAULT_MODE_TEMPLATE.format(
695  cname=cd.cname,
696  default_mode=cd.default_mode,
697  )
698  elif cd.type == CD_TYPE_FAKE:
699  formatted_string = DEFINE_FAKE_TEMPLATE.format(
700  cname=cd.cname,
701  parent_cname=cd.parent.cname,
702  name=strornull(cd.name),
703  help_cname=cd.get_help_cname(),
704  )
705  elif cd.type == CD_TYPE_INNER:
706  formatted_string = DEFINE_INNER_TEMPLATE.format(
707  cname=cd.cname,
708  parent_cname=cd.parent.cname,
709  name=strornull(cd.name),
710  help_cname=cd.get_help_cname(),
711  )
712  formatted_string += "\n".join(
713  [createcd(child) for child in cd.subcommands or []]
714  )
715  elif cd.type == CD_TYPE_OLDINPUT:
716  formatted_string = DEFINE_OLDINPUT_TEMPLATE.format(
717  cname=cd.cname,
718  parent_cname=cd.parent.cname,
719  name=strornull(cd.name),
720  handler_cname=cd.get_handler_cname(),
721  help_cname=cd.get_help_cname(),
722  )
723  formatted_string += "\n".join(
724  [createcd(child) for child in cd.subcommands or []]
725  )
726  elif cd.type == CD_TYPE_GROUP:
727  formatted_string = createcd_typegroup(cd)
728  else:
729  raise Exception("Not handled cd type")
730 
731  return formatted_string
732 
733 

References createcd_typegroup(), and strornull().

Referenced by createcd_typegroup().

◆ createcd_typegroup()

def cmd_descs_generate.createcd_typegroup (   cd)

Definition at line 605 of file cmd_descs_generate.py.

605 def createcd_typegroup(cd):
606  if cd.exec_cd and cd.exec_cd.type == CD_TYPE_ARGV_MODES:
607  formatted_string = DEFINE_GROUP_MODES_TEMPLATE.format(
608  cname=cd.cname,
609  parent_cname=cd.parent.cname,
610  name=strornull(cd.name),
611  modes=" | ".join(cd.exec_cd.modes),
612  handler_cname=cd.exec_cd.get_handler_cname(),
613  help_cname_ref="&" + cd.exec_cd.get_help_cname(),
614  group_help_cname=cd.get_help_cname(),
615  )
616  if cd.exec_cd.default_mode is not None:
617  formatted_string += SET_DEFAULT_MODE_TEMPLATE.format(
618  cname=cd.cname,
619  default_mode=cd.exec_cd.default_mode,
620  )
621  formatted_string += "\n".join(
622  [createcd(child) for child in cd.subcommands[1:] or []]
623  )
624  elif cd.exec_cd and cd.exec_cd.type == CD_TYPE_ARGV_STATE:
625  formatted_string = DEFINE_GROUP_STATE_TEMPLATE.format(
626  cname=cd.cname,
627  parent_cname=cd.parent.cname,
628  name=strornull(cd.name),
629  modes=" | ".join(cd.exec_cd.modes),
630  handler_cname=cd.exec_cd.get_handler_cname(),
631  help_cname_ref="&" + cd.exec_cd.get_help_cname(),
632  group_help_cname=cd.get_help_cname(),
633  )
634  if cd.exec_cd.default_mode is not None:
635  formatted_string += SET_DEFAULT_MODE_TEMPLATE.format(
636  cname=cd.cname,
637  default_mode=cd.exec_cd.default_mode,
638  )
639  formatted_string += "\n".join(
640  [createcd(child) for child in cd.subcommands[1:] or []]
641  )
642  else:
643  formatted_string = DEFINE_GROUP_TEMPLATE.format(
644  cname=cd.cname,
645  parent_cname=cd.parent.cname,
646  name=strornull(cd.name),
647  handler_cname=(cd.exec_cd and cd.exec_cd.get_handler_cname()) or "NULL",
648  help_cname_ref=(cd.exec_cd and "&" + cd.exec_cd.get_help_cname()) or "NULL",
649  group_help_cname=cd.get_help_cname(),
650  )
651  subcommands = (
652  cd.exec_cd and cd.subcommands and cd.subcommands[1:]
653  ) or cd.subcommands
654  formatted_string += "\n".join([createcd(child) for child in subcommands or []])
655 
656  return formatted_string
657 
658 

References createcd(), and strornull().

Referenced by createcd().

◆ detail2decl()

def cmd_descs_generate.detail2decl (   cd)

Definition at line 740 of file cmd_descs_generate.py.

740 def detail2decl(cd):
741  return DECL_DESC_HELP_DETAILS_TEMPLATE.format(
742  cname=CmdDesc.get_detail_cname(cd), size=len(cd.details) + 1
743  )
744 
745 

References len.

◆ format_detail_entry()

def cmd_descs_generate.format_detail_entry (   c)

Definition at line 256 of file cmd_descs_generate.py.

256 def format_detail_entry(c):
257  if "text" not in c or "comment" not in c:
258  print("No `text`/`comment` fields for DetailEntry %s" % (c,))
259  sys.exit(1)
260 
261  text = strip(c["text"])
262  comment = strip(c["comment"])
263  arg_str = strip(c.get("arg_str"))
264 
265  return DESC_HELP_DETAIL_ENTRY_TEMPLATE.format(
266  text=strornull(text),
267  arg_str=strornull(arg_str),
268  comment=strornull(comment),
269  )
270 
271 

References strip(), and strornull().

◆ handler2decl()

def cmd_descs_generate.handler2decl (   cd,
  cd_type,
  handler_name 
)

Definition at line 746 of file cmd_descs_generate.py.

746 def handler2decl(cd, cd_type, handler_name):
747  out = []
748  if cd_type == CD_TYPE_ARGV:
749  out.append(
750  "RZ_IPI RzCmdStatus %s(RzCore *core, int argc, const char **argv);"
751  % (handler_name,)
752  )
753  if cd_type == CD_TYPE_ARGV_MODES:
754  out.append(
755  "RZ_IPI RzCmdStatus %s(RzCore *core, int argc, const char **argv, RzOutputMode mode);"
756  % (handler_name,)
757  )
758  if cd_type == CD_TYPE_ARGV_STATE:
759  out.append(
760  "RZ_IPI RzCmdStatus %s(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state);"
761  % (handler_name,)
762  )
763  if cd_type == CD_TYPE_OLDINPUT:
764  out.append("RZ_IPI int %s(void *data, const char *input);" % (handler_name,))
765 
766  if cd.details_cb is not None:
767  out.append(
768  "RZ_IPI RzCmdDescDetail *%s(RzCore *core, int argc, const char **argv);"
769  % (cd.details_cb,)
770  )
771 
772  if isinstance(cd.args, list):
773  for arg in cd.args:
774  d = arg.decl()
775  if d is not None:
776  out.append(d)
777 
778  return "\n".join(out) if out else None
779 
780 
def handler2decl(cd, cd_type, handler_name)

◆ strip()

def cmd_descs_generate.strip (   s)

Definition at line 148 of file cmd_descs_generate.py.

148 def strip(s):
149  return s.strip("\n") if s is not None else None
150 
151 

Referenced by format_detail_entry(), const_generator.gen(), mkdbname(), test_mc.run_mc(), rz_core_disasm_pde(), and test_mc.test_file().

◆ strornull()

def cmd_descs_generate.strornull (   s)

Definition at line 144 of file cmd_descs_generate.py.

144 def strornull(s):
145  return '"' + _escape(s) + '"' if s is not None else "NULL"
146 
147 

References _escape().

Referenced by cmd_descs_generate.Arg.__str__(), cmd_descs_generate.Detail.__str__(), cmd_descs_generate.CmdDesc.__str__(), createcd(), createcd_typegroup(), and format_detail_entry().

Variable Documentation

◆ arg_decls

list cmd_descs_generate.arg_decls = [arg2decl(cd) for cd in CmdDesc.c_args.values()]

Definition at line 803 of file cmd_descs_generate.py.

◆ args

cmd_descs_generate.args = parser.parse_args()

Definition at line 795 of file cmd_descs_generate.py.

◆ cf_text

string cmd_descs_generate.cf_text
Initial value:
1 = CMDDESCS_C_TEMPLATE.format(
2  helps_declarations="\n".join(detail_decls + arg_decls),
3  helps="\n".join(helps),
4  init_code="\n".join(init_code),
5 )

Definition at line 808 of file cmd_descs_generate.py.

◆ CMDDESCS_C_TEMPLATE

string cmd_descs_generate.CMDDESCS_C_TEMPLATE
Initial value:
1 = """// SPDX-FileCopyrightText: 2021 RizinOrg <info@rizin.re>
2 // SPDX-License-Identifier: LGPL-3.0-only
3 //
4 // WARNING: This file was auto-generated by cmd_descs_generate.py script. Do not
5 // modify it manually. Look at cmd_descs.yaml if you want to update commands.
6 //
7 
8 #include <cmd_descs.h>
9 
10 {helps_declarations}
11 
12 {helps}
13 RZ_IPI void rzshell_cmddescs_init(RzCore *core) {{
14 \tRzCmdDesc *root_cd = rz_cmd_get_root(core->rcmd);
15 \trz_cmd_batch_start(core->rcmd);
16 {init_code}
17 \trz_cmd_batch_end(core->rcmd);
18 }}
19 """

Definition at line 24 of file cmd_descs_generate.py.

◆ CMDDESCS_H_TEMPLATE

string cmd_descs_generate.CMDDESCS_H_TEMPLATE
Initial value:
1 = """// SPDX-FileCopyrightText: 2021 RizinOrg <info@rizin.re>
2 // SPDX-License-Identifier: LGPL-3.0-only
3 //
4 // WARNING: This file was auto-generated by cmd_descs_generate.py script. Do not
5 // modify it manually. Look at cmd_descs.yaml if you want to update commands.
6 //
7 
8 #include <rz_cmd.h>
9 #include <rz_core.h>
10 #include <rz_util.h>
11 
12 // Command handlers, manually defined somewhere else
13 {handlers_declarations}
14 
15 // Main function that initialize the entire commands tree
16 RZ_IPI void rzshell_cmddescs_init(RzCore *core);
17 """

Definition at line 44 of file cmd_descs_generate.py.

◆ commands_yml

dictionary cmd_descs_generate.commands_yml = {c["name"]: c["commands"] for c in commands_yml_arr}

Definition at line 798 of file cmd_descs_generate.py.

◆ commands_yml_arr

list cmd_descs_generate.commands_yml_arr = [yaml.safe_load(f) for f in args.yaml_files]

Definition at line 797 of file cmd_descs_generate.py.

◆ DECL_DESC_HELP_ARGS_TEMPLATE

string cmd_descs_generate.DECL_DESC_HELP_ARGS_TEMPLATE = "static const RzCmdDescArg {cname}[{size}];"

Definition at line 93 of file cmd_descs_generate.py.

◆ DECL_DESC_HELP_DETAILS_TEMPLATE

string cmd_descs_generate.DECL_DESC_HELP_DETAILS_TEMPLATE = "static const RzCmdDescDetail {cname}[{size}];"

Definition at line 75 of file cmd_descs_generate.py.

◆ DEFINE_ARGV_MODES_TEMPLATE

string cmd_descs_generate.DEFINE_ARGV_MODES_TEMPLATE
Initial value:
1 = """
2 \tRzCmdDesc *{cname}_cd = rz_cmd_desc_argv_modes_new(core->rcmd, {parent_cname}_cd, {name}, {modes}, {handler_cname}, &{help_cname});
3 \trz_warn_if_fail({cname}_cd);"""

Definition at line 114 of file cmd_descs_generate.py.

◆ DEFINE_ARGV_STATE_TEMPLATE

string cmd_descs_generate.DEFINE_ARGV_STATE_TEMPLATE
Initial value:
1 = """
2 \tRzCmdDesc *{cname}_cd = rz_cmd_desc_argv_state_new(core->rcmd, {parent_cname}_cd, {name}, {modes}, {handler_cname}, &{help_cname});
3 \trz_warn_if_fail({cname}_cd);"""

Definition at line 117 of file cmd_descs_generate.py.

◆ DEFINE_ARGV_TEMPLATE

string cmd_descs_generate.DEFINE_ARGV_TEMPLATE
Initial value:
1 = """
2 \tRzCmdDesc *{cname}_cd = rz_cmd_desc_argv_new(core->rcmd, {parent_cname}_cd, {name}, {handler_cname}, &{help_cname});
3 \trz_warn_if_fail({cname}_cd);"""

Definition at line 111 of file cmd_descs_generate.py.

◆ DEFINE_FAKE_TEMPLATE

string cmd_descs_generate.DEFINE_FAKE_TEMPLATE
Initial value:
1 = """
2 \tRzCmdDesc *{cname}_cd = rz_cmd_desc_fake_new(core->rcmd, {parent_cname}_cd, {name}, &{help_cname});
3 \trz_warn_if_fail({cname}_cd);"""

Definition at line 132 of file cmd_descs_generate.py.

◆ DEFINE_GROUP_MODES_TEMPLATE

string cmd_descs_generate.DEFINE_GROUP_MODES_TEMPLATE
Initial value:
1 = """
2 \tRzCmdDesc *{cname}_cd = rz_cmd_desc_group_modes_new(core->rcmd, {parent_cname}_cd, {name}, {modes}, {handler_cname}, {help_cname_ref}, &{group_help_cname});
3 \trz_warn_if_fail({cname}_cd);"""

Definition at line 123 of file cmd_descs_generate.py.

◆ DEFINE_GROUP_STATE_TEMPLATE

string cmd_descs_generate.DEFINE_GROUP_STATE_TEMPLATE
Initial value:
1 = """
2 \tRzCmdDesc *{cname}_cd = rz_cmd_desc_group_state_new(core->rcmd, {parent_cname}_cd, {name}, {modes}, {handler_cname}, {help_cname_ref}, &{group_help_cname});
3 \trz_warn_if_fail({cname}_cd);"""

Definition at line 126 of file cmd_descs_generate.py.

◆ DEFINE_GROUP_TEMPLATE

string cmd_descs_generate.DEFINE_GROUP_TEMPLATE
Initial value:
1 = """
2 \tRzCmdDesc *{cname}_cd = rz_cmd_desc_group_new(core->rcmd, {parent_cname}_cd, {name}, {handler_cname}, {help_cname_ref}, &{group_help_cname});
3 \trz_warn_if_fail({cname}_cd);"""

Definition at line 120 of file cmd_descs_generate.py.

◆ DEFINE_INNER_TEMPLATE

string cmd_descs_generate.DEFINE_INNER_TEMPLATE
Initial value:
1 = """
2 \tRzCmdDesc *{cname}_cd = rz_cmd_desc_inner_new(core->rcmd, {parent_cname}_cd, {name}, &{help_cname});
3 \trz_warn_if_fail({cname}_cd);"""

Definition at line 129 of file cmd_descs_generate.py.

◆ DEFINE_OLDINPUT_TEMPLATE

string cmd_descs_generate.DEFINE_OLDINPUT_TEMPLATE
Initial value:
1 = """
2 \tRzCmdDesc *{cname}_cd = rz_cmd_desc_oldinput_new(core->rcmd, {parent_cname}_cd, {name}, {handler_cname}, &{help_cname});
3 \trz_warn_if_fail({cname}_cd);"""

Definition at line 108 of file cmd_descs_generate.py.

◆ DESC_HELP_ARG_CHOICES

string cmd_descs_generate.DESC_HELP_ARG_CHOICES = "static const char *{cname}[] = {{ {choices} }};\n"

Definition at line 77 of file cmd_descs_generate.py.

◆ DESC_HELP_ARG_TEMPLATE

string cmd_descs_generate.DESC_HELP_ARG_TEMPLATE
Initial value:
1 = """\t{{
2 \t\t.name = {name},
3 \t\t.type = {type},
4 {flags}{optional}{no_space}{default_value}{union}
5 \t}}"""

Definition at line 84 of file cmd_descs_generate.py.

◆ DESC_HELP_ARG_TEMPLATE_DEFAULT_VALUE

string cmd_descs_generate.DESC_HELP_ARG_TEMPLATE_DEFAULT_VALUE = "\t\t.default_value = {default_value},\n"

Definition at line 83 of file cmd_descs_generate.py.

◆ DESC_HELP_ARG_TEMPLATE_FLAGS

string cmd_descs_generate.DESC_HELP_ARG_TEMPLATE_FLAGS = "\t\t.flags = {flags},\n"

Definition at line 80 of file cmd_descs_generate.py.

◆ DESC_HELP_ARG_TEMPLATE_NO_SPACE

string cmd_descs_generate.DESC_HELP_ARG_TEMPLATE_NO_SPACE = "\t\t.no_space = {no_space},\n"

Definition at line 82 of file cmd_descs_generate.py.

◆ DESC_HELP_ARG_TEMPLATE_OPTIONAL

string cmd_descs_generate.DESC_HELP_ARG_TEMPLATE_OPTIONAL = "\t\t.optional = {optional},\n"

Definition at line 81 of file cmd_descs_generate.py.

◆ DESC_HELP_ARG_UNION_CHOICES

string cmd_descs_generate.DESC_HELP_ARG_UNION_CHOICES = "\t\t.choices = {choices},\n"

Definition at line 78 of file cmd_descs_generate.py.

◆ DESC_HELP_ARG_UNION_CHOICES_CB

string cmd_descs_generate.DESC_HELP_ARG_UNION_CHOICES_CB = "\t\t.choices_cb = {choices_cb},\n"

Definition at line 79 of file cmd_descs_generate.py.

◆ DESC_HELP_ARGS_TEMPLATE

string cmd_descs_generate.DESC_HELP_ARGS_TEMPLATE
Initial value:
1 = """static const RzCmdDescArg {cname}[] = {{
2 {args}
3 }};
4 """

Definition at line 89 of file cmd_descs_generate.py.

◆ DESC_HELP_DETAIL_ENTRIES_TEMPLATE

string cmd_descs_generate.DESC_HELP_DETAIL_ENTRIES_TEMPLATE
Initial value:
1 = """static const RzCmdDescDetailEntry {cname}[] = {{
2 {entry}
3 }};
4 """

Definition at line 65 of file cmd_descs_generate.py.

◆ DESC_HELP_DETAIL_ENTRY_TEMPLATE

tuple cmd_descs_generate.DESC_HELP_DETAIL_ENTRY_TEMPLATE
Initial value:
1 = (
2 
3 )

Definition at line 62 of file cmd_descs_generate.py.

◆ DESC_HELP_DETAIL_TEMPLATE

string cmd_descs_generate.DESC_HELP_DETAIL_TEMPLATE = """\t{{ .name = {name}, .entries = {entries} }}"""

Definition at line 70 of file cmd_descs_generate.py.

◆ DESC_HELP_DETAILS_TEMPLATE

string cmd_descs_generate.DESC_HELP_DETAILS_TEMPLATE
Initial value:
1 = """static const RzCmdDescDetail {cname}[] = {{
2 {details}
3 }};
4 """

Definition at line 71 of file cmd_descs_generate.py.

◆ DESC_HELP_TEMPLATE

string cmd_descs_generate.DESC_HELP_TEMPLATE
Initial value:
1 = """static const RzCmdDescHelp {cname} = {{
2 \t.summary = {summary},
3 {description}{args_str}{usage}{options}{details}{details_cb}{args}{sort_subcommands}}};
4 """

Definition at line 103 of file cmd_descs_generate.py.

◆ DESC_HELP_TEMPLATE_ARGS

string cmd_descs_generate.DESC_HELP_TEMPLATE_ARGS = "\t.args = {args},\n"

Definition at line 102 of file cmd_descs_generate.py.

◆ DESC_HELP_TEMPLATE_ARGS_STR

string cmd_descs_generate.DESC_HELP_TEMPLATE_ARGS_STR = "\t.args_str = {args_str},\n"

Definition at line 96 of file cmd_descs_generate.py.

◆ DESC_HELP_TEMPLATE_DESCRIPTION

string cmd_descs_generate.DESC_HELP_TEMPLATE_DESCRIPTION = "\t.description = {description},\n"

Definition at line 95 of file cmd_descs_generate.py.

◆ DESC_HELP_TEMPLATE_DETAILS

string cmd_descs_generate.DESC_HELP_TEMPLATE_DETAILS = "\t.details = {details},\n"

Definition at line 100 of file cmd_descs_generate.py.

◆ DESC_HELP_TEMPLATE_DETAILS_CB

string cmd_descs_generate.DESC_HELP_TEMPLATE_DETAILS_CB = "\t.details_cb = {details_cb},\n"

Definition at line 101 of file cmd_descs_generate.py.

◆ DESC_HELP_TEMPLATE_OPTIONS

string cmd_descs_generate.DESC_HELP_TEMPLATE_OPTIONS = "\t.options = {options},\n"

Definition at line 99 of file cmd_descs_generate.py.

◆ DESC_HELP_TEMPLATE_SORT_SUBCOMMANDS

string cmd_descs_generate.DESC_HELP_TEMPLATE_SORT_SUBCOMMANDS = "\t.sort_subcommands = {sort_subcommands},\n"

Definition at line 98 of file cmd_descs_generate.py.

◆ DESC_HELP_TEMPLATE_USAGE

string cmd_descs_generate.DESC_HELP_TEMPLATE_USAGE = "\t.usage = {usage},\n"

Definition at line 97 of file cmd_descs_generate.py.

◆ detail_decls

list cmd_descs_generate.detail_decls = [detail2decl(cd) for cd in CmdDesc.c_details.values()]

Definition at line 804 of file cmd_descs_generate.py.

◆ encoding

◆ False

cmd_descs_generate.False

Definition at line 785 of file cmd_descs_generate.py.

◆ handlers_decls

cmd_descs_generate.handlers_decls
Initial value:
1 = filter(
2  lambda th: th[2] is not None,
3  [(cd, cd.type, cd.get_handler_cname()) for cd in CmdDesc.c_cds.values()],
4 )

Definition at line 821 of file cmd_descs_generate.py.

◆ help

◆ helps

list cmd_descs_generate.helps = [str(cd) for cd in root_cds]

Definition at line 805 of file cmd_descs_generate.py.

◆ hf_text

string cmd_descs_generate.hf_text
Initial value:
1 = CMDDESCS_H_TEMPLATE.format(
2  handlers_declarations="\n".join(
3  [handler2decl(cd, t, h) for cd, t, h in handlers_decls]
4  ),
5 )

Definition at line 826 of file cmd_descs_generate.py.

◆ init_code

list cmd_descs_generate.init_code = [createcd(cd) for cd in root_cds]

Definition at line 806 of file cmd_descs_generate.py.

◆ nargs

◆ parser

◆ required

cmd_descs_generate.required

Definition at line 785 of file cmd_descs_generate.py.

Referenced by gzfilebuf.fillbuf().

◆ root_cd

cmd_descs_generate.root_cd = CmdDesc(commands_yml, None)

◆ root_cds

list cmd_descs_generate.root_cds = [CmdDesc(commands_yml, c, root_cd) for c in commands_yml["root"]]

Definition at line 801 of file cmd_descs_generate.py.

◆ SET_DEFAULT_MODE_TEMPLATE

string cmd_descs_generate.SET_DEFAULT_MODE_TEMPLATE
Initial value:
1 = """
2 \trz_cmd_desc_set_default_mode({cname}_cd, {default_mode});"""

Definition at line 136 of file cmd_descs_generate.py.

◆ str

cmd_descs_generate.str

Definition at line 785 of file cmd_descs_generate.py.

Referenced by __add_cmdf_panel(), __addRow(), __input_cb(), __io_maps(), __load_cmdf(), __open(), __rap_system(), __read_nonnull_str_at(), __rtr_shell(), __search_strings(), cmd_descs_generate.CmdDesc.__str__(), __str_ansi_length(), __strbuf_append_col_aligned(), __strbuf_append_col_aligned_fancy(), _cb_hit(), _handle_call(), _is_any(), _zip_dirent_process_ef_utf_8(), _zip_ef_utf8(), _zip_get_name(), _zip_guess_encoding(), _zip_name_locate(), _zip_set_name(), add_abi_info(), add_cpu_info(), agraph_print(), Aindexof(), analop_esil(), aprintf(), arch_xap_disasm(), arm64ass(), arm_assemble(), arm_opcode_parse(), armass_assemble(), asciiart_backtrace(), assemble(), assign_reg(), autocomplete_breakpoints(), autocomplete_evals(), autocomplete_file(), autocomplete_flags(), autocomplete_functions(), autocomplete_macro(), autocomplete_minus(), autocomplete_process_path(), autocomplete_sdb(), autocomplete_theme(), base36_decode(), test-lz4-speed.benchmark_and_compare(), bfvm_reg_set(), bin_strfilter(), bsd_desc_list(), cabd_read_string(), calculate_utf8_string_info(), can_replace(), machtraps.carve_trap_num(), cin_get_num(), cmd_analysis_esil(), cmd_debug_cont_syscall(), cmd_prc(), cmd_print_pv(), cons_stack_dump(), cons_stack_load(), convert_dot_str_to_image(), core_analysis_graph_construct_nodes(), core_analysis_graph_label(), core_print_raw_buffer(), create_type_name_from_offset(), cs_strdup(), csr_number_to_string(), d_java_resource(), dalvik_disassemble(), decode_access_flags(), decode_addressing_modes(), decode_jmp8(), deflateBound(), deflateSetDictionary(), dem_str_replace(), disasm_strings(), disassemble(), do_analysis_search(), do_fputs(), do_ref_search(), ds_esc_str(), ds_print_as_string(), ds_print_lines_left(), ds_print_ptr(), ds_print_show_bytes(), ds_print_str(), ds_sub_jumps(), emit_arg(), emit_branch(), emit_call(), emit_get_while_end(), emit_jmp(), emit_set_string(), emit_string(), esilbreak_mem_read(), evalWord(), exists_var(), expect_reg_type_by_name(), false_positive(), file_info_cmp(), fill_window(), filter(), find_alias(), find_e_opts(), find_include(), foreachOffset(), gdbr_set_reg_profile(), const_generator.gen(), get_char_ratio(), get_cond_str(), get_constants(), cmd_descs_generate.Detail.get_cstructure(), get_elf_intrp(), get_namespace_and_name(), get_operator_code(), get_smem_str(), get_template_params(), getcoproc(), getcoprocreg(), gethtmlrgb(), getimmed8(), getnum(), getnumbang(), getreg(), getshift(), getthimmed12(), getToken(), test-lz4-speed.git_get_changes(), go_string_from_table(), gotoWord(), gzgets(), handlePAC(), has_dir_sep(), hex_string(), hit(), hud_filter(), ihex_parse(), info(), interpret_msrbank(), is_indirect_reg(), is_reg(), is_slash(), is_string_at(), isnum(), ispackedreg(), isregornum(), java_assemble(), lastChar(), le_read_nonnull_str_at(), libdemangle_handler_msvc(), libdemangle_handler_rust(), libdemangle_handler_swift(), libps_snprint(), lua_convert_str_to_num(), lua_is_valid_num_value_string(), macro_call(), match(), match_prefix_f(), mcore_snprint(), mdebug(), memlimit_show(), meta_load_cb(), meta_set(), meta_set_flag(), meta_set_string(), mini_RzANode_print(), mips_assemble(), mpc_err_print_to(), my_index(), myregwrite(), disasm_mc.normalize_hex(), test_mc.normalize_hex(), num_callback(), options_bcj(), options_delta(), options_lzma(), out_printf(), parse(), parse_bdot(), parse_block_list(), parse_cond(), parse_data_type(), parse_go_build_info(), parse_grep_expression(), parse_line_header_source(), parse_list(), parse_memlimit(), parse_number(), parse_options(), parse_real(), parse_segment_offset(), parse_tmp_evals(), parse_type_string(), parse_type_string_cached(), parsedatachar(), parseOpcode(), parseOperand(), parseOperands(), parseReg(), pattern_match(), popRN(), print_buf(), print_loop(), print_operands(), print_pseudo_instruction(), print_runner(), print_string_hex(), print_string_hex_short(), printHistBlock(), prompt(), PUT_CALLBACK(), rasm_asm(), rax(), rcc_context(), rcc_element(), rcc_fun(), rcc_next(), rcc_pusharg(), rcc_pushstr(), read_elf_intrp(), readline_callback(), reduce_false_positives(), reg_number_to_string(), replace(), replace_directives(), replace_directives_for(), resolve_fcn_name(), rop_classify(), rtrcmd(), runcmd(), rz_analysis_data_kind(), rz_analysis_esil_condition(), rz_analysis_esil_get_parm(), rz_analysis_esil_get_parm_size(), rz_analysis_esil_get_parm_type(), rz_analysis_esil_parse(), rz_analysis_esil_push(), rz_analysis_esil_pushnum(), rz_analysis_function_name_guess(), rz_analysis_function_signature_handler(), rz_analysis_op_hexstr(), rz_analysis_reflines_str(), rz_analysis_xrefs_from_list_handler(), rz_analysis_xrefs_to_graph_cmd_handler(), rz_arm_cs_analysis_op_32_esil(), rz_asm_code_equ_replace(), rz_asm_code_get_hex(), rz_asm_describe(), rz_asm_lm32_stringify(), rz_asm_massemble(), rz_asm_op_get_hex(), rz_asm_op_set_asm(), rz_asm_op_set_hex(), rz_asm_tokenize_asm_regex(), rz_asn1_concatenate_strings(), rz_asn1_free_string(), rz_asn1_stringify_bits(), rz_asn1_stringify_bytes(), rz_asn1_stringify_integer(), rz_asn1_stringify_oid(), rz_asn1_stringify_string(), rz_asn1_stringify_time(), rz_asn1_stringify_utctime(), rz_big_from_hexstr(), rz_bin_dmp64_init_triage_drivers(), rz_bin_string_filter(), rz_bin_string_free(), rz_bin_strpurge(), rz_buf_append_string(), rz_bv_as_hex_string(), rz_bv_as_string(), rz_cmd_debug(), rz_cmd_debug_process_profile_handler(), rz_cmd_eval_color_highlight_current_instruction_handler(), rz_cmd_eval_color_highlight_instruction_word_handler(), rz_cmd_help(), rz_cmd_print(), rz_cmd_search(), rz_config_eval(), rz_cons_flush(), rz_cons_get_size(), rz_cons_grep_line(), rz_cons_grepbuf(), rz_cons_html_filter(), rz_cons_less_str(), rz_cons_memcat(), rz_cons_pal_list(), rz_cons_pal_parse(), rz_cons_println(), rz_cons_readpush(), rz_cons_rgb_tostring(), rz_cons_set_title(), rz_cons_strcat(), rz_cons_strcat_at(), rz_cons_strcat_justify(), rz_core_analysis_data(), rz_core_analysis_esil(), rz_core_bin_apply_config(), rz_core_bin_apply_entry(), rz_core_bin_apply_sections(), rz_core_bin_apply_strings(), rz_core_bin_pdb_gvars_as_string(), rz_core_bin_pdb_gvars_print(), rz_core_cmd_buffer(), rz_core_cmd_foreach(), rz_core_cmd_pipe_old(), rz_core_cmd_subst_i(), rz_core_config_print_all(), rz_core_disasm_instruction(), rz_core_editor(), rz_core_fortune_list(), rz_core_get_asmqjmps(), rz_core_hack_arm(), rz_core_hack_x86(), rz_core_io_plugin_print(), rz_core_magic_at(), rz_core_meta_print(), rz_core_op_str(), rz_core_print_disasm_all(), rz_core_print_examine(), rz_core_rtr_add(), rz_core_rtr_cmd(), rz_core_rtr_cmds(), rz_core_rtr_pushout(), rz_core_set_asmqjmps(), rz_core_syscall_as_string(), rz_core_syscallf(), rz_core_types_as_c_all(), rz_core_types_enum_as_c_all(), rz_core_types_function_print(), rz_core_types_struct_as_c_all(), rz_core_types_typedef_as_c_all(), rz_core_types_union_as_c_all(), rz_core_visual_comments(), rz_core_visual_define(), rz_core_write_length_string_at(), rz_core_write_string_at(), rz_core_write_string_wide_at(), rz_core_write_string_zero_at(), rz_core_yank_dump(), rz_core_yank_hexpair(), rz_core_yank_set_str(), rz_debug_gdb_set_reg_profile(), rz_debug_num_callback(), rz_debug_plugin_set_reg_profile(), rz_debug_trace_at(), rz_debug_use(), rz_detected_string_free(), rz_egg_lang_parsechar(), rz_egg_mkvar(), rz_file_exists(), rz_file_gzslurp(), rz_file_is_directory(), rz_file_is_regular(), rz_file_path(), rz_file_size(), rz_file_slurp(), rz_file_slurp_hexpairs(), rz_file_slurp_line(), rz_file_slurp_lines(), rz_file_slurp_lines_from_bottom(), rz_file_slurp_random_line_count(), rz_file_slurp_range(), rz_get_input_num_value(), rz_hex_from_js(), rz_hex_str_is_valid(), rz_interpret_output_handler(), rz_json_as_string(), rz_lib_types_get_i(), rz_line_clipboard_push(), rz_line_completion_push(), rz_luac_asm(), rz_main_rz_gg(), rz_meta_set(), rz_meta_set_with_subtype(), rz_num_as_string(), rz_num_base_of_string(), rz_num_between(), rz_num_calc(), rz_num_conditional(), rz_num_get(), rz_num_get_float(), rz_num_is_float(), rz_num_math(), rz_num_str_len(), rz_num_str_split(), rz_num_str_split_list(), rz_parse_assemble(), rz_parse_filter(), rz_parse_subvar(), rz_print_hexpair(), rz_print_jsondump_str(), rz_print_string_c_cpp_handler(), rz_range_add_from_string(), rz_reg_arena_set_bytes(), rz_reg_cond_from_string(), rz_reg_parse_gdb_profile(), rz_reg_role_by_name(), rz_reg_set_bvalue(), rz_reg_set_profile(), rz_reg_type_by_name(), rz_regex_check(), rz_run_new(), rz_run_parse(), rz_search_keyword_new_regexp(), rz_search_keyword_new_wide(), rz_search_strings_update(), rz_serialize_core_load(), rz_serialize_flag_load(), rz_signal_from_string(), rz_socket_http_handle_upload(), rz_socket_to_string(), rz_str_ansi_chrn(), rz_str_ansi_crop(), rz_str_ansi_filter(), rz_str_ansi_len(), rz_str_ansi_nlen(), rz_str_ansi_trim(), rz_str_arg_escape(), rz_str_binstr2bin(), rz_str_bounds(), rz_str_case(), rz_str_constpool_get(), rz_str_crop(), rz_str_do_until_token(), rz_str_dup(), rz_str_endswith(), rz_str_endswith_icase(), rz_str_filter(), rz_str_filter_zeroline(), rz_str_from_ut64(), rz_str_get(), rz_str_get_null(), rz_str_glob(), rz_str_highlight(), rz_str_home(), rz_str_ichr(), rz_str_is_ascii(), rz_str_is_printable(), rz_str_is_printable_incl_newlines(), rz_str_is_printable_limited(), rz_str_is_utf8(), rz_str_is_whitespace(), rz_str_isnumber(), rz_str_last(), rz_str_lchr(), rz_str_len_utf8_ansi(), rz_str_list_join(), rz_str_new(), rz_str_newlen(), rz_str_nlen(), rz_str_nlen_w(), rz_str_path_escape(), rz_str_remove_char(), rz_str_replace(), rz_str_replace_icase(), rz_str_replace_in(), rz_str_replace_thunked(), rz_str_reverse(), rz_str_rwx(), rz_str_scale(), rz_str_split(), rz_str_split_duplist(), rz_str_split_duplist_n(), rz_str_split_duplist_n_regex(), rz_str_split_lines(), rz_str_split_list(), rz_str_split_list_regex(), rz_str_startswith(), rz_str_startswith_icase(), rz_str_strchr(), rz_str_stripLine(), rz_str_trim(), rz_str_trim_char(), rz_str_trim_dup(), rz_str_trim_head(), rz_str_trim_head_char(), rz_str_trim_head_ro(), rz_str_trim_head_wp(), rz_str_trim_lines(), rz_str_trim_nc(), rz_str_trim_tail(), rz_str_trim_tail_char(), rz_str_trunc_ellipsis(), rz_str_utf8_charsize(), rz_str_utf8_charsize_last(), rz_str_utf8_charsize_prev(), rz_str_word_get0(), rz_str_word_get_next0(), rz_str_word_set0(), rz_str_word_set0_stack(), rz_str_wrap(), rz_strbuf_new(), rz_sub_str_lchr(), rz_sub_str_rchr(), rz_sys_cmdbg(), rz_syscall_get_num(), rz_type_db_load_callables_sdb_str(), rz_type_db_load_sdb_str(), rz_type_enum_c_handler(), rz_type_enum_c_nl_handler(), rz_type_list_c_handler(), rz_type_list_c_nl_handler(), rz_type_structure_c_handler(), rz_type_structure_c_nl_handler(), rz_type_typedef_c_handler(), rz_type_union_c_handler(), rz_type_union_c_nl_handler(), rz_types_open_editor(), rz_utf8_encode_str(), rz_utf8_strlen(), rz_utf_block_list(), rzpipe_cmd(), rzpipe_write(), sdb_alen(), sdb_alen_ignore_empty(), sdb_anext(), sdb_anext2(), sdb_array_add_sorted(), sdb_array_add_sorted_num(), sdb_array_append(), sdb_array_delete(), sdb_array_get(), sdb_array_get_num(), sdb_array_indexof(), sdb_array_insert(), sdb_array_pop_head(), sdb_array_pop_tail(), sdb_array_prepend(), sdb_array_remove(), sdb_array_remove_num(), sdb_array_set(), sdb_array_sort(), sdb_array_sort_num(), sdb_aslice(), sdb_bool_get(), sdb_bool_set(), sdb_const_anext(), sdb_disk_create(), sdb_fmt_array(), sdb_fmt_array_num(), sdb_fmt_tobin(), sdb_journal_load(), sdb_journal_log(), sdb_match(), sdb_ns_path(), search_db_check_panel_type(), sections(), seek_to_end_of_token(), set_profile_string(), showstr(), srecord_parse(), str_dup_safe(), str_dup_safe_fixed(), str_endswith(), str_split_list_common(), str_split_list_common_regex(), strbuf_append(), strdup_limit(), strdupn(), strings_print(), strnlen(), subvar(), TAG_CALLBACK(), test-lz4-list.TestVerbose.test_compressed(), test-lz4-list.TestVerbose.test_frame_number(), test-lz4-list.TestNonVerbose.test_frames(), test-lz4-list.TestVerbose.test_uncompressed(), thumb_getshift(), tms320_c55x_op(), tokenize_asm_generic(), ts_node_handle_arg(), tuklib_mbstr_fw(), tuklib_mbstr_width(), type_list_c_all(), type_list_c_all_nl(), types_xrefs_function(), types_xrefs_summary(), visual_search(), vle_snprint(), w32_dbg_wait(), machtraps.walk_back_until(), zip_file_get_comment(), and zip_get_archive_comment().

◆ True

cmd_descs_generate.True

Definition at line 787 of file cmd_descs_generate.py.

◆ type

cmd_descs_generate.type

Definition at line 785 of file cmd_descs_generate.py.