Commit 2f61dc6f0029038684306d2efaa7f0229e5c7272
1 parent
20153f18
Exists in
master
and in
5 other branches
Implementando método is protected
Showing
10 changed files
with
65 additions
and
108 deletions
Show diff stats
src/classlib/local.cc
... | ... | @@ -146,6 +146,7 @@ |
146 | 146 | int (*_get_cursor_addr)(H3270 *h); |
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 | + int (*_get_is_protected)(H3270 *hSession, int baddr); | |
149 | 150 | void (*_popup_va)(H3270 *session, LIB3270_NOTIFY id , const char *title, const char *message, const char *fmt, va_list); |
150 | 151 | void * (*_free)(void *); |
151 | 152 | const char * (*_get_display_charset)(H3270 *hSession); |
... | ... | @@ -204,6 +205,7 @@ |
204 | 205 | { (void **) & _get_cursor_addr, "lib3270_get_cursor_address" }, |
205 | 206 | { (void **) & _emulate_input, "lib3270_emulate_input" }, |
206 | 207 | { (void **) & _get_next_unprotected, "lib3270_get_next_unprotected" }, |
208 | + { (void **) & _get_is_protected, "lib3270_get_is_protected" }, | |
207 | 209 | { (void **) & _popup_va, "lib3270_popup_va" }, |
208 | 210 | { (void **) & _free, "lib3270_free" }, |
209 | 211 | { (void **) & _get_display_charset, "lib3270_get_display_charset" }, |
... | ... | @@ -394,6 +396,11 @@ |
394 | 396 | return _get_next_unprotected(hSession,baddr); |
395 | 397 | } |
396 | 398 | |
399 | + int get_is_protected(int baddr) | |
400 | + { | |
401 | + return _get_is_protected(hSession,baddr); | |
402 | + } | |
403 | + | |
397 | 404 | int popup_dialog(LIB3270_NOTIFY id , const char *title, const char *message, const char *fmt, ...) |
398 | 405 | { |
399 | 406 | va_list args; | ... | ... |
src/classlib/remote.cc
... | ... | @@ -1228,6 +1228,36 @@ |
1228 | 1228 | |
1229 | 1229 | } |
1230 | 1230 | |
1231 | + int get_is_protected(int baddr) | |
1232 | + { | |
1233 | +#if defined(WIN32) | |
1234 | + | |
1235 | + struct hllapi_packet_addr query = { HLLAPI_PACKET_IS_PROTECTED, (unsigned short) baddr }; | |
1236 | + | |
1237 | + return query_intval((void *) &query, sizeof(query)); | |
1238 | + | |
1239 | +#elif defined(HAVE_DBUS) | |
1240 | + | |
1241 | + dbus_int32_t k = (dbus_int32_t) baddr; | |
1242 | + | |
1243 | + DBusMessage * msg = create_message("getIsProtected"); | |
1244 | + if(msg) | |
1245 | + { | |
1246 | + dbus_message_append_args(msg, DBUS_TYPE_INT32, &k, DBUS_TYPE_INVALID); | |
1247 | + return get_intval(call(msg)); | |
1248 | + } | |
1249 | + | |
1250 | + return -1; | |
1251 | + | |
1252 | +#else | |
1253 | + | |
1254 | + return -1; | |
1255 | + | |
1256 | +#endif | |
1257 | + | |
1258 | + } | |
1259 | + | |
1260 | + | |
1231 | 1261 | int set_host_charset(const char *charset) |
1232 | 1262 | { |
1233 | 1263 | #if defined(WIN32) | ... | ... |
src/include/pw3270/class.h
... | ... | @@ -220,6 +220,7 @@ |
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 | + virtual int get_is_protected(int baddr = -1) = 0; | |
223 | 224 | |
224 | 225 | // Clipboard management |
225 | 226 | virtual int set_copy(const char *text); | ... | ... |
src/include/pw3270/ipcpackets.h
src/java/plugin.cc
... | ... | @@ -234,6 +234,10 @@ |
234 | 234 | return lib3270_get_next_unprotected(hSession,baddr); |
235 | 235 | } |
236 | 236 | |
237 | + int get_is_protected(int baddr = -1) { | |
238 | + return lib3270_is_protected(hSession,baddr); | |
239 | + } | |
240 | + | |
237 | 241 | int set_copy(const char *text) { |
238 | 242 | v3270_set_copy(GTK_WIDGET(lib3270_get_user_data(hSession)),text); |
239 | 243 | return 0; | ... | ... |
src/java/terminal.java
... | ... | @@ -306,6 +306,16 @@ public class terminal |
306 | 306 | public native int get_next_unprotected(int baddr); |
307 | 307 | |
308 | 308 | /** |
309 | + * Check if the address is protected. | |
310 | + * | |
311 | + * @param baddr Field address. | |
312 | + * | |
313 | + * @return Protect state. | |
314 | + * | |
315 | + */ | |
316 | + public native int get_is_protected(int baddr); | |
317 | + | |
318 | + /** | |
309 | 319 | * Get next field address. |
310 | 320 | * |
311 | 321 | * @return Address of the next field. | ... | ... |
src/plugins/rx3270/pluginmain.cc
src/plugins/rx3270/rexx_methods.cc
... | ... | @@ -465,6 +465,15 @@ RexxMethod2(int, rx3270_method_get_next_unprotected, CSELF, sessionPtr, OPTIONAL |
465 | 465 | return baddr; |
466 | 466 | } |
467 | 467 | |
468 | +RexxMethod2(int, rx3270_method_get_is_protected, CSELF, sessionPtr, OPTIONAL_int, baddr) | |
469 | +{ | |
470 | + session *hSession = (session *) sessionPtr; | |
471 | + if(!hSession) | |
472 | + return -1; | |
473 | + | |
474 | + return hSession->get_is_protected(baddr); | |
475 | +} | |
476 | + | |
468 | 477 | RexxMethod1(RexxStringObject, rx3270_method_get_selection, CSELF, sessionPtr) |
469 | 478 | { |
470 | 479 | try | ... | ... |
src/plugins/rx3270/rx3270.cls
... | ... | @@ -82,6 +82,7 @@ |
82 | 82 | ::METHOD GETFIELDSTART EXTERNAL "LIBRARY rx3270 rx3270_method_get_field_start" |
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 | +::METHOD GETISPROTECTED EXTERNAL "LIBRARY rx3270 rx3270_method_get_is_protected" | |
85 | 86 | |
86 | 87 | ::METHOD GETSELECTION EXTERNAL "LIBRARY rx3270 rx3270_method_get_selection" |
87 | 88 | ::METHOD SETSELECTION EXTERNAL "LIBRARY rx3270 rx3270_method_set_selection" | ... | ... |
src/plugins/rx3270/rx3270.h
... | ... | @@ -124,6 +124,7 @@ |
124 | 124 | REXX_METHOD_PROTOTYPE(rx3270_method_get_field_len); |
125 | 125 | REXX_METHOD_PROTOTYPE(rx3270_method_get_field_start); |
126 | 126 | REXX_METHOD_PROTOTYPE(rx3270_method_get_next_unprotected); |
127 | + REXX_METHOD_PROTOTYPE(rx3270_method_get_is_protected); | |
127 | 128 | REXX_METHOD_PROTOTYPE(rx3270_method_get_selection); |
128 | 129 | REXX_METHOD_PROTOTYPE(rx3270_method_set_selection); |
129 | 130 | REXX_METHOD_PROTOTYPE(rx3270_method_get_clipboard); |
... | ... | @@ -141,114 +142,6 @@ |
141 | 142 | |
142 | 143 | /*--[ 3270 Session ]-----------------------------------------------------------------------------------------*/ |
143 | 144 | |
144 | -/* | |
145 | -#if defined (HAVE_GNUC_VISIBILITY) | |
146 | - class __attribute__((visibility("default"))) rx3270 | |
147 | -#elif defined(WIN32) | |
148 | - class __declspec (dllexport) rx3270 | |
149 | -#else | |
150 | - #error NOT_IMPLEMENTED | |
151 | -#endif | |
152 | - { | |
153 | - | |
154 | - protected: | |
155 | -#ifdef HAVE_ICONV | |
156 | - iconv_t conv2Local; | |
157 | - iconv_t conv2Host; | |
158 | -#endif | |
159 | - | |
160 | - public: | |
161 | - | |
162 | - class exception : public std::exception | |
163 | - { | |
164 | - public: | |
165 | - exception(int code, const char *fmt, ...); | |
166 | - exception(const char *fmt, ...); | |
167 | - | |
168 | - const char * getMessage(void); | |
169 | - void logMessage(void); | |
170 | - | |
171 | - void RaiseException(RexxMethodContext *context); | |
172 | - void RaiseException(RexxCallContext *context); | |
173 | - | |
174 | - virtual const char * what() const throw(); | |
175 | - | |
176 | - private: | |
177 | - int code; | |
178 | - char msg[4096]; | |
179 | - | |
180 | - }; | |
181 | - | |
182 | - rx3270(const char *local = REXX_DEFAULT_CHARSET, const char *remote = "ISO-8859-1"); | |
183 | - | |
184 | - virtual ~rx3270(); | |
185 | - | |
186 | - virtual void free(void *ptr); | |
187 | - | |
188 | - | |
189 | - static rx3270 * create(const char *name = NULL); | |
190 | - static rx3270 * create_remote(const char *name); | |
191 | - static rx3270 * create_local(void); | |
192 | - static rx3270 * get_default(void); | |
193 | - | |
194 | - static void set_plugin(rx3270 * (*factory)(const char *name)); | |
195 | - | |
196 | - char * get_3270_string(const char *str); | |
197 | - char * get_local_string(const char *str); | |
198 | - | |
199 | - void log(const char *fmt, ...); | |
200 | - virtual void logva(const char *fmt, va_list arg); | |
201 | - | |
202 | - virtual char * get_version(void); | |
203 | - virtual char * get_revision(void); | |
204 | - virtual LIB3270_CSTATE get_cstate(void) = 0; | |
205 | - | |
206 | - virtual int connect(const char *uri, bool wait = true) = 0; | |
207 | - virtual int disconnect(void) = 0; | |
208 | - virtual bool is_connected(void) = 0; | |
209 | - virtual bool is_ready(void) = 0; | |
210 | - virtual int iterate(bool wait = true) = 0; | |
211 | - virtual int wait(int seconds) = 0; | |
212 | - virtual int wait_for_ready(int seconds) = 0; | |
213 | - virtual int wait_for_text_at(int row, int col, const char *key, int timeout); | |
214 | - | |
215 | - virtual int set_cursor_position(int row, int col) = 0; | |
216 | - virtual int set_cursor_addr(int addr) = 0; | |
217 | - virtual int get_cursor_addr(void) = 0; | |
218 | - | |
219 | - virtual int set_toggle(LIB3270_TOGGLE ix, bool value) = 0; | |
220 | - | |
221 | - virtual int enter(void) = 0; | |
222 | - virtual int pfkey(int key) = 0; | |
223 | - virtual int pakey(int key) = 0; | |
224 | - | |
225 | - virtual char * get_text_at(int row, int col, size_t sz) = 0; | |
226 | - virtual char * get_text(int baddr, size_t len) = 0; | |
227 | - virtual int cmp_text_at(int row, int col, const char *text) = 0; | |
228 | - virtual int set_text_at(int row, int col, const char *str) = 0; | |
229 | - virtual int emulate_input(const char *str) = 0; | |
230 | - | |
231 | - virtual int get_field_start(int baddr = -1) = 0; | |
232 | - virtual int get_field_len(int baddr = -1) = 0; | |
233 | - virtual int get_next_unprotected(int baddr = -1) = 0; | |
234 | - | |
235 | - virtual int set_copy(const char *text); | |
236 | - virtual char * get_copy(void); | |
237 | - | |
238 | - virtual char * get_clipboard(void); | |
239 | - virtual int set_clipboard(const char *text); | |
240 | - | |
241 | - virtual int quit(void) = 0; | |
242 | - | |
243 | - // Dialogs | |
244 | - virtual int popup_dialog(LIB3270_NOTIFY id , const char *title, const char *message, const char *fmt, ...); | |
245 | - virtual char * file_chooser_dialog(GtkFileChooserAction action, const char *title, const char *extension, const char *filename); | |
246 | - | |
247 | - }; | |
248 | - | |
249 | - rx3270 * create_lib3270_instance(void); | |
250 | -*/ | |
251 | - | |
252 | 145 | #ifdef __cplusplus |
253 | 146 | extern "C" { |
254 | 147 | #endif | ... | ... |