aboutsummaryrefslogtreecommitdiffstats
path: root/src/ffi.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/ffi.rs')
-rw-r--r--src/ffi.rs34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/ffi.rs b/src/ffi.rs
new file mode 100644
index 0000000..ceb8f35
--- /dev/null
+++ b/src/ffi.rs
@@ -0,0 +1,34 @@
+use libc;
+
+use types;
+
+extern "C" {
+ pub fn vt100_screen_new(
+ rows: libc::c_int,
+ cols: libc::c_int
+ ) -> *mut types::ScreenImpl;
+ pub fn vt100_screen_delete(screen: *mut types::ScreenImpl);
+
+ pub fn vt100_screen_process_string(
+ screen: *mut types::ScreenImpl,
+ buf: *const libc::c_char,
+ len: libc::size_t,
+ ) -> libc::c_int;
+ pub fn vt100_screen_get_string_plaintext(
+ screen: *mut types::ScreenImpl,
+ start: *const types::Loc,
+ end: *const types::Loc,
+ outp: *mut *mut libc::c_char,
+ outlen: *mut libc::size_t,
+ );
+}
+
+#[cfg(test)]
+mod tests {
+ #[test]
+ fn ffi() {
+ let ptr = unsafe { super::vt100_screen_new(24, 80) };
+ assert!(!ptr.is_null());
+ unsafe { super::vt100_screen_delete(ptr) };
+ }
+}