Commit bcd59ddc5b804c649701d2b7e92612d20f4c6888
1 parent
1c7d5d03
Exists in
master
and in
3 other branches
Incluindo configuração de charset
Showing
2 changed files
with
24 additions
and
12 deletions
Show diff stats
charset.c
| ... | ... | @@ -36,7 +36,7 @@ |
| 36 | 36 | |
| 37 | 37 | #include "globals.h" |
| 38 | 38 | #include "X11keysym.h" |
| 39 | -#include <lib3270/charset.h"> | |
| 39 | +#include <lib3270/charset.h> | |
| 40 | 40 | |
| 41 | 41 | /* |
| 42 | 42 | * EBCDIC-to-Unicode translation tables. |
| ... | ... | @@ -220,6 +220,20 @@ static const remap charset[] = |
| 220 | 220 | } |
| 221 | 221 | }, |
| 222 | 222 | |
| 223 | + { | |
| 224 | + "cp500", | |
| 225 | + (const unsigned short const []) | |
| 226 | + { | |
| 227 | + 0x004a, '[', | |
| 228 | + 0x004f, '!', | |
| 229 | + 0x005a, ']', | |
| 230 | + 0x005f, '^', | |
| 231 | + 0x00b0, XK_percent, | |
| 232 | + 0x00ba, XK_notsign, | |
| 233 | + 0x00bb, XK_bar | |
| 234 | + } | |
| 235 | + }, | |
| 236 | + | |
| 223 | 237 | // Terminate list |
| 224 | 238 | { |
| 225 | 239 | NULL |
| ... | ... | @@ -236,7 +250,7 @@ static void copy_charset(const unsigned short *from, unsigned short *to) |
| 236 | 250 | to[f+UT_OFFSET] = from[f]; |
| 237 | 251 | } |
| 238 | 252 | |
| 239 | -LIB3270_EXPORT struct lib3270_charset * lib3270_load_charset(H3270 *hSession, const char *name) | |
| 253 | +LIB3270_EXPORT int lib3270_set_host_charset(H3270 *hSession, const char *name) | |
| 240 | 254 | { |
| 241 | 255 | int f; |
| 242 | 256 | |
| ... | ... | @@ -259,7 +273,7 @@ LIB3270_EXPORT struct lib3270_charset * lib3270_load_charset(H3270 *hSession, co |
| 259 | 273 | #endif |
| 260 | 274 | |
| 261 | 275 | if(!(name && strcasecmp(name,hSession->charset.host))) |
| 262 | - return &hSession->charset; | |
| 276 | + return 0; | |
| 263 | 277 | |
| 264 | 278 | for(f=0;charset[f].name != NULL;f++) |
| 265 | 279 | { |
| ... | ... | @@ -272,14 +286,11 @@ LIB3270_EXPORT struct lib3270_charset * lib3270_load_charset(H3270 *hSession, co |
| 272 | 286 | |
| 273 | 287 | for(c=0;charset[f].chr[c];c+=2) |
| 274 | 288 | lib3270_remap(hSession,charset[f].chr[c],charset[f].chr[c+1], BOTH, 0); |
| 275 | - errno = 0; | |
| 276 | - return &hSession->charset; | |
| 289 | + return 0; | |
| 277 | 290 | } |
| 278 | 291 | } |
| 279 | 292 | |
| 280 | - errno = ENOENT; | |
| 281 | - | |
| 282 | - return NULL; | |
| 293 | + return ENOENT; | |
| 283 | 294 | |
| 284 | 295 | } |
| 285 | 296 | |
| ... | ... | @@ -358,7 +369,8 @@ LIB3270_ACTION( charsettable ) |
| 358 | 369 | // Process a single character definition. |
| 359 | 370 | LIB3270_EXPORT void lib3270_remap(H3270 *hSession, unsigned short ebc, unsigned short iso, lib3270_remap_scope scope, unsigned char one_way) |
| 360 | 371 | { |
| 361 | -// unsigned char cg; | |
| 372 | + // unsigned char cg; | |
| 373 | + CHECK_SESSION_HANDLE(hSession); | |
| 362 | 374 | |
| 363 | 375 | // Ignore mappings of EBCDIC control codes and the space character. |
| 364 | 376 | if (ebc <= 0x40) | ... | ... |
session.c
| ... | ... | @@ -46,7 +46,7 @@ |
| 46 | 46 | #include "3270ds.h" |
| 47 | 47 | // #include "tablesc.h" |
| 48 | 48 | #include "popupsc.h" |
| 49 | -#include "charset.h" | |
| 49 | +//#include "charset.h" | |
| 50 | 50 | |
| 51 | 51 | /*---[ Globals ]--------------------------------------------------------------------------------------------------------------*/ |
| 52 | 52 | |
| ... | ... | @@ -187,7 +187,7 @@ static void lib3270_session_init(H3270 *hSession, const char *model, const char |
| 187 | 187 | memset(hSession,0,sizeof(H3270)); |
| 188 | 188 | hSession->sz = sizeof(H3270); |
| 189 | 189 | |
| 190 | - lib3270_load_charset(hSession,charset); | |
| 190 | + lib3270_set_host_charset(hSession,charset); | |
| 191 | 191 | |
| 192 | 192 | // Default calls |
| 193 | 193 | hSession->write = lib3270_sock_send; |
| ... | ... | @@ -321,7 +321,7 @@ H3270 * lib3270_session_new(const char *model) |
| 321 | 321 | |
| 322 | 322 | hSession = default_session = lib3270_malloc(sizeof(H3270)); |
| 323 | 323 | |
| 324 | - lib3270_session_init(hSession, model, "bracket"); | |
| 324 | + lib3270_session_init(hSession, model, _( "bracket" ) ); | |
| 325 | 325 | |
| 326 | 326 | if(screen_init(hSession)) |
| 327 | 327 | return NULL; | ... | ... |