summaryrefslogtreecommitdiff
path: root/host/proto/test/interactive.py
diff options
context:
space:
mode:
authorNicolas Schodet2008-04-02 23:02:59 +0200
committerNicolas Schodet2008-04-02 23:02:59 +0200
commitf1c0281f0827699b5990c5dd21908d2384407578 (patch)
tree92c70cc7539208d36ba13ea9ba05b323ee5e8df5 /host/proto/test/interactive.py
parent1197ceaf9f4a3730bf89542ad28ddd6aff634ade (diff)
* host/proto:
- added proto interface.
Diffstat (limited to 'host/proto/test/interactive.py')
-rw-r--r--host/proto/test/interactive.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/host/proto/test/interactive.py b/host/proto/test/interactive.py
new file mode 100644
index 00000000..f68dd121
--- /dev/null
+++ b/host/proto/test/interactive.py
@@ -0,0 +1,29 @@
+import sys
+sys.path.append (sys.path[0] + '/..')
+
+import proto
+from fio import IO
+import time, select
+
+def log (x):
+ print x
+
+p = proto.Proto (IO (), time.time, 2, log)
+
+def a (i, j):
+ print 'a (%d, %d)' % (i, j)
+
+def b (i):
+ print 'b (%d)' % i
+
+p.register ('a', 'BH', a)
+p.register ('b', 'L', b)
+
+p.send ('a', 'BH', 1, 2)
+p.send ('b', 'L', 3)
+
+while True:
+ p.sync ()
+ fds = select.select ((p,), (), (), 0.1)[0]
+ for i in fds:
+ i.read ()