Rizin
unix-like reverse engineering framework and cli tools
rz_lang.h
Go to the documentation of this file.
1 #ifndef RZ_LANG_H
2 #define RZ_LANG_H
3 
4 #include <rz_types.h>
5 #include <rz_list.h>
6 #include <rz_cmd.h>
7 
8 #ifdef __cplusplus
9 extern "C" {
10 #endif
11 
13 
14 typedef char *(*RzCoreCmdStrCallback)(void *core, const char *s);
15 typedef int (*RzCoreCmdfCallback)(void *core, const char *s, ...);
16 
17 typedef struct rz_lang_t {
19  void *user;
26 
27 typedef struct rz_lang_plugin_t {
28  const char *name;
29  const char *alias;
30  const char *desc;
31  const char *license;
32  const char **help;
33  const char *ext;
34  int (*init)(RzLang *user);
35  bool (*setup)(RzLang *user);
36  int (*fini)(RzLang *user);
37  int (*prompt)(RzLang *user);
38  int (*run)(RzLang *user, const char *code, int len);
39  int (*run_file)(RzLang *user, const char *file);
40  int (*set_argv)(RzLang *user, int argc, char **argv);
42 
43 typedef struct rz_lang_def_t {
44  char *name;
45  char *type;
46  void *value;
48 
49 #ifdef RZ_API
51 RZ_API void rz_lang_free(RzLang *lang);
52 RZ_API bool rz_lang_setup(RzLang *lang);
54 RZ_API bool rz_lang_use(RzLang *lang, const char *name);
55 RZ_API int rz_lang_run(RzLang *lang, const char *code, int len);
56 RZ_API int rz_lang_run_string(RzLang *lang, const char *code);
57 RZ_API int rz_lang_run_file(RzLang *lang, const char *file);
58 /* TODO: user_ptr must be deprecated */
59 RZ_API void rz_lang_set_user_ptr(RzLang *lang, void *user);
60 RZ_API bool rz_lang_set_argv(RzLang *lang, int argc, char **argv);
61 RZ_API int rz_lang_prompt(RzLang *lang);
65 // TODO: rename rz_Lang_add for rz_lang_plugin_add
66 
67 RZ_API bool rz_lang_define(RzLang *lang, const char *type, const char *name, void *value);
68 RZ_API void rz_lang_undef(RzLang *lang, const char *name);
70 
73 extern RzLangPlugin rz_lang_plugin_rust;
74 extern RzLangPlugin rz_lang_plugin_vala;
75 extern RzLangPlugin rz_lang_plugin_c;
76 extern RzLangPlugin rz_lang_plugin_cpipe;
77 
78 #endif
79 
80 #ifdef __cplusplus
81 }
82 #endif
83 
84 #endif
size_t len
Definition: 6502dis.c:15
static const char ext[]
Definition: apprentice.c:1981
static int value
Definition: cmd_api.c:93
#define RZ_API
RZ_API void rz_lang_undef(RzLang *lang, const char *name)
Definition: lang.c:91
RZ_API int rz_lang_run_string(RzLang *lang, const char *code)
Definition: lang.c:179
RZ_API int rz_lang_run(RzLang *lang, const char *code, int len)
Definition: lang.c:172
RZ_API void rz_lang_def_free(RzLangDef *def)
Definition: lang.c:85
RZ_API void rz_lang_plugin_free(RzLangPlugin *p)
Definition: lang.c:14
RZ_API int rz_lang_prompt(RzLang *lang)
Definition: lang.c:205
RZ_API RzLangPlugin * rz_lang_get_by_name(RzLang *lang, const char *name)
Definition: lang.c:141
RZ_API void rz_lang_free(RzLang *lang)
Definition: lang.c:46
RZ_API RzLang * rz_lang_new(void)
Definition: lang.c:20
RZ_API void rz_lang_set_user_ptr(RzLang *lang, void *user)
Definition: lang.c:61
RZ_API int rz_lang_run_file(RzLang *lang, const char *file)
Definition: lang.c:183
RZ_API RzLangPlugin * rz_lang_get_by_extension(RzLang *lang, const char *ext)
Definition: lang.c:126
RZ_API bool rz_lang_set_argv(RzLang *lang, int argc, char **argv)
Definition: lang.c:165
RZ_API bool rz_lang_use(RzLang *lang, const char *name)
Definition: lang.c:155
RZ_API bool rz_lang_setup(RzLang *lang)
Definition: lang.c:108
RZ_API bool rz_lang_define(RzLang *lang, const char *type, const char *name, void *value)
Definition: lang.c:65
RZ_API bool rz_lang_add(RzLang *lang, RzLangPlugin *foo)
Definition: lang.c:115
void * p
Definition: libc.cpp:67
RzLangPlugin rz_lang_plugin_lib
Definition: lib.c:46
RzLangPlugin rz_lang_plugin_pipe
Definition: pipe.c:19
static RzMain foo[]
Definition: main.c:11
static static fork const void static count static fd const char const char static newpath char char argv
Definition: sflib.h:40
int type
Definition: mipsasm.c:17
Definition: setup.py:1
const char * code
Definition: pal.c:98
static RzSocket * s
Definition: rtr.c:28
struct rz_lang_def_t RzLangDef
char *(* RzCoreCmdStrCallback)(void *core, const char *s)
Definition: rz_lang.h:14
int(* RzCoreCmdfCallback)(void *core, const char *s,...)
Definition: rz_lang.h:15
struct rz_lang_plugin_t RzLangPlugin
RZ_LIB_VERSION_HEADER(rz_lang)
struct rz_lang_t RzLang
int(* PrintfCallback)(const char *str,...) RZ_PRINTF_CHECK(1
Definition: rz_types.h:233
static int
Definition: sfsocketcall.h:114
Definition: inftree9.h:24
Definition: gzappend.c:170
Definition: z80asm.h:102
char * name
Definition: rz_lang.h:44
char * type
Definition: rz_lang.h:45
void * value
Definition: rz_lang.h:46
const char ** help
Definition: rz_lang.h:32
const char * desc
Definition: rz_lang.h:30
const char * alias
Definition: rz_lang.h:29
const char * license
Definition: rz_lang.h:31
int(* prompt)(RzLang *user)
Definition: rz_lang.h:37
int(* init)(RzLang *user)
Definition: rz_lang.h:34
const char * name
Definition: rz_lang.h:28
const char * ext
Definition: rz_lang.h:33
int(* set_argv)(RzLang *user, int argc, char **argv)
Definition: rz_lang.h:40
int(* fini)(RzLang *user)
Definition: rz_lang.h:36
int(* run)(RzLang *user, const char *code, int len)
Definition: rz_lang.h:38
int(* run_file)(RzLang *user, const char *file)
Definition: rz_lang.h:39
RzCoreCmdStrCallback cmd_str
Definition: rz_lang.h:23
void * user
Definition: rz_lang.h:19
RzList * defs
Definition: rz_lang.h:20
PrintfCallback cb_printf
Definition: rz_lang.h:22
struct rz_lang_plugin_t * cur
Definition: rz_lang.h:18
RzList * langs
Definition: rz_lang.h:21
RzCoreCmdfCallback cmdf
Definition: rz_lang.h:24
#define bool
Definition: sysdefs.h:146
static int file
Definition: z80asm.c:58
int def(FILE *source, FILE *dest, int level)
Definition: zpipe.c:36