Commit 812c356fc82e00078f0b06573f6b2ba427a2737c
1 parent
ea65f9ed
Exists in
master
and in
3 other branches
Reduzindo warnings, reativando programa de teste da biblioteca
Showing
17 changed files
with
134 additions
and
93 deletions
Show diff stats
charset.c
| ... | ... | @@ -45,6 +45,10 @@ |
| 45 | 45 | #include "kybdc.h" |
| 46 | 46 | #include "popupsc.h" |
| 47 | 47 | |
| 48 | +#ifndef ANDROID | |
| 49 | + #include <stdlib.h> | |
| 50 | +#endif // !ANDROID | |
| 51 | + | |
| 48 | 52 | /* |
| 49 | 53 | #if defined(X3270_DISPLAY) || (defined(C3270) && !defined(_WIN32)) |
| 50 | 54 | #include "screenc.h" |
| ... | ... | @@ -199,8 +203,8 @@ wide_resource_init(char *csname) |
| 199 | 203 | */ |
| 200 | 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 | 208 | enum cs_result rc; |
| 205 | 209 | char *ccs, *cftcs; |
| 206 | 210 | const char *ak; | ... | ... |
globals.h
| ... | ... | @@ -352,3 +352,5 @@ LIB3270_INTERNAL int cursor_move(H3270 *session, int baddr); |
| 352 | 352 | LIB3270_INTERNAL void add_input_calls(H3270 *, void (*)(H3270 *), void (*)(H3270 *)); |
| 353 | 353 | |
| 354 | 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); | ... | ... |
glue.c
html.c
| ... | ... | @@ -161,7 +161,7 @@ |
| 161 | 161 | |
| 162 | 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 | 165 | struct html_info info; |
| 166 | 166 | |
| 167 | 167 | memset(&info,0,sizeof(info)); |
| ... | ... | @@ -180,16 +180,24 @@ |
| 180 | 180 | baddr = 0; |
| 181 | 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 | 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 | 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 | 202 | static const struct chr_xlat xlat[] = |
| 195 | 203 | { |
| ... | ... | @@ -213,7 +221,7 @@ |
| 213 | 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 | 227 | else |
| ... | ... | @@ -224,19 +232,21 @@ |
| 224 | 232 | { '&', "&" }, |
| 225 | 233 | { '<', "<" }, |
| 226 | 234 | { '>', ">" }, |
| 235 | + { ' ', " " }, | |
| 227 | 236 | |
| 228 | 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 | 250 | append_element(&info,HTML_ELEMENT_LINE_BREAK); |
| 241 | 251 | } |
| 242 | 252 | ... | ... |
iocalls.c
| ... | ... | @@ -34,6 +34,7 @@ |
| 34 | 34 | #include <sys/types.h> |
| 35 | 35 | #include "xioc.h" |
| 36 | 36 | #include "telnetc.h" |
| 37 | +#include "utilc.h" | |
| 37 | 38 | |
| 38 | 39 | #define MILLION 1000000L |
| 39 | 40 | #define InputReadMask 0x1 |
| ... | ... | @@ -54,7 +55,7 @@ static void * internal_add_except(int source, H3270 *session, void (*fn)(H3270 * |
| 54 | 55 | |
| 55 | 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 | 60 | static int internal_callthread(int(*callback)(H3270 *, void *), H3270 *session, void *parm); |
| 60 | 61 | static int internal_wait(int seconds); |
| ... | ... | @@ -505,6 +506,7 @@ static int internal_event_dispatcher(int block) |
| 505 | 506 | static int internal_callthread(int(*callback)(H3270 *, void *), H3270 *session, void *parm) |
| 506 | 507 | { |
| 507 | 508 | callback(session,parm); |
| 509 | + return 0; | |
| 508 | 510 | } |
| 509 | 511 | |
| 510 | 512 | static int internal_wait(int seconds) |
| ... | ... | @@ -651,7 +653,7 @@ LIB3270_EXPORT int lib3270_register_handlers(const struct lib3270_callbacks *cbk |
| 651 | 653 | |
| 652 | 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 | 657 | CHECK_SESSION_HANDLE(h); |
| 656 | 658 | |
| 657 | 659 | if(h->set_timer) |
| ... | ... | @@ -664,7 +666,7 @@ LIB3270_EXPORT int lib3270_call_thread(int(*callback)(H3270 *h, void *), H3270 * |
| 664 | 666 | if(h->set_timer) |
| 665 | 667 | h->set_timer(h,0); |
| 666 | 668 | |
| 667 | - return rc; | |
| 669 | + return 0; | |
| 668 | 670 | } |
| 669 | 671 | |
| 670 | 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 | 678 | LIB3270_EXPORT int lib3270_wait(seconds) |
| 677 | 679 | { |
| 678 | 680 | wait(seconds); |
| 681 | + return 0; | |
| 679 | 682 | } |
| 680 | 683 | |
| 681 | 684 | LIB3270_EXPORT void lib3270_ring_bell(H3270 *session) | ... | ... |
kybd.c
| ... | ... | @@ -37,6 +37,10 @@ |
| 37 | 37 | |
| 38 | 38 | #include "globals.h" |
| 39 | 39 | |
| 40 | +#ifndef ANDROID | |
| 41 | + #include <stdlib.h> | |
| 42 | +#endif // !ANDROID | |
| 43 | + | |
| 40 | 44 | #if defined(X3270_DISPLAY) /*[*/ |
| 41 | 45 | #include <X11/Xatom.h> |
| 42 | 46 | #endif |
| ... | ... | @@ -2264,6 +2268,8 @@ LIB3270_ACTION( dup ) |
| 2264 | 2268 | hSession->display(hSession); |
| 2265 | 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 | 2280 | if (kybdlock) |
| 2275 | 2281 | { |
| 2276 | 2282 | ENQUEUE_ACTION(lib3270_fieldmark); |
| 2277 | - return; | |
| 2283 | + return 0; | |
| 2278 | 2284 | } |
| 2279 | 2285 | #if defined(X3270_ANSI) |
| 2280 | 2286 | if (IN_ANSI) |
| 2281 | - return; | |
| 2287 | + return 0 ; | |
| 2282 | 2288 | #endif |
| 2283 | 2289 | (void) key_Character(EBC_fm, False, False, NULL); |
| 2290 | + | |
| 2291 | + return 0; | |
| 2284 | 2292 | } |
| 2285 | 2293 | |
| 2286 | 2294 | /** | ... | ... |
lib3270.cbp
| ... | ... | @@ -9,9 +9,8 @@ |
| 9 | 9 | <Target title="Debug"> |
| 10 | 10 | <Option output=".bin/Debug/lib3270" prefix_auto="1" extension_auto="1" /> |
| 11 | 11 | <Option object_output=".obj/Debug/" /> |
| 12 | - <Option type="1" /> | |
| 12 | + <Option type="3" /> | |
| 13 | 13 | <Option compiler="gcc" /> |
| 14 | - <Option use_console_runner="0" /> | |
| 15 | 14 | <Compiler> |
| 16 | 15 | <Add option="-g" /> |
| 17 | 16 | <Add option="-DDEBUG=1" /> |
| ... | ... | @@ -52,10 +51,14 @@ |
| 52 | 51 | <Add option="-Wunreachable-code" /> |
| 53 | 52 | <Add option="-Wmissing-declarations" /> |
| 54 | 53 | <Add option="-Wall" /> |
| 54 | + <Add option="-pthread" /> | |
| 55 | 55 | <Add option="-DLIB3270=1" /> |
| 56 | 56 | <Add directory="../include" /> |
| 57 | 57 | <Add directory="../include/lib3270" /> |
| 58 | 58 | </Compiler> |
| 59 | + <Linker> | |
| 60 | + <Add option="-pthread" /> | |
| 61 | + </Linker> | |
| 59 | 62 | <Unit filename="../include/lib3270.h" /> |
| 60 | 63 | <Unit filename="../include/lib3270/action_table.h" /> |
| 61 | 64 | <Unit filename="../include/lib3270/actions.h" /> |
| ... | ... | @@ -68,24 +71,18 @@ |
| 68 | 71 | <Unit filename="3270ds.h" /> |
| 69 | 72 | <Unit filename="Makefile.in" /> |
| 70 | 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 | 74 | <Unit filename="actionsc.h" /> |
| 78 | 75 | <Unit filename="ansi.c"> |
| 79 | 76 | <Option compilerVar="CC" /> |
| 80 | 77 | </Unit> |
| 81 | 78 | <Unit filename="ansic.h" /> |
| 82 | 79 | <Unit filename="api.h" /> |
| 83 | - <Unit filename="apl.c"> | |
| 84 | - <Option compilerVar="CC" /> | |
| 85 | - </Unit> | |
| 86 | 80 | <Unit filename="aplc.h" /> |
| 87 | 81 | <Unit filename="appres.h" /> |
| 88 | 82 | <Unit filename="arpa_telnet.h" /> |
| 83 | + <Unit filename="bounds.c"> | |
| 84 | + <Option compilerVar="CC" /> | |
| 85 | + </Unit> | |
| 89 | 86 | <Unit filename="cg.h" /> |
| 90 | 87 | <Unit filename="charset.c"> |
| 91 | 88 | <Option compilerVar="CC" /> |
| ... | ... | @@ -125,7 +122,7 @@ |
| 125 | 122 | </Unit> |
| 126 | 123 | <Unit filename="hostc.h" /> |
| 127 | 124 | <Unit filename="icmdc.h" /> |
| 128 | - <Unit filename="init.c"> | |
| 125 | + <Unit filename="iocalls.c"> | |
| 129 | 126 | <Option compilerVar="CC" /> |
| 130 | 127 | </Unit> |
| 131 | 128 | <Unit filename="keypadc.h" /> |
| ... | ... | @@ -183,11 +180,17 @@ |
| 183 | 180 | <Unit filename="selection.c"> |
| 184 | 181 | <Option compilerVar="CC" /> |
| 185 | 182 | </Unit> |
| 183 | + <Unit filename="session.c"> | |
| 184 | + <Option compilerVar="CC" /> | |
| 185 | + </Unit> | |
| 186 | 186 | <Unit filename="sf.c"> |
| 187 | 187 | <Option compilerVar="CC" /> |
| 188 | 188 | </Unit> |
| 189 | 189 | <Unit filename="sfc.h" /> |
| 190 | 190 | <Unit filename="shlobj_missing.h" /> |
| 191 | + <Unit filename="state.c"> | |
| 192 | + <Option compilerVar="CC" /> | |
| 193 | + </Unit> | |
| 191 | 194 | <Unit filename="statusc.h" /> |
| 192 | 195 | <Unit filename="tables.c"> |
| 193 | 196 | <Option compilerVar="CC" /> |
| ... | ... | @@ -221,18 +224,9 @@ |
| 221 | 224 | <Unit filename="version.c"> |
| 222 | 225 | <Option compilerVar="CC" /> |
| 223 | 226 | </Unit> |
| 224 | - <Unit filename="w3misc.c"> | |
| 225 | - <Option compilerVar="CC" /> | |
| 226 | - </Unit> | |
| 227 | 227 | <Unit filename="w3miscc.h" /> |
| 228 | 228 | <Unit filename="widec.h" /> |
| 229 | - <Unit filename="winvers.c"> | |
| 230 | - <Option compilerVar="CC" /> | |
| 231 | - </Unit> | |
| 232 | 229 | <Unit filename="winversc.h" /> |
| 233 | - <Unit filename="xio.c"> | |
| 234 | - <Option compilerVar="CC" /> | |
| 235 | - </Unit> | |
| 236 | 230 | <Unit filename="xioc.h" /> |
| 237 | 231 | <Unit filename="xl.h" /> |
| 238 | 232 | <Extensions> | ... | ... |
macros.c
| ... | ... | @@ -104,30 +104,15 @@ |
| 104 | 104 | |
| 105 | 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 | 109 | switch(argc) |
| 112 | 110 | { |
| 113 | 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 | 116 | case 2: // Just size, get current cursor position |
| 132 | 117 | start = 0; |
| 133 | 118 | qtd = atoi(argv[1]); |
| ... | ... | @@ -153,22 +138,11 @@ |
| 153 | 138 | start = (row * cols) + col; |
| 154 | 139 | qtd = atoi(argv[3]); |
| 155 | 140 | break; |
| 156 | - | |
| 141 | +*/ | |
| 157 | 142 | default: |
| 158 | 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 | 146 | return buffer; |
| 173 | 147 | } |
| 174 | 148 | ... | ... |
resolver.c
| ... | ... | @@ -76,6 +76,7 @@ static int get_rpq_address(unsigned char buf[], const int buflen); |
| 76 | 76 | static void rpq_warning(const char *fmt, ...); |
| 77 | 77 | static void rpq_dump_warnings(void); |
| 78 | 78 | static Boolean rpq_complained = False; |
| 79 | + | |
| 79 | 80 | #if !defined(_WIN32) /*[*/ |
| 80 | 81 | static Boolean omit_due_space_limit = False; |
| 81 | 82 | #endif /*]*/ | ... | ... |
selection.c
| ... | ... | @@ -349,7 +349,7 @@ LIB3270_ACTION( selectfield ) |
| 349 | 349 | |
| 350 | 350 | LIB3270_ACTION( selectall ) |
| 351 | 351 | { |
| 352 | - int len, baddr; | |
| 352 | +// int len, baddr; | |
| 353 | 353 | |
| 354 | 354 | CHECK_SESSION_HANDLE(hSession); |
| 355 | 355 | |
| ... | ... | @@ -360,7 +360,7 @@ LIB3270_ACTION( selectall ) |
| 360 | 360 | |
| 361 | 361 | LIB3270_ACTION( reselect ) |
| 362 | 362 | { |
| 363 | - int start, end; | |
| 363 | +// int start, end; | |
| 364 | 364 | |
| 365 | 365 | CHECK_SESSION_HANDLE(hSession); |
| 366 | 366 | |
| ... | ... | @@ -542,7 +542,8 @@ LIB3270_EXPORT int lib3270_get_selection_bounds(H3270 *hSession, int *start, int |
| 542 | 542 | LIB3270_EXPORT int lib3270_move_selected_area(H3270 *hSession, int from, int to) |
| 543 | 543 | { |
| 544 | 544 | int pos[2]; |
| 545 | - int rows, cols, f, step, start, end; | |
| 545 | + int rows, cols, f, step; | |
| 546 | + // , start, end; | |
| 546 | 547 | |
| 547 | 548 | if(!lib3270_get_selection_bounds(hSession,&pos[0],&pos[1])) |
| 548 | 549 | return from; |
| ... | ... | @@ -715,5 +716,7 @@ LIB3270_EXPORT int lib3270_move_cursor(H3270 *hSession, LIB3270_DIRECTION dir, u |
| 715 | 716 | lib3270_select_to(hSession,cursor_addr); |
| 716 | 717 | else |
| 717 | 718 | cursor_move(hSession,cursor_addr); |
| 719 | + | |
| 720 | + return 0; | |
| 718 | 721 | } |
| 719 | 722 | ... | ... |
session.c
| ... | ... | @@ -30,11 +30,19 @@ |
| 30 | 30 | * |
| 31 | 31 | */ |
| 32 | 32 | |
| 33 | +#ifndef ANDROID | |
| 34 | + #include <stdlib.h> | |
| 35 | +#endif // !ANDROID | |
| 33 | 36 | |
| 34 | 37 | #include "globals.h" |
| 35 | 38 | #include "charsetc.h" |
| 36 | 39 | #include "kybdc.h" |
| 37 | 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 | 47 | /*---[ Globals ]--------------------------------------------------------------------------------------------------------------*/ |
| 40 | 48 | |
| ... | ... | @@ -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 | 132 | #ifdef ANDROID |
| 125 | 133 | |
| 126 | 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 | 136 | __android_log_print(ANDROID_LOG_VERBOSE, PACKAGE_NAME, "%s\n",text); |
| 129 | 137 | |
| 130 | 138 | #else |
| 131 | 139 | |
| 132 | 140 | lib3270_write_log(session,"%s",title); |
| 133 | - lib3270_write_log(session,"%s",message); | |
| 141 | + lib3270_write_log(session,"%s",msg); | |
| 134 | 142 | lib3270_write_log(session,"%s",text); |
| 135 | 143 | |
| 136 | 144 | #endif // ANDROID | ... | ... |
telnet.c
| ... | ... | @@ -370,7 +370,7 @@ static void continue_tls(unsigned char *sbbuf, int len); |
| 370 | 370 | |
| 371 | 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 | 375 | if(state == session->secure) |
| 376 | 376 | return; | ... | ... |
testprogram.c
| 1 | 1 | |
| 2 | 2 | #include <stdio.h> |
| 3 | 3 | #include <string.h> |
| 4 | +#include <pthread.h> | |
| 5 | + | |
| 4 | 6 | #include "globals.h" |
| 5 | 7 | #include <lib3270/macros.h> |
| 6 | 8 | |
| 7 | 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 | 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 | 30 | lib3270_initialize(); |
| 15 | 31 | |
| 16 | - h = lib3270_session_new(""); | |
| 32 | + session = h = lib3270_session_new(""); | |
| 17 | 33 | printf("3270 session %p created\n]",h); |
| 18 | 34 | |
| 35 | + pthread_create(&thread, NULL, mainloop, NULL); | |
| 36 | + | |
| 19 | 37 | while(fgets(line,4095,stdin)) |
| 20 | 38 | { |
| 21 | 39 | const LIB3270_MACRO_LIST *cmd = get_3270_calls(); |
| ... | ... | @@ -52,7 +70,7 @@ int main(int numpar, char *param[]) |
| 52 | 70 | if(str) |
| 53 | 71 | { |
| 54 | 72 | printf("\n%s\n",str); |
| 55 | - free(str); | |
| 73 | + lib3270_free(str); | |
| 56 | 74 | } |
| 57 | 75 | else |
| 58 | 76 | { |
| ... | ... | @@ -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 | 90 | printf("Ending 3270 session %p\n",h); |
| 70 | 91 | lib3270_session_free(h); |
| 71 | 92 | ... | ... |
utf8.c
| ... | ... | @@ -95,10 +95,12 @@ static char *dcs[] = { // same order as enum UTF_IX and utf8_tab[] |
| 95 | 95 | * Note that this could be done much more generally with the iconv library |
| 96 | 96 | * or the ICU library, but there is no guarantee that either is available or |
| 97 | 97 | * properly configured. |
| 98 | - */ | |
| 98 | + */ /* | |
| 99 | 99 | #define HI_SIZE 96 |
| 100 | 100 | static char *utf8_tab[U_MAX][96] = { |
| 101 | -/* iso8859-1 */ { | |
| 101 | + | |
| 102 | + // iso8859-1 | |
| 103 | + { | |
| 102 | 104 | "\xc2\xa0", "\xc2\xa1", "\xc2\xa2", "\xc2\xa3", |
| 103 | 105 | "\xc2\xa4", "\xc2\xa5", "\xc2\xa6", "\xc2\xa7", |
| 104 | 106 | "\xc2\xa8", "\xc2\xa9", "\xc2\xaa", "\xc2\xab", |
| ... | ... | @@ -124,7 +126,8 @@ static char *utf8_tab[U_MAX][96] = { |
| 124 | 126 | "\xc3\xb8", "\xc3\xb9", "\xc3\xba", "\xc3\xbb", |
| 125 | 127 | "\xc3\xbc", "\xc3\xbd", "\xc3\xbe", "\xc3\xbf" |
| 126 | 128 | }, |
| 127 | -/* iso8859-2 */ { | |
| 129 | +// iso8859-2 | |
| 130 | +{ | |
| 128 | 131 | "\xc2\xa0", "\xc4\x84", "\xcb\x98", "\xc5\x81", |
| 129 | 132 | "\xc2\xa4", "\xc4\xbd", "\xc5\x9a", "\xc2\xa7", |
| 130 | 133 | "\xc2\xa8", "\xc5\xa0", "\xc5\x9e", "\xc5\xa4", |
| ... | ... | @@ -150,7 +153,8 @@ static char *utf8_tab[U_MAX][96] = { |
| 150 | 153 | "\xc5\x99", "\xc5\xaf", "\xc3\xba", "\xc5\xb1", |
| 151 | 154 | "\xc3\xbc", "\xc3\xbd", "\xc5\xa3", "\xcb\x99" |
| 152 | 155 | }, |
| 153 | -/* iso8859-7 */ { | |
| 156 | +// iso8859-7 | |
| 157 | +{ | |
| 154 | 158 | "\xc2\xa0", "\xe2\x80\x98", "\xe2\x80\x99", "\xc2\xa3", |
| 155 | 159 | "\xe2\x82\xac", "\xe2\x82\xaf", "\xc2\xa6", "\xc2\xa7", |
| 156 | 160 | "\xc2\xa8", "\xc2\xa9", "\xcd\xba", "\xc2\xab", |
| ... | ... | @@ -176,7 +180,8 @@ static char *utf8_tab[U_MAX][96] = { |
| 176 | 180 | "\xcf\x88", "\xcf\x89", "\xcf\x8a", "\xcf\x8b", |
| 177 | 181 | "\xcf\x8c", "\xcf\x8d", "\xcf\x8e", " " |
| 178 | 182 | }, |
| 179 | -/* iso8859-8 */ { | |
| 183 | +// iso8859-8 | |
| 184 | +{ | |
| 180 | 185 | "\xc2\xa0", " ", "\xc2\xa2", "\xc2\xa3", |
| 181 | 186 | "\xc2\xa4", "\xc2\xa5", "\xc2\xa6", "\xc2\xa7", |
| 182 | 187 | "\xc2\xa8", "\xc2\xa9", "\xc3\x97", "\xc2\xab", |
| ... | ... | @@ -202,7 +207,8 @@ static char *utf8_tab[U_MAX][96] = { |
| 202 | 207 | "\xd7\xa8", "\xd7\xa9", "\xd7\xaa", " ", |
| 203 | 208 | " ", "\xe2\x80\x8e", "\xe2\x80\x8f", " " |
| 204 | 209 | }, |
| 205 | -/* iso8859-9 */ { | |
| 210 | +// iso8859-9 | |
| 211 | +{ | |
| 206 | 212 | "\xc2\xa0", "\xc2\xa1", "\xc2\xa2", "\xc2\xa3", |
| 207 | 213 | "\xc2\xa4", "\xc2\xa5", "\xc2\xa6", "\xc2\xa7", |
| 208 | 214 | "\xc2\xa8", "\xc2\xa9", "\xc2\xaa", "\xc2\xab", |
| ... | ... | @@ -228,7 +234,8 @@ static char *utf8_tab[U_MAX][96] = { |
| 228 | 234 | "\xc3\xb8", "\xc3\xb9", "\xc3\xba", "\xc3\xbb", |
| 229 | 235 | "\xc3\xbc", "\xc4\xb1", "\xc5\x9f", "\xc3\xbf" |
| 230 | 236 | }, |
| 231 | -/* iso8859-11 */ { | |
| 237 | +// iso8859-11 | |
| 238 | +{ | |
| 232 | 239 | "\xc2\xa0", "\xe0\xb8\x81", "\xe0\xb8\x82", "\xe0\xb8\x83", |
| 233 | 240 | "\xe0\xb8\x84", "\xe0\xb8\x85", "\xe0\xb8\x86", "\xe0\xb8\x87", |
| 234 | 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 | 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 | 266 | "\xc2\xa0", "\xc2\xa1", "\xc2\xa2", "\xc2\xa3", |
| 259 | 267 | "\xe2\x82\xac", "\xc2\xa5", "\xc5\xa0", "\xc2\xa7", |
| 260 | 268 | "\xc5\xa1", "\xc2\xa9", "\xc2\xaa", "\xc2\xab", |
| ... | ... | @@ -280,7 +288,8 @@ static char *utf8_tab[U_MAX][96] = { |
| 280 | 288 | "\xc3\xb8", "\xc3\xb9", "\xc3\xba", "\xc3\xbb", |
| 281 | 289 | "\xc3\xbc", "\xc3\xbd", "\xc3\xbe", "\xc3\xbf" |
| 282 | 290 | }, |
| 283 | -/* koi8-r */ { | |
| 291 | +// koi8-r | |
| 292 | +{ | |
| 284 | 293 | "\xe2\x95\x90", "\xe2\x95\x91", "\xe2\x95\x92", "\xd1\x91", |
| 285 | 294 | "\xe2\x95\x93", "\xe2\x95\x94", "\xe2\x95\x95", "\xe2\x95\x96", |
| 286 | 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 | 315 | "\xd0\xac", "\xd0\xab", "\xd0\x97", "\xd0\xa8", |
| 307 | 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 | 321 | "\x81\x30\x84\x32", "\x81\x30\x84\x33", "\x81\x30\x84\x34", "\x81\x30\x84\x35", |
| 312 | 322 | "\xa1\xe8", "\x81\x30\x84\x36", "\x81\x30\x84\x37", "\xa1\xec", |
| 313 | 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 | 343 | "\x81\x30\x8b\x33", "\xa8\xb4", "\xa8\xb2", "\x81\x30\x8b\x34", |
| 334 | 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 | 350 | * Look up a multi-byte UTF-8 string and return its value in the 'implied' |
| 341 | 351 | * character set. | ... | ... |