diff --git a/src/include/lib3270.h b/src/include/lib3270.h
index 7dae17e..cf68b82 100644
--- a/src/include/lib3270.h
+++ b/src/include/lib3270.h
@@ -932,6 +932,9 @@
*/
LIB3270_EXPORT int lib3270_get_field_bounds(H3270 *hSession, int baddr, int *start, int *end);
+ LIB3270_EXPORT int lib3270_get_field_start(H3270 *hSession, int baddr);
+ LIB3270_EXPORT int lib3270_get_field_len(H3270 *hSession, int baddr);
+
LIB3270_EXPORT int lib3270_get_word_bounds(H3270 *hSession, int baddr, int *start, int *end);
diff --git a/src/include/pw3270/ipcpackets.h b/src/include/pw3270/ipcpackets.h
index e8c62a4..84e59da 100644
--- a/src/include/pw3270/ipcpackets.h
+++ b/src/include/pw3270/ipcpackets.h
@@ -49,7 +49,9 @@
HLLAPI_PACKET_ERASE_EOF,
HLLAPI_PACKET_PRINT,
HLLAPI_PACKET_GET_CSTATE,
- HLLAPI_PACKET_IS_READY,
HLLAPI_PACKET_SET_TOGGLE,
+ HLLAPI_PACKET_IS_READY,
HLLAPI_PACKET_SET_TOGGLE,
+ HLLAPI_PACKET_FIELD_START,
+ HLLAPI_PACKET_FIELD_LEN,
HLLAPI_PACKET_INVALID
diff --git a/src/lib3270/ctlr.c b/src/lib3270/ctlr.c
index c7bfb7c..6e4f8eb 100644
--- a/src/lib3270/ctlr.c
+++ b/src/lib3270/ctlr.c
@@ -303,6 +303,62 @@ static void ctlr_connect(H3270 *hSession, int ignored unused, void *dunno)
hSession->crm_nattr = 0;
}
+LIB3270_EXPORT int lib3270_get_field_start(H3270 *hSession, int baddr)
+{
+ int sbaddr;
+
+ CHECK_SESSION_HANDLE(hSession);
+
+ if (!hSession->formatted)
+ return -1;
+
+ if(baddr < 0)
+ baddr = hSession->cursor_addr;
+
+ sbaddr = baddr;
+ do
+ {
+ if(hSession->ea_buf[baddr].fa)
+ return baddr;
+ DEC_BA(baddr);
+ } while (baddr != sbaddr);
+
+ return -1;
+
+}
+
+LIB3270_EXPORT int lib3270_get_field_len(H3270 *hSession, int baddr)
+{
+ int saddr;
+ int addr;
+ int width = 0;
+
+ CHECK_SESSION_HANDLE(hSession);
+
+ if (!hSession->formatted)
+ return -1;
+
+ if(baddr < 0)
+ baddr = hSession->cursor_addr;
+
+ addr = find_field_attribute(hSession,baddr);
+
+ if(addr < 0)
+ return -1;
+
+ saddr = addr;
+ INC_BA(addr);
+ do
+ {
+ if(hSession->ea_buf[addr].fa)
+ return width;
+ INC_BA(addr);
+ width++;
+ } while (addr != saddr);
+
+ return -1;
+}
+
LIB3270_EXPORT int lib3270_field_addr(H3270 *hSession, int baddr)
{
int sbaddr;
diff --git a/src/plugins/dbus3270/gobject.c b/src/plugins/dbus3270/gobject.c
index 7f2e9b1..899d358 100644
--- a/src/plugins/dbus3270/gobject.c
+++ b/src/plugins/dbus3270/gobject.c
@@ -319,3 +319,15 @@ void pw3270_dbus_pa_key(PW3270Dbus *object, int key, DBusGMethodInvocation *cont
return;
dbus_g_method_return(context,lib3270_pakey(pw3270_dbus_get_session_handle(object),key));
}
+
+ void pw3270_dbus_get_field_start(PW3270Dbus *object, int baddr, DBusGMethodInvocation *context)
+ {
+ trace("%s object=%p context=%p",__FUNCTION__,object,context);
+ dbus_g_method_return(context,lib3270_get_field_start(pw3270_dbus_get_session_handle(object),baddr));
+ }
+
+void pw3270_dbus_get_field_len(PW3270Dbus *object, int baddr, DBusGMethodInvocation *context)
+ {
+ trace("%s object=%p context=%p",__FUNCTION__,object,context);
+ dbus_g_method_return(context,lib3270_get_field_len(pw3270_dbus_get_session_handle(object),baddr));
+ }
diff --git a/src/plugins/dbus3270/pw3270dbus.xml b/src/plugins/dbus3270/pw3270dbus.xml
index b2fb639..d706af0 100644
--- a/src/plugins/dbus3270/pw3270dbus.xml
+++ b/src/plugins/dbus3270/pw3270dbus.xml
@@ -93,6 +93,15 @@
-
+
+
+
+
+
+
+
+
+
+
diff --git a/src/plugins/dbus3270/service.h b/src/plugins/dbus3270/service.h
index 1a3ce32..35909a0 100644
--- a/src/plugins/dbus3270/service.h
+++ b/src/plugins/dbus3270/service.h
@@ -81,6 +81,9 @@
void pw3270_dbus_wait_for_ready(PW3270Dbus *object, int timeout, DBusGMethodInvocation *context);
+ void pw3270_dbus_get_field_start(PW3270Dbus *object, int baddr, DBusGMethodInvocation *context);
+ void pw3270_dbus_get_field_length(PW3270Dbus *object, int baddr, DBusGMethodInvocation *context);
+
// Actions
void pw3270_dbus_enter(PW3270Dbus *object, DBusGMethodInvocation *context);
void pw3270_dbus_pf_key(PW3270Dbus *object, int key, DBusGMethodInvocation *context);
diff --git a/src/plugins/hllapi/pluginmain.c b/src/plugins/hllapi/pluginmain.c
index c410062..9e20e48 100644
--- a/src/plugins/hllapi/pluginmain.c
+++ b/src/plugins/hllapi/pluginmain.c
@@ -282,6 +282,18 @@
((struct hllapi_packet_set *) source->buffer)->id,
((struct hllapi_packet_set *) source->buffer)->value));
break;
+
+ case HLLAPI_PACKET_FIELD_START:
+ send_result(source,lib3270_get_field_start(lib3270_get_default_session_handle(),
+ ((struct hllapi_packet_addr *) source->buffer)->addr));
+ break;
+
+
+ case HLLAPI_PACKET_FIELD_LEN:
+ send_result(source,lib3270_get_field_len(lib3270_get_default_session_handle(),
+ ((struct hllapi_packet_addr *) source->buffer)->addr));
+ break;
+
default:
send_result(source, EINVAL);
g_message("Invalid remote request (id=%d)",source->buffer[0]);
diff --git a/src/plugins/rx3270/local.cc b/src/plugins/rx3270/local.cc
index a9418af..1012543 100644
--- a/src/plugins/rx3270/local.cc
+++ b/src/plugins/rx3270/local.cc
@@ -81,6 +81,9 @@
int pfkey(int key);
int pakey(int key);
+ int get_field_start(int baddr = -1);
+ int get_field_len(int baddr = -1);
+
private:
const char * (*_get_version)(void);
@@ -101,6 +104,8 @@
int (*_is_ready)(H3270 *h);
int (*_set_cursor_position)(H3270 *h, int row, int col);
int (*_set_toggle)(H3270 *h, LIB3270_TOGGLE ix, int value);
+ int (*_get_field_start)(H3270 *h, int baddr);
+ int (*_get_field_len)(H3270 *h, int baddr);
#ifdef WIN32
HMODULE hModule;
@@ -227,6 +232,8 @@ dynamic::dynamic()
{ (void **) & _is_ready, "lib3270_is_ready" },
{ (void **) & _set_cursor_position, "lib3270_set_cursor_position" },
{ (void **) & _set_toggle, "lib3270_set_toggle" },
+ { (void **) & _get_field_start, "lib3270_get_field_start" },
+ { (void **) & _get_field_len, "lib3270_get_field_len" },
};
@@ -508,3 +515,18 @@ int dynamic::set_toggle(LIB3270_TOGGLE ix, bool value)
return _set_toggle(hSession,ix,(int) value);
return -1;
}
+
+int dynamic::get_field_start(int baddr)
+{
+ if(hModule)
+ return _get_field_start(hSession,baddr);
+ return -1;
+}
+
+int dynamic::get_field_len(int baddr)
+{
+ if(hModule)
+ return _get_field_len(hSession,baddr);
+ return -1;
+}
+
diff --git a/src/plugins/rx3270/pluginmain.cc b/src/plugins/rx3270/pluginmain.cc
index 2e776cb..a5a017b 100644
--- a/src/plugins/rx3270/pluginmain.cc
+++ b/src/plugins/rx3270/pluginmain.cc
@@ -91,6 +91,9 @@
int pfkey(int key);
int pakey(int key);
+ int get_field_start(int baddr = -1);
+ int get_field_len(int baddr = -1);
+
private:
H3270 *hSession;
@@ -231,6 +234,16 @@
return lib3270_get_text(hSession,baddr,len);
}
+ int plugin::get_field_start(int baddr)
+ {
+ return lib3270_get_field_start(hSession,baddr);
+ }
+
+ int plugin::get_field_len(int baddr)
+ {
+ return lib3270_get_field_len(hSession,baddr);
+ }
+
static int REXXENTRY Rexx_IO_exit(RexxExitContext *context, int exitnumber, int subfunction, PEXIT parmBlock)
{
trace("%s call with ExitNumber: %d Subfunction: %d",__FUNCTION__,(int) exitnumber, (int) subfunction);
diff --git a/src/plugins/rx3270/remote.cc b/src/plugins/rx3270/remote.cc
index eff0203..a02d60c 100644
--- a/src/plugins/rx3270/remote.cc
+++ b/src/plugins/rx3270/remote.cc
@@ -76,6 +76,9 @@
int pfkey(int key);
int pakey(int key);
+ int get_field_start(int baddr = -1);
+ int get_field_len(int baddr = -1);
+
private:
#if defined(WIN32)
@@ -911,6 +914,66 @@ int remote::pakey(int key)
return -1;
}
+int remote::get_field_start(int baddr)
+{
+#if defined(WIN32)
+
+ if(hPipe != INVALID_HANDLE_VALUE)
+ {
+ struct hllapi_packet_addr query = { HLLAPI_PACKET_FIELD_START, (unsigned short) baddr };
+ struct hllapi_packet_result response;
+ DWORD cbSize = sizeof(query);
+ TransactNamedPipe(hPipe,(LPVOID) &query, cbSize, &response, sizeof(response), &cbSize,NULL);
+ return response.rc;
+ }
+
+#elif defined(HAVE_DBUS)
+
+ dbus_int32_t k = (dbus_int32_t) baddr;
+
+ DBusMessage * msg = create_message("getFieldStart");
+ if(msg)
+ {
+ dbus_message_append_args(msg, DBUS_TYPE_INT32, &k, DBUS_TYPE_INVALID);
+ return get_intval(call(msg));
+ }
+
+#endif
+
+ return -1;
+}
+
+int remote::get_field_len(int baddr)
+{
+#if defined(WIN32)
+
+ if(hPipe != INVALID_HANDLE_VALUE)
+ {
+ struct hllapi_packet_addr query = { HLLAPI_PACKET_FIELD_LEN, (unsigned short) baddr };
+ struct hllapi_packet_result response;
+ DWORD cbSize = sizeof(query);
+ TransactNamedPipe(hPipe,(LPVOID) &query, cbSize, &response, sizeof(response), &cbSize,NULL);
+ return response.rc;
+ }
+
+#elif defined(HAVE_DBUS)
+
+ dbus_int32_t k = (dbus_int32_t) baddr;
+
+ DBusMessage * msg = create_message("getFieldLength");
+ if(msg)
+ {
+ dbus_message_append_args(msg, DBUS_TYPE_INT32, &k, DBUS_TYPE_INVALID);
+ return get_intval(call(msg));
+ }
+
+#endif
+
+ return -1;
+}
+
+
+
int remote::set_toggle(LIB3270_TOGGLE ix, bool value)
{
#if defined(WIN32)
diff --git a/src/plugins/rx3270/rexx_methods.cc b/src/plugins/rx3270/rexx_methods.cc
index 967fc68..036d433 100644
--- a/src/plugins/rx3270/rexx_methods.cc
+++ b/src/plugins/rx3270/rexx_methods.cc
@@ -357,3 +357,19 @@ RexxMethod3(RexxStringObject, rx3270_method_get_text, CSELF, sessionPtr, OPTIONA
return context->String("");
}
+
+RexxMethod2(int, rx3270_method_get_field_len, CSELF, sessionPtr, OPTIONAL_int, baddr)
+{
+ rx3270 *hSession = (rx3270 *) sessionPtr;
+ if(!hSession)
+ return -1;
+ return hSession->get_field_len(baddr);
+}
+
+RexxMethod2(int, rx3270_method_get_field_start, CSELF, sessionPtr, OPTIONAL_int, baddr)
+{
+ rx3270 *hSession = (rx3270 *) sessionPtr;
+ if(!hSession)
+ return -1;
+ return hSession->get_field_start(baddr);
+}
diff --git a/src/plugins/rx3270/rx3270.cls b/src/plugins/rx3270/rx3270.cls
index e23dbbc..f7a1596 100644
--- a/src/plugins/rx3270/rx3270.cls
+++ b/src/plugins/rx3270/rx3270.cls
@@ -68,6 +68,9 @@
::METHOD WAITFORTEXTAT EXTERNAL "LIBRARY rx3270 rx3270_method_wait_for_text_at"
::METHOD TEST EXTERNAL "LIBRARY rx3270 rx3270_method_test"
+::METHOD GETFIELDSTART EXTERNAL "LIBRARY rx3270 rx3270_method_get_field_start"
+::METHOD GETFIELDLEN EXTERNAL "LIBRARY rx3270 rx3270_method_get_field_len"
+
/*
getConnectionState
waitForEvents
diff --git a/src/plugins/rx3270/rx3270.h b/src/plugins/rx3270/rx3270.h
index e1334b7..98c317a 100644
--- a/src/plugins/rx3270/rx3270.h
+++ b/src/plugins/rx3270/rx3270.h
@@ -168,6 +168,9 @@
virtual int cmp_text_at(int row, int col, const char *text) = 0;
virtual int set_text_at(int row, int col, const char *str) = 0;
+ virtual int get_field_start(int baddr = -1) = 0;
+ virtual int get_field_len(int baddr = -1) = 0;
+
};
rx3270 * create_lib3270_instance(void);
--
libgit2 0.21.2