summaryrefslogtreecommitdiff
path: root/examples/unix
diff options
context:
space:
mode:
Diffstat (limited to 'examples/unix')
-rw-r--r--examples/unix/ffi_example.py38
-rw-r--r--examples/unix/machine_bios.py9
2 files changed, 0 insertions, 47 deletions
diff --git a/examples/unix/ffi_example.py b/examples/unix/ffi_example.py
deleted file mode 100644
index f650e3370..000000000
--- a/examples/unix/ffi_example.py
+++ /dev/null
@@ -1,38 +0,0 @@
-import ffi
-
-libc = ffi.open("libc.so.6")
-print("libc:", libc)
-print()
-
-# Declare few functions
-perror = libc.func("v", "perror", "s")
-time = libc.func("i", "time", "p")
-open = libc.func("i", "open", "si")
-qsort = libc.func("v", "qsort", "piip")
-# And one variable
-errno = libc.var("i", "errno")
-
-print("time:", time)
-print("UNIX time is:", time(None))
-print()
-
-perror("ffi before error")
-open("somethingnonexistent__", 0)
-print("errno object:", errno)
-print("errno value:", errno.get())
-perror("ffi after error")
-print()
-
-def cmp(pa, pb):
- a = ffi.as_bytearray(pa, 1)
- b = ffi.as_bytearray(pb, 1)
- print("cmp:", a, b)
- return a[0] - b[0]
-
-cmp_c = ffi.callback("i", cmp, "pp")
-print("callback:", cmp_c)
-
-s = bytearray(b"foobar")
-print("org string:", s)
-qsort(s, len(s), 1, cmp_c)
-print("qsort'ed string:", s)
diff --git a/examples/unix/machine_bios.py b/examples/unix/machine_bios.py
deleted file mode 100644
index f62e4dbdb..000000000
--- a/examples/unix/machine_bios.py
+++ /dev/null
@@ -1,9 +0,0 @@
-# This example shows how to access Video BIOS memory area via machine.mem
-# It requires root privilege and x86 legacy harfware (which has mentioned
-# Video BIOS at all).
-# It is expected to print 0xaa55, which is a signature at the start of
-# Video BIOS.
-
-import umachine as machine
-
-print(hex(machine.mem16[0xc0000]))