diff --git a/src/include/pw3270/class.h b/src/include/pw3270/class.h index 29f8100..0ca844a 100644 --- a/src/include/pw3270/class.h +++ b/src/include/pw3270/class.h @@ -184,7 +184,7 @@ string ebc2asc(string &str); // Get/Set/Text with charset translation - string get_string(int baddr, size_t len); + string get_string(int baddr = 0, size_t len = -1); string get_string_at(int row, int col, size_t sz); int set_string_at(int row, int col, const char *str); int cmp_string_at(int row, int col, const char *text); diff --git a/src/python/get.cc b/src/python/get.cc index 30aaece..d3ea909 100644 --- a/src/python/get.cc +++ b/src/python/get.cc @@ -132,3 +132,23 @@ PyObject * terminal_get_string_at(PyObject *self, PyObject *args) { return PyString_FromString(rc.c_str()); } + +PyObject * terminal_get_contents(PyObject *self) { + + string rc; + + try { + + rc = ((pw3270_TerminalObject *) self)->session->get_string(); + + } catch(std::exception &e) { + + PyErr_SetString(terminalError, e.what()); + return NULL; + } + + return PyString_FromString(rc.c_str()); + + + +} diff --git a/src/python/private.h b/src/python/private.h index a6915d1..7b41109 100644 --- a/src/python/private.h +++ b/src/python/private.h @@ -64,6 +64,7 @@ PyObject * terminal_disconnect(PyObject *self, PyObject *args); PyObject * terminal_get_string_at(PyObject *self, PyObject *args); + PyObject * terminal_get_contents(PyObject *self); PyObject * terminal_set_string_at(PyObject *self, PyObject *args); PyObject * terminal_cmp_string_at(PyObject *self, PyObject *args); diff --git a/src/python/py3270.cc b/src/python/py3270.cc index 12ee60d..7347da8 100644 --- a/src/python/py3270.cc +++ b/src/python/py3270.cc @@ -103,7 +103,7 @@ static PyTypeObject pw3270_TerminalType = { 0, /*tp_as_mapping*/ 0, /*tp_hash */ 0, /*tp_call*/ - 0, /*tp_str*/ + terminal_get_contents, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ diff --git a/src/python/sample.py b/src/python/sample.py index a67f56a..c7b682a 100644 --- a/src/python/sample.py +++ b/src/python/sample.py @@ -18,6 +18,11 @@ print term.IsReady() print term.GetStringAt(14,19,38) +print "-----------------------------------------------------------------------" +print term +print "-----------------------------------------------------------------------" + + -- libgit2 0.21.2