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,7 +36,7 @@ | ||
| 36 | 36 | ||
| 37 | #include "globals.h" | 37 | #include "globals.h" |
| 38 | #include "X11keysym.h" | 38 | #include "X11keysym.h" |
| 39 | -#include <lib3270/charset.h"> | 39 | +#include <lib3270/charset.h> |
| 40 | 40 | ||
| 41 | /* | 41 | /* |
| 42 | * EBCDIC-to-Unicode translation tables. | 42 | * EBCDIC-to-Unicode translation tables. |
| @@ -220,6 +220,20 @@ static const remap charset[] = | @@ -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 | // Terminate list | 237 | // Terminate list |
| 224 | { | 238 | { |
| 225 | NULL | 239 | NULL |
| @@ -236,7 +250,7 @@ static void copy_charset(const unsigned short *from, unsigned short *to) | @@ -236,7 +250,7 @@ static void copy_charset(const unsigned short *from, unsigned short *to) | ||
| 236 | to[f+UT_OFFSET] = from[f]; | 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 | int f; | 255 | int f; |
| 242 | 256 | ||
| @@ -259,7 +273,7 @@ LIB3270_EXPORT struct lib3270_charset * lib3270_load_charset(H3270 *hSession, co | @@ -259,7 +273,7 @@ LIB3270_EXPORT struct lib3270_charset * lib3270_load_charset(H3270 *hSession, co | ||
| 259 | #endif | 273 | #endif |
| 260 | 274 | ||
| 261 | if(!(name && strcasecmp(name,hSession->charset.host))) | 275 | if(!(name && strcasecmp(name,hSession->charset.host))) |
| 262 | - return &hSession->charset; | 276 | + return 0; |
| 263 | 277 | ||
| 264 | for(f=0;charset[f].name != NULL;f++) | 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,14 +286,11 @@ LIB3270_EXPORT struct lib3270_charset * lib3270_load_charset(H3270 *hSession, co | ||
| 272 | 286 | ||
| 273 | for(c=0;charset[f].chr[c];c+=2) | 287 | for(c=0;charset[f].chr[c];c+=2) |
| 274 | lib3270_remap(hSession,charset[f].chr[c],charset[f].chr[c+1], BOTH, 0); | 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,7 +369,8 @@ LIB3270_ACTION( charsettable ) | ||
| 358 | // Process a single character definition. | 369 | // Process a single character definition. |
| 359 | LIB3270_EXPORT void lib3270_remap(H3270 *hSession, unsigned short ebc, unsigned short iso, lib3270_remap_scope scope, unsigned char one_way) | 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 | // Ignore mappings of EBCDIC control codes and the space character. | 375 | // Ignore mappings of EBCDIC control codes and the space character. |
| 364 | if (ebc <= 0x40) | 376 | if (ebc <= 0x40) |
session.c
| @@ -46,7 +46,7 @@ | @@ -46,7 +46,7 @@ | ||
| 46 | #include "3270ds.h" | 46 | #include "3270ds.h" |
| 47 | // #include "tablesc.h" | 47 | // #include "tablesc.h" |
| 48 | #include "popupsc.h" | 48 | #include "popupsc.h" |
| 49 | -#include "charset.h" | 49 | +//#include "charset.h" |
| 50 | 50 | ||
| 51 | /*---[ Globals ]--------------------------------------------------------------------------------------------------------------*/ | 51 | /*---[ Globals ]--------------------------------------------------------------------------------------------------------------*/ |
| 52 | 52 | ||
| @@ -187,7 +187,7 @@ static void lib3270_session_init(H3270 *hSession, const char *model, const char | @@ -187,7 +187,7 @@ static void lib3270_session_init(H3270 *hSession, const char *model, const char | ||
| 187 | memset(hSession,0,sizeof(H3270)); | 187 | memset(hSession,0,sizeof(H3270)); |
| 188 | hSession->sz = sizeof(H3270); | 188 | hSession->sz = sizeof(H3270); |
| 189 | 189 | ||
| 190 | - lib3270_load_charset(hSession,charset); | 190 | + lib3270_set_host_charset(hSession,charset); |
| 191 | 191 | ||
| 192 | // Default calls | 192 | // Default calls |
| 193 | hSession->write = lib3270_sock_send; | 193 | hSession->write = lib3270_sock_send; |
| @@ -321,7 +321,7 @@ H3270 * lib3270_session_new(const char *model) | @@ -321,7 +321,7 @@ H3270 * lib3270_session_new(const char *model) | ||
| 321 | 321 | ||
| 322 | hSession = default_session = lib3270_malloc(sizeof(H3270)); | 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 | if(screen_init(hSession)) | 326 | if(screen_init(hSession)) |
| 327 | return NULL; | 327 | return NULL; |