2009-08-21 19:09:48 +00:00
|
|
|
/* radare - LGPL - Copyright 2009 pancake<@nopcode.org> */
|
2009-03-10 01:49:24 +00:00
|
|
|
|
2010-01-26 01:28:33 +01:00
|
|
|
//[Compact]
|
|
|
|
//[CCode (cheader_filename="r_util.h", cprefix="r_util_")]
|
|
|
|
//public static class Radare.RUtil {
|
|
|
|
//public static int hex_str2bin (string input, uint8 *buf);
|
|
|
|
//public static int hex_bin2str (uint8 *buf, int len, out string str);
|
|
|
|
//public static string hex_bin2strdup (uint8 *buf, int len);
|
|
|
|
/* mem */
|
|
|
|
//public static uint8 *mem_mem (uint8 *a, int al, uint8 *b, int bl);
|
|
|
|
//public static void mem_copyendian (uint8 *dest, uint8 *orig, int size, int endian);
|
|
|
|
//public static void mem_copyloop (uint8 *dest, uint8 *orig, int dsize, int osize);
|
|
|
|
//public static void mem_cmp_mask (uint8 *dest, uint8 *orig, uint8 *mask, int len);
|
|
|
|
/* num */
|
|
|
|
//public static uint64 num_get(void *num, string str); // XXX void *
|
|
|
|
//public static int offsetof(void *type, void *member);
|
|
|
|
//}
|
2009-03-10 01:49:24 +00:00
|
|
|
|
2010-01-26 01:28:33 +01:00
|
|
|
// ??? wtf
|
|
|
|
[CCode (cheader_filename="r_util.h", cprefix="r_str_")]
|
|
|
|
public static class RString {
|
|
|
|
public RString();
|
|
|
|
public int hash(string str);
|
|
|
|
}
|
2009-09-08 02:14:19 +00:00
|
|
|
|
2010-01-26 01:28:33 +01:00
|
|
|
[CCode (cheader_filename="r_util.h", cprefix="r_num_")]
|
|
|
|
public static class RNum {
|
|
|
|
public RNum(RNumCallback cb, void *user);
|
|
|
|
public uint64 get(string str);
|
|
|
|
public uint64 math(string str);
|
|
|
|
}
|
|
|
|
public delegate uint64 RNumCallback (RNum num, string str, int *ok);
|
2010-01-04 13:11:48 +01:00
|
|
|
|
2010-01-26 01:28:33 +01:00
|
|
|
[CCode (cheader_filename="r_util.h", cprefix="r_log_")]
|
|
|
|
public static class RLog {
|
|
|
|
public bool msg(string str);
|
|
|
|
public bool err(string str);
|
|
|
|
}
|
2009-10-12 17:41:52 +02:00
|
|
|
|
2010-01-26 01:28:33 +01:00
|
|
|
[Compact]
|
|
|
|
[CCode (cname="RBuffer", cheader_filename="r_util.h", cprefix="r_buf_")]
|
|
|
|
public class RBuffer {
|
|
|
|
public RBuffer();
|
|
|
|
public int read_at(uint64 addr, uint8 *buf, int len);
|
|
|
|
public int write_at(uint64 addr, uint8 *buf, int len);
|
|
|
|
public bool set_bytes(uint8 *buf, int len);
|
|
|
|
//public bool memcpy(uint64 addr, uint8 *dst, uint8 *src, int len);
|
|
|
|
/* ... */
|
|
|
|
}
|
2009-09-08 02:14:19 +00:00
|
|
|
|
2010-01-26 01:28:33 +01:00
|
|
|
/* Generic Iterator interfaced with r_iter */
|
2010-01-24 23:47:18 +01:00
|
|
|
#if 0
|
|
|
|
// XXX not yet supported by valaswig ://
|
2010-01-26 01:28:33 +01:00
|
|
|
[Compact]
|
|
|
|
[CCode (cheader_filename="r_array.h", cprefix="r_array_", cname="void*")]
|
|
|
|
public class RArray<G> {
|
|
|
|
public RArray (int size);
|
|
|
|
public unowned G cur ();
|
|
|
|
public bool next ();
|
|
|
|
public void rewind ();
|
|
|
|
public unowned G get ();
|
|
|
|
public unowned rArray<G> get_n (int idx);
|
|
|
|
public unowned G prev ();
|
|
|
|
public void delete ();
|
|
|
|
public unowned G first ();
|
|
|
|
public void @foreach (rArrayCallback cb);
|
|
|
|
public unowned G free ();
|
|
|
|
public void set (int idx, owned G data);
|
|
|
|
public rArray<G> iterator ();
|
|
|
|
/* defining the callback here results in signature of:
|
|
|
|
static gint __lambda1__void*r_iter_callback (IterableObject* foo, gpointer self) {
|
|
|
|
^---- wtf!
|
|
|
|
iter.vala:55.23-55.28: error: The name `name' does not exist in the context of `G'
|
|
|
|
public delegate int rIterCallback (G foo);
|
|
|
|
*/
|
|
|
|
}
|
|
|
|
/* TODO: move this declaration inside rIter to have access to the Generic type */
|
|
|
|
public delegate int rArrayCallback (void *foo);
|
2010-01-24 23:47:18 +01:00
|
|
|
#endif
|
2009-09-05 23:58:02 +00:00
|
|
|
|
2010-01-24 23:47:18 +01:00
|
|
|
#if 0
|
2010-01-26 01:28:33 +01:00
|
|
|
/* TODO: to be removed. not fully compliant */
|
|
|
|
[Compact]
|
|
|
|
[CCode (cprefix="ralist_", cheader_filename="r_types.h,list.h", cname="struct list_head")]
|
|
|
|
public class KernelList<G> {
|
|
|
|
public KernelList ();
|
|
|
|
[CCode (cname="ralist_next")]
|
|
|
|
public bool next();
|
|
|
|
[CCode (cname="ralist_append")]
|
|
|
|
public void append(owned G foo);
|
|
|
|
[CCode (cname="")]
|
|
|
|
public G @free(G arg);
|
|
|
|
[CCode (cname="ralist_get", generic_type_pos=2)]
|
|
|
|
public unowned G get();
|
|
|
|
[CCode (cname="ralist_iterator")]
|
|
|
|
public KernelList<G> iterator();
|
|
|
|
}
|
2010-01-24 23:47:18 +01:00
|
|
|
#endif
|
2010-01-18 13:45:02 +01:00
|
|
|
|
2010-01-26 01:28:33 +01:00
|
|
|
[Compact]
|
|
|
|
[CCode (cprefix="r_list_", cheader_filename="r_util.h", cname="struct r_list_t")]
|
|
|
|
public class RList<G> {
|
|
|
|
public RList ();
|
|
|
|
public void append(owned G foo);
|
|
|
|
public void prepend(owned G foo);
|
|
|
|
//public unowned G get();
|
|
|
|
//public rListIter<G> iterator();
|
|
|
|
}
|
2010-01-24 23:47:18 +01:00
|
|
|
|
2010-01-26 01:28:33 +01:00
|
|
|
[Compact]
|
|
|
|
[CCode (cprefix="r_list_iter_", cheader_filename="r_list.h", cname="struct r_list_iter_t")]
|
|
|
|
public class RListIter<G> {
|
|
|
|
public bool next();
|
|
|
|
// public G @free(G arg);
|
|
|
|
public unowned G get();
|
|
|
|
}
|
2009-09-24 12:29:05 +02:00
|
|
|
|
2010-01-26 01:28:33 +01:00
|
|
|
/* TODO: deprecated by r_iter ??? */
|
2010-01-18 13:45:02 +01:00
|
|
|
/*
|
2010-01-26 01:28:33 +01:00
|
|
|
[Compact]
|
|
|
|
[CCode (cprefix="rarray_", cheader_filename="r_types.h", cname="void")]
|
|
|
|
public static class rArray<G> {
|
|
|
|
[CCode (cname="rarray_next", generic_type_pos=2)]
|
|
|
|
public bool next(); //int type=0);
|
|
|
|
[CCode (cname="")]
|
|
|
|
public G @free(G arg);
|
|
|
|
[CCode (cname="rarray_get", generic_type_pos=2)]
|
|
|
|
public unowned G get(); //int type=0);
|
|
|
|
[CCode (cname="rarray_iterator")] //, generic_type_pos=2)]
|
|
|
|
public rArray<G> iterator();
|
2009-09-03 11:17:00 +00:00
|
|
|
}
|
2010-01-26 01:28:33 +01:00
|
|
|
*/
|