Commit 597d8ae92b130bcf24d65e4807f3d2724d1b2ea7
1 parent
2347f103
Exists in
master
and in
5 other branches
Incluindo handle de sessão nas funções de carga de recursos
Showing
8 changed files
with
82 additions
and
78 deletions
Show diff stats
src/include/lib3270.h
| ... | ... | @@ -867,7 +867,7 @@ |
| 867 | 867 | * @return Resource string (Release with lib3270_free()) |
| 868 | 868 | * |
| 869 | 869 | */ |
| 870 | - LIB3270_EXPORT char * lib3270_get_resource_string(const char *first_element, ...); | |
| 870 | + LIB3270_EXPORT char * lib3270_get_resource_string(H3270 *hSession, const char *first_element, ...); | |
| 871 | 871 | |
| 872 | 872 | LIB3270_EXPORT const char * lib3270_get_version(void); |
| 873 | 873 | LIB3270_EXPORT const char * lib3270_get_revision(void); | ... | ... |
src/lib3270/ansi.c
| ... | ... | @@ -482,7 +482,7 @@ static const char csnames[] = "0AB"; |
| 482 | 482 | #if defined(X3270_DBCS) /*[*/ |
| 483 | 483 | static unsigned char mb_pending = 0; |
| 484 | 484 | static char mb_buffer[LIB3270_MB_MAX]; |
| 485 | -static int dbcs_process(int ch, unsigned char ebc[]); | |
| 485 | +static int dbcs_process(H3270 *hSession, int ch, unsigned char ebc[]); | |
| 486 | 486 | #endif /*]*/ |
| 487 | 487 | // static int pmi = 0; |
| 488 | 488 | // static char pending_mbs[LIB3270_MB_MAX]; |
| ... | ... | @@ -1107,7 +1107,7 @@ ansi_printing(H3270 *hSession, int ig1 unused, int ig2 unused) |
| 1107 | 1107 | int len; |
| 1108 | 1108 | unsigned char ebc[2]; |
| 1109 | 1109 | |
| 1110 | - len = dbcs_process(ansi_ch, ebc); | |
| 1110 | + len = dbcs_process(hSession, ansi_ch, ebc); | |
| 1111 | 1111 | switch (len) { |
| 1112 | 1112 | default: |
| 1113 | 1113 | case 0: |
| ... | ... | @@ -1148,7 +1148,7 @@ ansi_printing(H3270 *hSession, int ig1 unused, int ig2 unused) |
| 1148 | 1148 | break; |
| 1149 | 1149 | } |
| 1150 | 1150 | } else if (ansi_ch & 0x80) { |
| 1151 | - (void) dbcs_process(ansi_ch, NULL); | |
| 1151 | + (void) dbcs_process(hSession, ansi_ch, NULL); | |
| 1152 | 1152 | ebc_ch = EBC_space; |
| 1153 | 1153 | } |
| 1154 | 1154 | } |
| ... | ... | @@ -1722,13 +1722,13 @@ void ansi_in3270(H3270 *session, int in3270, void *dunno) |
| 1722 | 1722 | } |
| 1723 | 1723 | |
| 1724 | 1724 | #if defined(X3270_DBCS) /*[*/ |
| 1725 | -static void trace_pending_mb(void) | |
| 1725 | +static void trace_pending_mb(H3270 *hSession) | |
| 1726 | 1726 | { |
| 1727 | 1727 | int i; |
| 1728 | 1728 | |
| 1729 | 1729 | for (i = 0; i < mb_pending; i++) |
| 1730 | 1730 | { |
| 1731 | - trace_ds(&h3270," %02x", mb_buffer[i] & 0xff); | |
| 1731 | + trace_ds(hSession," %02x", mb_buffer[i] & 0xff); | |
| 1732 | 1732 | } |
| 1733 | 1733 | } |
| 1734 | 1734 | #endif /*]*/ |
| ... | ... | @@ -1758,7 +1758,7 @@ ansi_process(H3270 *hSession, unsigned int c) |
| 1758 | 1758 | if (mb_pending && fn != &ansi_printing) |
| 1759 | 1759 | { |
| 1760 | 1760 | trace_ds(hSession,"Dropped incomplete multi-byte character"); |
| 1761 | - trace_pending_mb(); | |
| 1761 | + trace_pending_mb(hSession); | |
| 1762 | 1762 | trace_ds(hSession,"\n"); |
| 1763 | 1763 | mb_pending = 0; |
| 1764 | 1764 | } |
| ... | ... | @@ -1863,30 +1863,29 @@ void toggle_lineWrap(H3270 *hSession, struct lib3270_toggle *t unused, LIB3270_T |
| 1863 | 1863 | |
| 1864 | 1864 | #if defined(X3270_DBCS) /*[*/ |
| 1865 | 1865 | /* Accumulate and process pending DBCS characters. */ |
| 1866 | -static int | |
| 1867 | -dbcs_process(int ch, unsigned char ebc[]) | |
| 1866 | +static int dbcs_process(H3270 *hSession, int ch, unsigned char ebc[]) | |
| 1868 | 1867 | { |
| 1869 | 1868 | UChar Ubuf[2]; |
| 1870 | 1869 | UErrorCode err = U_ZERO_ERROR; |
| 1871 | 1870 | |
| 1872 | - /* See if we have too many. */ | |
| 1871 | + // See if we have too many. | |
| 1873 | 1872 | if (mb_pending >= MB_MAX) { |
| 1874 | 1873 | trace_ds(&h3270,"Multi-byte character "); |
| 1875 | - trace_pending_mb(); | |
| 1874 | + trace_pending_mb(hSession); | |
| 1876 | 1875 | trace_ds(&h3270," too long, dropping\n"); |
| 1877 | 1876 | mb_pending = 0; |
| 1878 | 1877 | return 0; |
| 1879 | 1878 | } |
| 1880 | 1879 | |
| 1881 | 1880 | |
| 1882 | - /* Store it and see if we're done. */ | |
| 1881 | + // Store it and see if we're done. | |
| 1883 | 1882 | mb_buffer[mb_pending++] = ch & 0xff; |
| 1884 | - /* An interesting idea. */ | |
| 1883 | + // An interesting idea. | |
| 1885 | 1884 | if (mb_pending == 1) |
| 1886 | 1885 | return 0; |
| 1887 | 1886 | |
| 1888 | 1887 | if (mb_to_unicode(mb_buffer, mb_pending, Ubuf, 2, &err) > 0) { |
| 1889 | - /* It translated! */ | |
| 1888 | + // It translated! | |
| 1890 | 1889 | if (dbcs_map8(Ubuf[0], ebc)) { |
| 1891 | 1890 | mb_pending = 0; |
| 1892 | 1891 | return 1; |
| ... | ... | @@ -1895,7 +1894,7 @@ dbcs_process(int ch, unsigned char ebc[]) |
| 1895 | 1894 | return 2; |
| 1896 | 1895 | } else { |
| 1897 | 1896 | trace_ds(&h3270,"Can't map multi-byte character"); |
| 1898 | - trace_pending_mb(); | |
| 1897 | + trace_pending_mb(&h3270); | |
| 1899 | 1898 | trace_ds(&h3270," -> U+%04x to SBCS or DBCS, dropping\n", |
| 1900 | 1899 | Ubuf[0] & 0xffff); |
| 1901 | 1900 | mb_pending = 0; |
| ... | ... | @@ -1903,7 +1902,7 @@ dbcs_process(int ch, unsigned char ebc[]) |
| 1903 | 1902 | } |
| 1904 | 1903 | } |
| 1905 | 1904 | |
| 1906 | - /* It failed. See why. */ | |
| 1905 | + // It failed. See why | |
| 1907 | 1906 | switch (err) { |
| 1908 | 1907 | case U_TRUNCATED_CHAR_FOUND: |
| 1909 | 1908 | /* 'Cause we're not finished. */ |
| ... | ... | @@ -1911,12 +1910,12 @@ dbcs_process(int ch, unsigned char ebc[]) |
| 1911 | 1910 | case U_INVALID_CHAR_FOUND: |
| 1912 | 1911 | case U_ILLEGAL_CHAR_FOUND: |
| 1913 | 1912 | trace_ds(&h3270,"Invalid multi-byte character"); |
| 1914 | - trace_pending_mb(); | |
| 1913 | + trace_pending_mb(&h3270); | |
| 1915 | 1914 | trace_ds(&h3270,", dropping\n"); |
| 1916 | 1915 | break; |
| 1917 | 1916 | default: |
| 1918 | 1917 | trace_ds(&h3270,"Unexpected ICU error %d translating multi-type character", (int)err); |
| 1919 | - trace_pending_mb(); | |
| 1918 | + trace_pending_mb(&h3270); | |
| 1920 | 1919 | trace_ds(&h3270,", dropping\n"); |
| 1921 | 1920 | break; |
| 1922 | 1921 | } | ... | ... |
src/lib3270/charset.c
| ... | ... | @@ -95,7 +95,7 @@ unsigned char xk_selector = 0; |
| 95 | 95 | unsigned char auto_keymap = 0; |
| 96 | 96 | |
| 97 | 97 | /* Statics. */ |
| 98 | -static enum cs_result resource_charset(const char *csname, char *cs, char *ftcs); | |
| 98 | +static enum cs_result resource_charset(H3270 *hSession, const char *csname, char *cs, char *ftcs); | |
| 99 | 99 | typedef enum { CS_ONLY, FT_ONLY, BOTH } remap_scope; |
| 100 | 100 | static enum cs_result remap_chars(const char *csname, char *spec, remap_scope scope, int *ne); |
| 101 | 101 | static void remap_one(unsigned char ebc, KeySym iso, remap_scope scope,Boolean one_way); |
| ... | ... | @@ -201,7 +201,7 @@ wide_resource_init(char *csname) |
| 201 | 201 | /* |
| 202 | 202 | * Change character sets. |
| 203 | 203 | */ |
| 204 | -enum cs_result charset_init(H3270 *session, const char *csname) | |
| 204 | +enum cs_result charset_init(H3270 *hSession, const char *csname) | |
| 205 | 205 | { |
| 206 | 206 | // char *cs; |
| 207 | 207 | // const char *ftcs; |
| ... | ... | @@ -215,7 +215,7 @@ enum cs_result charset_init(H3270 *session, const char *csname) |
| 215 | 215 | { |
| 216 | 216 | charset_defaults(); |
| 217 | 217 | set_cgcsgids(CN); |
| 218 | - set_display_charset(session, "ISO-8859-1"); | |
| 218 | + set_display_charset(hSession, "ISO-8859-1"); | |
| 219 | 219 | return CS_OKAY; |
| 220 | 220 | } |
| 221 | 221 | |
| ... | ... | @@ -223,7 +223,7 @@ enum cs_result charset_init(H3270 *session, const char *csname) |
| 223 | 223 | #ifdef ANDROID |
| 224 | 224 | ccs = strdup("0xad: [ \n 0xba: Yacute \n0xbd: ] \n 0xbb: diaeresis \n"); |
| 225 | 225 | #else |
| 226 | - ccs = lib3270_get_resource_string("charset", csname, NULL); | |
| 226 | + ccs = lib3270_get_resource_string(hSession,"charset", csname, NULL); | |
| 227 | 227 | #endif |
| 228 | 228 | /* |
| 229 | 229 | if (cs == CN && strlen(csname) > ES_SIZE && !strcasecmp(csname + strlen(csname) - ES_SIZE, EURO_SUFFIX)) |
| ... | ... | @@ -241,21 +241,21 @@ enum cs_result charset_init(H3270 *session, const char *csname) |
| 241 | 241 | return CS_NOTFOUND; |
| 242 | 242 | |
| 243 | 243 | /* Grab the File Transfer character set. */ |
| 244 | - cftcs = lib3270_get_resource_string("ftCharset",csname,NULL); | |
| 244 | + cftcs = lib3270_get_resource_string(hSession,"ftCharset",csname,NULL); | |
| 245 | 245 | |
| 246 | 246 | /* Save the current definitions, and start over with the defaults. */ |
| 247 | 247 | save_charset(); |
| 248 | 248 | charset_defaults(); |
| 249 | 249 | |
| 250 | 250 | /* Check for auto-keymap. */ |
| 251 | - ak = lib3270_get_resource_string("autoKeymap", csname, NULL); | |
| 251 | + ak = lib3270_get_resource_string(hSession,"autoKeymap", csname, NULL); | |
| 252 | 252 | if (ak != NULL) |
| 253 | 253 | auto_keymap = !strcasecmp(ak, "true"); |
| 254 | 254 | else |
| 255 | 255 | auto_keymap = 0; |
| 256 | 256 | |
| 257 | 257 | /* Interpret them. */ |
| 258 | - rc = resource_charset(csname, ccs, cftcs); | |
| 258 | + rc = resource_charset(hSession,csname, ccs, cftcs); | |
| 259 | 259 | |
| 260 | 260 | /* Free them. */ |
| 261 | 261 | lib3270_free(ccs); |
| ... | ... | @@ -376,7 +376,7 @@ set_charset_name(char *csname) |
| 376 | 376 | */ |
| 377 | 377 | |
| 378 | 378 | /* Define a charset from resources. */ |
| 379 | -static enum cs_result resource_charset(const char *csname, char *cs, char *ftcs) | |
| 379 | +static enum cs_result resource_charset(H3270 *hSession, const char *csname, char *cs, char *ftcs) | |
| 380 | 380 | { |
| 381 | 381 | enum cs_result rc; |
| 382 | 382 | int ne = 0; |
| ... | ... | @@ -395,7 +395,7 @@ static enum cs_result resource_charset(const char *csname, char *cs, char *ftcs) |
| 395 | 395 | } |
| 396 | 396 | |
| 397 | 397 | // rcs = get_fresource("%s.%s", "displayCharset", csname); |
| 398 | - rcs = lib3270_get_resource_string("displayCharset", csname, NULL); | |
| 398 | + rcs = lib3270_get_resource_string(hSession,"displayCharset", csname, NULL); | |
| 399 | 399 | |
| 400 | 400 | /* Isolate the pieces. */ |
| 401 | 401 | if (rcs != CN) |
| ... | ... | @@ -448,18 +448,18 @@ static enum cs_result resource_charset(const char *csname, char *cs, char *ftcs) |
| 448 | 448 | /* Set up the cgcsgid. */ |
| 449 | 449 | // set_cgcsgids(get_fresource("%s.%s", "codepage", csname)); |
| 450 | 450 | { |
| 451 | - char *ptr = lib3270_get_resource_string("codepage", csname, NULL); | |
| 451 | + char *ptr = lib3270_get_resource_string(hSession,"codepage", csname, NULL); | |
| 452 | 452 | set_cgcsgids(ptr); |
| 453 | 453 | lib3270_free(ptr); |
| 454 | 454 | } |
| 455 | 455 | |
| 456 | 456 | // dcs = get_fresource("%s.%s", "displayCharset", csname); |
| 457 | - dcs = lib3270_get_resource_string("displayCharset", csname, NULL); | |
| 457 | + dcs = lib3270_get_resource_string(hSession,"displayCharset", csname, NULL); | |
| 458 | 458 | |
| 459 | 459 | if (dcs != NULL) |
| 460 | - set_display_charset(&h3270,dcs); | |
| 460 | + set_display_charset(hSession,dcs); | |
| 461 | 461 | else |
| 462 | - set_display_charset(&h3270,"ISO-8859-1"); | |
| 462 | + set_display_charset(hSession,"ISO-8859-1"); | |
| 463 | 463 | |
| 464 | 464 | lib3270_free(dcs); |
| 465 | 465 | ... | ... |
src/lib3270/ctlr.c
| ... | ... | @@ -1233,29 +1233,29 @@ enum pds ctlr_write(H3270 *hSession, unsigned char buf[], int buflen, Boolean er |
| 1233 | 1233 | else |
| 1234 | 1234 | { |
| 1235 | 1235 | if (ra_ge) |
| 1236 | - ctlr_add(hSession,h3270.buffer_addr, add_c1,CS_GE); | |
| 1237 | - else if (h3270.default_cs) | |
| 1238 | - ctlr_add(hSession,h3270.buffer_addr, add_c1,h3270.default_cs); | |
| 1236 | + ctlr_add(hSession,hSession->buffer_addr, add_c1,CS_GE); | |
| 1237 | + else if (hSession->default_cs) | |
| 1238 | + ctlr_add(hSession,hSession->buffer_addr, add_c1,hSession->default_cs); | |
| 1239 | 1239 | else |
| 1240 | - ctlr_add(hSession,h3270.buffer_addr, add_c1,0); | |
| 1240 | + ctlr_add(hSession,hSession->buffer_addr, add_c1,0); | |
| 1241 | 1241 | } |
| 1242 | - ctlr_add_fg(hSession,h3270.buffer_addr, h3270.default_fg); | |
| 1243 | - ctlr_add_gr(hSession,h3270.buffer_addr, h3270.default_gr); | |
| 1244 | - ctlr_add_ic(hSession,h3270.buffer_addr, h3270.default_ic); | |
| 1242 | + ctlr_add_fg(hSession,hSession->buffer_addr, hSession->default_fg); | |
| 1243 | + ctlr_add_gr(hSession,hSession->buffer_addr, hSession->default_gr); | |
| 1244 | + ctlr_add_ic(hSession,hSession->buffer_addr, hSession->default_ic); | |
| 1245 | 1245 | |
| 1246 | 1246 | INC_BA(hSession->buffer_addr); |
| 1247 | 1247 | if (add_dbcs) |
| 1248 | 1248 | { |
| 1249 | - ctlr_add(hSession,h3270.buffer_addr, add_c2,h3270.default_cs); | |
| 1250 | - ctlr_add_fg(hSession,h3270.buffer_addr, h3270.default_fg); | |
| 1251 | - ctlr_add_bg(hSession,h3270.buffer_addr, h3270.default_bg); | |
| 1252 | - ctlr_add_gr(hSession,h3270.buffer_addr, h3270.default_gr); | |
| 1253 | - ctlr_add_ic(hSession,h3270.buffer_addr, h3270.default_ic); | |
| 1249 | + ctlr_add(hSession,hSession->buffer_addr, add_c2,hSession->default_cs); | |
| 1250 | + ctlr_add_fg(hSession,hSession->buffer_addr, h3270.default_fg); | |
| 1251 | + ctlr_add_bg(hSession,hSession->buffer_addr, hSession->default_bg); | |
| 1252 | + ctlr_add_gr(hSession,hSession->buffer_addr, hSession->default_gr); | |
| 1253 | + ctlr_add_ic(hSession,hSession->buffer_addr, hSession->default_ic); | |
| 1254 | 1254 | INC_BA(hSession->buffer_addr); |
| 1255 | 1255 | } |
| 1256 | - } while (h3270.buffer_addr != baddr); | |
| 1256 | + } while (hSession->buffer_addr != baddr); | |
| 1257 | 1257 | |
| 1258 | - current_fa = get_field_attribute(&h3270,h3270.buffer_addr); | |
| 1258 | + current_fa = get_field_attribute(hSession,hSession->buffer_addr); | |
| 1259 | 1259 | last_cmd = True; |
| 1260 | 1260 | last_zpt = False; |
| 1261 | 1261 | break; | ... | ... |
src/lib3270/kybd.c
| ... | ... | @@ -2062,19 +2062,19 @@ LIB3270_ACTION( eraseeof ) |
| 2062 | 2062 | #endif /*]*/ |
| 2063 | 2063 | baddr = hSession->cursor_addr; |
| 2064 | 2064 | fa = get_field_attribute(hSession,baddr); |
| 2065 | - if (FA_IS_PROTECTED(fa) || h3270.ea_buf[baddr].fa) { | |
| 2066 | - operator_error(&h3270,KL_OERR_PROTECTED); | |
| 2065 | + if (FA_IS_PROTECTED(fa) || hSession->ea_buf[baddr].fa) { | |
| 2066 | + operator_error(hSession,KL_OERR_PROTECTED); | |
| 2067 | 2067 | return -1; |
| 2068 | 2068 | } |
| 2069 | 2069 | if (hSession->formatted) { /* erase to next field attribute */ |
| 2070 | 2070 | do { |
| 2071 | - ctlr_add(&h3270,baddr, EBC_null, 0); | |
| 2071 | + ctlr_add(hSession,baddr, EBC_null, 0); | |
| 2072 | 2072 | INC_BA(baddr); |
| 2073 | - } while (!h3270.ea_buf[baddr].fa); | |
| 2073 | + } while (!hSession->ea_buf[baddr].fa); | |
| 2074 | 2074 | mdt_set(hSession,hSession->cursor_addr); |
| 2075 | 2075 | } else { /* erase to end of screen */ |
| 2076 | 2076 | do { |
| 2077 | - ctlr_add(&h3270,baddr, EBC_null, 0); | |
| 2077 | + ctlr_add(hSession,baddr, EBC_null, 0); | |
| 2078 | 2078 | INC_BA(baddr); |
| 2079 | 2079 | } while (baddr != 0); |
| 2080 | 2080 | } |
| ... | ... | @@ -2085,9 +2085,9 @@ LIB3270_ACTION( eraseeof ) |
| 2085 | 2085 | if (d == DBCS_RIGHT) { |
| 2086 | 2086 | baddr = hSession->cursor_addr; |
| 2087 | 2087 | DEC_BA(baddr); |
| 2088 | - h3270.ea_buf[baddr].cc = EBC_si; | |
| 2088 | + hSession->ea_buf[baddr].cc = EBC_si; | |
| 2089 | 2089 | } else |
| 2090 | - h3270.ea_buf[hSession->cursor_addr].cc = EBC_si; | |
| 2090 | + hSession->ea_buf[hSession->cursor_addr].cc = EBC_si; | |
| 2091 | 2091 | } |
| 2092 | 2092 | (void) ctlr_dbcs_postprocess(hSession); |
| 2093 | 2093 | hSession->display(hSession); |
| ... | ... | @@ -2183,7 +2183,7 @@ LIB3270_ACTION( deleteword ) |
| 2183 | 2183 | |
| 2184 | 2184 | /* Make sure we're on a modifiable field. */ |
| 2185 | 2185 | if (FA_IS_PROTECTED(fa) || hSession->ea_buf[baddr].fa) { |
| 2186 | - operator_error(&h3270,KL_OERR_PROTECTED); | |
| 2186 | + operator_error(hSession,KL_OERR_PROTECTED); | |
| 2187 | 2187 | return -1; |
| 2188 | 2188 | } |
| 2189 | 2189 | |
| ... | ... | @@ -2377,28 +2377,33 @@ LIB3270_ACTION( fieldend ) |
| 2377 | 2377 | return 0; |
| 2378 | 2378 | } |
| 2379 | 2379 | |
| 2380 | -/* PA key action for String actions */ | |
| 2381 | -static void | |
| 2382 | -do_pa(unsigned n) | |
| 2380 | +/** | |
| 2381 | + * PA key action for String actions | |
| 2382 | + */ | |
| 2383 | +static void do_pa(H3270 *hSession, unsigned n) | |
| 2383 | 2384 | { |
| 2384 | - if (n < 1 || n > PA_SZ) { | |
| 2385 | - popup_an_error(NULL, _( "Unknown PA key %d" ), n); | |
| 2385 | + if (n < 1 || n > PA_SZ) | |
| 2386 | + { | |
| 2387 | + popup_an_error(hSession, _( "Unknown PA key %d" ), n); | |
| 2386 | 2388 | return; |
| 2387 | 2389 | } |
| 2388 | 2390 | |
| 2389 | - lib3270_pakey(&h3270,n); | |
| 2391 | + lib3270_pakey(hSession,n); | |
| 2390 | 2392 | |
| 2391 | 2393 | } |
| 2392 | 2394 | |
| 2393 | -/* PF key action for String actions */ | |
| 2394 | -static void do_pf(unsigned n) | |
| 2395 | +/** | |
| 2396 | + * PF key action for String actions | |
| 2397 | + */ | |
| 2398 | +static void do_pf(H3270 *hSession, unsigned n) | |
| 2395 | 2399 | { |
| 2396 | - if (n < 1 || n > PF_SZ) { | |
| 2397 | - popup_an_error(NULL, _( "Unknown PF key %d" ), n); | |
| 2400 | + if (n < 1 || n > PF_SZ) | |
| 2401 | + { | |
| 2402 | + popup_an_error(hSession, _( "Unknown PF key %d" ), n); | |
| 2398 | 2403 | return; |
| 2399 | 2404 | } |
| 2400 | 2405 | |
| 2401 | - lib3270_pfkey(&h3270,n); | |
| 2406 | + lib3270_pfkey(hSession,n); | |
| 2402 | 2407 | } |
| 2403 | 2408 | |
| 2404 | 2409 | /* |
| ... | ... | @@ -2747,7 +2752,7 @@ LIB3270_EXPORT int lib3270_emulate_input(H3270 *hSession, char *s, int len, int |
| 2747 | 2752 | } |
| 2748 | 2753 | else |
| 2749 | 2754 | { |
| 2750 | - do_pf(literal); | |
| 2755 | + do_pf(hSession,literal); | |
| 2751 | 2756 | skipped = False; |
| 2752 | 2757 | if (IN_3270) |
| 2753 | 2758 | return len-1; |
| ... | ... | @@ -2769,7 +2774,7 @@ LIB3270_EXPORT int lib3270_emulate_input(H3270 *hSession, char *s, int len, int |
| 2769 | 2774 | } |
| 2770 | 2775 | else |
| 2771 | 2776 | { |
| 2772 | - do_pa(literal); | |
| 2777 | + do_pa(hSession, literal); | |
| 2773 | 2778 | skipped = False; |
| 2774 | 2779 | if (IN_3270) |
| 2775 | 2780 | return len-1; |
| ... | ... | @@ -2866,7 +2871,7 @@ LIB3270_EXPORT int lib3270_emulate_input(H3270 *hSession, char *s, int len, int |
| 2866 | 2871 | case BACKPF: |
| 2867 | 2872 | if (nc > 0) |
| 2868 | 2873 | { |
| 2869 | - do_pf(literal); | |
| 2874 | + do_pf(hSession,literal); | |
| 2870 | 2875 | state = BASE; |
| 2871 | 2876 | } |
| 2872 | 2877 | break; |
| ... | ... | @@ -2874,7 +2879,7 @@ LIB3270_EXPORT int lib3270_emulate_input(H3270 *hSession, char *s, int len, int |
| 2874 | 2879 | case BACKPA: |
| 2875 | 2880 | if (nc > 0) |
| 2876 | 2881 | { |
| 2877 | - do_pa(literal); | |
| 2882 | + do_pa(hSession,literal); | |
| 2878 | 2883 | state = BASE; |
| 2879 | 2884 | } |
| 2880 | 2885 | break; | ... | ... |
src/lib3270/resources.c
| ... | ... | @@ -127,7 +127,7 @@ void add_resource(const char *name, const char *value) |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | |
| 130 | -const char * get_resource(const char *name) | |
| 130 | +const char * get_resource(H3270 *hSession, const char *name) | |
| 131 | 131 | { |
| 132 | 132 | struct dresource *d; |
| 133 | 133 | int i; |
| ... | ... | @@ -136,7 +136,7 @@ const char * get_resource(const char *name) |
| 136 | 136 | { |
| 137 | 137 | if (!strcmp(d->name, name)) |
| 138 | 138 | { |
| 139 | - lib3270_write_log(&h3270,"resource","%s=\"%s\"",name,d->value); | |
| 139 | + lib3270_write_log(hSession,"resource","%s=\"%s\"",name,d->value); | |
| 140 | 140 | return d->value; |
| 141 | 141 | } |
| 142 | 142 | } |
| ... | ... | @@ -146,7 +146,7 @@ const char * get_resource(const char *name) |
| 146 | 146 | if (!strncmp(fallbacks[i], name, strlen(name)) && *(fallbacks[i] + strlen(name)) == ':') |
| 147 | 147 | { |
| 148 | 148 | const char *ret = fallbacks[i] + strlen(name) + 2; |
| 149 | - lib3270_write_log(&h3270,"resource","%s=\"%s\"",name,ret); | |
| 149 | + lib3270_write_log(hSession,"resource","%s=\"%s\"",name,ret); | |
| 150 | 150 | return ret; |
| 151 | 151 | } |
| 152 | 152 | } |
| ... | ... | @@ -156,7 +156,7 @@ const char * get_resource(const char *name) |
| 156 | 156 | { |
| 157 | 157 | if (!strcmp(rdb[i].name, name)) |
| 158 | 158 | { |
| 159 | - lib3270_write_log(&h3270,"resource","%s=\"%s\"",name,rdb[i].value); | |
| 159 | + lib3270_write_log(hSession,"resource","%s=\"%s\"",name,rdb[i].value); | |
| 160 | 160 | return rdb[i].value; |
| 161 | 161 | } |
| 162 | 162 | } |
| ... | ... | @@ -165,7 +165,7 @@ const char * get_resource(const char *name) |
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | /* A version of get_resource that accepts sprintf arguments. */ |
| 168 | -const char * get_fresource(const char *fmt, ...) | |
| 168 | +const char * get_fresource(H3270 *hSession, const char *fmt, ...) | |
| 169 | 169 | { |
| 170 | 170 | va_list args; |
| 171 | 171 | char *name; |
| ... | ... | @@ -174,7 +174,7 @@ const char * get_fresource(const char *fmt, ...) |
| 174 | 174 | va_start(args, fmt); |
| 175 | 175 | name = lib3270_vsprintf(fmt, args); |
| 176 | 176 | va_end(args); |
| 177 | - r = get_resource(name); | |
| 177 | + r = get_resource(hSession,name); | |
| 178 | 178 | lib3270_free(name); |
| 179 | 179 | return r; |
| 180 | 180 | } | ... | ... |
src/lib3270/util.c
| ... | ... | @@ -943,7 +943,7 @@ void * Calloc(size_t nelem, size_t elsize) |
| 943 | 943 | } |
| 944 | 944 | */ |
| 945 | 945 | |
| 946 | -LIB3270_EXPORT char * lib3270_get_resource_string(const char *first_element, ...) | |
| 946 | +LIB3270_EXPORT char * lib3270_get_resource_string(H3270 *hSession, const char *first_element, ...) | |
| 947 | 947 | { |
| 948 | 948 | #ifdef ANDROID |
| 949 | 949 | |
| ... | ... | @@ -972,7 +972,7 @@ LIB3270_EXPORT char * lib3270_get_resource_string(const char *first_element, ... |
| 972 | 972 | |
| 973 | 973 | *ptr = 0; |
| 974 | 974 | |
| 975 | - res = get_resource(str); | |
| 975 | + res = get_resource(hSession,str); | |
| 976 | 976 | |
| 977 | 977 | trace("%s(%s)=%s",__FUNCTION__,str,res ? res : "NULL"); |
| 978 | 978 | ... | ... |
src/lib3270/utilc.h
| ... | ... | @@ -23,8 +23,8 @@ LIB3270_INTERNAL char *ctl_see(int c); |
| 23 | 23 | LIB3270_INTERNAL char *do_subst(const char *s, Boolean do_vars, Boolean do_tilde); |
| 24 | 24 | LIB3270_INTERNAL void fcatv(FILE *f, char *s); |
| 25 | 25 | LIB3270_INTERNAL const char *get_message(const char *key); |
| 26 | -LIB3270_INTERNAL const char *get_fresource(const char *fmt, ...) printflike(1, 2); | |
| 27 | -LIB3270_INTERNAL const char *get_resource(const char *name); | |
| 26 | +LIB3270_INTERNAL const char *get_fresource(H3270 *hSession, const char *fmt, ...) printflike(2, 3); | |
| 27 | +LIB3270_INTERNAL const char *get_resource(H3270 *hSession, const char *name); | |
| 28 | 28 | LIB3270_INTERNAL char *scatv(const char *s, char *buf, size_t len); |
| 29 | 29 | LIB3270_INTERNAL int split_dbcs_resource(const char *value, char sep, char **part1, |
| 30 | 30 | char **part2); | ... | ... |