* Fix pkg-config-symstall

- Update all .pc files
* Fix 'pf d*' segfault
  - Show flag references in all 'pf' values
* Many bugfixes in vapis
  - Use nested namespaces instead of static classes
    - Static classes was deprecated in Vala some years ago
  - All bindings are working again
  - C++ support has been added
  - Guile is now compiled by default
* Added ./configure-langs to select which langs to use
  - Use --enable=python,perl or --disable=guile
This commit is contained in:
pancake 2011-05-20 19:49:50 +02:00
parent 53b08a13be
commit a4b57487bf
54 changed files with 291 additions and 144 deletions

View File

@ -78,7 +78,7 @@ install: install-doc install-man
install-pkgconfig-symlink:
@${INSTALL_DIR} ${PFX}/lib/pkgconfig
cd pkgcfg ; for a in *.pc ; do ln -fs ${PWD}/$$a ${PFX}/lib/pkgconfig/$$a ; done
cd pkgcfg ; for a in *.pc ; do ln -fs $${PWD}/$$a ${PFX}/lib/pkgconfig/$$a ; done
symstall install-symlink: install-man-symlink install-doc-symlink install-pkgconfig-symlink
cd libr && ${MAKE} install-symlink PREFIX=${PREFIX} DESTDIR=${DESTDIR}

View File

@ -2,7 +2,7 @@
#
# Script to configure "staticability" of plugins
# author: pancake // nopcode
# date: 2010-01-14
# update: 2010-01-14
#
list () {

View File

@ -1,6 +1,6 @@
NAME=r_cmd
OBJ=cmd.o plugin.o macro.o
DEPS=r_util
DEPS=r_util r_lib
include ../config.mk

View File

@ -3083,6 +3083,10 @@ static int cmd_write(void *data, const char *input) {
r_core_write_op (core, input+3, input[1]);
r_core_block_read (core, 0);
break;
case 'n':
r_core_write_op (core, "ff", 'x');
r_core_block_read (core, 0);
break;
case '\0':
case '?':
default:

View File

@ -242,14 +242,20 @@ static int __dbg_read(void *user, int pid, ut64 addr, ut8 *buf, int len)
return r_core_read_at(core, addr, buf, len);
}
static int __dbg_write(void *user, int pid, ut64 addr, const ut8 *buf, int len)
{
static int __dbg_write(void *user, int pid, ut64 addr, const ut8 *buf, int len) {
RCore *core = (RCore *)user;
// TODO: pid not used
return r_core_write_at(core, addr, buf, len);
}
#endif
static const char *r_core_print_offname(void *p, ut64 addr) {
RCore *c = (RCore*)p;
RFlagItem *item = r_flag_get_i (c->flags, addr);
if (item) return item->name;
return NULL;
}
R_API int r_core_init(RCore *core) {
static int singleton = R_TRUE;
core->rtr_n = 0;
@ -278,6 +284,8 @@ R_API int r_core_init(RCore *core) {
singleton = R_FALSE;
}
core->print = r_print_new ();
core->print->user = core;
core->print->offname = r_core_print_offname;
core->print->printf = (void *)r_cons_printf;
core->lang = r_lang_new ();
r_lang_define (core->lang, "RCore", "core", core);

View File

@ -233,7 +233,7 @@ R_API RList *r_fs_dir(RFS* fs, const char *p) {
return ret;
}
R_API int r_fs_dir_dump (RFS* fs, const char *path, char *name) {
R_API int r_fs_dir_dump (RFS* fs, const char *path, const char *name) {
RList *list;
RListIter *iter;
RFSFile *file, *item;
@ -243,7 +243,7 @@ R_API int r_fs_dir_dump (RFS* fs, const char *path, char *name) {
if (!list)
return R_FALSE;
if (!r_sys_mkdir (name)) {
if (r_sys_mkdir_failed()) {
if (r_sys_mkdir_failed ()) {
eprintf ("Cannot create \"%s\"\n", name);
return R_FALSE;
}

View File

@ -123,7 +123,6 @@ R_API void r_bp_traptrace_list(RBreakpoint *bp);
R_API int r_bp_traptrace_at(RBreakpoint *bp, ut64 from, int len);
R_API RList *r_bp_traptrace_new();
R_API void r_bp_traptrace_enable(RBreakpoint *bp, int enable);
#endif
/* plugin pointers */
extern struct r_bp_plugin_t r_bp_plugin_x86;
@ -131,6 +130,7 @@ extern struct r_bp_plugin_t r_bp_plugin_arm;
extern struct r_bp_plugin_t r_bp_plugin_mips;
extern struct r_bp_plugin_t r_bp_plugin_ppc;
extern struct r_bp_plugin_t r_bp_plugin_sh;
#endif
#if 0
extern struct r_bp_plugin_t r_bp_plugin_sparc;
#endif

View File

@ -88,7 +88,7 @@ R_API void r_fs_close (RFS* fs, RFSFile *file);
R_API int r_fs_read (RFS* fs, RFSFile *file, ut64 addr, int len);
R_API RFSFile *r_fs_slurp(RFS* fs, const char *path);
R_API RList *r_fs_dir(RFS* fs, const char *path);
R_API int r_fs_dir_dump (RFS* fs, const char *path, char *name);
R_API int r_fs_dir_dump (RFS* fs, const char *path, const char *name);
R_API RList *r_fs_find (RFS* fs, const char *name, const char *glob);
R_API RList *r_fs_partitions(RFS* fs, const char *ptype, ut64 delta);
R_API int r_fs_prompt (RFS *fs, char *root);

View File

@ -11,6 +11,7 @@
#define R_PRINT_FLAGS_HEADER 0x00000008
typedef int (*RPrintZoomCallback)(void *user, int mode, ut64 addr, ut8 *bufz, ut64 size);
typedef const char *(*RPrintNameCallback)(void *user, ut64 addr);
typedef struct r_print_zoom_t {
ut8 *buf;
@ -37,6 +38,7 @@ typedef struct r_print_t {
int flags;
int addrmod;
RPrintZoom *zoom;
RPrintNameCallback offname;
} RPrint;
#ifdef R_API
@ -61,7 +63,7 @@ R_API int r_print_string(RPrint *p, ut64 seek, const ut8 *str, int len, int wide
R_API int r_print_date_dos(struct r_print_t *p, ut8 *buf, int len);
R_API int r_print_date_w32(struct r_print_t *p, const ut8 *buf, int len);
R_API int r_print_date_unix(struct r_print_t *p, const ut8 *buf, int len);
R_API void r_print_zoom (RPrint *p, void *user, RPrintZoomCallback cb, ut64 from, ut64 to, int len, int maxlen);
R_API void r_print_zoom(RPrint *p, void *user, RPrintZoomCallback cb, ut64 from, ut64 to, int len, int maxlen);
R_API void r_print_progressbar(RPrint *pr, int pc, int _cols);
#endif

View File

@ -212,10 +212,11 @@ R_API void r_num_irand();
#define R_BETWEEN(x,y,z) (((x)>=(y)) && ((x)<=(z)))
#define r_offsetof(type, member) ((unsigned long) &((type*)0)->member)
#define strnull(x) (!x||!*x)
#define iswhitechar(x) (x==' '||x=='\t'||x=='\n'||x=='\r')
#define iswhitespace(x) (x==' '||x=='\t')
#define isseparator(x) (x==' '||x=='\t'||x=='\n'||x=='\r'||x==' '|| \
x==','||x==';'||x==':'||x=='['||x==']'||x=='('||x==')'||x=='{'||x=='}')
#define iswhitechar(x) ((x)==' '||(x)=='\t'||(x)=='\n'||(x)=='\r')
#define iswhitespace(x) ((x)==' '||(x)=='\t')
#define isseparator(x) ((x)==' '||(x)=='\t'||(x)=='\n'||(x)=='\r'||(x)==' '|| \
(x)==','||(x)==';'||(x)==':'||(x)=='['||(x)==']'|| \
(x)=='('||(x)==')'||(x)=='{'||(x)=='}')
#define ishexchar(x) ((x>='0'&&x<='9') || (x>='a'&&x<='f') || (x>='A'&&x<='F')) {
R_API void r_base64_encode(ut8 *bout, const ut8 *bin, int len);

View File

@ -29,17 +29,17 @@ static void print_format_help(RPrint *p) {
}
/* TODO: needs refactoring */
R_API void r_print_format(struct r_print_t *p, ut64 seek, const ut8* buf, int len, const char *fmt) {
unsigned char buffer[256];
R_API void r_print_format(RPrint *p, ut64 seek, const ut8* buf, int len, const char *fmt) {
ut8 buffer[256];
int nargs, i, j, idx, times, otimes, endian;
char *args, *bracket, tmp, last = 0;
const char *arg = fmt;
const char *argend = arg+strlen(fmt);
ut64 addr = 0;
const char *argend = arg+strlen (fmt);
char namefmt[8];
ut64 addr = 0, seeki = 0;;
nargs = endian = i = j = 0;
while (*arg && *arg==' ') arg++;
while (*arg && iswhitechar (*arg)) arg++;
/* get times */
otimes = times = atoi (arg);
if (times > 0)
@ -79,13 +79,13 @@ R_API void r_print_format(struct r_print_t *p, ut64 seek, const ut8* buf, int le
/* go format */
i = 0;
if (times==0)
otimes = times = 1;
for(;times;times--) { // repeat N times
if (!times) otimes = times = 1;
for (;times;times--) { // repeat N times
const char * orig = arg;
if (otimes>1)
p->printf ("0x%08"PFMT64x" [%d] {\n", seek+i, otimes-times);
for(idx=0;arg<argend && idx<len;idx++, arg=arg+1) {
for (idx=0; arg<argend && i<len && idx<len; idx++, arg++) {
seeki = seek+i;
addr = 0LL;
if (endian)
addr = (*(buf+i))<<24 | (*(buf+i+1))<<16 | *(buf+i+2)<<8 | *(buf+i+3);
@ -96,16 +96,16 @@ R_API void r_print_format(struct r_print_t *p, ut64 seek, const ut8* buf, int le
if (tmp == 0 && last != '*')
break;
/* skip chars */
switch(tmp) {
switch (tmp) {
case '*':
if (i<=0) break;
tmp = last;
arg = arg - 1;
arg--;
idx--;
goto feed_me_again;
case 'e': // tmp swap endian
idx--;
endian ^=1;
endian ^= 1;
continue;
case '.': // skip char
i++;
@ -114,11 +114,11 @@ R_API void r_print_format(struct r_print_t *p, ut64 seek, const ut8* buf, int le
case '?': // help
print_format_help (p);
idx--;
i=len; // exit
i = len; // exit
continue;
}
if (idx<nargs)
p->printf (namefmt, r_str_word_get0(args, idx));
p->printf (namefmt, r_str_word_get0 (args, idx));
/* cmt chars */
switch (tmp) {
#if 0
@ -147,73 +147,73 @@ R_API void r_print_format(struct r_print_t *p, ut64 seek, const ut8* buf, int le
memcpy (&doub, buf+i, sizeof (double));
p->printf ("%e = ", doub);
p->printf ("(double)");
i+=8;
i += 8;
}
break;
case 'q':
p->printf ("0x%08x = ", seek+i);
p->printf ("0x%08"PFMT64x" = ", seeki);
p->printf ("(qword)");
i+=8;
i += 8;
break;
case 'b':
p->printf ("0x%08x = ", seek+i);
p->printf ("0x%08"PFMT64x" = ", seeki);
p->printf ("%d ; 0x%02x ; '%c' ",
buf[i], buf[i], IS_PRINTABLE(buf[i])?buf[i]:0);
buf[i], buf[i], IS_PRINTABLE (buf[i])?buf[i]:0);
i++;
break;
case 'B':
memset(buffer, '\0', 255);
memset (buffer, '\0', 255);
if (!p->iob.read_at) {
printf ("(cannot read memory)\n");
break;
} else p->iob.read_at (p->iob.io, (ut64)addr, buffer, 248);
p->printf ("0x%08x = ", seek+i);
for (j=0;j<10;j++) p->printf ("%02x ", buf[j]);
p->printf ("0x%08"PFMT64x" = ", seeki);
for (j=0; j<10; j++) p->printf ("%02x ", buf[j]);
p->printf(" ... (");
for (j=0;j<10;j++)
for (j=0; j<10; j++)
if (IS_PRINTABLE (buf[j]))
p->printf("%c", buf[j]);
p->printf(")");
i+=4;
p->printf ("%c", buf[j]);
p->printf (")");
i += 4;
break;
case 'i':
p->printf("0x%08x = ", seek+i);
p->printf("%d", addr);
i+=4;
p->printf ("0x%08"PFMT64x" = ", seeki);
p->printf ("%d", addr);
i += 4;
break;
case 'd':
p->printf("0x%08x = ", seek+i);
p->printf("0x%08x ", addr);
i+=4;
p->printf ("0x%08"PFMT64x" = ", seeki);
p->printf ("0x%08"PFMT64x" ", addr);
i += 4;
break;
case 'X': {
ut32 addr32 = (ut32)addr;
//char buf[128];
p->printf ("0x%08x = ", seek+i);
p->printf ("0x%08"PFMT64x" = ", seeki);
p->printf ("0x%08"PFMT64x" ", addr32);
//if (string_flag_offset(buf, (ut64)addr32, -1))
// p->printf("; %s", buf);
i+=4;
i += 4;
} break;
case 'w':
case '1': // word (16 bits)
p->printf ("0x%08x = ", seek+i);
p->printf ("0x%08x = ", seeki);
if (endian)
addr = (*(buf+i))<<8 | (*(buf+i+1));
addr = (*(buf+i))<<8 | (*(buf+i+1));
else addr = (*(buf+i+1))<<8 | (*(buf+i));
p->printf ("0x%04x ", addr);
break;
case 'z': // zero terminated string
p->printf ("0x%08x = ", seek+i);
for (;buf[i]&&i<len; i++) {
p->printf ("0x%08"PFMT64x" = ", seeki);
for (; buf[i]&&i<len; i++) {
if (IS_PRINTABLE (buf[i]))
p->printf ("%c", buf[i]);
else p->printf (".");
}
break;
case 'Z': // zero terminated wide string
p->printf ("0x%08x = ", seek+i);
for (;buf[i]&&i<len; i+=2) {
p->printf ("0x%08"PFMT64x" = ", seeki);
for (; buf[i]&&i<len; i+=2) {
if (IS_PRINTABLE (buf[i]))
p->printf ("%c", buf[i]);
else p->printf (".");
@ -221,24 +221,30 @@ R_API void r_print_format(struct r_print_t *p, ut64 seek, const ut8* buf, int le
p->printf (" ");
break;
case 's':
p->printf ("0x%08x = ", seek+i);
p->printf ("0x%08"PFMT64x" = ", seeki);
memset (buffer, '\0', 255);
if (p->iob.read_at)
if (p->iob.read_at) {
p->iob.read_at (p->iob.io, (ut64)addr, buffer, 248);
else {
} else {
printf ("(cannot read memory)\n");
break;
}
p->printf ("0x%08x -> 0x%08x ", seek+i, addr);
p->printf ("0x%08"PFMT64x" -> 0x%08"PFMT64x" ", seeki, addr);
p->printf ("%s ", buffer);
i+=4;
i += 4;
break;
default:
/* ignore unknown chars */
break;
}
p->printf ("\n");
last = tmp;
if (p->offname) {
const char *s = p->offname (p->user, seeki);
if (s) p->printf ("@(%s)", s);
s = p->offname (p->user, addr);
if (s) p->printf ("*(%s)", s);
}
p->printf ("\n");
last = tmp;
}
if (otimes>1)
p->printf ("}\n");

View File

@ -9,6 +9,7 @@ R_API RPrint *r_print_new() {
if (p) {
strcpy (p->datefmt, "%d:%m:%Y %H:%M:%S %z");
p->user = NULL;
p->name = NULL;
r_io_bind_init (p->iob);
p->printf = printf;
p->interrupt = 0;
@ -203,7 +204,7 @@ R_API void r_print_hexdump(RPrint *p, ut64 addr, const ut8 *buf, int len, int ba
if (step<1) step = 1;
switch(base) {
case 8: fmt = "%03x"; pre = " "; break;
case 8: fmt = "%03o"; pre = " "; break;
case 10: fmt = "%03d"; pre = " "; break;
}

View File

@ -5,7 +5,7 @@ includedir=${prefix}/include
Name: r_anal
Description: radare foundation libraries
Version:
Version: 0.7.1
Requires:
Libs: -L${libdir} -lr_anal -lr_util -lr_lib -lr_reg
Libs: -L${libdir} -lr_anal -lr_util -lr_lib -lr_reg -lr_syscall -lr_diff
Cflags: -I${includedir}/libr

View File

@ -5,7 +5,7 @@ includedir=${prefix}/include
Name: r_asm
Description: radare foundation libraries
Version: 0.2
Version: 0.7.1
Requires:
Libs: -L${libdir} -lr_asm -lr_lib -lr_util
Cflags: -I${includedir}/libr

View File

@ -5,7 +5,7 @@ includedir=${prefix}/include
Name: r_bin
Description: radare foundation libraries
Version: 0.2
Version: 0.7.1
Requires:
Libs: -L${libdir} -lr_bin -lr_lib -lr_util
Cflags: -I${includedir}/libr

View File

@ -5,7 +5,7 @@ includedir=${prefix}/include
Name: r_bp
Description: radare foundation libraries
Version: 0.2
Version: 0.7.1
Requires:
Libs: -L${libdir} -lr_util -lr_bp
Libs: -L${libdir} -lr_bp -lr_util
Cflags: -I${includedir}/libr

View File

@ -5,7 +5,7 @@ includedir=${prefix}/include
Name: r_cmd
Description: radare foundation libraries
Version:
Version: 0.7.1
Requires:
Libs: -L${libdir} -lr_cmd -lr_util -lr_lib
Cflags: -I${includedir}/libr

View File

@ -5,7 +5,7 @@ includedir=${prefix}/include
Name: r_config
Description: radare foundation libraries
Version:
Version: 0.7.1
Requires:
Libs: -L${libdir} -lr_config -lr_util
Cflags: -I${includedir}/libr

View File

@ -5,7 +5,7 @@ includedir=${prefix}/include
Name: r_cons
Description: radare foundation libraries
Version:
Version: 0.7.1
Requires:
Libs: -L${libdir} -lr_cons -lr_util
Cflags: -I${includedir}/libr

View File

@ -5,7 +5,7 @@ includedir=${prefix}/include
Name: r_core
Description: radare foundation libraries
Version:
Version: 0.7.1
Requires:
Libs: -L${libdir} -lr_core -lr_config -lr_cons -lr_line -lr_io -lr_cmd -lr_util -lr_print -lr_flags -lr_asm -lr_lib -lr_debug -lr_hash -lr_bin -lr_lang -lr_io -lr_anal -lr_parse -lr_print -lr_bp -lr_reg -lr_search -lr_syscall -lr_sign -lr_diff -lr_fs
Libs: -L${libdir} -lr_core -lr_config -lr_cons -lr_line -lr_io -lr_cmd -lr_util -lr_print -lr_flags -lr_asm -lr_lib -lr_debug -lr_hash -lr_bin -lr_lang -lr_io -lr_anal -lr_parse -lr_print -lr_bp -lr_reg -lr_search -lr_syscall -lr_sign -lr_diff -lr_socket -lr_fs
Cflags: -I${includedir}/libr

View File

@ -5,7 +5,7 @@ includedir=${prefix}/include
Name: r_debug
Description: radare foundation libraries
Version: 0.2
Version: 0.7.1
Requires:
Libs: -L${libdir} -lr_util -lr_debug -lr_reg -lr_bp -lr_anal
Libs: -L${libdir} -lr_debug -lr_reg -lr_anal -lr_bp -lr_util -lr_io
Cflags: -I${includedir}/libr

View File

@ -5,7 +5,7 @@ includedir=${prefix}/include
Name: r_diff
Description: radare foundation libraries
Version:
Version: 0.7.1
Requires:
Libs: -L${libdir} -lr_diff -lr_util
Cflags: -I${includedir}/libr

View File

@ -5,7 +5,7 @@ includedir=${prefix}/include
Name: r_flags
Description: radare foundation libraries
Version:
Version: 0.7.1
Requires:
Libs: -L${libdir} -lr_flags
Libs: -L${libdir} -lr_flags -lr_util -lr_cons
Cflags: -I${includedir}/libr

View File

@ -5,7 +5,7 @@ includedir=${prefix}/include
Name: r_fs
Description: radare foundation libraries
Version:
Version: 0.7.1
Requires:
Libs: -L${libdir} -lr_fs -lr_util
Libs: -L${libdir} -lr_fs -lr_lib -lr_util -lr_io
Cflags: -I${includedir}/libr

View File

@ -5,7 +5,7 @@ includedir=${prefix}/include
Name: r_hash
Description: radare foundation libraries
Version:
Version: 0.7.1
Requires:
Libs: -L${libdir} -lr_hash
Cflags: -I${includedir}/libr

View File

@ -5,7 +5,7 @@ includedir=${prefix}/include
Name: r_io
Description: radare foundation libraries
Version: 0.2
Version: 0.7.1
Requires:
Libs: -L${libdir} -lr_io -lr_lib -lr_util
Libs: -L${libdir} -lr_io -lr_lib -lr_util -lr_socket
Cflags: -I${includedir}/libr

View File

@ -5,7 +5,7 @@ includedir=${prefix}/include
Name: r_lang
Description: radare foundation libraries
Version:
Version: 0.7.1
Requires:
Libs: -L${libdir} -lr_lang
Libs: -L${libdir} -lr_lang -lr_util -lr_lib
Cflags: -I${includedir}/libr

View File

@ -5,7 +5,7 @@ includedir=${prefix}/include
Name: r_lib
Description: radare foundation libraries
Version:
Version: 0.7.1
Requires:
Libs: -L${libdir} -lr_lib
Libs: -L${libdir} -lr_lib -lr_util
Cflags: -I${includedir}/libr

View File

@ -5,7 +5,7 @@ includedir=${prefix}/include
Name: r_line
Description: radare foundation libraries
Version:
Version: 0.7.1
Requires:
Libs: -L${libdir} -lr_line -lr_util
Libs: -L${libdir} -lr_line -lr_util -lr_cons
Cflags: -I${includedir}/libr

View File

@ -5,7 +5,7 @@ includedir=${prefix}/include
Name: r_parse
Description: radare foundation libraries
Version:
Version: 0.7.1
Requires:
Libs: -L${libdir} -lr_parse -lr_flags
Libs: -L${libdir} -lr_parse -lr_lib -lr_flags -lr_util -lr_anal
Cflags: -I${includedir}/libr

View File

@ -5,7 +5,7 @@ includedir=${prefix}/include
Name: r_print
Description: radare foundation libraries
Version:
Version: 0.7.1
Requires:
Libs: -L${libdir} -lr_print
Libs: -L${libdir} -lr_print -lr_cons -lr_util -lr_asm -lr_anal
Cflags: -I${includedir}/libr

View File

@ -5,7 +5,7 @@ includedir=${prefix}/include
Name: r_reg
Description: radare foundation libraries
Version:
Version: 0.7.1
Requires:
Libs: -L${libdir} -lr_reg
Libs: -L${libdir} -lr_reg -lr_util
Cflags: -I${includedir}/libr

View File

@ -5,7 +5,7 @@ includedir=${prefix}/include
Name: r_search
Description: radare foundation libraries
Version:
Version: 0.7.1
Requires:
Libs: -L${libdir} -lr_search -lr_util
Cflags: -I${includedir}/libr

View File

@ -5,7 +5,7 @@ includedir=${prefix}/include
Name: r_sign
Description: radare foundation libraries
Version:
Version: 0.7.1
Requires:
Libs: -L${libdir} -lr_sign
Libs: -L${libdir} -lr_sign -lr_util -lr_anal
Cflags: -I${includedir}/libr

View File

@ -5,7 +5,7 @@ includedir=${prefix}/include
Name: r_socket
Description: radare foundation libraries
Version:
Version: 0.7.1
Requires:
Libs: -L${libdir} -lr_socket
Cflags: -I${includedir}/libr

View File

@ -5,7 +5,7 @@ includedir=${prefix}/include
Name: r_syscall
Description: radare foundation libraries
Version:
Version: 0.7.1
Requires:
Libs: -L${libdir} -lr_syscall
Cflags: -I${includedir}/libr

View File

@ -5,7 +5,7 @@ includedir=${prefix}/include
Name: r_util
Description: radare foundation libraries
Version:
Version: 0.7.1
Requires:
Libs: -L${libdir} -lr_util
Cflags: -I${includedir}/libr

View File

@ -1,15 +1,16 @@
-include config.mk
LANGS=python perl ruby lua go java vapi
LANGS=python perl ruby lua go java guile gear
W32PY="${HOME}/.wine/drive_c/Python27/"
ifeq ($(DEVEL_MODE),1)
all: supported.langs ruby perl python lua go
all: supported.langs ruby perl python lua go gear
supported.langs:
CC=${CC} CXX=${CXX} sh check-langs.sh
else
# compile more
all: supported.langs python lua
all: supported.langs python lua gear
supported.langs:
CC=${CC} CXX=${CXX} sh check-langs.sh force-all
endif
@ -58,6 +59,9 @@ vdoc_pkg:
valadoc -o vdoc vapi/*.vapi
# rsync -avz vdoc/* pancake@radare.org:/srv/http/radareorg/vdoc/
gear:
cd gear && ${MAKE}
# TODO: unspaguetti this targets
perl:
@-[ "`grep perl supported.langs`" ] && cd perl && ${MAKE} ; true
@ -65,6 +69,9 @@ perl:
python:
@-[ "`grep python supported.langs`" ] && cd python && ${MAKE} ; true
guile:
@-[ "`grep guile supported.langs`" ] && cd guile && ${MAKE} ; true
ruby:
@-[ "`grep ruby supported.langs`" ] && cd ruby && ${MAKE} ; true
@ -83,6 +90,7 @@ test:
cd python && ${MAKE} test
cd ruby && ${MAKE} test
cd lua && ${MAKE} test
cd guile && ${MAKE} test
cd go && ${MAKE} test
cd java && ${MAKE} test
@ -129,6 +137,9 @@ install-ruby:
done ; \
fi
install-guile:
@echo TODO: install-guile
install-perl:
# hack for slpm
@-if [ "`grep perl supported.langs`" ]; then \
@ -170,7 +181,8 @@ oldtest:
python test.py
clean:
for a in $(LANGS); do \
@for a in $(LANGS); do \
echo "Cleaning $$a " ; \
cd $$a ; ${MAKE} clean ; cd .. ; \
done

View File

@ -1,9 +1,9 @@
#!/bin/sh
# Check bindings supported by valaswig
# Check bindings supported by valabind
# pancake // radare.org - 2010-2011
SUP_LANGS=""
LANGS="python perl ruby lua go java"
LANGS="python perl ruby lua go java guile"
[ -z "${CC}" ] && CC=gcc
[ -z "${CXX}" ] && CXX=g++
@ -24,17 +24,39 @@ if [ "$1" = "force-all" ]; then
exit 0
fi
for a in ${LANGS}; do
printf "Checking $a support for valaswig... "
CC=${CC} CXX=${CXX} valaswig-cc --test $a
echo "Checking valabind languages support..."
valabind-cc --help > /dev/null 2>&1
if [ $? = 0 ]; then
echo " - gir: yes"
echo " - v8gear: yes"
SUP_LANGS="gir gear ${SUP_LANGS}"
for a in ${LANGS}; do
printf " - $a: "
CC=${CC} CXX=${CXX} valabind-cc --test $a
if [ $? = 0 ]; then
echo yes
SUP_LANGS="$a ${SUP_LANGS}"
else
echo no
fi
done
else
echo "WARNING: cannot find valabind"
echo " - gir: no"
echo " - v8gear: no"
fi
for a in valac g++ ; do
$a --help > /dev/null 2>&1
if [ $? = 0 ]; then
echo yes
echo " - $a: yes"
SUP_LANGS="$a ${SUP_LANGS}"
else
echo no
echo " - $a: no"
fi
done
:> supported.langs
for a in ${SUP_LANGS}; do
echo $a >> supported.langs

72
r2-bindings/configure-langs Executable file
View File

@ -0,0 +1,72 @@
#!/bin/sh
#
# Script to choose which langs you want to build
# author: pancake // nopcode
# update: 2011-05-20
#
LANGS=""
help () {
echo "Usage: ./configure-langs [options]"
echo " --enable=python,perl"
echo " --disable=java,ruby"
echo " --list"
echo "Filter out supported.langs"
}
ENABLE=""
DISABLE=""
enable() {
if [ -n "${DISABLE}" ]; then
echo "Cannot use --enable and --disable"
exit 1
fi
ENABLE="${1/:/ }"
DISABLE=""
}
disable() {
if [ -n "${ENABLE}" ]; then
echo "Cannot use --enable and --disable"
exit 1
fi
ENABLE=""
DISABLE="${1/:/ }"
}
MODE=""
DONOTHING=0
while : ; do
[ -z "$1" ] && break
k=${1%=*} # key
v=${1#*=} # value
case "$k" in
"--enable") enable "$v" ; ;;
"--disable") disable "$v" ; ;;
"--list") cat supported.langs ; exit 0 ; ;;
"-h"|"--help") help ; exit 0 ; ;;
esac
shift
done
sh check-langs.sh
if [ -n "${ENABLE}" ]; then
mv supported.langs .sl
cat .sl | grep -e `echo ${ENABLE} | sed -e 's/,/ -e/g'` > supported.langs
rm -f .sl
fi
if [ -n "${DISABLE}" ]; then
mv supported.langs .sl
cat .sl | grep -v -e `echo ${DISABLE} | sed -e 's/,/ -e/g'` > supported.langs
rm -f .sl
fi
echo "Supported langs:"
cat supported.langs | sed -e 's,^, - ,'
# check for python
# check for perl
:> langs.cfg
exit 0

3
r2-bindings/configure.hook Executable file
View File

@ -0,0 +1,3 @@
#!/bin/sh
#[ ! -f supported.langs ] &&
./configure-langs $@

View File

@ -8,14 +8,14 @@ all: mkcxx
include ../rules.mk
LIBS=r_lib.so
LIBS=r_search.so
#LIBS=r_asm.so
#LIBS=r_search.so r_util.so
LIBS=r_asm.so
#LIBS=r_util.so
mkcxx:
for a in ${LIBS} ; do \
mod=`echo $$a|cut -d . -f 1` ; \
valaswig -X -m $$mod --vapidir=../vapi $$mod ; \
valabind --cxx -m $$mod --vapidir=../vapi $$mod && \
${CXX} -shared -fPIC -o $$a $${mod}.cxx `pkg-config --cflags --libs $$mod` ; \
done

View File

@ -5,11 +5,13 @@ include ../libs.mk
all: ${LIBS}
${LIBS}:
ifeq ($(HAVE_VALABIND),1)
@PKG=`echo $@|sed -e s,.gear,,` ; \
VAPI=`echo $@|sed -e s,.gear,.vapi,` ; \
DEPS="$$(cat ../vapi/$${PKG}.deps 2>/dev/null | awk '{print "--pkg "$$1}')" ; \
echo "valabind --module $${PKG} $$(echo $$DEPS) --gear ../vapi/$@" ; \
valabind --module $${PKG} $${DEPS} --gear ../vapi/$${VAPI}
endif
clean:
rm -f *.gear
@rm -f *.gear

2
r2-bindings/getostype.sh Executable file
View File

@ -0,0 +1,2 @@
#!/bin/sh
if [ -n "`uname -a| grep -i darwin`" ]; then echo darwin ; elif [ -n "`echo $CC| grep -i mingw`" ]; then echo windows ; else echo linux ; fi

View File

@ -10,6 +10,12 @@ tri:
swig -python -I/usr/include/libr r_debug.i
$(CC) r_debug_wrap.c -shared -fPIC -I /usr/include/libr -I /usr/include/python2.6/ -o _r_debug.so -lr_debug -lr_bp -lr_reg -lr_util
mytest:
mkdir -p r2
cp r_bin.py* r2
cp _r_bin* r2
PYTHONPATH=. python test-r_bin.py
bis:
valaswig-cc python r_io -I../../libr/include r_io `pkg-config --libs r_io`

View File

@ -1,4 +1,4 @@
from r2.r_bin import *
from r_bin import *
b = RBin ()
b.load("/bin/ls", None)
baddr= b.get_baddr()

View File

@ -17,6 +17,12 @@ w32:
ifeq ($(DEVEL_MODE),1)
%.${SOEXT}:
ifeq (${LANG},cxx)
mod=`echo $@ | sed -e s,.${SOEXT},,` ; \
echo "MOD=$$mod" ; \
valabind --cxx -m $$mod --vapidir=../vapi $$mod && \
${CXX} -shared -fPIC -o $@ $${mod}.cxx `pkg-config --cflags --libs $$mod`
else
@-test ../vapi/`echo $@|sed -e s,.${SOEXT},.vapi,` -nt ${LIBS_PFX}$@ ; \
if [ ! $$? = 0 ]; then \
if [ ! -e ${LIBS_PFX}$@ ]; then \
@ -28,6 +34,7 @@ ifeq ($(DEVEL_MODE),1)
[ $$? = 0 ] && \
(cd .. && RELEASE=$(RELEASE) \
sh do-swig.sh ${LANG} `echo $@ | sed -e s,.${SOEXT},,`) ; true
endif
clean:
rm -f *.${SOEXT} r_*
@ -48,7 +55,7 @@ else
esac ; fi ; true
clean:
rm -f *.${SOEXT}
@rm -f *.${SOEXT} ; rm -rf *.dSYM
endif
test:

View File

@ -1 +1,2 @@
r_util
r_lib

View File

@ -38,7 +38,7 @@ namespace Radare {
}
[Compact]
[CCode (cheader_filename="r_fs.h", cname="struct r_fs_plugin_t", free_function="r_fs_plugin_free", cprefix="r_fs_plugin_", unref_function="" free_function="")]
[CCode (cheader_filename="r_fs.h", cname="struct r_fs_plugin_t", free_function="r_fs_plugin_free", cprefix="r_fs_plugin_", unref_function="", free_function="")]
public class RFSPlugin {
public string name;
public string desc;

View File

@ -99,7 +99,7 @@ namespace Radare {
public void plugin_list();
/* maps */
[CCode (cname="RIOMap", cprefix="r_io_map_", free_function="", unref_function)]
[CCode (cname="RIOMap", cprefix="r_io_map_", free_function="", unref_function="")]
public class Map {
int fd;
int flags;

View File

@ -0,0 +1 @@
r_util

View File

@ -4,8 +4,8 @@ namespace Radare {
[Compact]
[CCode (cheader_filename="r_line.h", cprefix="r_line_")]
public class RLine {
public RLine(string symname);
public static bool readline (int argc, char **argv);
public RLine(); //string symname);
public static bool readline (); //int argc, char **argv);
public static bool hist_load (string file);
public static bool hist_add (string line);

View File

@ -1,6 +1,5 @@
/* radare - LGPL - Copyright 2009-2010 pancake<nopcode.org> */
/* radare - LGPL - Copyright 2009-2011 pancake<nopcode.org> */
//[Compact]
[CCode (cheader_filename="r_types_base.h,r_list.h,r_search.h", cname="struct r_search_t", free_function="r_search_free", unref_function="r_search_free", cprefix="r_search_")]
public class Radare.RSearch {
[CCode (cname="RSearchCallback", has_target="false")]

View File

@ -20,13 +20,11 @@ namespace Radare {
}
#endif
[CCode (cheader_filename="r_util.h", cprefix="r_str_", unref_function="")]
public static class RStr {
public static unowned string rwx_i (int rwx);
}
// [CCode (cheader_filename="r_util.h", cprefix="r_str_", unref_function="")]
#if FAILFAIL
[CCode (cheader_filename="r_util.h", cprefix="r_str_")]
public static class RStr {
[CCode (cheader_filename="r_util.h", cprefix="r_str_", unref_function="")]
public class RStr {
public static unowned string rwx_i (int rwx);
public RStr(string arg);
public static int hash(string str);
public static int write(int fd, string str);
@ -34,42 +32,42 @@ namespace Radare {
public static string rwx_i (int rwx);
public static void subchr(string str, int a, int b);
//public static string @bool(bool b);
public int int ansi_len(string str);
public int int ansi_filter(string str, int len);
public static int ansi_len(string str);
public static int ansi_filter(string str, int len);
//public static int writef(...);
}
#endif
[CCode (cheader_filename="r_util.h", cprefix="r_file_")]
public static class RFile {
[CCode (cheader_filename="r_util.h", lower_case_cprefix="r_file_")]
namespace RFile {
public static string slurp(string file, out int osz=null);
public static string slurp_range(string file, uint64 off, int sz, out int osz=null);
public static int dump(string file, uint8 *buf, int len);
public static string basename (string path);
public static unowned string basename (string path);
public static string abspath(string path);
public static bool rm (string file);
public static bool exist (string file);
public static bool slurp_line (string file, int line, int ctx);
}
[CCode (cheader_filename="r_util.h", cprefix="r_log_", free_function="")]
public static class RLog {
[CCode (cheader_filename="r_util.h", lower_case_cprefix="r_log_")]
namespace RLog {
public static void msg(string str);
public static void error(string str);
public static void file(string str);
public static void progress(string str, int pc);
}
[CCode (cheader_filename="r_util.h", cprefix="r_hex_", free_function="")]
public static class RHex {
[CCode (cheader_filename="r_util.h", lower_case_cprefix="r_hex_", free_function="")]
namespace RHex {
public static int str2bin (string input, uint8 *buf);
public static int bin2str (uint8 *buf, int len, out string str);
public static string bin2strdup (uint8 *buf, int len);
}
[CCode (cheader_filename="r_util.h", cprefix="r_sys_", free_function="")]
public static class RSystem {
[CCode (cheader_filename="r_util.h", lower_case_cprefix="r_sys_")]
namespace RSystem {
//public static const weak string OS;
//public static const weak string ARCH;
public static int sleep (int secs);
@ -83,8 +81,8 @@ namespace Radare {
public static void backtrace();
}
[CCode (cname="RNum", cheader_filename="r_util.h", unref_function="", cprefix="r_num_", free_function="")]
public static class RNum {
[CCode (cname="RNum", cheader_filename="r_util.h", unref_function="", cprefix="r_num_", free_function="r_num_free")]
public class RNum {
public RNum(RNumCallback? cb=null, void *user=null);
public uint64 get(string str);
public uint64 math(string str);
@ -94,7 +92,7 @@ namespace Radare {
[Compact]
[CCode (cname="RBuffer", cheader_filename="r_util.h", cprefix="r_buf_", free_function="r_buf_free")]
public static class RBuffer {
public class RBuffer {
public RBuffer();
public uint8 *buf;
public int read_at(uint64 addr, uint8 *buf, int len);