Commit 4908377b3ffb2edd80eb4718dc544b64d17c2142

Authored by perry.werneck@gmail.com
1 parent b20e5839

Implementando biblioteca básica para android

XtGlue.c
... ... @@ -34,15 +34,18 @@
34 34  
35 35 #include "globals.h"
36 36 #include "api.h"
37   -#if defined(_WIN32) /*[*/
38   -#include "appres.h"
39   -#include "trace_dsc.h"
40   -#include "xioc.h"
41   -#endif /*]*/
  37 +#include <malloc.h>
  38 +
  39 +#if defined(_WIN32)
  40 + #include "appres.h"
  41 + #include "trace_dsc.h"
  42 + #include "xioc.h"
  43 +#endif
  44 +
42 45 #include "utilc.h"
43 46  
44 47 #include <stdio.h>
45   -#include <stdlib.h>
  48 +// #include <stdlib.h>
46 49 #include <string.h>
47 50 #include <errno.h>
48 51 #include "X11keysym.h"
... ... @@ -78,6 +81,10 @@
78 81  
79 82 #define MILLION 1000000L
80 83  
  84 +/*---[ Globals ]--------------------------------------------------------------------------------------------------------------*/
  85 +
  86 + H3270 h3270;
  87 +
81 88 /*---[ Callbacks ]------------------------------------------------------------------------------------------*/
82 89  
83 90 static void DefaultRemoveTimeOut(unsigned long timer);
... ...
ctlr.c
... ... @@ -477,7 +477,7 @@ void ctlr_erase(H3270 *session, int alt)
477 477 /* Going from maximum to 24x80. */
478 478 if (session->maxROWS > 24 || session->maxCOLS > 80)
479 479 {
480   - if (visible_control)
  480 + if(session->vcontrol)
481 481 {
482 482 ctlr_blanks();
483 483 screen_disp(session);
... ... @@ -2282,7 +2282,7 @@ ps_process(void)
2282 2282 ;
2283 2283 // sms_continue();
2284 2284  
2285   -#if defined(X3270_FT) /*[*/
  2285 +#if defined(X3270_FT)
2286 2286 /* Process file transfers. */
2287 2287 if (lib3270_get_ft_state(&h3270) != LIB3270_FT_STATE_NONE && /* transfer in progress */
2288 2288 h3270.formatted && /* screen is formatted */
... ... @@ -2292,7 +2292,7 @@ ps_process(void)
2292 2292 h3270.ea_buf[1919].fa && FA_IS_SKIP(h3270.ea_buf[1919].fa)) {
2293 2293 ft_cut_data();
2294 2294 }
2295   -#endif /*]*/
  2295 +#endif
2296 2296 }
2297 2297  
2298 2298 /*
... ... @@ -2666,9 +2666,10 @@ ctlr_shrink(void)
2666 2666 {
2667 2667 int baddr;
2668 2668  
2669   - for (baddr = 0; baddr < h3270.rows*h3270.cols; baddr++) {
  2669 + for (baddr = 0; baddr < h3270.rows*h3270.cols; baddr++)
  2670 + {
2670 2671 if (!h3270.ea_buf[baddr].fa)
2671   - h3270.ea_buf[baddr].cc = visible_control? EBC_space : EBC_null;
  2672 + h3270.ea_buf[baddr].cc = h3270.vcontrol ? EBC_space : EBC_null;
2672 2673 }
2673 2674 ALL_CHANGED;
2674 2675 screen_disp(&h3270);
... ...
ft.c
... ... @@ -36,6 +36,7 @@
36 36 #include "globals.h"
37 37  
38 38 #include <errno.h>
  39 +#include <malloc.h>
39 40  
40 41 #include "appres.h"
41 42 #include "actionsc.h"
... ...
ft_cut.c
... ... @@ -36,6 +36,7 @@
36 36 */
37 37  
38 38 #include <errno.h>
  39 +#include <malloc.h>
39 40  
40 41 #include "globals.h"
41 42  
... ...
ft_dft.c
... ... @@ -55,6 +55,7 @@
55 55 #include "utilc.h"
56 56  
57 57 #include <errno.h>
  58 +#include <malloc.h>
58 59  
59 60 extern unsigned char aid;
60 61  
... ...
globals.h
... ... @@ -106,7 +106,7 @@
106 106 * Prerequisite #includes.
107 107 */
108 108 #include <stdio.h> /* Unix standard I/O library */
109   -#include <stdlib.h> /* Other Unix library functions */
  109 +// #include <stdlib.h> /* Other Unix library functions */
110 110 #include <unistd.h> /* Unix system calls */
111 111 #include <ctype.h> /* Character classes */
112 112 #include <string.h> /* String manipulations */
... ... @@ -248,7 +248,7 @@ LIB3270_INTERNAL Boolean *standard_font;
248 248 LIB3270_INTERNAL Boolean std_ds_host;
249 249 LIB3270_INTERNAL char *termtype;
250 250 LIB3270_INTERNAL Widget toplevel;
251   -LIB3270_INTERNAL Boolean visible_control;
  251 +// LIB3270_INTERNAL Boolean visible_control;
252 252 LIB3270_INTERNAL int *xtra_width;
253 253  
254 254 /*
... ...
glue.c
... ... @@ -100,7 +100,6 @@
100 100 #define LAST_ARG "--"
101 101  
102 102 /*---[ Globals ]--------------------------------------------------------------------------------------------------------------*/
103   - H3270 h3270;
104 103 const char * programname;
105 104 AppRes appres;
106 105 int children = 0;
... ... @@ -798,8 +797,6 @@ int *char_width = &amp;cw;
798 797 static int ch = 7;
799 798 int *char_height = &ch;
800 799  
801   -Boolean visible_control = False;
802   -
803 800 // Boolean flipped = False;
804 801  
805 802 /* Replacements for functions in popups.c. */
... ...
host.c
... ... @@ -52,6 +52,7 @@
52 52 #include "xioc.h"
53 53  
54 54 #include <errno.h>
  55 +#include <malloc.h>
55 56  
56 57 #define RECONNECT_MS 2000 /* 2 sec before reconnecting to host */
57 58 #define RECONNECT_ERR_MS 5000 /* 5 sec before reconnecting to host */
... ...
init.c
... ... @@ -35,6 +35,8 @@
35 35 #include "appres.h"
36 36 #include "charsetc.h"
37 37  
  38 +#include <malloc.h>
  39 +
38 40 /*---[ Statics ]--------------------------------------------------------------------------------------------------------------*/
39 41  
40 42 static int parse_model_number(H3270 *session, const char *m);
... ...
paste.c
... ... @@ -45,9 +45,10 @@
45 45 #endif
46 46  
47 47 #include <fcntl.h>
  48 +#include <malloc.h>
  49 +
48 50 #include "3270ds.h"
49 51 #include "appres.h"
50   -// #include "ctlr.h"
51 52 #include "resources.h"
52 53  
53 54 #include "actionsc.h"
... ...
proxy.c
... ... @@ -46,6 +46,8 @@
46 46 #include <winsock2.h>
47 47 #include <ws2tcpip.h>
48 48 #else /*][*/
  49 +
  50 +#include <malloc.h>
49 51 #include <sys/socket.h>
50 52 #include <sys/ioctl.h>
51 53 #include <netinet/in.h>
... ...
rpq.c
... ... @@ -48,6 +48,8 @@
48 48 #include <netdb.h>
49 49 #endif /*]*/
50 50  
  51 +#include <stdlib.h>
  52 +
51 53 #include "api.h"
52 54  
53 55 #include <assert.h>
... ...
selection.c
... ... @@ -29,6 +29,7 @@
29 29  
30 30 #include "globals.h"
31 31 #include "appres.h"
  32 + #include <malloc.h>
32 33 #include <lib3270.h>
33 34 #include <lib3270/session.h>
34 35 #include <lib3270/selection.h>
... ...
telnet.c
... ... @@ -38,10 +38,14 @@
38 38 */
39 39  
40 40 #if defined(_WIN32)
41   - #include <winsock2.h>
42   - #include <windows.h>
  41 + #include <winsock2.h>
  42 + #include <windows.h>
43 43 #endif
44 44  
  45 +#ifndef ANDROID
  46 + #include <stdlib.h>
  47 +#endif // !ANDROID
  48 +
45 49 #include <lib3270/config.h>
46 50 #if defined(HAVE_LIBSSL)
47 51 #include <openssl/ssl.h>
... ... @@ -533,9 +537,12 @@ int net_connect(H3270 *session, const char *host, char *portname, Boolean ls, Bo
533 537  
534 538 /* get the passthru host and port number */
535 539 if (session->passthru_host) {
536   - const char *hn;
  540 + const char *hn = CN;
537 541  
  542 +#ifndef ANDROID
538 543 hn = getenv("INTERNET_HOST");
  544 +#endif // ANDROID
  545 +
539 546 if (hn == CN)
540 547 hn = "internet-gateway";
541 548  
... ... @@ -3432,7 +3439,7 @@ int net_getsockname(const H3270 *session, void *buf, int *len)
3432 3439 char *
3433 3440 net_proxy_type(void)
3434 3441 {
3435   - if (proxy_type > 0)
  3442 + if (proxy_type > 0)
3436 3443 return proxy_type_name(proxy_type);
3437 3444 else
3438 3445 return NULL;
... ...
toggle.h
... ... @@ -55,7 +55,7 @@
55 55 #define MARGINED_PASTE LIB3270_TOGGLE_MARGINED_PASTE
56 56 #define RECTANGLE_SELECT LIB3270_TOGGLE_RECTANGLE_SELECT
57 57 #define CROSSHAIR LIB3270_TOGGLE_CROSSHAIR
58   - #define VISIBLE_CONTROL LIB3270_TOGGLE_VISIBLE_CONTROL
  58 +// #define VISIBLE_CONTROL LIB3270_TOGGLE_VISIBLE_CONTROL
59 59 #define AID_WAIT LIB3270_TOGGLE_AID_WAIT
60 60 #define FULL_SCREEN LIB3270_TOGGLE_FULL_SCREEN
61 61 #define RECONNECT LIB3270_TOGGLE_RECONNECT
... ...
util.c
... ... @@ -53,6 +53,10 @@
53 53 #include <pwd.h>
54 54 #endif // _WIN32
55 55  
  56 +#ifndef ANDROID
  57 + #include <stdlib.h>
  58 +#endif // !ANDROID
  59 +
56 60 #include <stdarg.h>
57 61 #include "resources.h"
58 62  
... ... @@ -516,7 +520,7 @@ get_message(const char *key)
516 520 #endif
517 521 */
518 522  
519   -#define ex_getenv getenv
  523 +// #define ex_getenv getenv
520 524  
521 525 /* Variable and tilde substitution functions. */
522 526 static char *
... ... @@ -602,7 +606,10 @@ var_subst(const char *s)
602 606 vn = Malloc(vn_len + 1);
603 607 (void) strncpy(vn, vn_start, vn_len);
604 608 vn[vn_len] = '\0';
605   - if ((vv = ex_getenv(vn))) {
  609 +
  610 +#ifndef ANDROID
  611 + if((vv = getenv(vn)))
  612 + {
606 613 *o = '\0';
607 614 o_len = o_len
608 615 - 1 /* '$' */
... ... @@ -615,6 +622,8 @@ var_subst(const char *s)
615 622 (void) strcpy(o, vv);
616 623 o += strlen(vv);
617 624 }
  625 +#endif // !ANDROID
  626 +
618 627 Free(vn);
619 628 if (state == VS_VNB) {
620 629 state = VS_BASE;
... ...