1996-09-24 12:35:50 -03:00
|
|
|
"""twit - The Window-Independent Tracer.
|
|
|
|
|
|
|
|
Interface:
|
|
|
|
twit.main() Enter debugger in inactive interactive state
|
|
|
|
twit.run(stmt, globals, locals) Enter debugger and start running stmt
|
|
|
|
twit.post_mortem(traceback) Enter debugger in post-mortem mode on traceback
|
|
|
|
twit.pm() Enter debugger in pm-mode on sys.last_traceback
|
|
|
|
|
|
|
|
main program: nothing but a bit of glue to put it all together.
|
|
|
|
|
|
|
|
Jack Jansen, CWI, August 1996."""
|
|
|
|
|
|
|
|
import os
|
1996-11-11 11:40:45 -04:00
|
|
|
import sys
|
|
|
|
|
|
|
|
# Add our directory to path, if needed
|
|
|
|
dirname = os.path.split(__file__)[0]
|
|
|
|
if not dirname in sys.path:
|
|
|
|
sys.path.append(dirname)
|
|
|
|
|
1996-09-24 12:35:50 -03:00
|
|
|
if os.name == 'mac':
|
1996-10-23 12:38:26 -03:00
|
|
|
import MacOS
|
1996-12-23 13:11:00 -04:00
|
|
|
MacOS.splash(502) # Try to show the splash screen
|
1996-09-24 12:35:50 -03:00
|
|
|
import mactwit_app; twit_app = mactwit_app
|
|
|
|
else:
|
|
|
|
try:
|
|
|
|
import _tkinter
|
|
|
|
have_tk = 1
|
|
|
|
except ImportError:
|
|
|
|
have_tk = 0
|
|
|
|
if have_tk:
|
|
|
|
import tktwit_app; twit_app = tktwit_app
|
|
|
|
else:
|
1996-09-26 13:26:05 -03:00
|
|
|
print 'Please implementent machine-dependent code and try again:-)'
|
1996-09-24 12:35:50 -03:00
|
|
|
sys.exit(1)
|
|
|
|
|
|
|
|
import sys
|
|
|
|
|
|
|
|
def main():
|
|
|
|
twit_app.Initialize()
|
1996-10-23 12:38:26 -03:00
|
|
|
if os.name == 'mac':
|
|
|
|
MacOS.splash()
|
1996-09-26 13:26:05 -03:00
|
|
|
twit_app.Twit('none', None)
|
1996-09-24 12:35:50 -03:00
|
|
|
|
|
|
|
def run(statement, globals=None, locals=None):
|
|
|
|
twit_app.Initialize()
|
1996-09-26 13:26:05 -03:00
|
|
|
twit_app.Twit('run', (statement, globals, locals))
|
1996-09-24 12:35:50 -03:00
|
|
|
|
|
|
|
def post_mortem(t):
|
|
|
|
Initialize()
|
1996-09-26 13:26:05 -03:00
|
|
|
twit_app.Twit('pm', t)
|
1996-09-24 12:35:50 -03:00
|
|
|
|
|
|
|
def pm():
|
|
|
|
post_mortem(sys.last_traceback)
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
main()
|
|
|
|
|
|
|
|
|