-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
15 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,33 @@ | ||
/* tcc extension for libr (radare2) - copyright pancake 2011-2013 */ | ||
/* tcc extension for libr (radare2) - copyright pancake 2011-2024 */ | ||
|
||
#include "r_lib.h" | ||
#include "r_lang.h" | ||
#include <r_lib.h> | ||
#include <r_lang.h> | ||
#include <libtcc.h> | ||
|
||
/* TODO: store the state globally or so.. */ | ||
static int r_lang_tcc_run(struct r_lang_t *lang, const char *code, int len) { | ||
static bool r_lang_tcc_run(RLangSession *ls, const char *code, int len) { | ||
TCCState *ts = tcc_new (); | ||
/* TODO: set defined vars as global */ | ||
//list_for_each(lang->defs) { | ||
// list_for_each(lang->defs) { | ||
tcc_compile_string (ts, code); | ||
tcc_run (ts, 0, 0);//argc, argv); | ||
tcc_run (ts, 0, 0); //argc, argv); | ||
tcc_delete (ts); | ||
return R_TRUE; | ||
} | ||
|
||
static struct r_lang_plugin_t r_lang_plugin_tcc = { | ||
.name = "c99", | ||
static RLangPlugin r_lang_plugin_tcc = { | ||
.meta = { | ||
.name = "tcc", | ||
.desc = "C99 rlang extension using libtcc", | ||
}, | ||
.ext = "c", | ||
.desc = "C99 language extension (using libtcc)", | ||
.help = NULL, | ||
.run = &r_lang_tcc_run, | ||
.run_file = NULL, | ||
.set_argv = NULL, | ||
.run = &r_lang_tcc_run | ||
}; | ||
|
||
#ifndef CORELIB | ||
struct r_lib_struct_t radare_plugin = { | ||
RLibStruct radare_plugin = { | ||
.type = R_LIB_TYPE_LANG, | ||
.version = R2_VERSION, | ||
.data = &r_lang_plugin_tcc, | ||
}; | ||
#endif |