Commit 42e6c7b28f07d1ed322fa296d88532295a437370
1 parent
2f61dc6f
Exists in
master
and in
5 other branches
Acertando suporte a scripts rexx (incluindo funções que faltavam), testando méto…
…dos para verificação se um ponto da tela é editável
Showing
13 changed files
with
139 additions
and
3 deletions
Show diff stats
src/classlib/local.cc
... | ... | @@ -147,6 +147,7 @@ |
147 | 147 | int (*_emulate_input)(H3270 *session, const char *s, int len, int pasting); |
148 | 148 | int (*_get_next_unprotected)(H3270 *hSession, int baddr0); |
149 | 149 | int (*_get_is_protected)(H3270 *hSession, int baddr); |
150 | + int (*_get_is_protected_at)(H3270 *hSession, int row, int col); | |
150 | 151 | void (*_popup_va)(H3270 *session, LIB3270_NOTIFY id , const char *title, const char *message, const char *fmt, va_list); |
151 | 152 | void * (*_free)(void *); |
152 | 153 | const char * (*_get_display_charset)(H3270 *hSession); |
... | ... | @@ -206,6 +207,7 @@ |
206 | 207 | { (void **) & _emulate_input, "lib3270_emulate_input" }, |
207 | 208 | { (void **) & _get_next_unprotected, "lib3270_get_next_unprotected" }, |
208 | 209 | { (void **) & _get_is_protected, "lib3270_get_is_protected" }, |
210 | + { (void **) & _get_is_protected_at, "lib3270_get_is_protected_at" }, | |
209 | 211 | { (void **) & _popup_va, "lib3270_popup_va" }, |
210 | 212 | { (void **) & _free, "lib3270_free" }, |
211 | 213 | { (void **) & _get_display_charset, "lib3270_get_display_charset" }, |
... | ... | @@ -401,6 +403,11 @@ |
401 | 403 | return _get_is_protected(hSession,baddr); |
402 | 404 | } |
403 | 405 | |
406 | + int get_is_protected_at(int row, int col) | |
407 | + { | |
408 | + return _get_is_protected_at(hSession,row,col); | |
409 | + } | |
410 | + | |
404 | 411 | int popup_dialog(LIB3270_NOTIFY id , const char *title, const char *message, const char *fmt, ...) |
405 | 412 | { |
406 | 413 | va_list args; | ... | ... |
src/classlib/remote.cc
... | ... | @@ -1257,6 +1257,36 @@ |
1257 | 1257 | |
1258 | 1258 | } |
1259 | 1259 | |
1260 | + int get_is_protected_at(int row,int col) | |
1261 | + { | |
1262 | +#if defined(WIN32) | |
1263 | + | |
1264 | + struct hllapi_packet_query_at query = { HLLAPI_PACKET_IS_PROTECTED_AT, (unsigned short) row, (unsigned short) col, 0 }; | |
1265 | + | |
1266 | + return query_intval((void *) &query, sizeof(query)); | |
1267 | + | |
1268 | +#elif defined(HAVE_DBUS) | |
1269 | + | |
1270 | + dbus_int32_t r = (dbus_int32_t) row; | |
1271 | + dbus_int32_t c = (dbus_int32_t) col; | |
1272 | + | |
1273 | + DBusMessage * msg = create_message("getIsProtectedAt"); | |
1274 | + if(msg) | |
1275 | + { | |
1276 | + dbus_message_append_args(msg, DBUS_TYPE_INT32, &r, DBUS_TYPE_INT32, &c, DBUS_TYPE_INVALID); | |
1277 | + return get_intval(call(msg)); | |
1278 | + } | |
1279 | + | |
1280 | + return -1; | |
1281 | + | |
1282 | +#else | |
1283 | + | |
1284 | + return -1; | |
1285 | + | |
1286 | +#endif | |
1287 | + | |
1288 | + } | |
1289 | + | |
1260 | 1290 | |
1261 | 1291 | int set_host_charset(const char *charset) |
1262 | 1292 | { | ... | ... |
src/include/lib3270.h
... | ... | @@ -935,11 +935,20 @@ |
935 | 935 | LIB3270_EXPORT int lib3270_get_next_unprotected(H3270 *hSession, int baddr0); |
936 | 936 | |
937 | 937 | /** |
938 | - * @brief Check if the screen position is unprotected. | |
938 | + * @brief Check if the screen position is protected. | |
939 | 939 | * |
940 | 940 | */ |
941 | 941 | LIB3270_EXPORT int lib3270_get_is_protected(H3270 *hSession, int baddr0); |
942 | 942 | |
943 | + /** | |
944 | + * Get Check if the screen position is protected. | |
945 | + * | |
946 | + * @param h Session Handle. | |
947 | + * @param row Desired row. | |
948 | + * @param col Desired col. | |
949 | + * | |
950 | + */ | |
951 | + LIB3270_EXPORT int lib3270_get_is_protected_at(H3270 *h, int row, int col); | |
943 | 952 | |
944 | 953 | /** |
945 | 954 | * Get address of the first blank. |
... | ... | @@ -1017,6 +1026,7 @@ |
1017 | 1026 | LIB3270_EXPORT int lib3270_get_model_number(H3270 *hSession); |
1018 | 1027 | |
1019 | 1028 | LIB3270_EXPORT int lib3270_is_protected(H3270 *h, unsigned int baddr); |
1029 | + LIB3270_EXPORT int lib3270_is_protected_at(H3270 *h, unsigned int row, unsigned int col); | |
1020 | 1030 | |
1021 | 1031 | /** |
1022 | 1032 | * Alloc/Realloc memory buffer. | ... | ... |
src/include/pw3270/class.h
... | ... | @@ -220,7 +220,9 @@ |
220 | 220 | virtual int get_field_start(int baddr = -1) = 0; |
221 | 221 | virtual int get_field_len(int baddr = -1) = 0; |
222 | 222 | virtual int get_next_unprotected(int baddr = -1) = 0; |
223 | + | |
223 | 224 | virtual int get_is_protected(int baddr = -1) = 0; |
225 | + virtual int get_is_protected_at(int row, int col) = 0; | |
224 | 226 | |
225 | 227 | // Clipboard management |
226 | 228 | virtual int set_copy(const char *text); | ... | ... |
src/java/plugin.cc
... | ... | @@ -238,6 +238,10 @@ |
238 | 238 | return lib3270_is_protected(hSession,baddr); |
239 | 239 | } |
240 | 240 | |
241 | + int get_is_protected_at(int row, int col) { | |
242 | + return lib3270_is_protected_at(hSession,row,col); | |
243 | + } | |
244 | + | |
241 | 245 | int set_copy(const char *text) { |
242 | 246 | v3270_set_copy(GTK_WIDGET(lib3270_get_user_data(hSession)),text); |
243 | 247 | return 0; | ... | ... |
src/lib3270/ctlr.c
... | ... | @@ -612,6 +612,11 @@ LIB3270_EXPORT int lib3270_get_next_unprotected(H3270 *hSession, int baddr0) |
612 | 612 | return 0; |
613 | 613 | } |
614 | 614 | |
615 | +LIB3270_EXPORT int lib3270_get_is_protected_at(H3270 *h, int row, int col) { | |
616 | + CHECK_SESSION_HANDLE(h); | |
617 | + return lib3270_get_is_protected(h, ((row-1) * h->cols) + (col-1)); | |
618 | +} | |
619 | + | |
615 | 620 | LIB3270_EXPORT int lib3270_get_is_protected(H3270 *hSession, int baddr) |
616 | 621 | { |
617 | 622 | CHECK_SESSION_HANDLE(hSession); |
... | ... | @@ -621,7 +626,7 @@ LIB3270_EXPORT int lib3270_get_is_protected(H3270 *hSession, int baddr) |
621 | 626 | |
622 | 627 | int faddr = find_field_attribute(hSession,baddr); |
623 | 628 | |
624 | - return FA_IS_PROTECTED(hSession->ea_buf[faddr].fa); | |
629 | + return FA_IS_PROTECTED(hSession->ea_buf[faddr].fa) ? 1 : 0; | |
625 | 630 | } |
626 | 631 | |
627 | 632 | ... | ... |
src/plugins/rx3270/pluginmain.cc
... | ... | @@ -127,6 +127,7 @@ |
127 | 127 | int get_field_len(int baddr = -1); |
128 | 128 | int get_next_unprotected(int baddr = -1); |
129 | 129 | int get_is_protected(int baddr = -1); |
130 | + int get_is_protected_at(int row, int col); | |
130 | 131 | |
131 | 132 | int set_copy(const char *text); |
132 | 133 | string get_copy(void); |
... | ... | @@ -726,6 +727,16 @@ extern "C" |
726 | 727 | return lib3270_get_next_unprotected(hSession,baddr); |
727 | 728 | } |
728 | 729 | |
730 | + int plugin::get_is_protected(int baddr) | |
731 | + { | |
732 | + return lib3270_get_is_protected(hSession,baddr); | |
733 | + } | |
734 | + | |
735 | + int plugin::get_is_protected_at(int row, int col) | |
736 | + { | |
737 | + return lib3270_get_is_protected_at(hSession,row,col); | |
738 | + } | |
739 | + | |
729 | 740 | int plugin::popup_dialog(LIB3270_NOTIFY id , const char *title, const char *message, const char *fmt, ...) |
730 | 741 | { |
731 | 742 | va_list args; | ... | ... |
src/plugins/rx3270/rexx_methods.cc
... | ... | @@ -467,6 +467,7 @@ RexxMethod2(int, rx3270_method_get_next_unprotected, CSELF, sessionPtr, OPTIONAL |
467 | 467 | |
468 | 468 | RexxMethod2(int, rx3270_method_get_is_protected, CSELF, sessionPtr, OPTIONAL_int, baddr) |
469 | 469 | { |
470 | + | |
470 | 471 | session *hSession = (session *) sessionPtr; |
471 | 472 | if(!hSession) |
472 | 473 | return -1; |
... | ... | @@ -474,6 +475,17 @@ RexxMethod2(int, rx3270_method_get_is_protected, CSELF, sessionPtr, OPTIONAL_int |
474 | 475 | return hSession->get_is_protected(baddr); |
475 | 476 | } |
476 | 477 | |
478 | +RexxMethod3(int, rx3270_method_get_is_protected_at, CSELF, sessionPtr, int, row, int, col) | |
479 | +{ | |
480 | + | |
481 | + session *hSession = (session *) sessionPtr; | |
482 | + if(!hSession) | |
483 | + return -1; | |
484 | + | |
485 | + return hSession->get_is_protected_at(row,col); | |
486 | +} | |
487 | + | |
488 | + | |
477 | 489 | RexxMethod1(RexxStringObject, rx3270_method_get_selection, CSELF, sessionPtr) |
478 | 490 | { |
479 | 491 | try | ... | ... |
src/plugins/rx3270/rx3270.cls
... | ... | @@ -83,6 +83,7 @@ |
83 | 83 | ::METHOD GETFIELDLEN EXTERNAL "LIBRARY rx3270 rx3270_method_get_field_len" |
84 | 84 | ::METHOD GETNEXTUNPROTECTED EXTERNAL "LIBRARY rx3270 rx3270_method_get_next_unprotected" |
85 | 85 | ::METHOD GETISPROTECTED EXTERNAL "LIBRARY rx3270 rx3270_method_get_is_protected" |
86 | +::METHOD GETISPROTECTEDAT EXTERNAL "LIBRARY rx3270 rx3270_method_get_is_protected_at" | |
86 | 87 | |
87 | 88 | ::METHOD GETSELECTION EXTERNAL "LIBRARY rx3270 rx3270_method_get_selection" |
88 | 89 | ::METHOD SETSELECTION EXTERNAL "LIBRARY rx3270 rx3270_method_set_selection" | ... | ... |
src/plugins/rx3270/rx3270.h
... | ... | @@ -91,6 +91,9 @@ |
91 | 91 | REXX_TYPED_ROUTINE_PROTOTYPE(rx3270EraseEOL); |
92 | 92 | REXX_TYPED_ROUTINE_PROTOTYPE(rx3270EraseInput); |
93 | 93 | |
94 | + REXX_TYPED_ROUTINE_PROTOTYPE(rx3270IsProtected); | |
95 | + REXX_TYPED_ROUTINE_PROTOTYPE(rx3270IsProtectedAt); | |
96 | + | |
94 | 97 | REXX_METHOD_PROTOTYPE(rx3270_method_version); |
95 | 98 | REXX_METHOD_PROTOTYPE(rx3270_method_revision); |
96 | 99 | REXX_METHOD_PROTOTYPE(rx3270_method_init); |
... | ... | @@ -125,6 +128,7 @@ |
125 | 128 | REXX_METHOD_PROTOTYPE(rx3270_method_get_field_start); |
126 | 129 | REXX_METHOD_PROTOTYPE(rx3270_method_get_next_unprotected); |
127 | 130 | REXX_METHOD_PROTOTYPE(rx3270_method_get_is_protected); |
131 | + REXX_METHOD_PROTOTYPE(rx3270_method_get_is_protected_at); | |
128 | 132 | REXX_METHOD_PROTOTYPE(rx3270_method_get_selection); |
129 | 133 | REXX_METHOD_PROTOTYPE(rx3270_method_set_selection); |
130 | 134 | REXX_METHOD_PROTOTYPE(rx3270_method_get_clipboard); | ... | ... |
src/plugins/rx3270/rxapimain.cc
... | ... | @@ -119,12 +119,14 @@ RexxRoutineEntry rx3270_functions[] = |
119 | 119 | REXX_TYPED_ROUTINE(rx3270EraseEOL, rx3270EraseEOL), |
120 | 120 | REXX_TYPED_ROUTINE(rx3270EraseInput, rx3270EraseInput), |
121 | 121 | |
122 | + REXX_TYPED_ROUTINE(rx3270Erase, rx3270IsProtected), | |
123 | + REXX_TYPED_ROUTINE(rx3270Erase, rx3270IsProtectedAt), | |
124 | + | |
122 | 125 | REXX_TYPED_ROUTINE(ebc2asc, ebc2asc), |
123 | 126 | REXX_TYPED_ROUTINE(asc2ebc, asc2ebc), |
124 | 127 | |
125 | 128 | |
126 | 129 | // rx3270Popup |
127 | - | |
128 | 130 | REXX_LAST_METHOD() |
129 | 131 | }; |
130 | 132 | |
... | ... | @@ -164,11 +166,20 @@ RexxMethodEntry rx3270_methods[] = |
164 | 166 | REXX_METHOD(rx3270_method_get_field_len, rx3270_method_get_field_len ), |
165 | 167 | REXX_METHOD(rx3270_method_get_field_start, rx3270_method_get_field_start ), |
166 | 168 | REXX_METHOD(rx3270_method_get_next_unprotected, rx3270_method_get_next_unprotected ), |
169 | + | |
170 | + REXX_METHOD(rx3270_method_get_is_protected, rx3270_method_get_is_protected ), | |
171 | + REXX_METHOD(rx3270_method_get_is_protected_at, rx3270_method_get_is_protected_at ), | |
172 | + | |
167 | 173 | REXX_METHOD(rx3270_method_get_selection, rx3270_method_get_selection ), |
168 | 174 | REXX_METHOD(rx3270_method_set_selection, rx3270_method_set_selection ), |
169 | 175 | REXX_METHOD(rx3270_method_get_clipboard, rx3270_method_get_clipboard ), |
170 | 176 | REXX_METHOD(rx3270_method_set_clipboard, rx3270_method_set_clipboard ), |
171 | 177 | |
178 | + REXX_METHOD(rx3270_method_erase, rx3270_method_erase ), | |
179 | + REXX_METHOD(rx3270_method_erase_eof, rx3270_method_erase_eof ), | |
180 | + REXX_METHOD(rx3270_method_erase_eol, rx3270_method_erase_eol ), | |
181 | + REXX_METHOD(rx3270_method_erase_input, rx3270_method_erase_input ), | |
182 | + | |
172 | 183 | REXX_METHOD(rx3270_method_popup, rx3270_method_popup ), |
173 | 184 | REXX_METHOD(rx3270_method_get_filename, rx3270_method_get_filename ), |
174 | 185 | ... | ... |
src/plugins/rx3270/typed_routines.cc
... | ... | @@ -279,3 +279,30 @@ RexxRoutine2(RexxStringObject, ebc2asc, CSTRING, str, OPTIONAL_int, sz) |
279 | 279 | return context->String(""); |
280 | 280 | } |
281 | 281 | |
282 | +RexxRoutine1(int, rx3270IsProtected, int, baddr) | |
283 | +{ | |
284 | + try | |
285 | + { | |
286 | + return session::get_default()->get_is_protected(baddr); | |
287 | + } | |
288 | + catch(std::exception &e) | |
289 | + { | |
290 | + context->RaiseException1(Rexx_Error_Application_error,context->NewStringFromAsciiz(e.what())); | |
291 | + } | |
292 | + | |
293 | + return -1; | |
294 | +} | |
295 | + | |
296 | +RexxRoutine2(int, rx3270IsProtectedAt, int, row, int, col) | |
297 | +{ | |
298 | + try | |
299 | + { | |
300 | + return session::get_default()->get_is_protected_at(row,col); | |
301 | + } | |
302 | + catch(std::exception &e) | |
303 | + { | |
304 | + context->RaiseException1(Rexx_Error_Application_error,context->NewStringFromAsciiz(e.what())); | |
305 | + } | |
306 | + | |
307 | + return -1; | |
308 | +} | ... | ... |