Rizin
unix-like reverse engineering framework and cli tools
clang.c
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: 2021 theopechli <theofilos.pechlivanis@gmail.com>
2 // SPDX-License-Identifier: LGPL-3.0-only
3 
4 #include <rz_core.h>
5 
7  const char *license = lp->license
8  ? lp->license
9  : "???";
10  PJ *pj = state->d.pj;
11  switch (state->mode) {
12  case RZ_OUTPUT_MODE_JSON: {
13  pj_o(pj);
14  pj_ks(pj, "name", lp->name);
15  pj_ks(pj, "description", lp->desc);
16  pj_ks(pj, "license", license);
17  pj_end(pj);
18  break;
19  }
21  rz_cons_printf("%s: %s (%s)\n",
22  lp->name, lp->desc, license);
23  break;
24  }
25  default: {
28  }
29  }
30  return RZ_CMD_STATUS_OK;
31 }
32 
35  RzLangPlugin *lp;
37  if (!lang) {
38  return RZ_CMD_STATUS_ERROR;
39  }
41  rz_list_foreach (lang->langs, iter, lp) {
43  if (status != RZ_CMD_STATUS_OK) {
44  return status;
45  }
46  }
48  return RZ_CMD_STATUS_OK;
49 }
RZ_API RzCmdStatus rz_core_lang_plugin_print(RzLangPlugin *lp, RzCmdStateOutput *state)
Definition: clang.c:6
RZ_API RzCmdStatus rz_core_lang_plugins_print(RzLang *lang, RzCmdStateOutput *state)
Definition: clang.c:33
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 int rz_cons_printf(const char *format,...)
Definition: cons.c:1202
#define RZ_API
static const char struct stat static buf struct stat static buf static vhangup int status
Definition: sflib.h:145
#define rz_warn_if_reached()
Definition: rz_assert.h:29
enum rz_cmd_status_t RzCmdStatus
@ 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_CMD_STATUS_ERROR
command handler had issues while running (e.g. allocation error, etc.)
Definition: rz_cmd.h:26
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
Represent the output state of a command handler.
Definition: rz_cmd.h:91
const char * desc
Definition: rz_lang.h:30
const char * license
Definition: rz_lang.h:31
const char * name
Definition: rz_lang.h:28
RzList * langs
Definition: rz_lang.h:21
Definition: dis.h:43