Commit c4c5be520eebf89f8abee6a9e566f9f9941e35e8

Authored by Perry Werneck
1 parent 63f527a7

Fixing auto unlock when cursor moves.

src/include/kybdc.h
@@ -12,15 +12,51 @@ @@ -12,15 +12,51 @@
12 * for more details. 12 * for more details.
13 */ 13 */
14 14
15 -/*  
16 - * kybdc.h  
17 - * Global declarations for kybd.c. 15 +/**
  16 + * @brief Global declarations for kybd.c.
18 */ 17 */
19 18
20 #ifndef KYBDC_H_INCLUDED 19 #ifndef KYBDC_H_INCLUDED
21 20
22 #define KYBDC_H_INCLUDED 21 #define KYBDC_H_INCLUDED
23 22
  23 + /// @brief Element in typeahead queue.
  24 + struct ta
  25 + {
  26 + struct ta *next;
  27 +
  28 + enum _ta_type
  29 + {
  30 + TA_TYPE_DEFAULT,
  31 + TA_TYPE_KEY_AID,
  32 + TA_TYPE_ACTION,
  33 + TA_TYPE_CURSOR_MOVE,
  34 + TA_TYPE_USER
  35 + } type;
  36 +
  37 + union
  38 + {
  39 + unsigned char aid_code;
  40 + struct
  41 + {
  42 + void (*fn)(H3270 *, const char *, const char *);
  43 + char *parm[2];
  44 + } def;
  45 +
  46 + int (*action)(H3270 *);
  47 +
  48 + struct
  49 + {
  50 + LIB3270_DIRECTION direction;
  51 + unsigned char sel;
  52 + int (*fn)(H3270 *, LIB3270_DIRECTION, unsigned char);
  53 + } move;
  54 +
  55 + } args;
  56 +
  57 + };
  58 +
  59 +
24 /* keyboard lock states */ 60 /* keyboard lock states */
25 typedef enum lib3270_kl_state 61 typedef enum lib3270_kl_state
26 { 62 {
@@ -54,26 +90,25 @@ @@ -54,26 +90,25 @@
54 #define KL_SCROLLED LIB3270_KL_SCROLLED 90 #define KL_SCROLLED LIB3270_KL_SCROLLED
55 #define KL_OIA_MINUS LIB3270_KL_OIA_MINUS 91 #define KL_OIA_MINUS LIB3270_KL_OIA_MINUS
56 92
57 - 93 + #define KYBDLOCK_IS_OERR(hSession) (hSession->kybdlock && !(hSession->kybdlock & ~KL_OERR_MASK))
58 94
59 /* other functions */ 95 /* other functions */
60 LIB3270_INTERNAL void add_xk(KeySym key, KeySym assoc); 96 LIB3270_INTERNAL void add_xk(KeySym key, KeySym assoc);
61 LIB3270_INTERNAL void clear_xks(void); 97 LIB3270_INTERNAL void clear_xks(void);
62 LIB3270_INTERNAL void do_reset(H3270 *session, Boolean explicit); 98 LIB3270_INTERNAL void do_reset(H3270 *session, Boolean explicit);
63 -// LIB3270_INTERNAL void hex_input(char *s);  
64 99
65 -// #define kybdlock_clr(session, bits, cause) lib3270_kybdlock_clear(session, bits)  
66 LIB3270_INTERNAL void lib3270_kybdlock_clear(H3270 *hSession, LIB3270_KL_STATE bits); 100 LIB3270_INTERNAL void lib3270_kybdlock_clear(H3270 *hSession, LIB3270_KL_STATE bits);
67 101
68 102
69 LIB3270_INTERNAL void kybd_inhibit(H3270 *session, Boolean inhibit); 103 LIB3270_INTERNAL void kybd_inhibit(H3270 *session, Boolean inhibit);
70 -// LIB3270_INTERNAL void kybd_init(void);  
71 LIB3270_INTERNAL int kybd_prime(H3270 *hSession); 104 LIB3270_INTERNAL int kybd_prime(H3270 *hSession);
72 LIB3270_INTERNAL void kybd_scroll_lock(Boolean lock); 105 LIB3270_INTERNAL void kybd_scroll_lock(Boolean lock);
73 - LIB3270_INTERNAL int run_ta(H3270 *hSession);  
74 -// LIB3270_INTERNAL int state_from_keymap(char keymap[32]);  
75 LIB3270_INTERNAL void kybd_connect(H3270 *session, int connected, void *dunno); 106 LIB3270_INTERNAL void kybd_connect(H3270 *session, int connected, void *dunno);
76 LIB3270_INTERNAL void kybd_in3270(H3270 *session, int in3270, void *dunno); 107 LIB3270_INTERNAL void kybd_in3270(H3270 *session, int in3270, void *dunno);
77 108
  109 + LIB3270_INTERNAL int run_ta(H3270 *hSession);
  110 + LIB3270_INTERNAL struct ta * new_ta(H3270 *hSession, enum _ta_type type);
  111 + LIB3270_INTERNAL void enq_action(H3270 *hSession, int (*fn)(H3270 *));
  112 +
78 113
79 #endif /* KYBDC_H_INCLUDED */ 114 #endif /* KYBDC_H_INCLUDED */
src/include/lib3270.h
@@ -177,6 +177,8 @@ @@ -177,6 +177,8 @@
177 177
178 LIB3270_DIR_END, 178 LIB3270_DIR_END,
179 179
  180 + LIB3270_DIR_COUNT /**< @brief Nº máximo de direções. */
  181 +
180 } LIB3270_DIRECTION; 182 } LIB3270_DIRECTION;
181 183
182 /** 184 /**
src/lib3270/cursor.c 0 → 100644
@@ -0,0 +1,299 @@ @@ -0,0 +1,299 @@
  1 +/*
  2 + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270
  3 + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a
  4 + * aplicativos mainframe. Registro no INPI sob o nome G3270. Registro no INPI sob o nome G3270.
  5 + *
  6 + * Copyright (C) <2008> <Banco do Brasil S.A.>
  7 + *
  8 + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
  9 + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
  10 + * Free Software Foundation.
  11 + *
  12 + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
  13 + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
  14 + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
  15 + * obter mais detalhes.
  16 + *
  17 + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
  18 + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin
  19 + * St, Fifth Floor, Boston, MA 02110-1301 USA
  20 + *
  21 + * Este programa está nomeado como - e possui - linhas de código.
  22 + *
  23 + * Contatos:
  24 + *
  25 + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
  26 + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça)
  27 + *
  28 + */
  29 +
  30 +/**
  31 + * @brief This module handles cursor moves.
  32 + */
  33 +
  34 +
  35 +#include "private.h"
  36 +#include <lib3270/trace.h>
  37 +#include <lib3270/selection.h>
  38 +
  39 +#include "kybdc.h"
  40 +#include "ctlrc.h"
  41 +#include "ansic.h"
  42 +#include "statusc.h"
  43 +#include "3270ds.h"
  44 +
  45 +/*---[ Prototipes ]---------------------------------------------------------------------------------*/
  46 +
  47 +static int cursor_left(H3270 *hSession);
  48 +static int cursor_right(H3270 *hSession);
  49 +static int cursor_up(H3270 *hSession);
  50 +static int cursor_down(H3270 *hSession);
  51 +static int cursor_end(H3270 *hSession);
  52 +
  53 +/*---[ Globals ]------------------------------------------------------------------------------------*/
  54 +
  55 + static const struct {
  56 + int (*exec)(H3270 *hSession);
  57 + } calls[LIB3270_DIR_COUNT] = {
  58 + { cursor_up },
  59 + { cursor_down },
  60 + { cursor_left },
  61 + { cursor_right },
  62 + { cursor_end }
  63 + };
  64 +
  65 +
  66 +/*---[ Implement ]----------------------------------------------------------------------------------*/
  67 +
  68 +/**
  69 + * @brief Move cursor.
  70 + *
  71 + * @param hSession Session handle.
  72 + * @param dir Where to move.
  73 + * @param sel Non zero if it's selecting.
  74 + *
  75 + * @return 0 if ok, non zero if not (sets errno).
  76 + *
  77 + */
  78 +LIB3270_EXPORT int lib3270_move_cursor(H3270 *hSession, LIB3270_DIRECTION dir, unsigned char sel)
  79 +{
  80 + FAIL_IF_NOT_ONLINE(hSession);
  81 +
  82 + if(dir < 0 || dir >= LIB3270_DIR_COUNT)
  83 + {
  84 + return errno = EINVAL;
  85 + }
  86 +
  87 + if (hSession->kybdlock)
  88 + {
  89 + if (KYBDLOCK_IS_OERR(hSession))
  90 + {
  91 + lib3270_kybdlock_clear(hSession,KL_OERR_MASK);
  92 + status_reset(hSession);
  93 + }
  94 + else
  95 + {
  96 + struct ta *ta = new_ta(hSession, TA_TYPE_CURSOR_MOVE);
  97 +
  98 + ta->args.move.direction = dir;
  99 + ta->args.move.fn = lib3270_move_cursor;
  100 + ta->args.move.sel = sel;
  101 + return 0;
  102 + }
  103 + }
  104 +
  105 + int rc = calls[dir].exec(hSession);
  106 + if(rc)
  107 + return rc;
  108 +
  109 + if(sel)
  110 + lib3270_select_to(hSession,hSession->cursor_addr);
  111 + else if(hSession->selected && !lib3270_get_toggle(hSession,LIB3270_TOGGLE_KEEP_SELECTED))
  112 + lib3270_unselect(hSession);
  113 +
  114 + return 0;
  115 +}
  116 +
  117 +LIB3270_EXPORT int lib3270_cursor_up(H3270 *hSession)
  118 +{
  119 + return lib3270_move_cursor(hSession,LIB3270_DIR_UP,0);
  120 +}
  121 +
  122 +LIB3270_EXPORT int lib3270_cursor_down(H3270 *hSession)
  123 +{
  124 + return lib3270_move_cursor(hSession,LIB3270_DIR_DOWN,0);
  125 +}
  126 +
  127 +LIB3270_EXPORT int lib3270_cursor_left(H3270 *hSession)
  128 +{
  129 + return lib3270_move_cursor(hSession,LIB3270_DIR_LEFT,0);
  130 +}
  131 +
  132 +LIB3270_EXPORT int lib3270_cursor_right(H3270 *hSession)
  133 +{
  134 + return lib3270_move_cursor(hSession,LIB3270_DIR_RIGHT,0);
  135 +}
  136 +
  137 +/**
  138 + * @brief Cursor left 1 position.
  139 + */
  140 +static void do_left(H3270 *hSession)
  141 +{
  142 + register int baddr;
  143 + enum dbcs_state d;
  144 +
  145 + baddr = hSession->cursor_addr;
  146 + DEC_BA(baddr);
  147 + d = ctlr_dbcs_state(baddr);
  148 + if (IS_LEFT(d))
  149 + DEC_BA(baddr);
  150 + cursor_move(hSession,baddr);
  151 +}
  152 +
  153 +static int cursor_left(H3270 *hSession)
  154 +{
  155 + if (hSession->kybdlock)
  156 + {
  157 + if(KYBDLOCK_IS_OERR(hSession))
  158 + {
  159 + lib3270_kybdlock_clear(hSession,KL_OERR_MASK);
  160 + status_reset(hSession);
  161 + }
  162 + else
  163 + {
  164 + enq_action(hSession, cursor_left);
  165 + return 0;
  166 + }
  167 + }
  168 +#if defined(X3270_ANSI) /*[*/
  169 + if (IN_ANSI)
  170 + {
  171 + ansi_send_left(hSession);
  172 + return 0;
  173 + }
  174 +#endif /*]*/
  175 +
  176 + if (!hSession->flipped)
  177 + {
  178 + do_left(hSession);
  179 + }
  180 + else
  181 + {
  182 + register int baddr;
  183 +
  184 + baddr = hSession->cursor_addr;
  185 + INC_BA(baddr);
  186 + /* XXX: DBCS? */
  187 + cursor_move(hSession,baddr);
  188 + }
  189 + return 0;
  190 +}
  191 +
  192 +static int cursor_right(H3270 *hSession)
  193 +{
  194 + register int baddr;
  195 + enum dbcs_state d;
  196 +
  197 + if (hSession->kybdlock)
  198 + {
  199 + if (KYBDLOCK_IS_OERR(hSession))
  200 + {
  201 + lib3270_kybdlock_clear(hSession,KL_OERR_MASK);
  202 + status_reset(hSession);
  203 + }
  204 + else
  205 + {
  206 + enq_action(hSession, cursor_right);
  207 + return 0;
  208 + }
  209 + }
  210 +#if defined(X3270_ANSI) /*[*/
  211 + if (IN_ANSI) {
  212 + ansi_send_right(hSession);
  213 + return 0;
  214 + }
  215 +#endif /*]*/
  216 + if (!hSession->flipped)
  217 + {
  218 + baddr = hSession->cursor_addr;
  219 + INC_BA(baddr);
  220 + d = ctlr_dbcs_state(baddr);
  221 + if (IS_RIGHT(d))
  222 + INC_BA(baddr);
  223 + cursor_move(hSession,baddr);
  224 + }
  225 + else
  226 + {
  227 + do_left(hSession);
  228 + }
  229 + return 0;
  230 +}
  231 +
  232 +static int cursor_up(H3270 *hSession)
  233 +{
  234 + register int baddr;
  235 +
  236 + trace("kybdlock=%d OERR=%s",(int) hSession->kybdlock, (KYBDLOCK_IS_OERR(hSession) ? "yes" : "no"));
  237 + if (hSession->kybdlock)
  238 + {
  239 + if (KYBDLOCK_IS_OERR(hSession))
  240 + {
  241 + lib3270_kybdlock_clear(hSession,KL_OERR_MASK);
  242 + status_reset(hSession);
  243 + }
  244 + else
  245 + {
  246 + enq_action(hSession, cursor_up);
  247 + return 0;
  248 + }
  249 + }
  250 +
  251 +#if defined(X3270_ANSI) /*[*/
  252 + if (IN_ANSI) {
  253 + ansi_send_up(hSession);
  254 + return 0;
  255 + }
  256 +#endif /*]*/
  257 +
  258 + baddr = hSession->cursor_addr - hSession->cols;
  259 + if (baddr < 0)
  260 + baddr = (hSession->cursor_addr + (hSession->rows * hSession->cols)) - hSession->cols;
  261 + cursor_move(hSession,baddr);
  262 + return 0;
  263 +}
  264 +
  265 +static int cursor_down(H3270 *hSession)
  266 +{
  267 + register int baddr;
  268 +
  269 + if (hSession->kybdlock)
  270 + {
  271 + if (KYBDLOCK_IS_OERR(hSession))
  272 + {
  273 + lib3270_kybdlock_clear(hSession,KL_OERR_MASK);
  274 + status_reset(hSession);
  275 + } else
  276 + {
  277 + enq_action(hSession, cursor_down);
  278 +// enq_ta(Down_action, CN, CN);
  279 + return 0;
  280 + }
  281 + }
  282 +#if defined(X3270_ANSI) /*[*/
  283 + if (IN_ANSI)
  284 + {
  285 + ansi_send_down(hSession);
  286 + return 0;
  287 + }
  288 +#endif /*]*/
  289 + baddr = (hSession->cursor_addr + hSession->cols) % (hSession->cols * hSession->rows);
  290 + cursor_move(hSession,baddr);
  291 + return 0;
  292 +}
  293 +
  294 +static int cursor_end(H3270 *hSession)
  295 +{
  296 + cursor_move(hSession,lib3270_get_field_end(hSession,hSession->cursor_addr));
  297 + return 0;
  298 +}
  299 +
src/lib3270/kybd.c
@@ -66,7 +66,6 @@ struct ta; @@ -66,7 +66,6 @@ struct ta;
66 #include "hostc.h" 66 #include "hostc.h"
67 #include "kybdc.h" 67 #include "kybdc.h"
68 #include "popupsc.h" 68 #include "popupsc.h"
69 -// #include "printc.h"  
70 #include "screenc.h" 69 #include "screenc.h"
71 #include "screen.h" 70 #include "screen.h"
72 #include "statusc.h" 71 #include "statusc.h"
@@ -132,83 +131,8 @@ struct akeysym @@ -132,83 +131,8 @@ struct akeysym
132 ((k1).keytype == (k2).keytype)) 131 ((k1).keytype == (k2).keytype))
133 132
134 133
135 -struct ta  
136 -{  
137 - struct ta *next;  
138 -  
139 - enum _ta_type  
140 - {  
141 - TA_TYPE_DEFAULT,  
142 - TA_TYPE_KEY_AID,  
143 - TA_TYPE_ACTION,  
144 - TA_TYPE_CURSOR_MOVE,  
145 - TA_TYPE_USER  
146 - } type;  
147 -  
148 - union  
149 - {  
150 - unsigned char aid_code;  
151 - struct  
152 - {  
153 - void (*fn)(H3270 *, const char *, const char *);  
154 - char *parm[2];  
155 - } def;  
156 -  
157 - int (*action)(H3270 *);  
158 -  
159 - struct  
160 - {  
161 - LIB3270_DIRECTION direction;  
162 - unsigned char sel;  
163 - int (*fn)(H3270 *, LIB3270_DIRECTION, unsigned char);  
164 - } move;  
165 -  
166 - } args;  
167 -  
168 -};  
169 -  
170 static const char dxl[] = "0123456789abcdef"; 134 static const char dxl[] = "0123456789abcdef";
171 #define FROM_HEX(c) (strchr(dxl, tolower(c)) - dxl) 135 #define FROM_HEX(c) (strchr(dxl, tolower(c)) - dxl)
172 -#define KYBDLOCK_IS_OERR(hSession) (hSession->kybdlock && !(hSession->kybdlock & ~KL_OERR_MASK))  
173 -  
174 -/*  
175 - * Check if the typeahead queue is available  
176 - */ /*  
177 -static int enq_chk(H3270 *hSession)  
178 -{  
179 - // If no connection, forget it.  
180 - if (!lib3270_connected(hSession))  
181 - {  
182 - lib3270_trace_event(hSession," dropped (not connected)\n");  
183 - return -1;  
184 - }  
185 -  
186 - // If operator error, complain and drop it.  
187 - if (hSession->kybdlock & KL_OERR_MASK)  
188 - {  
189 - lib3270_ring_bell(hSession);  
190 - lib3270_trace_event(hSession," dropped (operator error)\n");  
191 - return -1;  
192 - }  
193 -  
194 - // If scroll lock, complain and drop it.  
195 - if (hSession->kybdlock & KL_SCROLLED)  
196 - {  
197 - lib3270_ring_bell(hSession);  
198 - lib3270_trace_event(hSession," dropped (scrolled)\n");  
199 - return -1;  
200 - }  
201 -  
202 - // If typeahead disabled, complain and drop it.  
203 - if (!hSession->typeahead)  
204 - {  
205 - lib3270_trace_event(hSession," dropped (no typeahead)\n");  
206 - return -1;  
207 - }  
208 -  
209 - return 0;  
210 -}  
211 -*/  
212 136
213 /** 137 /**
214 * @brief Create a new typeahead action. 138 * @brief Create a new typeahead action.
@@ -217,7 +141,7 @@ static int enq_chk(H3270 *hSession) @@ -217,7 +141,7 @@ static int enq_chk(H3270 *hSession)
217 * 141 *
218 * @return new typeahead struct or NULL if it's not available. 142 * @return new typeahead struct or NULL if it's not available.
219 */ 143 */
220 -static struct ta * new_ta(H3270 *hSession, enum _ta_type type) 144 +struct ta * new_ta(H3270 *hSession, enum _ta_type type)
221 { 145 {
222 struct ta *ta; 146 struct ta *ta;
223 147
@@ -313,7 +237,7 @@ static void enq_ta(H3270 *hSession, void (*fn)(H3270 *, const char *, const char @@ -313,7 +237,7 @@ static void enq_ta(H3270 *hSession, void (*fn)(H3270 *, const char *, const char
313 lib3270_trace_event(hSession,"typeahead action queued (kybdlock 0x%x)\n", hSession->kybdlock); 237 lib3270_trace_event(hSession,"typeahead action queued (kybdlock 0x%x)\n", hSession->kybdlock);
314 } 238 }
315 239
316 -static void enq_action(H3270 *hSession, int (*fn)(H3270 *)) 240 +void enq_action(H3270 *hSession, int (*fn)(H3270 *))
317 { 241 {
318 struct ta *ta = new_ta(hSession, TA_TYPE_ACTION); 242 struct ta *ta = new_ta(hSession, TA_TYPE_ACTION);
319 243
@@ -1298,47 +1222,6 @@ static void do_left(H3270 *hSession) @@ -1298,47 +1222,6 @@ static void do_left(H3270 *hSession)
1298 cursor_move(hSession,baddr); 1222 cursor_move(hSession,baddr);
1299 } 1223 }
1300 1224
1301 -LIB3270_EXPORT int lib3270_cursor_left(H3270 *hSession)  
1302 -{  
1303 - FAIL_IF_NOT_ONLINE(hSession);  
1304 -  
1305 - if (hSession->kybdlock)  
1306 - {  
1307 - if(KYBDLOCK_IS_OERR(hSession))  
1308 - {  
1309 - lib3270_kybdlock_clear(hSession,KL_OERR_MASK);  
1310 - status_reset(hSession);  
1311 - }  
1312 - else  
1313 - {  
1314 - enq_action(hSession, lib3270_cursor_left);  
1315 - return 0;  
1316 - }  
1317 - }  
1318 -#if defined(X3270_ANSI) /*[*/  
1319 - if (IN_ANSI)  
1320 - {  
1321 - ansi_send_left(hSession);  
1322 - return 0;  
1323 - }  
1324 -#endif /*]*/  
1325 -  
1326 - if (!hSession->flipped)  
1327 - {  
1328 - do_left(hSession);  
1329 - }  
1330 - else  
1331 - {  
1332 - register int baddr;  
1333 -  
1334 - baddr = hSession->cursor_addr;  
1335 - INC_BA(baddr);  
1336 - /* XXX: DBCS? */  
1337 - lib3270_set_cursor_address(hSession,baddr);  
1338 - }  
1339 - return 0;  
1340 -}  
1341 -  
1342 /** 1225 /**
1343 * @brief Delete char key. 1226 * @brief Delete char key.
1344 * 1227 *
@@ -1584,51 +1467,6 @@ int lib3270_erase(H3270 *hSession) @@ -1584,51 +1467,6 @@ int lib3270_erase(H3270 *hSession)
1584 } 1467 }
1585 1468
1586 /** 1469 /**
1587 - * @brief Cursor right 1 position.  
1588 - */  
1589 -LIB3270_EXPORT int lib3270_cursor_right(H3270 *hSession)  
1590 -{  
1591 - register int baddr;  
1592 - enum dbcs_state d;  
1593 -  
1594 - FAIL_IF_NOT_ONLINE(hSession);  
1595 -  
1596 - if (hSession->kybdlock)  
1597 - {  
1598 - if (KYBDLOCK_IS_OERR(hSession))  
1599 - {  
1600 - lib3270_kybdlock_clear(hSession,KL_OERR_MASK);  
1601 - status_reset(hSession);  
1602 - }  
1603 - else  
1604 - {  
1605 - enq_action(hSession, lib3270_cursor_right);  
1606 - return 0;  
1607 - }  
1608 - }  
1609 -#if defined(X3270_ANSI) /*[*/  
1610 - if (IN_ANSI) {  
1611 - ansi_send_right(hSession);  
1612 - return 0;  
1613 - }  
1614 -#endif /*]*/  
1615 - if (!hSession->flipped)  
1616 - {  
1617 - baddr = hSession->cursor_addr;  
1618 - INC_BA(baddr);  
1619 - d = ctlr_dbcs_state(baddr);  
1620 - if (IS_RIGHT(d))  
1621 - INC_BA(baddr);  
1622 - lib3270_set_cursor_address(hSession,baddr);  
1623 - }  
1624 - else  
1625 - {  
1626 - do_left(hSession);  
1627 - }  
1628 - return 0;  
1629 -}  
1630 -  
1631 -/**  
1632 * @brief Cursor to previous word. 1470 * @brief Cursor to previous word.
1633 */ 1471 */
1634 LIB3270_EXPORT int lib3270_previousword(H3270 *hSession) 1472 LIB3270_EXPORT int lib3270_previousword(H3270 *hSession)
@@ -1820,135 +1658,6 @@ LIB3270_EXPORT int lib3270_nextword(H3270 *hSession) @@ -1820,135 +1658,6 @@ LIB3270_EXPORT int lib3270_nextword(H3270 *hSession)
1820 } 1658 }
1821 1659
1822 /** 1660 /**
1823 - * @brief Move cursor.  
1824 - *  
1825 - * @param hSession Session handle.  
1826 - * @param dir Where to move.  
1827 - * @param sel Non zero if it's selecting.  
1828 - *  
1829 - */  
1830 -LIB3270_EXPORT int lib3270_move_cursor(H3270 *hSession, LIB3270_DIRECTION dir, unsigned char sel)  
1831 -{  
1832 - FAIL_IF_NOT_ONLINE(hSession);  
1833 -  
1834 - if (hSession->kybdlock) {  
1835 -  
1836 - struct ta *ta = new_ta(hSession, TA_TYPE_CURSOR_MOVE);  
1837 -  
1838 - ta->args.move.direction = dir;  
1839 - ta->args.move.fn = lib3270_move_cursor;  
1840 - ta->args.move.sel = sel;  
1841 -  
1842 - return 0;  
1843 - }  
1844 -  
1845 - switch(dir)  
1846 - {  
1847 - case LIB3270_DIR_UP:  
1848 - lib3270_cursor_up(hSession);  
1849 - break;  
1850 -  
1851 - case LIB3270_DIR_DOWN:  
1852 - lib3270_cursor_down(hSession);  
1853 - break;  
1854 -  
1855 - case LIB3270_DIR_LEFT:  
1856 - lib3270_cursor_left(hSession);  
1857 - break;  
1858 -  
1859 - case LIB3270_DIR_RIGHT:  
1860 - lib3270_cursor_right(hSession);  
1861 - break;  
1862 -  
1863 - case LIB3270_DIR_END:  
1864 - cursor_move(hSession,lib3270_get_field_end(hSession,hSession->cursor_addr));  
1865 - break;  
1866 -  
1867 - default:  
1868 - errno = EINVAL;  
1869 - return -1;  
1870 - }  
1871 -  
1872 - if(sel)  
1873 - lib3270_select_to(hSession,hSession->cursor_addr);  
1874 -  
1875 - return 0;  
1876 -}  
1877 -  
1878 -/**  
1879 - * @brief Cursor up 1 position.  
1880 - */  
1881 -LIB3270_EXPORT int lib3270_cursor_up(H3270 *hSession)  
1882 -{  
1883 - register int baddr;  
1884 -  
1885 - FAIL_IF_NOT_ONLINE(hSession);  
1886 -  
1887 - trace("kybdlock=%d OERR=%s",(int) hSession->kybdlock, (KYBDLOCK_IS_OERR(hSession) ? "yes" : "no"));  
1888 - if (hSession->kybdlock)  
1889 - {  
1890 - if (KYBDLOCK_IS_OERR(hSession))  
1891 - {  
1892 - lib3270_kybdlock_clear(hSession,KL_OERR_MASK);  
1893 - status_reset(hSession);  
1894 - }  
1895 - else  
1896 - {  
1897 - enq_action(hSession, lib3270_cursor_up);  
1898 - return 0;  
1899 - }  
1900 - }  
1901 -  
1902 -#if defined(X3270_ANSI) /*[*/  
1903 - if (IN_ANSI) {  
1904 - ansi_send_up(hSession);  
1905 - return 0;  
1906 - }  
1907 -#endif /*]*/  
1908 -  
1909 - baddr = hSession->cursor_addr - hSession->cols;  
1910 - if (baddr < 0)  
1911 - baddr = (hSession->cursor_addr + (hSession->rows * hSession->cols)) - hSession->cols;  
1912 - lib3270_set_cursor_address(hSession,baddr);  
1913 - return 0;  
1914 -}  
1915 -  
1916 -/**  
1917 - * @brief Cursor down 1 position.  
1918 - *  
1919 - */  
1920 -LIB3270_EXPORT int lib3270_cursor_down(H3270 *hSession)  
1921 -{  
1922 - register int baddr;  
1923 -  
1924 - FAIL_IF_NOT_ONLINE(hSession);  
1925 -  
1926 - if (hSession->kybdlock)  
1927 - {  
1928 - if (KYBDLOCK_IS_OERR(hSession))  
1929 - {  
1930 - lib3270_kybdlock_clear(hSession,KL_OERR_MASK);  
1931 - status_reset(hSession);  
1932 - } else  
1933 - {  
1934 - enq_action(hSession, lib3270_cursor_down);  
1935 -// enq_ta(Down_action, CN, CN);  
1936 - return 0;  
1937 - }  
1938 - }  
1939 -#if defined(X3270_ANSI) /*[*/  
1940 - if (IN_ANSI)  
1941 - {  
1942 - ansi_send_down(hSession);  
1943 - return 0;  
1944 - }  
1945 -#endif /*]*/  
1946 - baddr = (hSession->cursor_addr + hSession->cols) % (hSession->cols * hSession->rows);  
1947 - lib3270_set_cursor_address(hSession,baddr);  
1948 - return 0;  
1949 -}  
1950 -  
1951 -/**  
1952 * @brief Cursor to first field on next line or any lines after that. 1661 * @brief Cursor to first field on next line or any lines after that.
1953 */ 1662 */
1954 LIB3270_EXPORT int lib3270_newline(H3270 *hSession) 1663 LIB3270_EXPORT int lib3270_newline(H3270 *hSession)