diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 10 | ||||
-rw-r--r-- | src/Term.vala | 71 |
2 files changed, 81 insertions, 0 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000..a725dd3 --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,10 @@ +vala_precompile(EVA_C + Term.vala +PACKAGES + gee-1.0 + erl_interface +GENERATE_VAPI + eva +) + +add_library(eva SHARED ${EVA_C}) diff --git a/src/Term.vala b/src/Term.vala new file mode 100644 index 0000000..2a9cca8 --- /dev/null +++ b/src/Term.vala @@ -0,0 +1,71 @@ +namespace Eva { + public interface Term : Object { + public abstract string to_string(); + + public abstract void encode(Erl.Buffer buffer); + } + + public class Long : Object, Term { + public long value {get; construct;} + + public Long(long v) { + Object(value: v); + } + + public string to_string() { + return value.to_string(); + } + + public void encode(Erl.Buffer buffer) { + buffer.encode_long(value); + } + } + + public class ULong : Object, Term { + public ulong value {get; construct;} + + public ULong(ulong v) { + Object(value: v); + } + + public string to_string() { + return value.to_string(); + } + + public void encode(Erl.Buffer buffer) { + buffer.encode_ulong(value); + } + } + + public class Double : Object, Term { + public double value {get; construct;} + + public Double(double v) { + Object(value: v); + } + + public string to_string() { + return value.to_string(); + } + + public void encode(Erl.Buffer buffer) { + buffer.encode_double(value); + } + } + + public class Atom : Object, Term { + public string value {get; construct;} + + public Atom(string v) { + Object(value: v); + } + + public string to_string() { + return value.to_string(); + } + + public void encode(Erl.Buffer buffer) { + buffer.encode_atom(value.to_utf8()); + } + } +} |