Commit 82d58a4189f36facf56ebe9d69961aa000dd0c42
1 parent
ce2c4cff
Exists in
master
and in
3 other branches
Incluindo metodos para permitir que scripts obtenham posição e tamanho de campos
Showing
1 changed file
with
56 additions
and
0 deletions
Show diff stats
ctlr.c
@@ -303,6 +303,62 @@ static void ctlr_connect(H3270 *hSession, int ignored unused, void *dunno) | @@ -303,6 +303,62 @@ static void ctlr_connect(H3270 *hSession, int ignored unused, void *dunno) | ||
303 | hSession->crm_nattr = 0; | 303 | hSession->crm_nattr = 0; |
304 | } | 304 | } |
305 | 305 | ||
306 | +LIB3270_EXPORT int lib3270_get_field_start(H3270 *hSession, int baddr) | ||
307 | +{ | ||
308 | + int sbaddr; | ||
309 | + | ||
310 | + CHECK_SESSION_HANDLE(hSession); | ||
311 | + | ||
312 | + if (!hSession->formatted) | ||
313 | + return -1; | ||
314 | + | ||
315 | + if(baddr < 0) | ||
316 | + baddr = hSession->cursor_addr; | ||
317 | + | ||
318 | + sbaddr = baddr; | ||
319 | + do | ||
320 | + { | ||
321 | + if(hSession->ea_buf[baddr].fa) | ||
322 | + return baddr; | ||
323 | + DEC_BA(baddr); | ||
324 | + } while (baddr != sbaddr); | ||
325 | + | ||
326 | + return -1; | ||
327 | + | ||
328 | +} | ||
329 | + | ||
330 | +LIB3270_EXPORT int lib3270_get_field_len(H3270 *hSession, int baddr) | ||
331 | +{ | ||
332 | + int saddr; | ||
333 | + int addr; | ||
334 | + int width = 0; | ||
335 | + | ||
336 | + CHECK_SESSION_HANDLE(hSession); | ||
337 | + | ||
338 | + if (!hSession->formatted) | ||
339 | + return -1; | ||
340 | + | ||
341 | + if(baddr < 0) | ||
342 | + baddr = hSession->cursor_addr; | ||
343 | + | ||
344 | + addr = find_field_attribute(hSession,baddr); | ||
345 | + | ||
346 | + if(addr < 0) | ||
347 | + return -1; | ||
348 | + | ||
349 | + saddr = addr; | ||
350 | + INC_BA(addr); | ||
351 | + do | ||
352 | + { | ||
353 | + if(hSession->ea_buf[addr].fa) | ||
354 | + return width; | ||
355 | + INC_BA(addr); | ||
356 | + width++; | ||
357 | + } while (addr != saddr); | ||
358 | + | ||
359 | + return -1; | ||
360 | +} | ||
361 | + | ||
306 | LIB3270_EXPORT int lib3270_field_addr(H3270 *hSession, int baddr) | 362 | LIB3270_EXPORT int lib3270_field_addr(H3270 *hSession, int baddr) |
307 | { | 363 | { |
308 | int sbaddr; | 364 | int sbaddr; |