Commit 83bd5a968fb8af87ae046a91d40b20c91976796e
1 parent
9046f9ed
Exists in
master
and in
5 other branches
Atualizando tratamento do loop de mensagems no modo texto
Showing
5 changed files
with
48 additions
and
22 deletions
Show diff stats
src/include/lib3270.h
| @@ -565,6 +565,25 @@ | @@ -565,6 +565,25 @@ | ||
| 565 | */ | 565 | */ |
| 566 | LIB3270_EXPORT int lib3270_call_thread(int(*callback)(H3270 *h, void *), H3270 *h, void *parm); | 566 | LIB3270_EXPORT int lib3270_call_thread(int(*callback)(H3270 *h, void *), H3270 *h, void *parm); |
| 567 | 567 | ||
| 568 | + | ||
| 569 | + /** | ||
| 570 | + * Run main iteration. | ||
| 571 | + * | ||
| 572 | + * Run lib3270 internal iterations, check for network inputs, process signals. | ||
| 573 | + * | ||
| 574 | + * @param wait Wait for signal if not available. | ||
| 575 | + * | ||
| 576 | + */ | ||
| 577 | + LIB3270_EXPORT void lib3270_main_iterate(int wait); | ||
| 578 | + | ||
| 579 | + /** | ||
| 580 | + * Wait for "N" seconds keeping main loop active. | ||
| 581 | + * | ||
| 582 | + * @param seconds Number of seconds to wait. | ||
| 583 | + * | ||
| 584 | + */ | ||
| 585 | + LIB3270_EXPORT int lib3270_wait(int seconds); | ||
| 586 | + | ||
| 568 | /** | 587 | /** |
| 569 | * Get the session's widget. | 588 | * Get the session's widget. |
| 570 | * | 589 | * |
src/lib3270/XtGlue.c
| @@ -970,13 +970,13 @@ LIB3270_EXPORT int lib3270_call_thread(int(*callback)(H3270 *h, void *), H3270 * | @@ -970,13 +970,13 @@ LIB3270_EXPORT int lib3270_call_thread(int(*callback)(H3270 *h, void *), H3270 * | ||
| 970 | return rc; | 970 | return rc; |
| 971 | } | 971 | } |
| 972 | 972 | ||
| 973 | -void RunPendingEvents(int wait) | 973 | +LIB3270_EXPORT void lib3270_main_iterate(int wait) |
| 974 | { | 974 | { |
| 975 | if(callbacks->RunPendingEvents) | 975 | if(callbacks->RunPendingEvents) |
| 976 | callbacks->RunPendingEvents(wait); | 976 | callbacks->RunPendingEvents(wait); |
| 977 | } | 977 | } |
| 978 | 978 | ||
| 979 | -int Wait(int seconds) | 979 | +LIB3270_EXPORT int lib3270_wait(seconds) |
| 980 | { | 980 | { |
| 981 | time_t end; | 981 | time_t end; |
| 982 | 982 | ||
| @@ -988,7 +988,7 @@ int Wait(int seconds) | @@ -988,7 +988,7 @@ int Wait(int seconds) | ||
| 988 | 988 | ||
| 989 | while(time(0) < end) | 989 | while(time(0) < end) |
| 990 | { | 990 | { |
| 991 | - RunPendingEvents(1); | 991 | + lib3270_main_iterate(1); |
| 992 | } | 992 | } |
| 993 | 993 | ||
| 994 | return 0; | 994 | return 0; |
src/lib3270/api.h
| @@ -431,11 +431,11 @@ | @@ -431,11 +431,11 @@ | ||
| 431 | #define Toggled(ix) lib3270_get_toggle(NULL,ix) | 431 | #define Toggled(ix) lib3270_get_toggle(NULL,ix) |
| 432 | #define CallAndWait(c,h,p) lib3270_call_thread(c,h,p) | 432 | #define CallAndWait(c,h,p) lib3270_call_thread(c,h,p) |
| 433 | 433 | ||
| 434 | - LOCAL_EXTERN void RunPendingEvents(int wait); | ||
| 435 | - LOCAL_EXTERN int Wait(int seconds); | 434 | +// #define RunPendingEvents(x) lib3270_main_iterate(x) |
| 435 | +// #define Wait(s) lib3270_wait(x) | ||
| 436 | 436 | ||
| 437 | - LOCAL_EXTERN int ctlr_get_cols(void) __attribute__ ((deprecated)); | ||
| 438 | - LOCAL_EXTERN int ctlr_get_rows(void) __attribute__ ((deprecated)); | 437 | +// LOCAL_EXTERN int ctlr_get_cols(void) __attribute__ ((deprecated)); |
| 438 | +// LOCAL_EXTERN int ctlr_get_rows(void) __attribute__ ((deprecated)); | ||
| 439 | 439 | ||
| 440 | /* Screen calls */ | 440 | /* Screen calls */ |
| 441 | LOCAL_EXTERN void screen_resume(H3270 *session); | 441 | LOCAL_EXTERN void screen_resume(H3270 *session); |
src/lib3270/host.c
| @@ -618,7 +618,7 @@ int lib3270_connect(H3270 *h, const char *n, int wait) | @@ -618,7 +618,7 @@ int lib3270_connect(H3270 *h, const char *n, int wait) | ||
| 618 | 618 | ||
| 619 | CHECK_SESSION_HANDLE(h); | 619 | CHECK_SESSION_HANDLE(h); |
| 620 | 620 | ||
| 621 | - RunPendingEvents(0); | 621 | + lib3270_main_iterate(0); |
| 622 | 622 | ||
| 623 | if(h->auto_reconnect_inprogress) | 623 | if(h->auto_reconnect_inprogress) |
| 624 | return EAGAIN; | 624 | return EAGAIN; |
| @@ -634,7 +634,7 @@ int lib3270_connect(H3270 *h, const char *n, int wait) | @@ -634,7 +634,7 @@ int lib3270_connect(H3270 *h, const char *n, int wait) | ||
| 634 | { | 634 | { |
| 635 | while(!IN_ANSI && !IN_3270) | 635 | while(!IN_ANSI && !IN_3270) |
| 636 | { | 636 | { |
| 637 | - RunPendingEvents(1); | 637 | + lib3270_main_iterate(1); |
| 638 | 638 | ||
| 639 | if(!PCONNECTED) | 639 | if(!PCONNECTED) |
| 640 | { | 640 | { |
src/lib3270/lib3270.cbp
| @@ -7,20 +7,22 @@ | @@ -7,20 +7,22 @@ | ||
| 7 | <Option compiler="gcc" /> | 7 | <Option compiler="gcc" /> |
| 8 | <Build> | 8 | <Build> |
| 9 | <Target title="Debug"> | 9 | <Target title="Debug"> |
| 10 | - <Option output=".bin\Debug\lib3270" prefix_auto="1" extension_auto="1" /> | ||
| 11 | - <Option object_output=".obj\Debug\" /> | ||
| 12 | - <Option type="3" /> | 10 | + <Option output=".bin/Debug/lib3270" prefix_auto="1" extension_auto="1" /> |
| 11 | + <Option object_output=".obj/Debug/" /> | ||
| 12 | + <Option type="1" /> | ||
| 13 | <Option compiler="gcc" /> | 13 | <Option compiler="gcc" /> |
| 14 | - <Option createDefFile="1" /> | ||
| 15 | - <Option createStaticLib="1" /> | 14 | + <Option use_console_runner="0" /> |
| 16 | <Compiler> | 15 | <Compiler> |
| 17 | <Add option="-g" /> | 16 | <Add option="-g" /> |
| 18 | <Add option="-DDEBUG=1" /> | 17 | <Add option="-DDEBUG=1" /> |
| 19 | </Compiler> | 18 | </Compiler> |
| 19 | + <Linker> | ||
| 20 | + <Add library="pthread" /> | ||
| 21 | + </Linker> | ||
| 20 | </Target> | 22 | </Target> |
| 21 | <Target title="Release"> | 23 | <Target title="Release"> |
| 22 | - <Option output=".bin\Release\lib3270" prefix_auto="1" extension_auto="1" /> | ||
| 23 | - <Option object_output=".obj\Release\" /> | 24 | + <Option output=".bin/Release/lib3270" prefix_auto="1" extension_auto="1" /> |
| 25 | + <Option object_output=".obj/Release/" /> | ||
| 24 | <Option type="3" /> | 26 | <Option type="3" /> |
| 25 | <Option compiler="gcc" /> | 27 | <Option compiler="gcc" /> |
| 26 | <Option createDefFile="1" /> | 28 | <Option createDefFile="1" /> |
| @@ -33,8 +35,8 @@ | @@ -33,8 +35,8 @@ | ||
| 33 | </Linker> | 35 | </Linker> |
| 34 | </Target> | 36 | </Target> |
| 35 | <Target title="testprogram"> | 37 | <Target title="testprogram"> |
| 36 | - <Option output=".bin\Debug\lib3270" prefix_auto="1" extension_auto="1" /> | ||
| 37 | - <Option object_output=".obj\testprogram\" /> | 38 | + <Option output=".bin/Debug/lib3270" prefix_auto="1" extension_auto="1" /> |
| 39 | + <Option object_output=".obj/testprogram/" /> | ||
| 38 | <Option type="1" /> | 40 | <Option type="1" /> |
| 39 | <Option compiler="gcc" /> | 41 | <Option compiler="gcc" /> |
| 40 | <Option use_console_runner="0" /> | 42 | <Option use_console_runner="0" /> |
| @@ -51,10 +53,11 @@ | @@ -51,10 +53,11 @@ | ||
| 51 | <Add option="-Wmissing-declarations" /> | 53 | <Add option="-Wmissing-declarations" /> |
| 52 | <Add option="-Wall" /> | 54 | <Add option="-Wall" /> |
| 53 | <Add option="-DLIB3270=1" /> | 55 | <Add option="-DLIB3270=1" /> |
| 54 | - <Add directory="..\include" /> | ||
| 55 | - <Add directory="..\include\lib3270" /> | 56 | + <Add directory="../include" /> |
| 57 | + <Add directory="../include/lib3270" /> | ||
| 56 | </Compiler> | 58 | </Compiler> |
| 57 | - <Unit filename="..\include\lib3270\config.h.in" /> | 59 | + <Unit filename="../include/lib3270/config.h.in" /> |
| 60 | + <Unit filename="3270ds.h" /> | ||
| 58 | <Unit filename="Makefile.in" /> | 61 | <Unit filename="Makefile.in" /> |
| 59 | <Unit filename="X11keysym.h" /> | 62 | <Unit filename="X11keysym.h" /> |
| 60 | <Unit filename="XtGlue.c"> | 63 | <Unit filename="XtGlue.c"> |
| @@ -68,6 +71,7 @@ | @@ -68,6 +71,7 @@ | ||
| 68 | <Option compilerVar="CC" /> | 71 | <Option compilerVar="CC" /> |
| 69 | </Unit> | 72 | </Unit> |
| 70 | <Unit filename="ansic.h" /> | 73 | <Unit filename="ansic.h" /> |
| 74 | + <Unit filename="api.h" /> | ||
| 71 | <Unit filename="apl.c"> | 75 | <Unit filename="apl.c"> |
| 72 | <Option compilerVar="CC" /> | 76 | <Option compilerVar="CC" /> |
| 73 | </Unit> | 77 | </Unit> |
| @@ -165,6 +169,9 @@ | @@ -165,6 +169,9 @@ | ||
| 165 | <Option compilerVar="CC" /> | 169 | <Option compilerVar="CC" /> |
| 166 | </Unit> | 170 | </Unit> |
| 167 | <Unit filename="seec.h" /> | 171 | <Unit filename="seec.h" /> |
| 172 | + <Unit filename="selection.c"> | ||
| 173 | + <Option compilerVar="CC" /> | ||
| 174 | + </Unit> | ||
| 168 | <Unit filename="sf.c"> | 175 | <Unit filename="sf.c"> |
| 169 | <Option compilerVar="CC" /> | 176 | <Option compilerVar="CC" /> |
| 170 | </Unit> | 177 | </Unit> |
| @@ -181,9 +188,9 @@ | @@ -181,9 +188,9 @@ | ||
| 181 | <Unit filename="telnetc.h" /> | 188 | <Unit filename="telnetc.h" /> |
| 182 | <Unit filename="testprogram.c"> | 189 | <Unit filename="testprogram.c"> |
| 183 | <Option compilerVar="CC" /> | 190 | <Option compilerVar="CC" /> |
| 184 | - <Option target="testprogram" /> | ||
| 185 | </Unit> | 191 | </Unit> |
| 186 | <Unit filename="tn3270e.h" /> | 192 | <Unit filename="tn3270e.h" /> |
| 193 | + <Unit filename="toggle.h" /> | ||
| 187 | <Unit filename="toggles.c"> | 194 | <Unit filename="toggles.c"> |
| 188 | <Option compilerVar="CC" /> | 195 | <Option compilerVar="CC" /> |
| 189 | </Unit> | 196 | </Unit> |