diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2010-10-05 21:45:52 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2010-10-05 21:45:52 +0200 |
commit | e65feb6fd3d035f06f7439c79b5eea37946eea5e (patch) | |
tree | cedd91d741161e7f5bc45b50a1006905699a5ecd /vapi | |
parent | 3639520b85a4c05334b7e8920d42a33b0831c3f0 (diff) | |
download | eva-e65feb6fd3d035f06f7439c79b5eea37946eea5e.tar eva-e65feb6fd3d035f06f7439c79b5eea37946eea5e.zip |
Include erl_interface.vapi
Diffstat (limited to 'vapi')
-rw-r--r-- | vapi/erl_interface.vapi | 162 |
1 files changed, 162 insertions, 0 deletions
diff --git a/vapi/erl_interface.vapi b/vapi/erl_interface.vapi new file mode 100644 index 0000000..55b89c2 --- /dev/null +++ b/vapi/erl_interface.vapi @@ -0,0 +1,162 @@ +[CCode (cheader_filename = "ei.h", cprefix = "ei_", lower_case_cprefix = "ei_")] +namespace Erl { + /*public int errno; + + [CCode (cname = "ei_cnode")] + [Compact] + public struct Node { + [CCode (cname = "ei_connect_init")] + public Node(string this_node_name, string cookie, short creation); + + public Connection connect(string nodename); + + public Pid* self(); + } + + [CCode (cname="int", cprefix="ERL_")] + public enum ReceiveType { + ERROR, TICK, MSG + } + [CCode (cname="int", cprefix="E")] + public enum Error { + TIMEDOUT + } + + [CCode (cname = "int")] + [Compact] + public struct Connection : int { + public bool is_valid() { + return (this >= 0); + } + + private ReceiveType xreceive_msg_tmo(Msg msg, Buffer buffer, uint timeout); + + [CCode (cname = "erl_receive_vala")] + public ReceiveType receive(out Buffer buffer, uint timeout = 0) { + buffer = Buffer(); + Msg msg; + ReceiveType ret = xreceive_msg_tmo(msg, buffer, timeout); + return ret; + } + }*/ + + + [CCode (cname="MAXATOMLEN")] + public const int MAXATOMLEN; + + [CCode (cname="char")] + public enum TermType { + [CCode (cname="ERL_SMALL_INTEGER_EXT")] + SMALL_INTEGER, + [CCode (cname="ERL_INTEGER_EXT")] + INTEGER, + [CCode (cname="ERL_FLOAT_EXT")] + FLOAT, + [CCode (cname="ERL_ATOM_EXT")] + ATOM, + [CCode (cname="ERL_REFERENCE_EXT")] + REFERENCE, + [CCode (cname="ERL_NEW_REFERENCE_EXT")] + NEW_REFERENCE, + [CCode (cname="ERL_PORT_EXT")] + PORT, + [CCode (cname="ERL_PID_EXT")] + PID, + [CCode (cname="ERL_SMALL_TUPLE_EXT")] + SMALL_TUPLE, + [CCode (cname="ERL_LARGE_TUPLE_EXT")] + LARGE_TUPLE, + [CCode (cname="ERL_NIL_EXT")] + NIL, + [CCode (cname="ERL_STRING_EXT")] + STRING, + [CCode (cname="ERL_LIST_EXT")] + LIST, + [CCode (cname="ERL_BINARY_EXT")] + BINARY, + [CCode (cname="ERL_SMALL_BIG_EXT")] + SMALL_BIG, + [CCode (cname="ERL_LARGE_BIG_EXT")] + LARGE_BIG, + [CCode (cname="ERL_NEW_FUN_EXT")] + NEW_FUN, + [CCode (cname="ERL_FUN_EXT")] + FUN + } + + public int get_type(char *buf, ref int index, out int type, out int size); + + public int decode_version(char *buf, ref int index, out int version); + public int decode_char(char *buf, ref int index, out char value); + public int decode_long(char *buf, ref int index, out long value); + public int decode_double(char *buf, ref int index, out double value); + public int decode_atom(char *buf, ref int index, char *p); + public int decode_tuple_header(char *buf, ref int index, out int arity); + public int decode_list_header(char *buf, ref int index, out int arity); + public int decode_string(char *buf, ref int index, char *p); + public int decode_binary(char *buf, ref int index, char *p, out long len); + public int decode_pid(char *buf, ref int index, out Pid pid); + public int decode_port(char *buf, ref int index, out Port port); + public int decode_ref(char *buf, ref int index, out Ref reference); + + + [CCode (cname = "ei_x_buff", cprefix = "ei_x_", destroy_function = "ei_x_free")] + [Compact] + public struct Buffer { + [CCode (array_length_cname = "index", array_length_type = "int")] + public char[] buff; + + [CCode (cname = "ei_x_new")] + public Buffer(); + + [CCode (cname = "ei_x_new_with_version")] + public Buffer.with_version(); + + public int encode_long(long p); + public int encode_ulong(ulong p); + public int encode_double(double p); + [CCode (cname = "ei_x_encode_atom_len")] + public int encode_atom(char[] p); + public int encode_tuple_header(int arity); + public int encode_list_header(int arity); + public int encode_empty_list(); + [CCode (cname = "ei_x_encode_string_len")] + public int encode_string(char[] p); + public int encode_binary(char* p, long len); + public int encode_pid(Pid pid); + public int encode_port(Port port); + public int encode_ref(Ref reference); + } + + [CCode (cname = "erlang_pid", destroy_function = "")] + [Compact] + public struct Pid { + public char[] node; + public uint num; + public uint serial; + public uint creation; + } + + [CCode (cname = "erlang_port", destroy_function = "")] + [Compact] + public struct Port { + public char[] node; + public uint id; + public uint creation; + } + + [CCode (cname = "erlang_ref", destroy_function = "")] + [Compact] + public struct Ref { + public char[] node; + public int len; + public uint* n; + public uint creation; + } + + /*[CCode (cname = "erlang_msg", destroy_function = "")] + [Compact] + private struct Msg { + public Pid from; + }*/ +} |