Commit 812c356fc82e00078f0b06573f6b2ba427a2737c

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

Reduzindo warnings, reativando programa de teste da biblioteca

@@ -45,6 +45,10 @@ @@ -45,6 +45,10 @@
45 #include "kybdc.h" 45 #include "kybdc.h"
46 #include "popupsc.h" 46 #include "popupsc.h"
47 47
  48 +#ifndef ANDROID
  49 + #include <stdlib.h>
  50 +#endif // !ANDROID
  51 +
48 /* 52 /*
49 #if defined(X3270_DISPLAY) || (defined(C3270) && !defined(_WIN32)) 53 #if defined(X3270_DISPLAY) || (defined(C3270) && !defined(_WIN32))
50 #include "screenc.h" 54 #include "screenc.h"
@@ -199,8 +203,8 @@ wide_resource_init(char *csname) @@ -199,8 +203,8 @@ wide_resource_init(char *csname)
199 */ 203 */
200 enum cs_result charset_init(H3270 *session, const char *csname) 204 enum cs_result charset_init(H3270 *session, const char *csname)
201 { 205 {
202 - char *cs;  
203 - const char *ftcs; 206 +// char *cs;
  207 +// const char *ftcs;
204 enum cs_result rc; 208 enum cs_result rc;
205 char *ccs, *cftcs; 209 char *ccs, *cftcs;
206 const char *ak; 210 const char *ak;
@@ -56,6 +56,7 @@ @@ -56,6 +56,7 @@
56 #include "tablesc.h" 56 #include "tablesc.h"
57 #include "telnetc.h" 57 #include "telnetc.h"
58 #include "utilc.h" 58 #include "utilc.h"
  59 +#include "trace_dsc.h"
59 60
60 static void ft_connected(H3270 *session, int ignored, void *unused); 61 static void ft_connected(H3270 *session, int ignored, void *unused);
61 static void ft_in3270(H3270 *session, int ignored unused, void *unused); 62 static void ft_in3270(H3270 *session, int ignored unused, void *unused);
@@ -352,3 +352,5 @@ LIB3270_INTERNAL int cursor_move(H3270 *session, int baddr); @@ -352,3 +352,5 @@ LIB3270_INTERNAL int cursor_move(H3270 *session, int baddr);
352 LIB3270_INTERNAL void add_input_calls(H3270 *, void (*)(H3270 *), void (*)(H3270 *)); 352 LIB3270_INTERNAL void add_input_calls(H3270 *, void (*)(H3270 *), void (*)(H3270 *));
353 353
354 LIB3270_INTERNAL void toggle_rectselect(H3270 *session, struct lib3270_toggle *t, LIB3270_TOGGLE_TYPE tt); 354 LIB3270_INTERNAL void toggle_rectselect(H3270 *session, struct lib3270_toggle *t, LIB3270_TOGGLE_TYPE tt);
  355 +
  356 +LIB3270_INTERNAL void remove_input_calls(H3270 *session);
@@ -96,7 +96,7 @@ @@ -96,7 +96,7 @@
96 static int init_calls = 0; 96 static int init_calls = 0;
97 #endif 97 #endif
98 98
99 - static void lib3270_session_init(H3270 *hSession, const char *model); 99 +// static void lib3270_session_init(H3270 *hSession, const char *model);
100 100
101 #define LAST_ARG "--" 101 #define LAST_ARG "--"
102 102
@@ -161,7 +161,7 @@ @@ -161,7 +161,7 @@
161 161
162 LIB3270_EXPORT char * lib3270_get_as_html(H3270 *session, LIB3270_HTML_OPTION option) 162 LIB3270_EXPORT char * lib3270_get_as_html(H3270 *session, LIB3270_HTML_OPTION option)
163 { 163 {
164 - int row, col, baddr; 164 + int row, baddr;
165 struct html_info info; 165 struct html_info info;
166 166
167 memset(&info,0,sizeof(info)); 167 memset(&info,0,sizeof(info));
@@ -180,16 +180,24 @@ @@ -180,16 +180,24 @@
180 baddr = 0; 180 baddr = 0;
181 for(row=0;row < session->rows;row++) 181 for(row=0;row < session->rows;row++)
182 { 182 {
183 - int cr = 0; 183 + int cr = 0;
  184 + int len = 0;
  185 + int col;
184 186
185 for(col = 0; col < session->cols;col++) 187 for(col = 0; col < session->cols;col++)
186 { 188 {
187 - if((option && LIB3270_HTML_OPTION_ALL) || (session->text[baddr].attr & LIB3270_ATTR_SELECTED)) 189 + if( session->text[baddr+col].chr != ' ' || (session->text[baddr+col].attr & LIB3270_ATTR_CG))
  190 + len = col;
  191 + }
  192 +
  193 + for(col = 0; col <= len;col++)
  194 + {
  195 + if((option && LIB3270_HTML_OPTION_ALL) || (session->text[baddr+col].attr & LIB3270_ATTR_SELECTED))
188 { 196 {
189 cr++; 197 cr++;
190 - update_colors(&info,session->text[baddr].attr); 198 + update_colors(&info,session->text[baddr+col].attr);
191 199
192 - if(session->text[baddr].attr & LIB3270_ATTR_CG) 200 + if(session->text[baddr+col].attr & LIB3270_ATTR_CG)
193 { 201 {
194 static const struct chr_xlat xlat[] = 202 static const struct chr_xlat xlat[] =
195 { 203 {
@@ -213,7 +221,7 @@ @@ -213,7 +221,7 @@
213 { 0x00, NULL } 221 { 0x00, NULL }
214 }; 222 };
215 223
216 - append_char(&info, xlat, session->text[baddr].chr); 224 + append_char(&info, xlat, session->text[baddr+col].chr);
217 225
218 } 226 }
219 else 227 else
@@ -224,19 +232,21 @@ @@ -224,19 +232,21 @@
224 { '&', "&amp;" }, 232 { '&', "&amp;" },
225 { '<', "&lt;" }, 233 { '<', "&lt;" },
226 { '>', "&gt;" }, 234 { '>', "&gt;" },
  235 + { ' ', "&nbsp;" },
227 236
228 { 0x00, NULL } 237 { 0x00, NULL }
229 }; 238 };
230 239
231 - append_char(&info, xlat, session->text[baddr].chr); 240 + append_char(&info, xlat, session->text[baddr+col].chr);
232 241
233 } 242 }
234 243
235 } 244 }
236 - baddr++;  
237 } 245 }
238 246
239 - if(cr) 247 + baddr += session->cols;
  248 +
  249 + if(cr || (option && LIB3270_HTML_OPTION_ALL))
240 append_element(&info,HTML_ELEMENT_LINE_BREAK); 250 append_element(&info,HTML_ELEMENT_LINE_BREAK);
241 } 251 }
242 252
@@ -34,6 +34,7 @@ @@ -34,6 +34,7 @@
34 #include <sys/types.h> 34 #include <sys/types.h>
35 #include "xioc.h" 35 #include "xioc.h"
36 #include "telnetc.h" 36 #include "telnetc.h"
  37 +#include "utilc.h"
37 38
38 #define MILLION 1000000L 39 #define MILLION 1000000L
39 #define InputReadMask 0x1 40 #define InputReadMask 0x1
@@ -54,7 +55,7 @@ static void * internal_add_except(int source, H3270 *session, void (*fn)(H3270 * @@ -54,7 +55,7 @@ static void * internal_add_except(int source, H3270 *session, void (*fn)(H3270 *
54 55
55 static void internal_remove_input(void *id); 56 static void internal_remove_input(void *id);
56 57
57 -static int internal_process_events(int block); 58 +// static int internal_process_events(int block);
58 59
59 static int internal_callthread(int(*callback)(H3270 *, void *), H3270 *session, void *parm); 60 static int internal_callthread(int(*callback)(H3270 *, void *), H3270 *session, void *parm);
60 static int internal_wait(int seconds); 61 static int internal_wait(int seconds);
@@ -505,6 +506,7 @@ static int internal_event_dispatcher(int block) @@ -505,6 +506,7 @@ static int internal_event_dispatcher(int block)
505 static int internal_callthread(int(*callback)(H3270 *, void *), H3270 *session, void *parm) 506 static int internal_callthread(int(*callback)(H3270 *, void *), H3270 *session, void *parm)
506 { 507 {
507 callback(session,parm); 508 callback(session,parm);
  509 + return 0;
508 } 510 }
509 511
510 static int internal_wait(int seconds) 512 static int internal_wait(int seconds)
@@ -651,7 +653,7 @@ LIB3270_EXPORT int lib3270_register_handlers(const struct lib3270_callbacks *cbk @@ -651,7 +653,7 @@ LIB3270_EXPORT int lib3270_register_handlers(const struct lib3270_callbacks *cbk
651 653
652 LIB3270_EXPORT int lib3270_call_thread(int(*callback)(H3270 *h, void *), H3270 *h, void *parm) 654 LIB3270_EXPORT int lib3270_call_thread(int(*callback)(H3270 *h, void *), H3270 *h, void *parm)
653 { 655 {
654 - int rc; 656 +// int rc;
655 CHECK_SESSION_HANDLE(h); 657 CHECK_SESSION_HANDLE(h);
656 658
657 if(h->set_timer) 659 if(h->set_timer)
@@ -664,7 +666,7 @@ LIB3270_EXPORT int lib3270_call_thread(int(*callback)(H3270 *h, void *), H3270 * @@ -664,7 +666,7 @@ LIB3270_EXPORT int lib3270_call_thread(int(*callback)(H3270 *h, void *), H3270 *
664 if(h->set_timer) 666 if(h->set_timer)
665 h->set_timer(h,0); 667 h->set_timer(h,0);
666 668
667 - return rc; 669 + return 0;
668 } 670 }
669 671
670 LIB3270_EXPORT void lib3270_main_iterate(H3270 *session, int block) 672 LIB3270_EXPORT void lib3270_main_iterate(H3270 *session, int block)
@@ -676,6 +678,7 @@ LIB3270_EXPORT void lib3270_main_iterate(H3270 *session, int block) @@ -676,6 +678,7 @@ LIB3270_EXPORT void lib3270_main_iterate(H3270 *session, int block)
676 LIB3270_EXPORT int lib3270_wait(seconds) 678 LIB3270_EXPORT int lib3270_wait(seconds)
677 { 679 {
678 wait(seconds); 680 wait(seconds);
  681 + return 0;
679 } 682 }
680 683
681 LIB3270_EXPORT void lib3270_ring_bell(H3270 *session) 684 LIB3270_EXPORT void lib3270_ring_bell(H3270 *session)
@@ -37,6 +37,10 @@ @@ -37,6 +37,10 @@
37 37
38 #include "globals.h" 38 #include "globals.h"
39 39
  40 +#ifndef ANDROID
  41 + #include <stdlib.h>
  42 +#endif // !ANDROID
  43 +
40 #if defined(X3270_DISPLAY) /*[*/ 44 #if defined(X3270_DISPLAY) /*[*/
41 #include <X11/Xatom.h> 45 #include <X11/Xatom.h>
42 #endif 46 #endif
@@ -2264,6 +2268,8 @@ LIB3270_ACTION( dup ) @@ -2264,6 +2268,8 @@ LIB3270_ACTION( dup )
2264 hSession->display(hSession); 2268 hSession->display(hSession);
2265 cursor_move(hSession,next_unprotected(hSession,hSession->cursor_addr)); 2269 cursor_move(hSession,next_unprotected(hSession,hSession->cursor_addr));
2266 } 2270 }
  2271 +
  2272 + return 0;
2267 } 2273 }
2268 2274
2269 /* 2275 /*
@@ -2274,13 +2280,15 @@ LIB3270_ACTION( fieldmark ) @@ -2274,13 +2280,15 @@ LIB3270_ACTION( fieldmark )
2274 if (kybdlock) 2280 if (kybdlock)
2275 { 2281 {
2276 ENQUEUE_ACTION(lib3270_fieldmark); 2282 ENQUEUE_ACTION(lib3270_fieldmark);
2277 - return; 2283 + return 0;
2278 } 2284 }
2279 #if defined(X3270_ANSI) 2285 #if defined(X3270_ANSI)
2280 if (IN_ANSI) 2286 if (IN_ANSI)
2281 - return; 2287 + return 0 ;
2282 #endif 2288 #endif
2283 (void) key_Character(EBC_fm, False, False, NULL); 2289 (void) key_Character(EBC_fm, False, False, NULL);
  2290 +
  2291 + return 0;
2284 } 2292 }
2285 2293
2286 /** 2294 /**
@@ -9,9 +9,8 @@ @@ -9,9 +9,8 @@
9 <Target title="Debug"> 9 <Target title="Debug">
10 <Option output=".bin/Debug/lib3270" prefix_auto="1" extension_auto="1" /> 10 <Option output=".bin/Debug/lib3270" prefix_auto="1" extension_auto="1" />
11 <Option object_output=".obj/Debug/" /> 11 <Option object_output=".obj/Debug/" />
12 - <Option type="1" /> 12 + <Option type="3" />
13 <Option compiler="gcc" /> 13 <Option compiler="gcc" />
14 - <Option use_console_runner="0" />  
15 <Compiler> 14 <Compiler>
16 <Add option="-g" /> 15 <Add option="-g" />
17 <Add option="-DDEBUG=1" /> 16 <Add option="-DDEBUG=1" />
@@ -52,10 +51,14 @@ @@ -52,10 +51,14 @@
52 <Add option="-Wunreachable-code" /> 51 <Add option="-Wunreachable-code" />
53 <Add option="-Wmissing-declarations" /> 52 <Add option="-Wmissing-declarations" />
54 <Add option="-Wall" /> 53 <Add option="-Wall" />
  54 + <Add option="-pthread" />
55 <Add option="-DLIB3270=1" /> 55 <Add option="-DLIB3270=1" />
56 <Add directory="../include" /> 56 <Add directory="../include" />
57 <Add directory="../include/lib3270" /> 57 <Add directory="../include/lib3270" />
58 </Compiler> 58 </Compiler>
  59 + <Linker>
  60 + <Add option="-pthread" />
  61 + </Linker>
59 <Unit filename="../include/lib3270.h" /> 62 <Unit filename="../include/lib3270.h" />
60 <Unit filename="../include/lib3270/action_table.h" /> 63 <Unit filename="../include/lib3270/action_table.h" />
61 <Unit filename="../include/lib3270/actions.h" /> 64 <Unit filename="../include/lib3270/actions.h" />
@@ -68,24 +71,18 @@ @@ -68,24 +71,18 @@
68 <Unit filename="3270ds.h" /> 71 <Unit filename="3270ds.h" />
69 <Unit filename="Makefile.in" /> 72 <Unit filename="Makefile.in" />
70 <Unit filename="X11keysym.h" /> 73 <Unit filename="X11keysym.h" />
71 - <Unit filename="XtGlue.c">  
72 - <Option compilerVar="CC" />  
73 - </Unit>  
74 - <Unit filename="actions.c">  
75 - <Option compilerVar="CC" />  
76 - </Unit>  
77 <Unit filename="actionsc.h" /> 74 <Unit filename="actionsc.h" />
78 <Unit filename="ansi.c"> 75 <Unit filename="ansi.c">
79 <Option compilerVar="CC" /> 76 <Option compilerVar="CC" />
80 </Unit> 77 </Unit>
81 <Unit filename="ansic.h" /> 78 <Unit filename="ansic.h" />
82 <Unit filename="api.h" /> 79 <Unit filename="api.h" />
83 - <Unit filename="apl.c">  
84 - <Option compilerVar="CC" />  
85 - </Unit>  
86 <Unit filename="aplc.h" /> 80 <Unit filename="aplc.h" />
87 <Unit filename="appres.h" /> 81 <Unit filename="appres.h" />
88 <Unit filename="arpa_telnet.h" /> 82 <Unit filename="arpa_telnet.h" />
  83 + <Unit filename="bounds.c">
  84 + <Option compilerVar="CC" />
  85 + </Unit>
89 <Unit filename="cg.h" /> 86 <Unit filename="cg.h" />
90 <Unit filename="charset.c"> 87 <Unit filename="charset.c">
91 <Option compilerVar="CC" /> 88 <Option compilerVar="CC" />
@@ -125,7 +122,7 @@ @@ -125,7 +122,7 @@
125 </Unit> 122 </Unit>
126 <Unit filename="hostc.h" /> 123 <Unit filename="hostc.h" />
127 <Unit filename="icmdc.h" /> 124 <Unit filename="icmdc.h" />
128 - <Unit filename="init.c"> 125 + <Unit filename="iocalls.c">
129 <Option compilerVar="CC" /> 126 <Option compilerVar="CC" />
130 </Unit> 127 </Unit>
131 <Unit filename="keypadc.h" /> 128 <Unit filename="keypadc.h" />
@@ -183,11 +180,17 @@ @@ -183,11 +180,17 @@
183 <Unit filename="selection.c"> 180 <Unit filename="selection.c">
184 <Option compilerVar="CC" /> 181 <Option compilerVar="CC" />
185 </Unit> 182 </Unit>
  183 + <Unit filename="session.c">
  184 + <Option compilerVar="CC" />
  185 + </Unit>
186 <Unit filename="sf.c"> 186 <Unit filename="sf.c">
187 <Option compilerVar="CC" /> 187 <Option compilerVar="CC" />
188 </Unit> 188 </Unit>
189 <Unit filename="sfc.h" /> 189 <Unit filename="sfc.h" />
190 <Unit filename="shlobj_missing.h" /> 190 <Unit filename="shlobj_missing.h" />
  191 + <Unit filename="state.c">
  192 + <Option compilerVar="CC" />
  193 + </Unit>
191 <Unit filename="statusc.h" /> 194 <Unit filename="statusc.h" />
192 <Unit filename="tables.c"> 195 <Unit filename="tables.c">
193 <Option compilerVar="CC" /> 196 <Option compilerVar="CC" />
@@ -221,18 +224,9 @@ @@ -221,18 +224,9 @@
221 <Unit filename="version.c"> 224 <Unit filename="version.c">
222 <Option compilerVar="CC" /> 225 <Option compilerVar="CC" />
223 </Unit> 226 </Unit>
224 - <Unit filename="w3misc.c">  
225 - <Option compilerVar="CC" />  
226 - </Unit>  
227 <Unit filename="w3miscc.h" /> 227 <Unit filename="w3miscc.h" />
228 <Unit filename="widec.h" /> 228 <Unit filename="widec.h" />
229 - <Unit filename="winvers.c">  
230 - <Option compilerVar="CC" />  
231 - </Unit>  
232 <Unit filename="winversc.h" /> 229 <Unit filename="winversc.h" />
233 - <Unit filename="xio.c">  
234 - <Option compilerVar="CC" />  
235 - </Unit>  
236 <Unit filename="xioc.h" /> 230 <Unit filename="xioc.h" />
237 <Unit filename="xl.h" /> 231 <Unit filename="xl.h" />
238 <Extensions> 232 <Extensions>
@@ -104,30 +104,15 @@ @@ -104,30 +104,15 @@
104 104
105 LIB3270_MACRO( get ) 105 LIB3270_MACRO( get )
106 { 106 {
107 - char *buffer = NULL;  
108 -/*  
109 - int start, qtd, rows, cols, row, col; 107 + char *buffer = NULL;
110 108
111 switch(argc) 109 switch(argc)
112 { 110 {
113 case 1: // Get entire screen 111 case 1: // Get entire screen
114 - lib3270_get_screen_size(hSession,&rows,&cols);  
115 - qtd = (rows*(cols+1)+1);  
116 - buffer = lib3270_malloc(qtd+2);  
117 -  
118 - memset(buffer,0,qtd+1);  
119 - start = qtd = 0;  
120 - for(row = 0; row < rows;row++)  
121 - {  
122 - screen_read(buffer+qtd,start,cols);  
123 - qtd += cols;  
124 - start += cols;  
125 - buffer[qtd++] = '\n';  
126 - }  
127 - buffer[qtd] = 0;  
128 -  
129 - return buffer; 112 + buffer = lib3270_get_text(hSession,0,-1);
  113 + break;
130 114
  115 +/*
131 case 2: // Just size, get current cursor position 116 case 2: // Just size, get current cursor position
132 start = 0; 117 start = 0;
133 qtd = atoi(argv[1]); 118 qtd = atoi(argv[1]);
@@ -153,22 +138,11 @@ @@ -153,22 +138,11 @@
153 start = (row * cols) + col; 138 start = (row * cols) + col;
154 qtd = atoi(argv[3]); 139 qtd = atoi(argv[3]);
155 break; 140 break;
156 - 141 +*/
157 default: 142 default:
158 errno = EINVAL; 143 errno = EINVAL;
159 - return NULL;  
160 } 144 }
161 145
162 - if(qtd < 1)  
163 - {  
164 - errno = EINVAL;  
165 - return NULL;  
166 - }  
167 -  
168 - buffer = lib3270_malloc(qtd+1);  
169 - screen_read(buffer, start, qtd);  
170 -  
171 -*/  
172 return buffer; 146 return buffer;
173 } 147 }
174 148
@@ -62,6 +62,7 @@ @@ -62,6 +62,7 @@
62 #include "api.h" 62 #include "api.h"
63 63
64 #include "resolverc.h" 64 #include "resolverc.h"
  65 +#include "statusc.h"
65 #include "w3miscc.h" 66 #include "w3miscc.h"
66 67
67 #pragma pack(1) 68 #pragma pack(1)
@@ -76,6 +76,7 @@ static int get_rpq_address(unsigned char buf[], const int buflen); @@ -76,6 +76,7 @@ static int get_rpq_address(unsigned char buf[], const int buflen);
76 static void rpq_warning(const char *fmt, ...); 76 static void rpq_warning(const char *fmt, ...);
77 static void rpq_dump_warnings(void); 77 static void rpq_dump_warnings(void);
78 static Boolean rpq_complained = False; 78 static Boolean rpq_complained = False;
  79 +
79 #if !defined(_WIN32) /*[*/ 80 #if !defined(_WIN32) /*[*/
80 static Boolean omit_due_space_limit = False; 81 static Boolean omit_due_space_limit = False;
81 #endif /*]*/ 82 #endif /*]*/
@@ -349,7 +349,7 @@ LIB3270_ACTION( selectfield ) @@ -349,7 +349,7 @@ LIB3270_ACTION( selectfield )
349 349
350 LIB3270_ACTION( selectall ) 350 LIB3270_ACTION( selectall )
351 { 351 {
352 - int len, baddr; 352 +// int len, baddr;
353 353
354 CHECK_SESSION_HANDLE(hSession); 354 CHECK_SESSION_HANDLE(hSession);
355 355
@@ -360,7 +360,7 @@ LIB3270_ACTION( selectall ) @@ -360,7 +360,7 @@ LIB3270_ACTION( selectall )
360 360
361 LIB3270_ACTION( reselect ) 361 LIB3270_ACTION( reselect )
362 { 362 {
363 - int start, end; 363 +// int start, end;
364 364
365 CHECK_SESSION_HANDLE(hSession); 365 CHECK_SESSION_HANDLE(hSession);
366 366
@@ -542,7 +542,8 @@ LIB3270_EXPORT int lib3270_get_selection_bounds(H3270 *hSession, int *start, int @@ -542,7 +542,8 @@ LIB3270_EXPORT int lib3270_get_selection_bounds(H3270 *hSession, int *start, int
542 LIB3270_EXPORT int lib3270_move_selected_area(H3270 *hSession, int from, int to) 542 LIB3270_EXPORT int lib3270_move_selected_area(H3270 *hSession, int from, int to)
543 { 543 {
544 int pos[2]; 544 int pos[2];
545 - int rows, cols, f, step, start, end; 545 + int rows, cols, f, step;
  546 + // , start, end;
546 547
547 if(!lib3270_get_selection_bounds(hSession,&pos[0],&pos[1])) 548 if(!lib3270_get_selection_bounds(hSession,&pos[0],&pos[1]))
548 return from; 549 return from;
@@ -715,5 +716,7 @@ LIB3270_EXPORT int lib3270_move_cursor(H3270 *hSession, LIB3270_DIRECTION dir, u @@ -715,5 +716,7 @@ LIB3270_EXPORT int lib3270_move_cursor(H3270 *hSession, LIB3270_DIRECTION dir, u
715 lib3270_select_to(hSession,cursor_addr); 716 lib3270_select_to(hSession,cursor_addr);
716 else 717 else
717 cursor_move(hSession,cursor_addr); 718 cursor_move(hSession,cursor_addr);
  719 +
  720 + return 0;
718 } 721 }
719 722
@@ -30,11 +30,19 @@ @@ -30,11 +30,19 @@
30 * 30 *
31 */ 31 */
32 32
  33 +#ifndef ANDROID
  34 + #include <stdlib.h>
  35 +#endif // !ANDROID
33 36
34 #include "globals.h" 37 #include "globals.h"
35 #include "charsetc.h" 38 #include "charsetc.h"
36 #include "kybdc.h" 39 #include "kybdc.h"
37 #include "ansic.h" 40 #include "ansic.h"
  41 +#include "togglesc.h"
  42 +#include "screen.h"
  43 +#include "screenc.h"
  44 +#include "ctlrc.h"
  45 +#include "ftc.h"
38 46
39 /*---[ Globals ]--------------------------------------------------------------------------------------------------------------*/ 47 /*---[ Globals ]--------------------------------------------------------------------------------------------------------------*/
40 48
@@ -119,18 +127,18 @@ static void set_cursor(H3270 *session, LIB3270_CURSOR id) @@ -119,18 +127,18 @@ static void set_cursor(H3270 *session, LIB3270_CURSOR id)
119 { 127 {
120 } 128 }
121 129
122 -static void message(H3270 *session, LIB3270_NOTIFY id , const char *title, const char *message, const char *text) 130 +static void message(H3270 *session, LIB3270_NOTIFY id , const char *title, const char *msg, const char *text)
123 { 131 {
124 #ifdef ANDROID 132 #ifdef ANDROID
125 133
126 __android_log_print(ANDROID_LOG_VERBOSE, PACKAGE_NAME, "%s\n",title); 134 __android_log_print(ANDROID_LOG_VERBOSE, PACKAGE_NAME, "%s\n",title);
127 - __android_log_print(ANDROID_LOG_VERBOSE, PACKAGE_NAME, "%s\n",message); 135 + __android_log_print(ANDROID_LOG_VERBOSE, PACKAGE_NAME, "%s\n",msg);
128 __android_log_print(ANDROID_LOG_VERBOSE, PACKAGE_NAME, "%s\n",text); 136 __android_log_print(ANDROID_LOG_VERBOSE, PACKAGE_NAME, "%s\n",text);
129 137
130 #else 138 #else
131 139
132 lib3270_write_log(session,"%s",title); 140 lib3270_write_log(session,"%s",title);
133 - lib3270_write_log(session,"%s",message); 141 + lib3270_write_log(session,"%s",msg);
134 lib3270_write_log(session,"%s",text); 142 lib3270_write_log(session,"%s",text);
135 143
136 #endif // ANDROID 144 #endif // ANDROID
@@ -370,7 +370,7 @@ static void continue_tls(unsigned char *sbbuf, int len); @@ -370,7 +370,7 @@ static void continue_tls(unsigned char *sbbuf, int len);
370 370
371 /*--[ Implement ]------------------------------------------------------------------------------------*/ 371 /*--[ Implement ]------------------------------------------------------------------------------------*/
372 372
373 -void set_ssl_state(H3270 *session, LIB3270_SSL_STATE state) 373 +static void set_ssl_state(H3270 *session, LIB3270_SSL_STATE state)
374 { 374 {
375 if(state == session->secure) 375 if(state == session->secure)
376 return; 376 return;
1 1
2 #include <stdio.h> 2 #include <stdio.h>
3 #include <string.h> 3 #include <string.h>
  4 +#include <pthread.h>
  5 +
4 #include "globals.h" 6 #include "globals.h"
5 #include <lib3270/macros.h> 7 #include <lib3270/macros.h>
6 8
7 #define MAX_ARGS 10 9 #define MAX_ARGS 10
8 10
  11 +#include <pthread.h>
  12 +
  13 +static H3270 *session = NULL;
  14 +
  15 +static void * mainloop(void *dunno)
  16 +{
  17 + while(session)
  18 + {
  19 + lib3270_main_iterate(session,1);
  20 + }
  21 + return NULL;
  22 +}
  23 +
9 int main(int numpar, char *param[]) 24 int main(int numpar, char *param[])
10 { 25 {
11 - H3270 * h;  
12 - char line[4096]; 26 + H3270 * h;
  27 + char line[4096];
  28 + pthread_t thread;
13 29
14 lib3270_initialize(); 30 lib3270_initialize();
15 31
16 - h = lib3270_session_new(""); 32 + session = h = lib3270_session_new("");
17 printf("3270 session %p created\n]",h); 33 printf("3270 session %p created\n]",h);
18 34
  35 + pthread_create(&thread, NULL, mainloop, NULL);
  36 +
19 while(fgets(line,4095,stdin)) 37 while(fgets(line,4095,stdin))
20 { 38 {
21 const LIB3270_MACRO_LIST *cmd = get_3270_calls(); 39 const LIB3270_MACRO_LIST *cmd = get_3270_calls();
@@ -52,7 +70,7 @@ int main(int numpar, char *param[]) @@ -52,7 +70,7 @@ int main(int numpar, char *param[])
52 if(str) 70 if(str)
53 { 71 {
54 printf("\n%s\n",str); 72 printf("\n%s\n",str);
55 - free(str); 73 + lib3270_free(str);
56 } 74 }
57 else 75 else
58 { 76 {
@@ -66,6 +84,9 @@ int main(int numpar, char *param[]) @@ -66,6 +84,9 @@ int main(int numpar, char *param[])
66 84
67 } 85 }
68 86
  87 + session = 0;
  88 + pthread_cancel(thread);
  89 +
69 printf("Ending 3270 session %p\n",h); 90 printf("Ending 3270 session %p\n",h);
70 lib3270_session_free(h); 91 lib3270_session_free(h);
71 92
@@ -95,10 +95,12 @@ static char *dcs[] = { // same order as enum UTF_IX and utf8_tab[] @@ -95,10 +95,12 @@ static char *dcs[] = { // same order as enum UTF_IX and utf8_tab[]
95 * Note that this could be done much more generally with the iconv library 95 * Note that this could be done much more generally with the iconv library
96 * or the ICU library, but there is no guarantee that either is available or 96 * or the ICU library, but there is no guarantee that either is available or
97 * properly configured. 97 * properly configured.
98 - */ 98 + */ /*
99 #define HI_SIZE 96 99 #define HI_SIZE 96
100 static char *utf8_tab[U_MAX][96] = { 100 static char *utf8_tab[U_MAX][96] = {
101 -/* iso8859-1 */ { 101 +
  102 + // iso8859-1
  103 + {
102 "\xc2\xa0", "\xc2\xa1", "\xc2\xa2", "\xc2\xa3", 104 "\xc2\xa0", "\xc2\xa1", "\xc2\xa2", "\xc2\xa3",
103 "\xc2\xa4", "\xc2\xa5", "\xc2\xa6", "\xc2\xa7", 105 "\xc2\xa4", "\xc2\xa5", "\xc2\xa6", "\xc2\xa7",
104 "\xc2\xa8", "\xc2\xa9", "\xc2\xaa", "\xc2\xab", 106 "\xc2\xa8", "\xc2\xa9", "\xc2\xaa", "\xc2\xab",
@@ -124,7 +126,8 @@ static char *utf8_tab[U_MAX][96] = { @@ -124,7 +126,8 @@ static char *utf8_tab[U_MAX][96] = {
124 "\xc3\xb8", "\xc3\xb9", "\xc3\xba", "\xc3\xbb", 126 "\xc3\xb8", "\xc3\xb9", "\xc3\xba", "\xc3\xbb",
125 "\xc3\xbc", "\xc3\xbd", "\xc3\xbe", "\xc3\xbf" 127 "\xc3\xbc", "\xc3\xbd", "\xc3\xbe", "\xc3\xbf"
126 }, 128 },
127 -/* iso8859-2 */ { 129 +// iso8859-2
  130 +{
128 "\xc2\xa0", "\xc4\x84", "\xcb\x98", "\xc5\x81", 131 "\xc2\xa0", "\xc4\x84", "\xcb\x98", "\xc5\x81",
129 "\xc2\xa4", "\xc4\xbd", "\xc5\x9a", "\xc2\xa7", 132 "\xc2\xa4", "\xc4\xbd", "\xc5\x9a", "\xc2\xa7",
130 "\xc2\xa8", "\xc5\xa0", "\xc5\x9e", "\xc5\xa4", 133 "\xc2\xa8", "\xc5\xa0", "\xc5\x9e", "\xc5\xa4",
@@ -150,7 +153,8 @@ static char *utf8_tab[U_MAX][96] = { @@ -150,7 +153,8 @@ static char *utf8_tab[U_MAX][96] = {
150 "\xc5\x99", "\xc5\xaf", "\xc3\xba", "\xc5\xb1", 153 "\xc5\x99", "\xc5\xaf", "\xc3\xba", "\xc5\xb1",
151 "\xc3\xbc", "\xc3\xbd", "\xc5\xa3", "\xcb\x99" 154 "\xc3\xbc", "\xc3\xbd", "\xc5\xa3", "\xcb\x99"
152 }, 155 },
153 -/* iso8859-7 */ { 156 +// iso8859-7
  157 +{
154 "\xc2\xa0", "\xe2\x80\x98", "\xe2\x80\x99", "\xc2\xa3", 158 "\xc2\xa0", "\xe2\x80\x98", "\xe2\x80\x99", "\xc2\xa3",
155 "\xe2\x82\xac", "\xe2\x82\xaf", "\xc2\xa6", "\xc2\xa7", 159 "\xe2\x82\xac", "\xe2\x82\xaf", "\xc2\xa6", "\xc2\xa7",
156 "\xc2\xa8", "\xc2\xa9", "\xcd\xba", "\xc2\xab", 160 "\xc2\xa8", "\xc2\xa9", "\xcd\xba", "\xc2\xab",
@@ -176,7 +180,8 @@ static char *utf8_tab[U_MAX][96] = { @@ -176,7 +180,8 @@ static char *utf8_tab[U_MAX][96] = {
176 "\xcf\x88", "\xcf\x89", "\xcf\x8a", "\xcf\x8b", 180 "\xcf\x88", "\xcf\x89", "\xcf\x8a", "\xcf\x8b",
177 "\xcf\x8c", "\xcf\x8d", "\xcf\x8e", " " 181 "\xcf\x8c", "\xcf\x8d", "\xcf\x8e", " "
178 }, 182 },
179 -/* iso8859-8 */ { 183 +// iso8859-8
  184 +{
180 "\xc2\xa0", " ", "\xc2\xa2", "\xc2\xa3", 185 "\xc2\xa0", " ", "\xc2\xa2", "\xc2\xa3",
181 "\xc2\xa4", "\xc2\xa5", "\xc2\xa6", "\xc2\xa7", 186 "\xc2\xa4", "\xc2\xa5", "\xc2\xa6", "\xc2\xa7",
182 "\xc2\xa8", "\xc2\xa9", "\xc3\x97", "\xc2\xab", 187 "\xc2\xa8", "\xc2\xa9", "\xc3\x97", "\xc2\xab",
@@ -202,7 +207,8 @@ static char *utf8_tab[U_MAX][96] = { @@ -202,7 +207,8 @@ static char *utf8_tab[U_MAX][96] = {
202 "\xd7\xa8", "\xd7\xa9", "\xd7\xaa", " ", 207 "\xd7\xa8", "\xd7\xa9", "\xd7\xaa", " ",
203 " ", "\xe2\x80\x8e", "\xe2\x80\x8f", " " 208 " ", "\xe2\x80\x8e", "\xe2\x80\x8f", " "
204 }, 209 },
205 -/* iso8859-9 */ { 210 +// iso8859-9
  211 +{
206 "\xc2\xa0", "\xc2\xa1", "\xc2\xa2", "\xc2\xa3", 212 "\xc2\xa0", "\xc2\xa1", "\xc2\xa2", "\xc2\xa3",
207 "\xc2\xa4", "\xc2\xa5", "\xc2\xa6", "\xc2\xa7", 213 "\xc2\xa4", "\xc2\xa5", "\xc2\xa6", "\xc2\xa7",
208 "\xc2\xa8", "\xc2\xa9", "\xc2\xaa", "\xc2\xab", 214 "\xc2\xa8", "\xc2\xa9", "\xc2\xaa", "\xc2\xab",
@@ -228,7 +234,8 @@ static char *utf8_tab[U_MAX][96] = { @@ -228,7 +234,8 @@ static char *utf8_tab[U_MAX][96] = {
228 "\xc3\xb8", "\xc3\xb9", "\xc3\xba", "\xc3\xbb", 234 "\xc3\xb8", "\xc3\xb9", "\xc3\xba", "\xc3\xbb",
229 "\xc3\xbc", "\xc4\xb1", "\xc5\x9f", "\xc3\xbf" 235 "\xc3\xbc", "\xc4\xb1", "\xc5\x9f", "\xc3\xbf"
230 }, 236 },
231 -/* iso8859-11 */ { 237 +// iso8859-11
  238 +{
232 "\xc2\xa0", "\xe0\xb8\x81", "\xe0\xb8\x82", "\xe0\xb8\x83", 239 "\xc2\xa0", "\xe0\xb8\x81", "\xe0\xb8\x82", "\xe0\xb8\x83",
233 "\xe0\xb8\x84", "\xe0\xb8\x85", "\xe0\xb8\x86", "\xe0\xb8\x87", 240 "\xe0\xb8\x84", "\xe0\xb8\x85", "\xe0\xb8\x86", "\xe0\xb8\x87",
234 "\xe0\xb8\x88", "\xe0\xb8\x89", "\xe0\xb8\x8a", "\xe0\xb8\x8b", 241 "\xe0\xb8\x88", "\xe0\xb8\x89", "\xe0\xb8\x8a", "\xe0\xb8\x8b",
@@ -254,7 +261,8 @@ static char *utf8_tab[U_MAX][96] = { @@ -254,7 +261,8 @@ static char *utf8_tab[U_MAX][96] = {
254 "\xe0\xb9\x98", "\xe0\xb9\x99", "\xe0\xb9\x9a", "\xe0\xb9\x9b", 261 "\xe0\xb9\x98", "\xe0\xb9\x99", "\xe0\xb9\x9a", "\xe0\xb9\x9b",
255 " ", " ", " ", " " 262 " ", " ", " ", " "
256 }, 263 },
257 -/* iso8859-15 */ { 264 +// iso8859-15
  265 +{
258 "\xc2\xa0", "\xc2\xa1", "\xc2\xa2", "\xc2\xa3", 266 "\xc2\xa0", "\xc2\xa1", "\xc2\xa2", "\xc2\xa3",
259 "\xe2\x82\xac", "\xc2\xa5", "\xc5\xa0", "\xc2\xa7", 267 "\xe2\x82\xac", "\xc2\xa5", "\xc5\xa0", "\xc2\xa7",
260 "\xc5\xa1", "\xc2\xa9", "\xc2\xaa", "\xc2\xab", 268 "\xc5\xa1", "\xc2\xa9", "\xc2\xaa", "\xc2\xab",
@@ -280,7 +288,8 @@ static char *utf8_tab[U_MAX][96] = { @@ -280,7 +288,8 @@ static char *utf8_tab[U_MAX][96] = {
280 "\xc3\xb8", "\xc3\xb9", "\xc3\xba", "\xc3\xbb", 288 "\xc3\xb8", "\xc3\xb9", "\xc3\xba", "\xc3\xbb",
281 "\xc3\xbc", "\xc3\xbd", "\xc3\xbe", "\xc3\xbf" 289 "\xc3\xbc", "\xc3\xbd", "\xc3\xbe", "\xc3\xbf"
282 }, 290 },
283 -/* koi8-r */ { 291 +// koi8-r
  292 +{
284 "\xe2\x95\x90", "\xe2\x95\x91", "\xe2\x95\x92", "\xd1\x91", 293 "\xe2\x95\x90", "\xe2\x95\x91", "\xe2\x95\x92", "\xd1\x91",
285 "\xe2\x95\x93", "\xe2\x95\x94", "\xe2\x95\x95", "\xe2\x95\x96", 294 "\xe2\x95\x93", "\xe2\x95\x94", "\xe2\x95\x95", "\xe2\x95\x96",
286 "\xe2\x95\x97", "\xe2\x95\x98", "\xe2\x95\x99", "\xe2\x95\x9a", 295 "\xe2\x95\x97", "\xe2\x95\x98", "\xe2\x95\x99", "\xe2\x95\x9a",
@@ -306,8 +315,9 @@ static char *utf8_tab[U_MAX][96] = { @@ -306,8 +315,9 @@ static char *utf8_tab[U_MAX][96] = {
306 "\xd0\xac", "\xd0\xab", "\xd0\x97", "\xd0\xa8", 315 "\xd0\xac", "\xd0\xab", "\xd0\x97", "\xd0\xa8",
307 "\xd0\xad", "\xd0\xa9", "\xd0\xa7", "\xd0\xaa" 316 "\xd0\xad", "\xd0\xa9", "\xd0\xa7", "\xd0\xaa"
308 }, 317 },
309 -#if defined(X3270_DBCS) /*[*/  
310 -/* pseudo-gb18030 - not actually a UTF-8 expansion */ { 318 +#if defined(X3270_DBCS)
  319 +// pseudo-gb18030 - not actually a UTF-8 expansion
  320 +{
311 "\x81\x30\x84\x32", "\x81\x30\x84\x33", "\x81\x30\x84\x34", "\x81\x30\x84\x35", 321 "\x81\x30\x84\x32", "\x81\x30\x84\x33", "\x81\x30\x84\x34", "\x81\x30\x84\x35",
312 "\xa1\xe8", "\x81\x30\x84\x36", "\x81\x30\x84\x37", "\xa1\xec", 322 "\xa1\xe8", "\x81\x30\x84\x36", "\x81\x30\x84\x37", "\xa1\xec",
313 "\xa1\xa7", "\x81\x30\x84\x38", "\x81\x30\x84\x39", "\x81\x30\x85\x30", 323 "\xa1\xa7", "\x81\x30\x84\x38", "\x81\x30\x84\x39", "\x81\x30\x85\x30",
@@ -333,9 +343,9 @@ static char *utf8_tab[U_MAX][96] = { @@ -333,9 +343,9 @@ static char *utf8_tab[U_MAX][96] = {
333 "\x81\x30\x8b\x33", "\xa8\xb4", "\xa8\xb2", "\x81\x30\x8b\x34", 343 "\x81\x30\x8b\x33", "\xa8\xb4", "\xa8\xb2", "\x81\x30\x8b\x34",
334 "\xa8\xb9", "\x81\x30\x8b\x35", "\x81\x30\x8b\x36", "\x81\x30\x8b\x37" 344 "\xa8\xb9", "\x81\x30\x8b\x35", "\x81\x30\x8b\x36", "\x81\x30\x8b\x37"
335 } 345 }
336 -#endif /*]*/ 346 +#endif
337 }; 347 };
338 - 348 +*/
339 /* 349 /*
340 * Look up a multi-byte UTF-8 string and return its value in the 'implied' 350 * Look up a multi-byte UTF-8 string and return its value in the 'implied'
341 * character set. 351 * character set.
@@ -66,6 +66,7 @@ @@ -66,6 +66,7 @@
66 #include "resources.h" 66 #include "resources.h"
67 67
68 #include "utilc.h" 68 #include "utilc.h"
  69 +#include "popupsc.h"
69 #include "api.h" 70 #include "api.h"
70 71
71 #define my_isspace(c) isspace((unsigned char)c) 72 #define my_isspace(c) isspace((unsigned char)c)