|
Hello Linux 5250 users: Me <-- Big, cheezy grin. swig has progressed somewhat (the simplified wrapper interface generator), and I've been able to get python language bindings for the tn5250 library working (sort of - all sorts of hacks and kludges right now, but I can connect and use an AS/400 ;-): I'll be checking it in after some cleanup, but soon you'll be able to script your own emulator. Things like macros, screen-scraping, and a rewrite of the Gnome 5250 emulator in python so that it can be customizeable. Woohoo! Also the 5250 -> HTML gateway I like to keep bringing up but never writing would be easier to write in python. Check it out (this is basically a rewrite of the tn5250.c driver program in python): #!/usr/bin/python # vi:set sts=4 sw=4 ai: # # tn5250.py - Python version of the tn5250 program. # import sys import os from _tn5250 import * def syntax (): print "Here's where the syntax message would go." sys.exit(1) class Error: pass config = tn5250_config_new () if tn5250_config_load_default (config) == -1: tn5250_config_unref (config) sys.exit(1) a = tn5250_argv_new (len(sys.argv)) for i in range(len(sys.argv)): tn5250_argv_set (a, i, sys.argv[i]) if tn5250_config_parse_argv (config, len(sys.argv), a) == -1: tn5250_config_unref (config) syntax () tn5250_argv_free (a) if tn5250_config_exists (config, "help"): syntax () if tn5250_config_exists (config, "version"): # version not implemented here. syntax () if not tn5250_config_exists (config, "host"): syntax () try: stream = tn5250_stream_open (tn5250_config_get (config, "host")) if stream == None: raise Error if tn5250_stream_config (stream, config) == -1: raise Error display = tn5250_display_new () print display if tn5250_display_config (display, config) == -1: raise Error term = tn5250_curses_terminal_new () if tn5250_config_exists (config, "underscores"): tn5250_curses_terminal_use_underscores (term, tn5250_config_get_bool (config, "underscores") ) if tn5250_terminal_config (term, config) == -1: raise Error try: tn5250_terminal_init (term) tn5250_display_set_terminal (display, term) sess = tn5250_session_new () tn5250_display_set_session (display, sess) tn5250_terminal_set_conn_fd (term, tn5250_stream_socket_handle (stream)) tn5250_session_set_stream (sess, stream) if tn5250_session_config (sess, config) == -1: raise Error tn5250_session_main_loop(sess) finally: tn5250_terminal_term (term) except Error, e: syntax () # END This all goes in the development version, of course. Feedback? - Jay 'Eraserhead' Felice +--- | This is the LINUX5250 Mailing List! | To submit a new message, send your mail to LINUX5250@midrange.com. | To subscribe to this list send email to LINUX5250-SUB@midrange.com. | To unsubscribe from this list send email to LINUX5250-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: david@midrange.com +---
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.