radare2/libr/lang/p/tcc.c
pancake cfbb6574f7 * Initial implementation of the r_lang VAPI
- Added test program in Vala
* Added r_lang_define and r_lang_undef
  - They are global on the module
  - Each plugin should use lang_t
  - *user must be deprecated
2009-09-20 01:03:57 +02:00

32 lines
724 B
C

/* tcc extension for libr (radare2) */
#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)
{
TCCState *ts = tcc_new ();
/* TODO: set defined vars as global */
//list_for_each(lang->defs) {
tcc_compile_string (ts, code);
tcc_run (ts, 0, 0);//argc, argv);
tcc_delete (ts);
return R_TRUE;
}
static struct r_lang_handle_t r_lang_plugin_tcc = {
.name = "c99",
.desc = "C99 language extension (using libtcc)",
.help = NULL,
.run = &r_lang_tcc_run,
.run_file = NULL,
.set_argv = NULL,
};
struct r_lib_struct_t radare_plugin = {
.type = R_LIB_TYPE_LANG,
.data = &r_lang_plugin_tcc,
};