Add in cffi 1.12.2 (e0c7666)
Since this is a mercurial repo, d/led zip of src:
https://bitbucket.org/cffi/cffi/get/v1.12.2.zip
Also add in misc METADATA/NOTICE/Android.bp/etc files.
Bug: 122778810
Test: None
Change-Id: I36c58ed07a2cdd4d9d11831908175a5c988f33c1
diff --git a/demo/xclient.py b/demo/xclient.py
new file mode 100644
index 0000000..e4b3dd2
--- /dev/null
+++ b/demo/xclient.py
@@ -0,0 +1,27 @@
+import sys, os
+
+# run xclient_build first, then make sure the shared object is on sys.path
+from _xclient_cffi import ffi, lib
+
+
+# ffi "knows" about the declared variables and functions from the
+# cdef parts of the module xclient_build created,
+# lib "knows" how to call the functions from the set_source parts
+# of the module.
+
+
+class XError(Exception):
+ pass
+
+def main():
+ display = lib.XOpenDisplay(ffi.NULL)
+ if display == ffi.NULL:
+ raise XError("cannot open display")
+ w = lib.XCreateSimpleWindow(display, lib.DefaultRootWindow(display),
+ 10, 10, 500, 350, 0, 0, 0)
+ lib.XMapRaised(display, w)
+ event = ffi.new("XEvent *")
+ lib.XNextEvent(display, event)
+
+if __name__ == '__main__':
+ main()