Rizin
unix-like reverse engineering framework and cli tools
cparser.c File Reference
#include <rz_core.h>

Go to the source code of this file.

Functions

RZ_API RzCmdStatus rz_core_parser_plugin_print (RzParsePlugin *plugin, RzCmdStateOutput *state)
 
RZ_API RzCmdStatus rz_core_parser_plugins_print (RzParse *parser, RzCmdStateOutput *state)
 

Function Documentation

◆ rz_core_parser_plugin_print()

RZ_API RzCmdStatus rz_core_parser_plugin_print ( RzParsePlugin plugin,
RzCmdStateOutput state 
)

Definition at line 6 of file cparser.c.

6  {
7  PJ *pj = state->d.pj;
8  switch (state->mode) {
9  case RZ_OUTPUT_MODE_JSON: {
10  pj_o(pj);
11  pj_ks(pj, "name", plugin->name);
12  pj_end(pj);
13  break;
14  }
16  rz_cons_printf("%s\n", plugin->name);
17  break;
18  }
19  default: {
22  }
23  }
24  return RZ_CMD_STATUS_OK;
25 }
RZ_API int rz_cons_printf(const char *format,...)
Definition: cons.c:1202
#define rz_warn_if_reached()
Definition: rz_assert.h:29
@ RZ_CMD_STATUS_OK
command handler exited in the right way
Definition: rz_cmd.h:24
@ RZ_CMD_STATUS_NONEXISTINGCMD
command does not exist
Definition: rz_cmd.h:28
RZ_API PJ * pj_end(PJ *j)
Definition: pj.c:87
RZ_API PJ * pj_o(PJ *j)
Definition: pj.c:75
RZ_API PJ * pj_ks(PJ *j, const char *k, const char *v)
Definition: pj.c:170
@ RZ_OUTPUT_MODE_JSON
Definition: rz_types.h:40
@ RZ_OUTPUT_MODE_STANDARD
Definition: rz_types.h:39
Definition: rz_pj.h:12
Definition: dis.h:43

References rz_parse_plugin_t::name, pj_end(), pj_ks(), pj_o(), RZ_CMD_STATUS_NONEXISTINGCMD, RZ_CMD_STATUS_OK, rz_cons_printf(), RZ_OUTPUT_MODE_JSON, RZ_OUTPUT_MODE_STANDARD, and rz_warn_if_reached.

Referenced by rz_core_parser_plugins_print().

◆ rz_core_parser_plugins_print()

RZ_API RzCmdStatus rz_core_parser_plugins_print ( RzParse parser,
RzCmdStateOutput state 
)

Definition at line 27 of file cparser.c.

27  {
29  RzParsePlugin *plugin;
30  if (!parser) {
31  return RZ_CMD_STATUS_ERROR;
32  }
34  rz_list_foreach (parser->parsers, iter, plugin) {
36  }
37 
39  return RZ_CMD_STATUS_OK;
40 }
RZ_API void rz_cmd_state_output_array_start(RzCmdStateOutput *state)
Mark the start of an array of elements in the output.
Definition: cmd_api.c:2558
RZ_API void rz_cmd_state_output_array_end(RzCmdStateOutput *state)
Mark the end of an array of elements in the output.
Definition: cmd_api.c:2572
RZ_API RzCmdStatus rz_core_parser_plugin_print(RzParsePlugin *plugin, RzCmdStateOutput *state)
Definition: cparser.c:6
@ RZ_CMD_STATUS_ERROR
command handler had issues while running (e.g. allocation error, etc.)
Definition: rz_cmd.h:26

References cmd_descs_generate::parser, rz_cmd_state_output_array_end(), rz_cmd_state_output_array_start(), RZ_CMD_STATUS_ERROR, RZ_CMD_STATUS_OK, and rz_core_parser_plugin_print().

Referenced by rz_plugins_parser_print_handler().