summaryrefslogtreecommitdiffstats
path: root/Mac/Lib/test/ctbtest.py
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>2003-11-19 14:34:18 (GMT)
committerJack Jansen <jack.jansen@cwi.nl>2003-11-19 14:34:18 (GMT)
commit28ecf70db57828db2ca279643bf9aeca7662f35c (patch)
tree09b7767bbc411f85313b58d6fe7e5e67d9392973 /Mac/Lib/test/ctbtest.py
parent6045b9c93511c767f6cfa2d2fa299c76181acd9b (diff)
downloadcpython-28ecf70db57828db2ca279643bf9aeca7662f35c.zip
cpython-28ecf70db57828db2ca279643bf9aeca7662f35c.tar.gz
cpython-28ecf70db57828db2ca279643bf9aeca7662f35c.tar.bz2
Getting rid of support for MacOS9 and earlier. This is the first step,
and the biggest in size, but probably the easiest. Hunting through the source code comes next.
Diffstat (limited to 'Mac/Lib/test/ctbtest.py')
-rw-r--r--Mac/Lib/test/ctbtest.py50
1 files changed, 0 insertions, 50 deletions
diff --git a/Mac/Lib/test/ctbtest.py b/Mac/Lib/test/ctbtest.py
deleted file mode 100644
index 91824d3..0000000
--- a/Mac/Lib/test/ctbtest.py
+++ /dev/null
@@ -1,50 +0,0 @@
-#
-# Simple test program for ctb module: emulate a terminal.
-# To simplify matters use the python console window for output.
-#
-import ctb
-from Carbon import Evt
-from Carbon import Events
-import MacOS
-import sys
-
-def cb(err):
- print 'Done, err=', err
-
-def main():
- if not ctb.available():
- print 'Communications Toolbox not available'
- sys.exit(1)
- # Disable Python's event processing (we do that)
- MacOS.SchedParams(1, 0)
- print 'Minimal terminal emulator V1.0'
- print '(type command-Q to exit)'
- print
-
- l = ctb.CMNew('Serial Tool', None)
- l.Open(10)
- l.SetConfig(l.GetConfig() + ' baud 4800')
-
- while 1:
- l.Idle() # Give time to ctb
-
- ok, evt = Evt.WaitNextEvent(0xffff, 0)
- if ok:
- what, message, when, where, modifiers = evt
-
- if what == Events.keyDown:
- # It is ours. Check for command-. to terminate
- ch = chr(message & Events.charCodeMask)
- if ch == 'q' and (modifiers & Events.cmdKey):
- break
- l.Write(ch, ctb.cmData, -1, 0)
- d, dummy = l.Read(1000, ctb.cmData, 1)
- if d:
- for ch in d:
- if ch != '\r':
- sys.stdout.write(ch)
- sys.stdout.flush()
- l.Close(-1, 1)
- del l
-
-main()