Commit 88832e035acbf14db5d52c80cd7256f5b99dd349
1 parent
ac822686
Exists in
master
and in
3 other branches
Ajustes para android
Showing
9 changed files
with
213 additions
and
200 deletions
Show diff stats
actions.c
| @@ -95,13 +95,15 @@ static char *aliased_actions[] = { | @@ -95,13 +95,15 @@ static char *aliased_actions[] = { | ||
| 95 | "Close", "HardPrint", "Open", NULL | 95 | "Close", "HardPrint", "Open", NULL |
| 96 | }; | 96 | }; |
| 97 | */ | 97 | */ |
| 98 | + | ||
| 99 | +/* | ||
| 98 | enum iaction ia_cause; | 100 | enum iaction ia_cause; |
| 99 | const char *ia_name[] = { | 101 | const char *ia_name[] = { |
| 100 | "String", "Paste", "Screen redraw", "Keypad", "Default", "Key", | 102 | "String", "Paste", "Screen redraw", "Keypad", "Default", "Key", |
| 101 | "Macro", "Script", "Peek", "Typeahead", "File transfer", "Command", | 103 | "Macro", "Script", "Peek", "Typeahead", "File transfer", "Command", |
| 102 | "Keymap", "Idle" | 104 | "Keymap", "Idle" |
| 103 | }; | 105 | }; |
| 104 | - | 106 | +*/ |
| 105 | 107 | ||
| 106 | /* | 108 | /* |
| 107 | * Return a name for an action. | 109 | * Return a name for an action. |
| @@ -135,6 +137,7 @@ check_usage(XtActionProc action, Cardinal nargs, Cardinal nargs_min, | @@ -135,6 +137,7 @@ check_usage(XtActionProc action, Cardinal nargs, Cardinal nargs_min, | ||
| 135 | /* | 137 | /* |
| 136 | * Wrapper for calling an action internally. | 138 | * Wrapper for calling an action internally. |
| 137 | */ | 139 | */ |
| 140 | + /* | ||
| 138 | void | 141 | void |
| 139 | action_internal(XtActionProc action, enum iaction cause, const char *parm1, | 142 | action_internal(XtActionProc action, enum iaction cause, const char *parm1, |
| 140 | const char *parm2) | 143 | const char *parm2) |
| @@ -142,7 +145,7 @@ action_internal(XtActionProc action, enum iaction cause, const char *parm1, | @@ -142,7 +145,7 @@ action_internal(XtActionProc action, enum iaction cause, const char *parm1, | ||
| 142 | Cardinal count = 0; | 145 | Cardinal count = 0; |
| 143 | String parms[2]; | 146 | String parms[2]; |
| 144 | 147 | ||
| 145 | - /* Duplicate the parms, because XtActionProc doesn't grok 'const'. */ | 148 | + // Duplicate the parms, because XtActionProc doesn't grok 'const'. |
| 146 | if (parm1 != CN) { | 149 | if (parm1 != CN) { |
| 147 | parms[0] = NewString(parm1); | 150 | parms[0] = NewString(parm1); |
| 148 | count++; | 151 | count++; |
| @@ -157,11 +160,11 @@ action_internal(XtActionProc action, enum iaction cause, const char *parm1, | @@ -157,11 +160,11 @@ action_internal(XtActionProc action, enum iaction cause, const char *parm1, | ||
| 157 | count ? parms : (String *) NULL, | 160 | count ? parms : (String *) NULL, |
| 158 | &count); | 161 | &count); |
| 159 | 162 | ||
| 160 | - /* Free the parm copies. */ | 163 | + // Free the parm copies. |
| 161 | switch (count) { | 164 | switch (count) { |
| 162 | case 2: | 165 | case 2: |
| 163 | Free(parms[1]); | 166 | Free(parms[1]); |
| 164 | - /* fall through... */ | 167 | + // fall through... |
| 165 | case 1: | 168 | case 1: |
| 166 | Free(parms[0]); | 169 | Free(parms[0]); |
| 167 | break; | 170 | break; |
| @@ -169,5 +172,6 @@ action_internal(XtActionProc action, enum iaction cause, const char *parm1, | @@ -169,5 +172,6 @@ action_internal(XtActionProc action, enum iaction cause, const char *parm1, | ||
| 169 | break; | 172 | break; |
| 170 | } | 173 | } |
| 171 | } | 174 | } |
| 175 | +*/ | ||
| 172 | 176 | ||
| 173 | 177 |
actionsc.h
| @@ -17,22 +17,22 @@ | @@ -17,22 +17,22 @@ | ||
| 17 | * Global declarations for actions.c. | 17 | * Global declarations for actions.c. |
| 18 | */ | 18 | */ |
| 19 | 19 | ||
| 20 | -extern enum iaction ia_cause; | 20 | +// extern enum iaction ia_cause; |
| 21 | 21 | ||
| 22 | extern int actioncount; | 22 | extern int actioncount; |
| 23 | -extern XtActionsRec *actions; | 23 | +// extern XtActionsRec *actions; |
| 24 | 24 | ||
| 25 | -extern const char *ia_name[]; | 25 | +// extern const char *ia_name[]; |
| 26 | + | ||
| 27 | +// #if defined(X3270_TRACE) /*[*/ | ||
| 28 | +// extern void action_debug(XtActionProc action, XEvent *event, String *params, Cardinal *num_params); | ||
| 29 | +// #else /*][*/ | ||
| 30 | +// #define action_debug(a, e, p, n) | ||
| 31 | +// #endif /*]*/ | ||
| 26 | 32 | ||
| 27 | -#if defined(X3270_TRACE) /*[*/ | ||
| 28 | -extern void action_debug(XtActionProc action, XEvent *event, String *params, | ||
| 29 | - Cardinal *num_params); | ||
| 30 | -#else /*][*/ | ||
| 31 | -#define action_debug(a, e, p, n) | ||
| 32 | -#endif /*]*/ | ||
| 33 | extern void action_init(void); | 33 | extern void action_init(void); |
| 34 | -extern void action_internal(XtActionProc action, enum iaction cause, | ||
| 35 | - const char *parm1, const char *parm2); | 34 | + |
| 35 | +// extern void action_internal(XtActionProc action, enum iaction cause, const char *parm1, const char *parm2); | ||
| 36 | 36 | ||
| 37 | #define action_name(x) #x | 37 | #define action_name(x) #x |
| 38 | // extern const char *action_name(XtActionProc action); | 38 | // extern const char *action_name(XtActionProc action); |
| @@ -112,15 +112,15 @@ | @@ -112,15 +112,15 @@ | ||
| 112 | // #define LUNAME_SIZE 16 | 112 | // #define LUNAME_SIZE 16 |
| 113 | // #define FULL_MODEL_NAME_SIZE 13 | 113 | // #define FULL_MODEL_NAME_SIZE 13 |
| 114 | 114 | ||
| 115 | - #define ST_RESOLVING LIB3270_STATE_RESOLVING | ||
| 116 | - #define ST_HALF_CONNECT LIB3270_STATE_HALF_CONNECT | 115 | +// #define ST_RESOLVING LIB3270_STATE_RESOLVING |
| 116 | +// #define ST_HALF_CONNECT LIB3270_STATE_HALF_CONNECT | ||
| 117 | // #define ST_CONNECT LIB3270_STATE_CONNECT | 117 | // #define ST_CONNECT LIB3270_STATE_CONNECT |
| 118 | // #define ST_3270_MODE LIB3270_STATE_3270_MODE | 118 | // #define ST_3270_MODE LIB3270_STATE_3270_MODE |
| 119 | - #define ST_LINE_MODE LIB3270_STATE_LINE_MODE | ||
| 120 | - #define ST_REMODEL LIB3270_STATE_REMODEL | ||
| 121 | - #define ST_PRINTER LIB3270_STATE_PRINTER | ||
| 122 | - #define ST_EXITING LIB3270_STATE_EXITING | ||
| 123 | - #define ST_CHARSET LIB3270_STATE_CHARSET | 119 | +// #define ST_LINE_MODE LIB3270_STATE_LINE_MODE |
| 120 | +// #define ST_REMODEL LIB3270_STATE_REMODEL | ||
| 121 | +// #define ST_PRINTER LIB3270_STATE_PRINTER | ||
| 122 | +// #define ST_EXITING LIB3270_STATE_EXITING | ||
| 123 | +// #define ST_CHARSET LIB3270_STATE_CHARSET | ||
| 124 | #define N_ST LIB3270_STATE_USER | 124 | #define N_ST LIB3270_STATE_USER |
| 125 | #define LIB3270_STATE_CHANGE LIB3270_STATE | 125 | #define LIB3270_STATE_CHANGE LIB3270_STATE |
| 126 | 126 |
ctlr.c
| @@ -149,7 +149,7 @@ static unsigned char code_table[64] = { | @@ -149,7 +149,7 @@ static unsigned char code_table[64] = { | ||
| 149 | void ctlr_init(H3270 *session, unsigned cmask unused) | 149 | void ctlr_init(H3270 *session, unsigned cmask unused) |
| 150 | { | 150 | { |
| 151 | /* Register callback routines. */ | 151 | /* Register callback routines. */ |
| 152 | - lib3270_register_schange(session,ST_HALF_CONNECT, ctlr_half_connect, 0); | 152 | + lib3270_register_schange(session,LIB3270_STATE_HALF_CONNECT, ctlr_half_connect, 0); |
| 153 | lib3270_register_schange(session,LIB3270_STATE_CONNECT, ctlr_connect, 0); | 153 | lib3270_register_schange(session,LIB3270_STATE_CONNECT, ctlr_connect, 0); |
| 154 | lib3270_register_schange(session,LIB3270_STATE_3270_MODE, ctlr_connect, 0); | 154 | lib3270_register_schange(session,LIB3270_STATE_3270_MODE, ctlr_connect, 0); |
| 155 | } | 155 | } |
host.c
| @@ -559,7 +559,7 @@ static int do_connect(H3270 *hSession, const char *n) | @@ -559,7 +559,7 @@ static int do_connect(H3270 *hSession, const char *n) | ||
| 559 | if (resolving) | 559 | if (resolving) |
| 560 | { | 560 | { |
| 561 | hSession->cstate = RESOLVING; | 561 | hSession->cstate = RESOLVING; |
| 562 | - lib3270_st_changed(hSession, ST_RESOLVING, True); | 562 | + lib3270_st_changed(hSession, LIB3270_STATE_RESOLVING, True); |
| 563 | return 0; | 563 | return 0; |
| 564 | } | 564 | } |
| 565 | 565 | ||
| @@ -589,7 +589,7 @@ static int do_connect(H3270 *hSession, const char *n) | @@ -589,7 +589,7 @@ static int do_connect(H3270 *hSession, const char *n) | ||
| 589 | if (pending) | 589 | if (pending) |
| 590 | { | 590 | { |
| 591 | hSession->cstate = PENDING; | 591 | hSession->cstate = PENDING; |
| 592 | - lib3270_st_changed(hSession, ST_HALF_CONNECT, True); | 592 | + lib3270_st_changed(hSession, LIB3270_STATE_HALF_CONNECT, True); |
| 593 | } | 593 | } |
| 594 | else | 594 | else |
| 595 | { | 595 | { |
kybd.c
| @@ -84,6 +84,15 @@ | @@ -84,6 +84,15 @@ | ||
| 84 | /* Statics */ | 84 | /* Statics */ |
| 85 | // static enum { NONE, COMPOSE, FIRST } composing = NONE; | 85 | // static enum { NONE, COMPOSE, FIRST } composing = NONE; |
| 86 | 86 | ||
| 87 | +#ifdef X3270_TRACE | ||
| 88 | +static const char *ia_name[] = | ||
| 89 | +{ | ||
| 90 | + "String", "Paste", "Screen redraw", "Keypad", "Default", "Key", | ||
| 91 | + "Macro", "Script", "Peek", "Typeahead", "File transfer", "Command", | ||
| 92 | + "Keymap", "Idle" | ||
| 93 | +}; | ||
| 94 | +#endif // X3270_TRACE | ||
| 95 | + | ||
| 87 | static unsigned char pf_xlate[] = { | 96 | static unsigned char pf_xlate[] = { |
| 88 | AID_PF1, AID_PF2, AID_PF3, AID_PF4, AID_PF5, AID_PF6, | 97 | AID_PF1, AID_PF2, AID_PF3, AID_PF4, AID_PF5, AID_PF6, |
| 89 | AID_PF7, AID_PF8, AID_PF9, AID_PF10, AID_PF11, AID_PF12, | 98 | AID_PF7, AID_PF8, AID_PF9, AID_PF10, AID_PF11, AID_PF12, |
| @@ -100,13 +109,15 @@ static time_t unlock_delay_time; | @@ -100,13 +109,15 @@ static time_t unlock_delay_time; | ||
| 100 | #define UNLOCK_MS 350 /* 0.35s after last unlock */ | 109 | #define UNLOCK_MS 350 /* 0.35s after last unlock */ |
| 101 | static Boolean key_Character(int code, Boolean with_ge, Boolean pasting,Boolean *skipped); | 110 | static Boolean key_Character(int code, Boolean with_ge, Boolean pasting,Boolean *skipped); |
| 102 | static Boolean flush_ta(void); | 111 | static Boolean flush_ta(void); |
| 103 | -static void key_AID(unsigned char aid_code); | 112 | +static void key_AID(H3270 *session, unsigned char aid_code); |
| 104 | static void kybdlock_set(unsigned int bits, const char *cause); | 113 | static void kybdlock_set(unsigned int bits, const char *cause); |
| 105 | // static KeySym MyStringToKeysym(char *s, enum keytype *keytypep); | 114 | // static KeySym MyStringToKeysym(char *s, enum keytype *keytypep); |
| 106 | 115 | ||
| 107 | -#if defined(X3270_DBCS) /*[*/ | 116 | +/* |
| 117 | +#if defined(X3270_DBCS) | ||
| 108 | Boolean key_WCharacter(unsigned char code[], Boolean *skipped); | 118 | Boolean key_WCharacter(unsigned char code[], Boolean *skipped); |
| 109 | -#endif /*]*/ | 119 | +#endif |
| 120 | +*/ | ||
| 110 | 121 | ||
| 111 | static int nxk = 0; | 122 | static int nxk = 0; |
| 112 | static struct xks { | 123 | static struct xks { |
| @@ -146,23 +157,20 @@ static struct ta | @@ -146,23 +157,20 @@ static struct ta | ||
| 146 | { | 157 | { |
| 147 | TA_TYPE_DEFAULT, | 158 | TA_TYPE_DEFAULT, |
| 148 | TA_TYPE_KEY_AID, | 159 | TA_TYPE_KEY_AID, |
| 149 | - | ||
| 150 | TA_TYPE_USER | 160 | TA_TYPE_USER |
| 151 | } type; | 161 | } type; |
| 152 | 162 | ||
| 153 | - XtActionProc fn; | ||
| 154 | - char *parm1; | ||
| 155 | - char *parm2; | 163 | + H3270 * session; |
| 164 | + void (*fn)(H3270 *, const char *, const char *); | ||
| 165 | + char *parm[2]; | ||
| 166 | + unsigned char aid_code; | ||
| 156 | } *ta_head = (struct ta *) NULL, | 167 | } *ta_head = (struct ta *) NULL, |
| 157 | *ta_tail = (struct ta *) NULL; | 168 | *ta_tail = (struct ta *) NULL; |
| 158 | 169 | ||
| 159 | -#define ENQUEUE_ACTION(x) enq_ta((XtActionProc) x, CN, CN) | 170 | +#define ENQUEUE_ACTION(x) enq_ta(hSession, (void (*)(H3270 *, const char *, const char *)) x, NULL, NULL) |
| 160 | 171 | ||
| 161 | -static char dxl[] = "0123456789abcdef"; | 172 | +static const char dxl[] = "0123456789abcdef"; |
| 162 | #define FROM_HEX(c) (strchr(dxl, tolower(c)) - dxl) | 173 | #define FROM_HEX(c) (strchr(dxl, tolower(c)) - dxl) |
| 163 | - | ||
| 164 | -// extern Widget *screen; | ||
| 165 | - | ||
| 166 | #define KYBDLOCK_IS_OERR (kybdlock && !(kybdlock & ~KL_OERR_MASK)) | 174 | #define KYBDLOCK_IS_OERR (kybdlock && !(kybdlock & ~KL_OERR_MASK)) |
| 167 | 175 | ||
| 168 | 176 | ||
| @@ -207,11 +215,8 @@ static int enq_chk(void) | @@ -207,11 +215,8 @@ static int enq_chk(void) | ||
| 207 | /* | 215 | /* |
| 208 | * Put a "Key-aid" on the typeahead queue | 216 | * Put a "Key-aid" on the typeahead queue |
| 209 | */ | 217 | */ |
| 210 | - static void enq_key(unsigned char *xlate, int k) | 218 | + static void enq_key(unsigned char aid_code) |
| 211 | { | 219 | { |
| 212 | - if(enq_chk()) | ||
| 213 | - return; | ||
| 214 | - | ||
| 215 | struct ta *ta; | 220 | struct ta *ta; |
| 216 | 221 | ||
| 217 | if(enq_chk()) | 222 | if(enq_chk()) |
| @@ -220,10 +225,11 @@ static int enq_chk(void) | @@ -220,10 +225,11 @@ static int enq_chk(void) | ||
| 220 | ta = (struct ta *) Malloc(sizeof(*ta)); | 225 | ta = (struct ta *) Malloc(sizeof(*ta)); |
| 221 | memset(ta,0,sizeof(struct ta)); | 226 | memset(ta,0,sizeof(struct ta)); |
| 222 | 227 | ||
| 223 | - ta->next = (struct ta *) NULL; | ||
| 224 | - ta->type = TA_TYPE_KEY_AID; | ||
| 225 | - ta->parm1 = (char *) xlate; | ||
| 226 | - ta->parm2 = (char *) k; | 228 | + ta->next = (struct ta *) NULL; |
| 229 | + ta->type = TA_TYPE_KEY_AID; | ||
| 230 | + ta->aid_code = aid_code; | ||
| 231 | + | ||
| 232 | + trace("Adding key %02x on queue",(int) aid_code); | ||
| 227 | 233 | ||
| 228 | if (ta_head) | 234 | if (ta_head) |
| 229 | { | 235 | { |
| @@ -242,26 +248,34 @@ static int enq_chk(void) | @@ -242,26 +248,34 @@ static int enq_chk(void) | ||
| 242 | /* | 248 | /* |
| 243 | * Put an action on the typeahead queue. | 249 | * Put an action on the typeahead queue. |
| 244 | */ | 250 | */ |
| 245 | -static void enq_ta(XtActionProc fn, char *parm1, char *parm2) | 251 | +static void enq_ta(H3270 *hSession, void (*fn)(H3270 *, const char *, const char *), const char *parm1, const char *parm2) |
| 246 | { | 252 | { |
| 247 | struct ta *ta; | 253 | struct ta *ta; |
| 248 | 254 | ||
| 249 | if(enq_chk()) | 255 | if(enq_chk()) |
| 250 | return; | 256 | return; |
| 251 | 257 | ||
| 258 | + CHECK_SESSION_HANDLE(hSession); | ||
| 259 | + | ||
| 252 | ta = (struct ta *) Malloc(sizeof(*ta)); | 260 | ta = (struct ta *) Malloc(sizeof(*ta)); |
| 253 | - ta->next = (struct ta *) NULL; | ||
| 254 | - ta->type = TA_TYPE_DEFAULT; | ||
| 255 | - ta->fn = fn; | ||
| 256 | - ta->parm1 = ta->parm2 = CN; | ||
| 257 | - if (parm1) { | ||
| 258 | - ta->parm1 = NewString(parm1); | ||
| 259 | - if (parm2) | ||
| 260 | - ta->parm2 = NewString(parm2); | ||
| 261 | - } | 261 | + memset(ta,0,sizeof(struct ta)); |
| 262 | + ta->session = hSession; | ||
| 263 | + ta->next = (struct ta *) NULL; | ||
| 264 | + ta->type = TA_TYPE_DEFAULT; | ||
| 265 | + ta->fn = fn; | ||
| 266 | + | ||
| 267 | + if (parm1) | ||
| 268 | + ta->parm[0] = NewString(parm1); | ||
| 269 | + | ||
| 270 | + if (parm2) | ||
| 271 | + ta->parm[1] = NewString(parm2); | ||
| 272 | + | ||
| 262 | if (ta_head) | 273 | if (ta_head) |
| 274 | + { | ||
| 263 | ta_tail->next = ta; | 275 | ta_tail->next = ta; |
| 264 | - else { | 276 | + } |
| 277 | + else | ||
| 278 | + { | ||
| 265 | ta_head = ta; | 279 | ta_head = ta; |
| 266 | status_typeahead(&h3270,True); | 280 | status_typeahead(&h3270,True); |
| 267 | } | 281 | } |
| @@ -280,7 +294,8 @@ Boolean run_ta(void) | @@ -280,7 +294,8 @@ Boolean run_ta(void) | ||
| 280 | if (kybdlock || (ta = ta_head) == (struct ta *)NULL) | 294 | if (kybdlock || (ta = ta_head) == (struct ta *)NULL) |
| 281 | return False; | 295 | return False; |
| 282 | 296 | ||
| 283 | - if ((ta_head = ta->next) == (struct ta *)NULL) { | 297 | + if ((ta_head = ta->next) == (struct ta *)NULL) |
| 298 | + { | ||
| 284 | ta_tail = (struct ta *)NULL; | 299 | ta_tail = (struct ta *)NULL; |
| 285 | status_typeahead(&h3270,False); | 300 | status_typeahead(&h3270,False); |
| 286 | } | 301 | } |
| @@ -288,31 +303,19 @@ Boolean run_ta(void) | @@ -288,31 +303,19 @@ Boolean run_ta(void) | ||
| 288 | switch(ta->type) | 303 | switch(ta->type) |
| 289 | { | 304 | { |
| 290 | case TA_TYPE_DEFAULT: | 305 | case TA_TYPE_DEFAULT: |
| 291 | - action_internal(ta->fn, IA_TYPEAHEAD, ta->parm1, ta->parm2); | ||
| 292 | - Free(ta->parm1); | ||
| 293 | - Free(ta->parm2); | 306 | + ta->fn(ta->session,ta->parm[0],ta->parm[1]); |
| 307 | + Free(ta->parm[0]); | ||
| 308 | + Free(ta->parm[1]); | ||
| 294 | Free(ta); | 309 | Free(ta); |
| 295 | break; | 310 | break; |
| 296 | 311 | ||
| 297 | case TA_TYPE_KEY_AID: | 312 | case TA_TYPE_KEY_AID: |
| 298 | - key_AID( ((char *) ta->parm1)[(int) ta->parm2]); | 313 | + trace("Sending enqueued key %02x",ta->aid_code); |
| 314 | + key_AID(ta->session,ta->aid_code); | ||
| 299 | break; | 315 | break; |
| 300 | -/* | ||
| 301 | - enum _ta_type | ||
| 302 | - { | ||
| 303 | - TA_TYPE_DEFAULT, | ||
| 304 | - , | ||
| 305 | - | ||
| 306 | - TA_TYPE_USER | ||
| 307 | - } type; | ||
| 308 | - | ||
| 309 | - XtActionProc fn; | ||
| 310 | - char *parm1; | ||
| 311 | - char *parm2; | ||
| 312 | -*/ | ||
| 313 | 316 | ||
| 314 | default: | 317 | default: |
| 315 | - popup_an_error(NULL, _( "Unexpected type %d in typeahead queue" ), ta->type); | 318 | + popup_an_error(ta->session, _( "Unexpected type %d in typeahead queue" ), ta->type); |
| 316 | 319 | ||
| 317 | } | 320 | } |
| 318 | 321 | ||
| @@ -329,9 +332,10 @@ flush_ta(void) | @@ -329,9 +332,10 @@ flush_ta(void) | ||
| 329 | struct ta *ta, *next; | 332 | struct ta *ta, *next; |
| 330 | Boolean any = False; | 333 | Boolean any = False; |
| 331 | 334 | ||
| 332 | - for (ta = ta_head; ta != (struct ta *) NULL; ta = next) { | ||
| 333 | - Free(ta->parm1); | ||
| 334 | - Free(ta->parm2); | 335 | + for (ta = ta_head; ta != (struct ta *) NULL; ta = next) |
| 336 | + { | ||
| 337 | + Free(ta->parm[0]); | ||
| 338 | + Free(ta->parm[1]); | ||
| 335 | next = ta->next; | 339 | next = ta->next; |
| 336 | Free(ta); | 340 | Free(ta); |
| 337 | any = True; | 341 | any = True; |
| @@ -482,8 +486,7 @@ operator_error(int error_type) | @@ -482,8 +486,7 @@ operator_error(int error_type) | ||
| 482 | * Handle an AID (Attention IDentifier) key. This is the common stuff that | 486 | * Handle an AID (Attention IDentifier) key. This is the common stuff that |
| 483 | * gets executed for all AID keys (PFs, PAs, Clear and etc). | 487 | * gets executed for all AID keys (PFs, PAs, Clear and etc). |
| 484 | */ | 488 | */ |
| 485 | -static void | ||
| 486 | -key_AID(unsigned char aid_code) | 489 | +static void key_AID(H3270 *session, unsigned char aid_code) |
| 487 | { | 490 | { |
| 488 | #if defined(X3270_ANSI) /*[*/ | 491 | #if defined(X3270_ANSI) /*[*/ |
| 489 | if (IN_ANSI) { | 492 | if (IN_ANSI) { |
| @@ -551,9 +554,9 @@ LIB3270_FKEY_ACTION( pfkey ) | @@ -551,9 +554,9 @@ LIB3270_FKEY_ACTION( pfkey ) | ||
| 551 | if (kybdlock & KL_OIA_MINUS) | 554 | if (kybdlock & KL_OIA_MINUS) |
| 552 | return -1; | 555 | return -1; |
| 553 | else if (kybdlock) | 556 | else if (kybdlock) |
| 554 | - enq_key(pf_xlate,key-1); | 557 | + enq_key(pf_xlate[key-1]); |
| 555 | else | 558 | else |
| 556 | - key_AID(pf_xlate[key-1]); | 559 | + key_AID(hSession,pf_xlate[key-1]); |
| 557 | 560 | ||
| 558 | return 0; | 561 | return 0; |
| 559 | } | 562 | } |
| @@ -568,9 +571,9 @@ LIB3270_FKEY_ACTION( pakey ) | @@ -568,9 +571,9 @@ LIB3270_FKEY_ACTION( pakey ) | ||
| 568 | if (kybdlock & KL_OIA_MINUS) | 571 | if (kybdlock & KL_OIA_MINUS) |
| 569 | return -1; | 572 | return -1; |
| 570 | else if (kybdlock) | 573 | else if (kybdlock) |
| 571 | - enq_key(pa_xlate,key-1); | 574 | + enq_key(pa_xlate[key-1]); |
| 572 | else | 575 | else |
| 573 | - key_AID(pa_xlate[key-1]); | 576 | + key_AID(hSession,pa_xlate[key-1]); |
| 574 | 577 | ||
| 575 | return 0; | 578 | return 0; |
| 576 | } | 579 | } |
| @@ -720,27 +723,28 @@ static Boolean ins_prep(int faddr, int baddr, int count) | @@ -720,27 +723,28 @@ static Boolean ins_prep(int faddr, int baddr, int count) | ||
| 720 | #define GE_WFLAG 0x100 | 723 | #define GE_WFLAG 0x100 |
| 721 | #define PASTE_WFLAG 0x200 | 724 | #define PASTE_WFLAG 0x200 |
| 722 | 725 | ||
| 723 | -static void | ||
| 724 | -key_Character_wrapper(Widget w unused, XEvent *event unused, String *params, | ||
| 725 | - Cardinal *num_params unused) | 726 | +static void key_Character_wrapper(H3270 *param, const char *param1, const char *param2) |
| 726 | { | 727 | { |
| 727 | int code; | 728 | int code; |
| 728 | Boolean with_ge = False; | 729 | Boolean with_ge = False; |
| 729 | Boolean pasting = False; | 730 | Boolean pasting = False; |
| 730 | 731 | ||
| 731 | - code = atoi(params[0]); | ||
| 732 | - if (code & GE_WFLAG) { | 732 | + code = atoi(param1); |
| 733 | + | ||
| 734 | + if (code & GE_WFLAG) | ||
| 735 | + { | ||
| 733 | with_ge = True; | 736 | with_ge = True; |
| 734 | code &= ~GE_WFLAG; | 737 | code &= ~GE_WFLAG; |
| 735 | } | 738 | } |
| 736 | - if (code & PASTE_WFLAG) { | 739 | + |
| 740 | + if (code & PASTE_WFLAG) | ||
| 741 | + { | ||
| 737 | pasting = True; | 742 | pasting = True; |
| 738 | code &= ~PASTE_WFLAG; | 743 | code &= ~PASTE_WFLAG; |
| 739 | } | 744 | } |
| 740 | - trace_event(" %s -> Key(%s\"%s\")\n", | ||
| 741 | - ia_name[(int) ia_cause], | ||
| 742 | - with_ge ? "GE " : "", | ||
| 743 | - ctl_see((int) ebc2asc[code])); | 745 | + |
| 746 | +// trace_event(" %s -> Key(%s\"%s\")\n",ia_name[(int) ia_cause],with_ge ? "GE " : "",ctl_see((int) ebc2asc[code])); | ||
| 747 | + | ||
| 744 | (void) key_Character(code, with_ge, pasting, NULL); | 748 | (void) key_Character(code, with_ge, pasting, NULL); |
| 745 | } | 749 | } |
| 746 | 750 | ||
| @@ -757,13 +761,12 @@ static Boolean key_Character(int code, Boolean with_ge, Boolean pasting, Boolean | @@ -757,13 +761,12 @@ static Boolean key_Character(int code, Boolean with_ge, Boolean pasting, Boolean | ||
| 757 | if (skipped != NULL) | 761 | if (skipped != NULL) |
| 758 | *skipped = False; | 762 | *skipped = False; |
| 759 | 763 | ||
| 760 | - if (kybdlock) { | 764 | + if (kybdlock) |
| 765 | + { | ||
| 761 | char codename[64]; | 766 | char codename[64]; |
| 762 | 767 | ||
| 763 | - (void) sprintf(codename, "%d", code | | ||
| 764 | - (with_ge ? GE_WFLAG : 0) | | ||
| 765 | - (pasting ? PASTE_WFLAG : 0)); | ||
| 766 | - enq_ta(key_Character_wrapper, codename, CN); | 768 | + (void) sprintf(codename, "%d", code |(with_ge ? GE_WFLAG : 0) | (pasting ? PASTE_WFLAG : 0)); |
| 769 | + enq_ta(&h3270,key_Character_wrapper, codename, CN); | ||
| 767 | return False; | 770 | return False; |
| 768 | } | 771 | } |
| 769 | baddr = h3270.cursor_addr; | 772 | baddr = h3270.cursor_addr; |
| @@ -976,10 +979,10 @@ static Boolean key_Character(int code, Boolean with_ge, Boolean pasting, Boolean | @@ -976,10 +979,10 @@ static Boolean key_Character(int code, Boolean with_ge, Boolean pasting, Boolean | ||
| 976 | return True; | 979 | return True; |
| 977 | } | 980 | } |
| 978 | 981 | ||
| 979 | -#if defined(X3270_DBCS) /*[*/ | 982 | +/* |
| 983 | +#if defined(X3270_DBCS) | ||
| 980 | static void | 984 | static void |
| 981 | -key_WCharacter_wrapper(Widget w unused, XEvent *event unused, String *params, | ||
| 982 | - Cardinal *num_params unused) | 985 | +key_WCharacter_wrapper(Widget w unused, XEvent *event unused, String *params, Cardinal *num_params unused) |
| 983 | { | 986 | { |
| 984 | int code; | 987 | int code; |
| 985 | unsigned char codebuf[2]; | 988 | unsigned char codebuf[2]; |
| @@ -992,12 +995,11 @@ key_WCharacter_wrapper(Widget w unused, XEvent *event unused, String *params, | @@ -992,12 +995,11 @@ key_WCharacter_wrapper(Widget w unused, XEvent *event unused, String *params, | ||
| 992 | (void) key_WCharacter(codebuf, NULL); | 995 | (void) key_WCharacter(codebuf, NULL); |
| 993 | } | 996 | } |
| 994 | 997 | ||
| 995 | -/* | ||
| 996 | - * Input a DBCS character. | ||
| 997 | - * Returns True if a character was stored in the buffer, False otherwise. | ||
| 998 | - */ | ||
| 999 | -Boolean | ||
| 1000 | -key_WCharacter(unsigned char code[], Boolean *skipped) | 998 | +// |
| 999 | +// Input a DBCS character. | ||
| 1000 | +// Returns True if a character was stored in the buffer, False otherwise. | ||
| 1001 | +// | ||
| 1002 | +Boolean key_WCharacter(unsigned char code[], Boolean *skipped) | ||
| 1001 | { | 1003 | { |
| 1002 | int baddr; | 1004 | int baddr; |
| 1003 | register unsigned char fa; | 1005 | register unsigned char fa; |
| @@ -1006,7 +1008,7 @@ key_WCharacter(unsigned char code[], Boolean *skipped) | @@ -1006,7 +1008,7 @@ key_WCharacter(unsigned char code[], Boolean *skipped) | ||
| 1006 | int xaddr; | 1008 | int xaddr; |
| 1007 | Boolean done = False; | 1009 | Boolean done = False; |
| 1008 | Boolean no_si = False; | 1010 | Boolean no_si = False; |
| 1009 | - extern unsigned char reply_mode; /* XXX */ | 1011 | + extern unsigned char reply_mode; // XXX |
| 1010 | 1012 | ||
| 1011 | reset_idle_timer(); | 1013 | reset_idle_timer(); |
| 1012 | 1014 | ||
| @@ -1021,15 +1023,15 @@ key_WCharacter(unsigned char code[], Boolean *skipped) | @@ -1021,15 +1023,15 @@ key_WCharacter(unsigned char code[], Boolean *skipped) | ||
| 1021 | if (skipped != NULL) | 1023 | if (skipped != NULL) |
| 1022 | *skipped = False; | 1024 | *skipped = False; |
| 1023 | 1025 | ||
| 1024 | - /* In DBCS mode? */ | 1026 | + // In DBCS mode? |
| 1025 | if (!dbcs) { | 1027 | if (!dbcs) { |
| 1026 | trace_event("DBCS character received when not in DBCS mode, " | 1028 | trace_event("DBCS character received when not in DBCS mode, " |
| 1027 | "ignoring.\n"); | 1029 | "ignoring.\n"); |
| 1028 | return True; | 1030 | return True; |
| 1029 | } | 1031 | } |
| 1030 | 1032 | ||
| 1031 | -#if defined(X3270_ANSI) /*[*/ | ||
| 1032 | - /* In ANSI mode? */ | 1033 | +#if defined(X3270_ANSI) |
| 1034 | + // In ANSI mode? | ||
| 1033 | if (IN_ANSI) { | 1035 | if (IN_ANSI) { |
| 1034 | char mb[16]; | 1036 | char mb[16]; |
| 1035 | 1037 | ||
| @@ -1037,38 +1039,38 @@ key_WCharacter(unsigned char code[], Boolean *skipped) | @@ -1037,38 +1039,38 @@ key_WCharacter(unsigned char code[], Boolean *skipped) | ||
| 1037 | net_sends(mb); | 1039 | net_sends(mb); |
| 1038 | return True; | 1040 | return True; |
| 1039 | } | 1041 | } |
| 1040 | -#endif /*]*/ | 1042 | +#endif |
| 1041 | 1043 | ||
| 1042 | baddr = cursor_addr; | 1044 | baddr = cursor_addr; |
| 1043 | fa = get_field_attribute(baddr); | 1045 | fa = get_field_attribute(baddr); |
| 1044 | faddr = find_field_attribute(baddr); | 1046 | faddr = find_field_attribute(baddr); |
| 1045 | 1047 | ||
| 1046 | - /* Protected? */ | 1048 | + // Protected? |
| 1047 | if (ea_buf[baddr].fa || FA_IS_PROTECTED(fa)) { | 1049 | if (ea_buf[baddr].fa || FA_IS_PROTECTED(fa)) { |
| 1048 | operator_error(KL_OERR_PROTECTED); | 1050 | operator_error(KL_OERR_PROTECTED); |
| 1049 | return False; | 1051 | return False; |
| 1050 | } | 1052 | } |
| 1051 | 1053 | ||
| 1052 | - /* Numeric? */ | 1054 | + // Numeric? |
| 1053 | if (h3270.numeric_lock && FA_IS_NUMERIC(fa)) { | 1055 | if (h3270.numeric_lock && FA_IS_NUMERIC(fa)) { |
| 1054 | operator_error(KL_OERR_NUMERIC); | 1056 | operator_error(KL_OERR_NUMERIC); |
| 1055 | return False; | 1057 | return False; |
| 1056 | } | 1058 | } |
| 1057 | 1059 | ||
| 1058 | - /* | ||
| 1059 | - * Figure our what to do based on the DBCS state of the buffer. | ||
| 1060 | - * Leaves baddr pointing to the next unmodified position. | ||
| 1061 | - */ | 1060 | + // |
| 1061 | + // Figure our what to do based on the DBCS state of the buffer. | ||
| 1062 | + // Leaves baddr pointing to the next unmodified position. | ||
| 1063 | + // | ||
| 1062 | retry: | 1064 | retry: |
| 1063 | switch (d = ctlr_dbcs_state(baddr)) { | 1065 | switch (d = ctlr_dbcs_state(baddr)) { |
| 1064 | case DBCS_RIGHT: | 1066 | case DBCS_RIGHT: |
| 1065 | case DBCS_RIGHT_WRAP: | 1067 | case DBCS_RIGHT_WRAP: |
| 1066 | - /* Back up one position and process it as a LEFT. */ | 1068 | + // Back up one position and process it as a LEFT. |
| 1067 | DEC_BA(baddr); | 1069 | DEC_BA(baddr); |
| 1068 | - /* fall through... */ | 1070 | + // fall through... |
| 1069 | case DBCS_LEFT: | 1071 | case DBCS_LEFT: |
| 1070 | case DBCS_LEFT_WRAP: | 1072 | case DBCS_LEFT_WRAP: |
| 1071 | - /* Overwrite the existing character. */ | 1073 | + // Overwrite the existing character. |
| 1072 | if (insert) { | 1074 | if (insert) { |
| 1073 | if (!ins_prep(faddr, baddr, 2)) { | 1075 | if (!ins_prep(faddr, baddr, 2)) { |
| 1074 | return False; | 1076 | return False; |
| @@ -1081,24 +1083,24 @@ retry: | @@ -1081,24 +1083,24 @@ retry: | ||
| 1081 | done = True; | 1083 | done = True; |
| 1082 | break; | 1084 | break; |
| 1083 | case DBCS_SB: | 1085 | case DBCS_SB: |
| 1084 | - /* Back up one position and process it as an SI. */ | 1086 | + // Back up one position and process it as an SI. |
| 1085 | DEC_BA(baddr); | 1087 | DEC_BA(baddr); |
| 1086 | - /* fall through... */ | 1088 | + // fall through... |
| 1087 | case DBCS_SI: | 1089 | case DBCS_SI: |
| 1088 | - /* Extend the subfield to the right. */ | 1090 | + // Extend the subfield to the right. |
| 1089 | if (insert) { | 1091 | if (insert) { |
| 1090 | if (!ins_prep(faddr, baddr, 2)) { | 1092 | if (!ins_prep(faddr, baddr, 2)) { |
| 1091 | return False; | 1093 | return False; |
| 1092 | } | 1094 | } |
| 1093 | } else { | 1095 | } else { |
| 1094 | - /* Don't overwrite a field attribute or an SO. */ | 1096 | + // Don't overwrite a field attribute or an SO. |
| 1095 | xaddr = baddr; | 1097 | xaddr = baddr; |
| 1096 | - INC_BA(xaddr); /* C1 */ | 1098 | + INC_BA(xaddr); // C1 |
| 1097 | if (ea_buf[xaddr].fa) | 1099 | if (ea_buf[xaddr].fa) |
| 1098 | break; | 1100 | break; |
| 1099 | if (ea_buf[xaddr].cc == EBC_so) | 1101 | if (ea_buf[xaddr].cc == EBC_so) |
| 1100 | no_si = True; | 1102 | no_si = True; |
| 1101 | - INC_BA(xaddr); /* SI */ | 1103 | + INC_BA(xaddr); // SI |
| 1102 | if (ea_buf[xaddr].fa || ea_buf[xaddr].cc == EBC_so) | 1104 | if (ea_buf[xaddr].fa || ea_buf[xaddr].cc == EBC_so) |
| 1103 | break; | 1105 | break; |
| 1104 | } | 1106 | } |
| @@ -1117,107 +1119,107 @@ retry: | @@ -1117,107 +1119,107 @@ retry: | ||
| 1117 | if (ea_buf[faddr].ic) { | 1119 | if (ea_buf[faddr].ic) { |
| 1118 | Boolean extend_left = FALSE; | 1120 | Boolean extend_left = FALSE; |
| 1119 | 1121 | ||
| 1120 | - /* Is there room? */ | 1122 | + // Is there room? |
| 1121 | if (insert) { | 1123 | if (insert) { |
| 1122 | if (!ins_prep(faddr, baddr, 4)) { | 1124 | if (!ins_prep(faddr, baddr, 4)) { |
| 1123 | return False; | 1125 | return False; |
| 1124 | } | 1126 | } |
| 1125 | } else { | 1127 | } else { |
| 1126 | - xaddr = baddr; /* baddr, SO */ | 1128 | + xaddr = baddr; // baddr, SO |
| 1127 | if (ea_buf[xaddr].cc == EBC_so) { | 1129 | if (ea_buf[xaddr].cc == EBC_so) { |
| 1128 | - /* | ||
| 1129 | - * (baddr), where we would have put the | ||
| 1130 | - * SO, is already an SO. Move to | ||
| 1131 | - * (baddr+1) and try again. | ||
| 1132 | - */ | ||
| 1133 | -#if defined(DBCS_RIGHT_DEBUG) /*[*/ | 1130 | + // |
| 1131 | + // (baddr), where we would have put the | ||
| 1132 | + // SO, is already an SO. Move to | ||
| 1133 | + // (baddr+1) and try again. | ||
| 1134 | + // | ||
| 1135 | +#if defined(DBCS_RIGHT_DEBUG) | ||
| 1134 | printf("SO in position 0\n"); | 1136 | printf("SO in position 0\n"); |
| 1135 | -#endif /*]*/ | 1137 | +#endif |
| 1136 | INC_BA(baddr); | 1138 | INC_BA(baddr); |
| 1137 | goto retry; | 1139 | goto retry; |
| 1138 | } | 1140 | } |
| 1139 | 1141 | ||
| 1140 | - INC_BA(xaddr); /* baddr+1, C0 */ | 1142 | + INC_BA(xaddr); // baddr+1, C0 |
| 1141 | if (ea_buf[xaddr].fa) | 1143 | if (ea_buf[xaddr].fa) |
| 1142 | break; | 1144 | break; |
| 1143 | if (ea_buf[xaddr].cc == EBC_so) { | 1145 | if (ea_buf[xaddr].cc == EBC_so) { |
| 1144 | enum dbcs_state e; | 1146 | enum dbcs_state e; |
| 1145 | 1147 | ||
| 1146 | - /* | ||
| 1147 | - * (baddr+1), where we would have put | ||
| 1148 | - * the left side of the DBCS, is a SO. | ||
| 1149 | - * If there's room, we can extend the | ||
| 1150 | - * subfield to the left. If not, we're | ||
| 1151 | - * stuck. | ||
| 1152 | - */ | 1148 | + // |
| 1149 | + // (baddr+1), where we would have put | ||
| 1150 | + // the left side of the DBCS, is a SO. | ||
| 1151 | + // If there's room, we can extend the | ||
| 1152 | + // subfield to the left. If not, we're | ||
| 1153 | + // stuck. | ||
| 1154 | + // | ||
| 1153 | DEC_BA(xaddr); | 1155 | DEC_BA(xaddr); |
| 1154 | DEC_BA(xaddr); | 1156 | DEC_BA(xaddr); |
| 1155 | e = ctlr_dbcs_state(xaddr); | 1157 | e = ctlr_dbcs_state(xaddr); |
| 1156 | if (e == DBCS_NONE || e == DBCS_SB) { | 1158 | if (e == DBCS_NONE || e == DBCS_SB) { |
| 1157 | extend_left = True; | 1159 | extend_left = True; |
| 1158 | no_si = True; | 1160 | no_si = True; |
| 1159 | -#if defined(DBCS_RIGHT_DEBUG) /*[*/ | 1161 | +#if defined(DBCS_RIGHT_DEBUG) |
| 1160 | printf("SO in position 1, " | 1162 | printf("SO in position 1, " |
| 1161 | "extend left\n"); | 1163 | "extend left\n"); |
| 1162 | -#endif /*]*/ | 1164 | +#endif |
| 1163 | } else { | 1165 | } else { |
| 1164 | - /* | ||
| 1165 | - * Won't actually happen, | ||
| 1166 | - * because this implies that | ||
| 1167 | - * the buffer addr at baddr | ||
| 1168 | - * is an SB. | ||
| 1169 | - */ | ||
| 1170 | -#if defined(DBCS_RIGHT_DEBUG) /*[*/ | 1166 | + // |
| 1167 | + // Won't actually happen, | ||
| 1168 | + // because this implies that | ||
| 1169 | + // the buffer addr at baddr | ||
| 1170 | + // is an SB. | ||
| 1171 | + // | ||
| 1172 | +#if defined(DBCS_RIGHT_DEBUG) | ||
| 1171 | printf("SO in position 1, " | 1173 | printf("SO in position 1, " |
| 1172 | "no room on left, " | 1174 | "no room on left, " |
| 1173 | "fail\n"); | 1175 | "fail\n"); |
| 1174 | -#endif /*]*/ | 1176 | +#endif |
| 1175 | break; | 1177 | break; |
| 1176 | } | 1178 | } |
| 1177 | } | 1179 | } |
| 1178 | 1180 | ||
| 1179 | - INC_BA(xaddr); /* baddr+2, C1 */ | 1181 | + INC_BA(xaddr); // baddr+2, C1 |
| 1180 | if (ea_buf[xaddr].fa) | 1182 | if (ea_buf[xaddr].fa) |
| 1181 | break; | 1183 | break; |
| 1182 | if (ea_buf[xaddr].cc == EBC_so) { | 1184 | if (ea_buf[xaddr].cc == EBC_so) { |
| 1183 | - /* | ||
| 1184 | - * (baddr+2), where we want to put the | ||
| 1185 | - * right half of the DBCS character, is | ||
| 1186 | - * a SO. This is a natural extension | ||
| 1187 | - * to the left -- just make sure we | ||
| 1188 | - * don't write an SI. | ||
| 1189 | - */ | 1185 | + // |
| 1186 | + // (baddr+2), where we want to put the | ||
| 1187 | + // right half of the DBCS character, is | ||
| 1188 | + // a SO. This is a natural extension | ||
| 1189 | + // to the left -- just make sure we | ||
| 1190 | + // don't write an SI. | ||
| 1191 | + // | ||
| 1190 | no_si = True; | 1192 | no_si = True; |
| 1191 | -#if defined(DBCS_RIGHT_DEBUG) /*[*/ | 1193 | +#if defined(DBCS_RIGHT_DEBUG) |
| 1192 | printf("SO in position 2, no SI\n"); | 1194 | printf("SO in position 2, no SI\n"); |
| 1193 | -#endif /*]*/ | 1195 | +#endif |
| 1194 | } | 1196 | } |
| 1195 | 1197 | ||
| 1196 | - /* | ||
| 1197 | - * Check the fourth position only if we're | ||
| 1198 | - * not doing an extend-left. | ||
| 1199 | - */ | 1198 | + // |
| 1199 | + // Check the fourth position only if we're | ||
| 1200 | + // not doing an extend-left. | ||
| 1201 | + /// | ||
| 1200 | if (!no_si) { | 1202 | if (!no_si) { |
| 1201 | - INC_BA(xaddr); /* baddr+3, SI */ | 1203 | + INC_BA(xaddr); // baddr+3, SI |
| 1202 | if (ea_buf[xaddr].fa) | 1204 | if (ea_buf[xaddr].fa) |
| 1203 | break; | 1205 | break; |
| 1204 | if (ea_buf[xaddr].cc == EBC_so) { | 1206 | if (ea_buf[xaddr].cc == EBC_so) { |
| 1205 | - /* | ||
| 1206 | - * (baddr+3), where we want to | ||
| 1207 | - * put an | ||
| 1208 | - * SI, is an SO. Forget it. | ||
| 1209 | - */ | ||
| 1210 | -#if defined(DBCS_RIGHT_DEBUG) /*[*/ | 1207 | + // |
| 1208 | + // (baddr+3), where we want to | ||
| 1209 | + // put an | ||
| 1210 | + // SI, is an SO. Forget it. | ||
| 1211 | + // | ||
| 1212 | +#if defined(DBCS_RIGHT_DEBUG) | ||
| 1211 | printf("SO in position 3, " | 1213 | printf("SO in position 3, " |
| 1212 | "retry right\n"); | 1214 | "retry right\n"); |
| 1213 | INC_BA(baddr); | 1215 | INC_BA(baddr); |
| 1214 | goto retry; | 1216 | goto retry; |
| 1215 | -#endif /*]*/ | 1217 | +#endif |
| 1216 | break; | 1218 | break; |
| 1217 | } | 1219 | } |
| 1218 | } | 1220 | } |
| 1219 | } | 1221 | } |
| 1220 | - /* Yes, add it. */ | 1222 | + // Yes, add it. |
| 1221 | if (extend_left) | 1223 | if (extend_left) |
| 1222 | DEC_BA(baddr); | 1224 | DEC_BA(baddr); |
| 1223 | ctlr_add(baddr, EBC_so, ea_buf[baddr].cs); | 1225 | ctlr_add(baddr, EBC_so, ea_buf[baddr].cs); |
| @@ -1231,7 +1233,7 @@ retry: | @@ -1231,7 +1233,7 @@ retry: | ||
| 1231 | } | 1233 | } |
| 1232 | done = True; | 1234 | done = True; |
| 1233 | } else if (reply_mode == SF_SRM_CHAR) { | 1235 | } else if (reply_mode == SF_SRM_CHAR) { |
| 1234 | - /* Use the character attribute. */ | 1236 | + // Use the character attribute. |
| 1235 | if (insert) { | 1237 | if (insert) { |
| 1236 | if (!ins_prep(faddr, baddr, 2)) { | 1238 | if (!ins_prep(faddr, baddr, 2)) { |
| 1237 | return False; | 1239 | return False; |
| @@ -1252,7 +1254,7 @@ retry: | @@ -1252,7 +1254,7 @@ retry: | ||
| 1252 | } | 1254 | } |
| 1253 | 1255 | ||
| 1254 | if (done) { | 1256 | if (done) { |
| 1255 | - /* Implement blank fill mode. */ | 1257 | + // Implement blank fill mode. |
| 1256 | if (lib3270_get_toggle(&h3270,LIB3270_TOGGLE_BLANK_FILL)) { | 1258 | if (lib3270_get_toggle(&h3270,LIB3270_TOGGLE_BLANK_FILL)) { |
| 1257 | xaddr = faddr; | 1259 | xaddr = faddr; |
| 1258 | INC_BA(xaddr); | 1260 | INC_BA(xaddr); |
| @@ -1267,7 +1269,7 @@ retry: | @@ -1267,7 +1269,7 @@ retry: | ||
| 1267 | 1269 | ||
| 1268 | mdt_set(cursor_addr); | 1270 | mdt_set(cursor_addr); |
| 1269 | 1271 | ||
| 1270 | - /* Implement auto-skip. */ | 1272 | + // Implement auto-skip. |
| 1271 | while (ea_buf[baddr].fa) { | 1273 | while (ea_buf[baddr].fa) { |
| 1272 | if (skipped != NULL) | 1274 | if (skipped != NULL) |
| 1273 | *skipped = True; | 1275 | *skipped = True; |
| @@ -1284,7 +1286,8 @@ retry: | @@ -1284,7 +1286,8 @@ retry: | ||
| 1284 | return False; | 1286 | return False; |
| 1285 | } | 1287 | } |
| 1286 | } | 1288 | } |
| 1287 | -#endif /*]*/ | 1289 | +#endif |
| 1290 | +*/ | ||
| 1288 | 1291 | ||
| 1289 | /* | 1292 | /* |
| 1290 | * Handle an ordinary character key, given an ASCII code. | 1293 | * Handle an ordinary character key, given an ASCII code. |
| @@ -2306,7 +2309,7 @@ LIB3270_KEY_ACTION( enter ) | @@ -2306,7 +2309,7 @@ LIB3270_KEY_ACTION( enter ) | ||
| 2306 | else if (kybdlock) | 2309 | else if (kybdlock) |
| 2307 | ENQUEUE_ACTION(lib3270_enter); | 2310 | ENQUEUE_ACTION(lib3270_enter); |
| 2308 | else | 2311 | else |
| 2309 | - key_AID(AID_ENTER); | 2312 | + key_AID(hSession,AID_ENTER); |
| 2310 | 2313 | ||
| 2311 | return 0; | 2314 | return 0; |
| 2312 | } | 2315 | } |
| @@ -2328,7 +2331,7 @@ LIB3270_ACTION( sysreq ) | @@ -2328,7 +2331,7 @@ LIB3270_ACTION( sysreq ) | ||
| 2328 | else if (kybdlock) | 2331 | else if (kybdlock) |
| 2329 | ENQUEUE_ACTION(lib3270_sysreq); | 2332 | ENQUEUE_ACTION(lib3270_sysreq); |
| 2330 | else | 2333 | else |
| 2331 | - key_AID(AID_SYSREQ); | 2334 | + key_AID(hSession,AID_SYSREQ); |
| 2332 | } | 2335 | } |
| 2333 | return 0; | 2336 | return 0; |
| 2334 | } | 2337 | } |
| @@ -2356,7 +2359,7 @@ LIB3270_ACTION( clear ) | @@ -2356,7 +2359,7 @@ LIB3270_ACTION( clear ) | ||
| 2356 | ctlr_clear(hSession,True); | 2359 | ctlr_clear(hSession,True); |
| 2357 | cursor_move(hSession,0); | 2360 | cursor_move(hSession,0); |
| 2358 | if (CONNECTED) | 2361 | if (CONNECTED) |
| 2359 | - key_AID(AID_CLEAR); | 2362 | + key_AID(hSession,AID_CLEAR); |
| 2360 | return 0; | 2363 | return 0; |
| 2361 | } | 2364 | } |
| 2362 | 2365 | ||
| @@ -2836,7 +2839,6 @@ LIB3270_ACTION( fieldend ) | @@ -2836,7 +2839,6 @@ LIB3270_ACTION( fieldend ) | ||
| 2836 | // reset_idle_timer(); | 2839 | // reset_idle_timer(); |
| 2837 | if (kybdlock) { | 2840 | if (kybdlock) { |
| 2838 | ENQUEUE_ACTION( lib3270_fieldend ); | 2841 | ENQUEUE_ACTION( lib3270_fieldend ); |
| 2839 | -// enq_ta(FieldEnd_action, CN, CN); | ||
| 2840 | return 0; | 2842 | return 0; |
| 2841 | } | 2843 | } |
| 2842 | #if defined(X3270_ANSI) /*[*/ | 2844 | #if defined(X3270_ANSI) /*[*/ |
| @@ -3079,11 +3081,12 @@ LIB3270_EXPORT int lib3270_emulate_input(H3270 *session, char *s, int len, int p | @@ -3079,11 +3081,12 @@ LIB3270_EXPORT int lib3270_emulate_input(H3270 *session, char *s, int len, int p | ||
| 3079 | key_ACharacter((unsigned char) c, KT_STD, ia, &skipped); | 3081 | key_ACharacter((unsigned char) c, KT_STD, ia, &skipped); |
| 3080 | break; | 3082 | break; |
| 3081 | default: | 3083 | default: |
| 3082 | -#if defined(X3270_DBCS) /*[*/ | ||
| 3083 | - /* | ||
| 3084 | - * Try mapping it to the 8-bit character set, | ||
| 3085 | - * otherwise to the 16-bit character set. | ||
| 3086 | - */ | 3084 | +/* |
| 3085 | +#if defined(X3270_DBCS) | ||
| 3086 | + // | ||
| 3087 | + // Try mapping it to the 8-bit character set, | ||
| 3088 | + // otherwise to the 16-bit character set. | ||
| 3089 | + // | ||
| 3087 | if (dbcs_map8(c, &cx)) { | 3090 | if (dbcs_map8(c, &cx)) { |
| 3088 | key_ACharacter((unsigned char)cx, | 3091 | key_ACharacter((unsigned char)cx, |
| 3089 | KT_STD, ia_cause, &skipped); | 3092 | KT_STD, ia_cause, &skipped); |
| @@ -3096,9 +3099,8 @@ LIB3270_EXPORT int lib3270_emulate_input(H3270 *session, char *s, int len, int p | @@ -3096,9 +3099,8 @@ LIB3270_EXPORT int lib3270_emulate_input(H3270 *session, char *s, int len, int p | ||
| 3096 | "EBCDIC\n", c & 0xffff); | 3099 | "EBCDIC\n", c & 0xffff); |
| 3097 | break; | 3100 | break; |
| 3098 | } | 3101 | } |
| 3099 | -#endif /*]*/ | ||
| 3100 | - key_ACharacter((unsigned char) c, KT_STD, | ||
| 3101 | - ia, &skipped); | 3102 | +#endif */ |
| 3103 | + key_ACharacter((unsigned char) c, KT_STD, ia, &skipped); | ||
| 3102 | break; | 3104 | break; |
| 3103 | } | 3105 | } |
| 3104 | break; | 3106 | break; |
localdefs.h
| @@ -41,16 +41,23 @@ typedef char *String; | @@ -41,16 +41,23 @@ typedef char *String; | ||
| 41 | typedef unsigned int Cardinal; | 41 | typedef unsigned int Cardinal; |
| 42 | typedef unsigned long KeySym; | 42 | typedef unsigned long KeySym; |
| 43 | #define Bool int | 43 | #define Bool int |
| 44 | + | ||
| 45 | +/* | ||
| 44 | typedef void (*XtActionProc)( | 46 | typedef void (*XtActionProc)( |
| 45 | - Widget /* widget */, | ||
| 46 | - XEvent* /* event */, | ||
| 47 | - String* /* params */, | ||
| 48 | - Cardinal* /* num_params */ | 47 | + Widget // widget, |
| 48 | + XEvent* // event, | ||
| 49 | + String* // params, | ||
| 50 | + Cardinal* // num_param | ||
| 49 | ); | 51 | ); |
| 52 | +*/ | ||
| 53 | + | ||
| 54 | +/* | ||
| 50 | typedef struct _XtActionsRec{ | 55 | typedef struct _XtActionsRec{ |
| 51 | String string; | 56 | String string; |
| 52 | XtActionProc proc; | 57 | XtActionProc proc; |
| 53 | } XtActionsRec; | 58 | } XtActionsRec; |
| 59 | +*/ | ||
| 60 | + | ||
| 54 | #define XtNumber(n) (sizeof(n)/sizeof((n)[0])) | 61 | #define XtNumber(n) (sizeof(n)/sizeof((n)[0])) |
| 55 | #define NoSymbol 0L | 62 | #define NoSymbol 0L |
| 56 | 63 |
screen.c
| @@ -133,7 +133,7 @@ int screen_init(H3270 *session) | @@ -133,7 +133,7 @@ int screen_init(H3270 *session) | ||
| 133 | /* Set up callbacks for state changes. */ | 133 | /* Set up callbacks for state changes. */ |
| 134 | lib3270_register_schange(session,LIB3270_STATE_CONNECT, status_connect,0); | 134 | lib3270_register_schange(session,LIB3270_STATE_CONNECT, status_connect,0); |
| 135 | lib3270_register_schange(session,LIB3270_STATE_3270_MODE, status_3270_mode,0); | 135 | lib3270_register_schange(session,LIB3270_STATE_3270_MODE, status_3270_mode,0); |
| 136 | -// lib3270_register_schange(session,ST_PRINTER, status_printer,0); | 136 | +// lib3270_register_schange(session,LIB3270_STATE_PRINTER, status_printer,0); |
| 137 | 137 | ||
| 138 | /* Set up the controller. */ | 138 | /* Set up the controller. */ |
| 139 | ctlr_init(session,-1); | 139 | ctlr_init(session,-1); |
telnet.c
| @@ -2588,7 +2588,7 @@ check_linemode(Boolean init) | @@ -2588,7 +2588,7 @@ check_linemode(Boolean init) | ||
| 2588 | 2588 | ||
| 2589 | if (init || linemode != wasline) | 2589 | if (init || linemode != wasline) |
| 2590 | { | 2590 | { |
| 2591 | - st_changed(ST_LINE_MODE, linemode); | 2591 | + st_changed(LIB3270_STATE_LINE_MODE, linemode); |
| 2592 | if (!init) | 2592 | if (!init) |
| 2593 | { | 2593 | { |
| 2594 | trace_dsn("Operating in %s mode.\n",linemode ? "line" : "character-at-a-time"); | 2594 | trace_dsn("Operating in %s mode.\n",linemode ? "line" : "character-at-a-time"); |