Commit 60b8d5c8db4c27b82c03e17b7f8c5a914174eb50
1 parent
1a1e8112
Exists in
master
and in
3 other branches
Refactoring actions as properties (easier for language bindings).
Showing
4 changed files
with
90 additions
and
74 deletions
Show diff stats
src/core/actions/actions.c
| ... | ... | @@ -33,34 +33,39 @@ |
| 33 | 33 | |
| 34 | 34 | /*---[ Implement ]------------------------------------------------------------------------------------------------------------*/ |
| 35 | 35 | |
| 36 | -/** | |
| 37 | - * @brief Launch an action by name. | |
| 38 | - * | |
| 39 | - * @param name Name of the action to launch. | |
| 40 | - * | |
| 41 | - * @return 0 if ok, error code if not (sets errno). | |
| 42 | - * | |
| 43 | - */ | |
| 44 | -LIB3270_EXPORT int lib3270_action(H3270 *hSession, const char *name) | |
| 36 | +LIB3270_EXPORT const LIB3270_ACTION * lib3270_get_action(const char *name) | |
| 45 | 37 | { |
| 46 | - const LIB3270_ACTION_ENTRY *actions = lib3270_get_action_table(); | |
| 38 | + const LIB3270_ACTION * actions = lib3270_get_actions(); | |
| 47 | 39 | size_t f; |
| 48 | 40 | |
| 49 | 41 | for(f=0; actions[f].name; f++) |
| 50 | 42 | { |
| 51 | 43 | if(!strcasecmp(name,actions[f].name)) |
| 52 | - { | |
| 53 | - lib3270_trace_event(hSession,"Action(%s): %s\n",actions[f].name, (actions[f].label ? actions[f].label : "")); | |
| 44 | + return actions+f; | |
| 45 | + } | |
| 46 | + | |
| 47 | + errno = ENOTSUP; | |
| 48 | + return NULL; | |
| 49 | +} | |
| 54 | 50 | |
| 55 | - if(!actions[f].enabled(hSession)) | |
| 56 | - return errno = EPERM; | |
| 51 | +LIB3270_EXPORT int lib3270_action(H3270 *hSession, const char *name) | |
| 52 | +{ | |
| 53 | + const LIB3270_ACTION *action = lib3270_get_action(name); | |
| 57 | 54 | |
| 58 | - return actions[f].call(hSession); | |
| 59 | - } | |
| 55 | + if(!action) | |
| 56 | + { | |
| 57 | + lib3270_trace_event(hSession,"Unknown action \"%s\"\n",name); | |
| 58 | + return errno; | |
| 59 | + } | |
| 60 | 60 | |
| 61 | + if(!action->enabled(hSession)) | |
| 62 | + { | |
| 63 | + lib3270_trace_event(hSession,"Action \"%s\" is disabled\n",action->name); | |
| 64 | + return errno = EPERM; | |
| 61 | 65 | } |
| 62 | 66 | |
| 63 | - lib3270_trace_event(hSession,"Unknown action %s\n",name); | |
| 64 | - return errno = ENOENT; | |
| 67 | + lib3270_trace_event(hSession,"Activating action \"%s\"\n",action->name); | |
| 68 | + | |
| 69 | + return action->activate(hSession); | |
| 65 | 70 | |
| 66 | 71 | } | ... | ... |
src/core/actions/table.c
| ... | ... | @@ -68,10 +68,10 @@ |
| 68 | 68 | * @brief Get LIB3270 action table; |
| 69 | 69 | * |
| 70 | 70 | */ |
| 71 | - LIB3270_EXPORT const LIB3270_ACTION_ENTRY * lib3270_get_action_table() | |
| 71 | + LIB3270_EXPORT const LIB3270_ACTION * lib3270_get_actions() | |
| 72 | 72 | { |
| 73 | 73 | |
| 74 | - static const LIB3270_ACTION_ENTRY actions[] = | |
| 74 | + static const LIB3270_ACTION actions[] = | |
| 75 | 75 | { |
| 76 | 76 | // |
| 77 | 77 | // Network actions |
| ... | ... | @@ -82,7 +82,7 @@ |
| 82 | 82 | .icon = "connect", |
| 83 | 83 | .label = NULL, |
| 84 | 84 | .summary = N_( "Connect to host." ), |
| 85 | - .call = connect_host, | |
| 85 | + .activate = connect_host, | |
| 86 | 86 | .enabled = lib3270_is_disconnected |
| 87 | 87 | }, |
| 88 | 88 | |
| ... | ... | @@ -92,7 +92,7 @@ |
| 92 | 92 | .icon = "disconnect", |
| 93 | 93 | .label = NULL, |
| 94 | 94 | .summary = N_( "Disconnect from host." ), |
| 95 | - .call = lib3270_disconnect, | |
| 95 | + .activate = lib3270_disconnect, | |
| 96 | 96 | .enabled = lib3270_is_connected |
| 97 | 97 | }, |
| 98 | 98 | |
| ... | ... | @@ -105,7 +105,7 @@ |
| 105 | 105 | .icon = NULL, |
| 106 | 106 | .label = NULL, |
| 107 | 107 | .summary = N_( "Cursor up 1 position." ), |
| 108 | - .call = lib3270_cursor_up, | |
| 108 | + .activate = lib3270_cursor_up, | |
| 109 | 109 | .enabled = lib3270_is_connected |
| 110 | 110 | }, |
| 111 | 111 | |
| ... | ... | @@ -115,7 +115,7 @@ |
| 115 | 115 | .icon = NULL, |
| 116 | 116 | .label = NULL, |
| 117 | 117 | .summary = N_( "Cursor down 1 position." ), |
| 118 | - .call = lib3270_cursor_down, | |
| 118 | + .activate = lib3270_cursor_down, | |
| 119 | 119 | .enabled = lib3270_is_connected |
| 120 | 120 | }, |
| 121 | 121 | |
| ... | ... | @@ -125,7 +125,7 @@ |
| 125 | 125 | .icon = NULL, |
| 126 | 126 | .label = NULL, |
| 127 | 127 | .summary = N_( "Cursor left 1 position." ), |
| 128 | - .call = lib3270_cursor_left, | |
| 128 | + .activate = lib3270_cursor_left, | |
| 129 | 129 | .enabled = lib3270_is_connected |
| 130 | 130 | }, |
| 131 | 131 | |
| ... | ... | @@ -135,7 +135,7 @@ |
| 135 | 135 | .icon = NULL, |
| 136 | 136 | .label = NULL, |
| 137 | 137 | .summary = N_( "Cursor right 1 position." ), |
| 138 | - .call = lib3270_cursor_right, | |
| 138 | + .activate = lib3270_cursor_right, | |
| 139 | 139 | .enabled = lib3270_is_connected |
| 140 | 140 | }, |
| 141 | 141 | |
| ... | ... | @@ -145,7 +145,7 @@ |
| 145 | 145 | .icon = NULL, |
| 146 | 146 | .label = NULL, |
| 147 | 147 | .summary = N_( "Cursor to first field on next line or any lines after that." ), |
| 148 | - .call = lib3270_newline, | |
| 148 | + .activate = lib3270_newline, | |
| 149 | 149 | .enabled = lib3270_is_connected |
| 150 | 150 | }, |
| 151 | 151 | |
| ... | ... | @@ -155,7 +155,7 @@ |
| 155 | 155 | .icon = NULL, |
| 156 | 156 | .label = NULL, |
| 157 | 157 | .summary = N_( "Cursor to previous word." ), |
| 158 | - .call = lib3270_previousword, | |
| 158 | + .activate = lib3270_previousword, | |
| 159 | 159 | .enabled = lib3270_is_connected |
| 160 | 160 | }, |
| 161 | 161 | |
| ... | ... | @@ -165,7 +165,7 @@ |
| 165 | 165 | .icon = NULL, |
| 166 | 166 | .label = NULL, |
| 167 | 167 | .summary = N_( "Cursor to next unprotected word." ), |
| 168 | - .call = lib3270_nextword, | |
| 168 | + .activate = lib3270_nextword, | |
| 169 | 169 | .enabled = lib3270_is_connected |
| 170 | 170 | }, |
| 171 | 171 | |
| ... | ... | @@ -178,7 +178,7 @@ |
| 178 | 178 | .icon = "document-save", |
| 179 | 179 | .label = NULL, |
| 180 | 180 | .summary = N_( "Save screen." ), |
| 181 | - .call = save_all, | |
| 181 | + .activate = save_all, | |
| 182 | 182 | .enabled = lib3270_is_connected |
| 183 | 183 | }, |
| 184 | 184 | |
| ... | ... | @@ -188,7 +188,7 @@ |
| 188 | 188 | .icon = NULL, |
| 189 | 189 | .label = NULL, |
| 190 | 190 | .summary = N_( "Save selected area." ), |
| 191 | - .call = save_selected, | |
| 191 | + .activate = save_selected, | |
| 192 | 192 | .enabled = lib3270_has_selection |
| 193 | 193 | }, |
| 194 | 194 | |
| ... | ... | @@ -198,7 +198,7 @@ |
| 198 | 198 | .icon = NULL, |
| 199 | 199 | .label = NULL, |
| 200 | 200 | .summary = NULL, |
| 201 | - .call = save_copy, | |
| 201 | + .activate = save_copy, | |
| 202 | 202 | .enabled = lib3270_is_connected |
| 203 | 203 | }, |
| 204 | 204 | |
| ... | ... | @@ -208,7 +208,7 @@ |
| 208 | 208 | .icon = "document-load", |
| 209 | 209 | .label = NULL, |
| 210 | 210 | .summary = N_( "Paste file." ), |
| 211 | - .call = paste_file, | |
| 211 | + .activate = paste_file, | |
| 212 | 212 | .enabled = lib3270_is_connected |
| 213 | 213 | }, |
| 214 | 214 | |
| ... | ... | @@ -221,7 +221,7 @@ |
| 221 | 221 | .icon = "edit-select-all", |
| 222 | 222 | .label = NULL, |
| 223 | 223 | .summary = NULL, |
| 224 | - .call = lib3270_select_all, | |
| 224 | + .activate = lib3270_select_all, | |
| 225 | 225 | .enabled = lib3270_is_connected |
| 226 | 226 | }, |
| 227 | 227 | |
| ... | ... | @@ -231,7 +231,7 @@ |
| 231 | 231 | .icon = NULL, |
| 232 | 232 | .label = NULL, |
| 233 | 233 | .summary = N_( "Remove selection" ), |
| 234 | - .call = lib3270_unselect, | |
| 234 | + .activate = lib3270_unselect, | |
| 235 | 235 | .enabled = lib3270_has_selection |
| 236 | 236 | }, |
| 237 | 237 | |
| ... | ... | @@ -241,7 +241,7 @@ |
| 241 | 241 | .icon = NULL, |
| 242 | 242 | .label = NULL, |
| 243 | 243 | .summary = N_( "Reselect"), |
| 244 | - .call = lib3270_reselect, | |
| 244 | + .activate = lib3270_reselect, | |
| 245 | 245 | .enabled = lib3270_is_connected |
| 246 | 246 | }, |
| 247 | 247 | |
| ... | ... | @@ -254,7 +254,7 @@ |
| 254 | 254 | .icon = NULL, |
| 255 | 255 | .label = NULL, |
| 256 | 256 | .summary = N_( "Select Field" ), |
| 257 | - .call = lib3270_select_field, | |
| 257 | + .activate = lib3270_select_field, | |
| 258 | 258 | .enabled = lib3270_is_formatted |
| 259 | 259 | }, |
| 260 | 260 | |
| ... | ... | @@ -265,7 +265,7 @@ |
| 265 | 265 | .icon = NULL, |
| 266 | 266 | .label = NULL, |
| 267 | 267 | .summary = N_( "Move the cursor to the first blank after the last nonblank in the field." ), |
| 268 | - .call = lib3270_fieldend, | |
| 268 | + .activate = lib3270_fieldend, | |
| 269 | 269 | .enabled = lib3270_is_formatted |
| 270 | 270 | }, |
| 271 | 271 | |
| ... | ... | @@ -275,7 +275,7 @@ |
| 275 | 275 | .icon = "go-first", |
| 276 | 276 | .label = NULL, |
| 277 | 277 | .summary = N_( "Move to first unprotected field on screen." ), |
| 278 | - .call = lib3270_firstfield, | |
| 278 | + .activate = lib3270_firstfield, | |
| 279 | 279 | .enabled = lib3270_is_formatted |
| 280 | 280 | }, |
| 281 | 281 | |
| ... | ... | @@ -285,7 +285,7 @@ |
| 285 | 285 | .icon = "go-next", |
| 286 | 286 | .label = NULL, |
| 287 | 287 | .summary = N_( "Tab forward to next field." ), |
| 288 | - .call = lib3270_nextfield, | |
| 288 | + .activate = lib3270_nextfield, | |
| 289 | 289 | .enabled = lib3270_is_formatted |
| 290 | 290 | }, |
| 291 | 291 | |
| ... | ... | @@ -295,7 +295,7 @@ |
| 295 | 295 | .icon = "go-previous", |
| 296 | 296 | .label = NULL, |
| 297 | 297 | .summary = N_( "Tab backward to previous field." ), |
| 298 | - .call = lib3270_previousfield, | |
| 298 | + .activate = lib3270_previousfield, | |
| 299 | 299 | .enabled = lib3270_is_formatted |
| 300 | 300 | }, |
| 301 | 301 | |
| ... | ... | @@ -309,7 +309,7 @@ |
| 309 | 309 | .icon = NULL, |
| 310 | 310 | .label = NULL, |
| 311 | 311 | .summary = N_( "Backspaces the cursor until it hits the front of a word." ), |
| 312 | - .call = lib3270_deleteword, | |
| 312 | + .activate = lib3270_deleteword, | |
| 313 | 313 | .enabled = lib3270_is_connected |
| 314 | 314 | }, |
| 315 | 315 | |
| ... | ... | @@ -319,7 +319,7 @@ |
| 319 | 319 | .icon = NULL, |
| 320 | 320 | .label = NULL, |
| 321 | 321 | .summary = N_( "Delete field" ), |
| 322 | - .call = lib3270_deletefield, | |
| 322 | + .activate = lib3270_deletefield, | |
| 323 | 323 | .enabled = lib3270_is_formatted |
| 324 | 324 | }, |
| 325 | 325 | |
| ... | ... | @@ -330,7 +330,7 @@ |
| 330 | 330 | .icon = NULL, |
| 331 | 331 | .label = NULL, |
| 332 | 332 | .summary = NULL, |
| 333 | - .call = lib3270_eraseinput, | |
| 333 | + .activate = lib3270_eraseinput, | |
| 334 | 334 | .enabled = lib3270_is_connected |
| 335 | 335 | }, |
| 336 | 336 | |
| ... | ... | @@ -340,7 +340,7 @@ |
| 340 | 340 | .icon = NULL, |
| 341 | 341 | .label = NULL, |
| 342 | 342 | .summary = N_( "Erase End Of Field Key." ), |
| 343 | - .call = lib3270_eraseeof, | |
| 343 | + .activate = lib3270_eraseeof, | |
| 344 | 344 | .enabled = lib3270_is_formatted |
| 345 | 345 | }, |
| 346 | 346 | |
| ... | ... | @@ -350,7 +350,7 @@ |
| 350 | 350 | .icon = NULL, |
| 351 | 351 | .label = NULL, |
| 352 | 352 | .summary = N_( "Erase End Of Line Key." ), |
| 353 | - .call = lib3270_eraseeol, | |
| 353 | + .activate = lib3270_eraseeol, | |
| 354 | 354 | .enabled = lib3270_is_connected |
| 355 | 355 | }, |
| 356 | 356 | |
| ... | ... | @@ -360,7 +360,7 @@ |
| 360 | 360 | .icon = NULL, |
| 361 | 361 | .label = NULL, |
| 362 | 362 | .summary = NULL, |
| 363 | - .call = lib3270_erase, | |
| 363 | + .activate = lib3270_erase, | |
| 364 | 364 | .enabled = lib3270_is_connected |
| 365 | 365 | }, |
| 366 | 366 | |
| ... | ... | @@ -373,7 +373,7 @@ |
| 373 | 373 | .icon = NULL, |
| 374 | 374 | .label = NULL, |
| 375 | 375 | .summary = N_( "Send an \"Enter\" action." ), |
| 376 | - .call = lib3270_enter, | |
| 376 | + .activate = lib3270_enter, | |
| 377 | 377 | .enabled = lib3270_is_connected |
| 378 | 378 | }, |
| 379 | 379 | |
| ... | ... | @@ -384,7 +384,7 @@ |
| 384 | 384 | .icon = NULL, |
| 385 | 385 | .label = NULL, |
| 386 | 386 | .summary = NULL, |
| 387 | - .call = lib3270_kybdreset, | |
| 387 | + .activate = lib3270_kybdreset, | |
| 388 | 388 | .enabled = lib3270_is_connected |
| 389 | 389 | }, |
| 390 | 390 | |
| ... | ... | @@ -394,7 +394,7 @@ |
| 394 | 394 | .icon = NULL, |
| 395 | 395 | .label = NULL, |
| 396 | 396 | .summary = N_( "Clear AID key" ), |
| 397 | - .call = lib3270_clear, | |
| 397 | + .activate = lib3270_clear, | |
| 398 | 398 | .enabled = lib3270_is_connected |
| 399 | 399 | }, |
| 400 | 400 | |
| ... | ... | @@ -405,7 +405,7 @@ |
| 405 | 405 | .icon = NULL, |
| 406 | 406 | .label = NULL, |
| 407 | 407 | .summary = NULL, |
| 408 | - .call = lib3270_delete, | |
| 408 | + .activate = lib3270_delete, | |
| 409 | 409 | .enabled = lib3270_is_connected |
| 410 | 410 | }, |
| 411 | 411 | |
| ... | ... | @@ -415,7 +415,7 @@ |
| 415 | 415 | .icon = NULL, |
| 416 | 416 | .label = NULL, |
| 417 | 417 | .summary = N_( "DUP key" ), |
| 418 | - .call = lib3270_dup, | |
| 418 | + .activate = lib3270_dup, | |
| 419 | 419 | .enabled = lib3270_is_connected |
| 420 | 420 | }, |
| 421 | 421 | |
| ... | ... | @@ -425,7 +425,7 @@ |
| 425 | 425 | .icon = NULL, |
| 426 | 426 | .label = NULL, |
| 427 | 427 | .summary = N_( "FM key" ), |
| 428 | - .call = lib3270_fieldmark, | |
| 428 | + .activate = lib3270_fieldmark, | |
| 429 | 429 | .enabled = lib3270_is_connected |
| 430 | 430 | }, |
| 431 | 431 | |
| ... | ... | @@ -435,7 +435,7 @@ |
| 435 | 435 | .icon = NULL, |
| 436 | 436 | .label = NULL, |
| 437 | 437 | .summary = N_( "3270-style backspace." ), |
| 438 | - .call = lib3270_backspace, | |
| 438 | + .activate = lib3270_backspace, | |
| 439 | 439 | .enabled = lib3270_is_connected |
| 440 | 440 | }, |
| 441 | 441 | |
| ... | ... | @@ -445,7 +445,7 @@ |
| 445 | 445 | .icon = NULL, |
| 446 | 446 | .label = NULL, |
| 447 | 447 | .summary = N_( "ATTN key, per RFC 2355. Sends IP, regardless." ), |
| 448 | - .call = lib3270_attn, | |
| 448 | + .activate = lib3270_attn, | |
| 449 | 449 | .enabled = lib3270_is_connected |
| 450 | 450 | }, |
| 451 | 451 | |
| ... | ... | @@ -455,7 +455,7 @@ |
| 455 | 455 | .icon = NULL, |
| 456 | 456 | .label = NULL, |
| 457 | 457 | .summary = NULL, |
| 458 | - .call = lib3270_break, | |
| 458 | + .activate = lib3270_break, | |
| 459 | 459 | .enabled = lib3270_is_connected |
| 460 | 460 | }, |
| 461 | 461 | |
| ... | ... | @@ -465,7 +465,7 @@ |
| 465 | 465 | .icon = NULL, |
| 466 | 466 | .label = NULL, |
| 467 | 467 | .summary = NULL, |
| 468 | - .call = lib3270_paste_next, | |
| 468 | + .activate = lib3270_paste_next, | |
| 469 | 469 | .enabled = lib3270_is_connected |
| 470 | 470 | }, |
| 471 | 471 | |
| ... | ... | @@ -475,7 +475,7 @@ |
| 475 | 475 | .icon = NULL, |
| 476 | 476 | .label = NULL, |
| 477 | 477 | .summary = NULL, |
| 478 | - .call = lib3270_sysreq, | |
| 478 | + .activate = lib3270_sysreq, | |
| 479 | 479 | .enabled = lib3270_is_connected |
| 480 | 480 | }, |
| 481 | 481 | |
| ... | ... | @@ -487,8 +487,9 @@ |
| 487 | 487 | .key = "Print", |
| 488 | 488 | .icon = "document-print", |
| 489 | 489 | .label = NULL, |
| 490 | - .summary = N_("If the terminal has selected area print it, if not, print all contents."), | |
| 491 | - .call = lib3270_print, | |
| 490 | + .summary = N_("Send to print"), | |
| 491 | + .description = N_("If the terminal has selected area print it, if not, print all contents."), | |
| 492 | + .activate = lib3270_print, | |
| 492 | 493 | .enabled = lib3270_is_connected |
| 493 | 494 | }, |
| 494 | 495 | |
| ... | ... | @@ -498,7 +499,7 @@ |
| 498 | 499 | .icon = NULL, |
| 499 | 500 | .label = NULL, |
| 500 | 501 | .summary = N_("Print screen contents"), |
| 501 | - .call = lib3270_print_all, | |
| 502 | + .activate = lib3270_print_all, | |
| 502 | 503 | .enabled = lib3270_is_connected |
| 503 | 504 | }, |
| 504 | 505 | |
| ... | ... | @@ -508,7 +509,7 @@ |
| 508 | 509 | .icon = NULL, |
| 509 | 510 | .label = NULL, |
| 510 | 511 | .summary = N_( "Print selected area." ), |
| 511 | - .call = lib3270_print_selected, | |
| 512 | + .activate = lib3270_print_selected, | |
| 512 | 513 | .enabled = lib3270_has_selection |
| 513 | 514 | }, |
| 514 | 515 | |
| ... | ... | @@ -518,7 +519,7 @@ |
| 518 | 519 | .icon = NULL, |
| 519 | 520 | .label = NULL, |
| 520 | 521 | .summary = N_("Print copy (if available)"), |
| 521 | - .call = lib3270_print_copy, | |
| 522 | + .activate = lib3270_print_copy, | |
| 522 | 523 | .enabled = lib3270_is_connected |
| 523 | 524 | }, |
| 524 | 525 | |
| ... | ... | @@ -532,7 +533,7 @@ |
| 532 | 533 | .icon = NULL, |
| 533 | 534 | .label = NULL, |
| 534 | 535 | .summary = NULL, |
| 535 | - .call = lib3270_testpattern, | |
| 536 | + .activate = lib3270_testpattern, | |
| 536 | 537 | .enabled = lib3270_is_disconnected |
| 537 | 538 | }, |
| 538 | 539 | |
| ... | ... | @@ -542,7 +543,7 @@ |
| 542 | 543 | .icon = NULL, |
| 543 | 544 | .label = NULL, |
| 544 | 545 | .summary = NULL, |
| 545 | - .call = lib3270_charsettable, | |
| 546 | + .activate = lib3270_charsettable, | |
| 546 | 547 | .enabled = lib3270_is_disconnected |
| 547 | 548 | }, |
| 548 | 549 | |
| ... | ... | @@ -552,7 +553,7 @@ |
| 552 | 553 | .icon = NULL, |
| 553 | 554 | .label = NULL, |
| 554 | 555 | .summary = NULL, |
| 555 | - .call = NULL, | |
| 556 | + .activate = NULL, | |
| 556 | 557 | .enabled = NULL |
| 557 | 558 | } |
| 558 | 559 | }; | ... | ... |
src/include/lib3270/actions.h
| ... | ... | @@ -33,16 +33,18 @@ |
| 33 | 33 | extern "C" { |
| 34 | 34 | #endif |
| 35 | 35 | |
| 36 | - typedef struct _lib3270_action_entry | |
| 36 | + typedef struct _lib3270_action | |
| 37 | 37 | { |
| 38 | - const char *name; ///< @brief Action name. | |
| 38 | + LIB3270_PROPERTY_HEAD | |
| 39 | + | |
| 40 | + int (*activate)(H3270 *hSession); ///< @brief lib3270 associated method. | |
| 41 | + int (*enabled)(const H3270 *hSession); ///< @brief Is the action enabled? | |
| 42 | + | |
| 39 | 43 | const char *key; ///< @brief Default key (or NULL if no default). |
| 40 | 44 | const char *icon; ///< @brief Icon name (from https://standards.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html) |
| 41 | 45 | const char *label; ///< @brief Button label (or NULL). |
| 42 | - const char *summary; ///< @brief Short description (or NULL). | |
| 43 | - int (*call)(H3270 *hSession); ///< @brief lib3270 associated method. | |
| 44 | - int (*enabled)(const H3270 *hSession); ///< @brief Is the action enabled? | |
| 45 | - } LIB3270_ACTION_ENTRY; | |
| 46 | + | |
| 47 | + } LIB3270_ACTION; | |
| 46 | 48 | |
| 47 | 49 | /** |
| 48 | 50 | * |
| ... | ... | @@ -442,6 +444,13 @@ |
| 442 | 444 | */ |
| 443 | 445 | LIB3270_EXPORT int lib3270_charsettable(H3270 *hSession); |
| 444 | 446 | |
| 447 | +/** | |
| 448 | + * @brief Get lib3270 action by name. | |
| 449 | + * | |
| 450 | + * @return Action descriptor or NULL if failed (sets errno). | |
| 451 | + * | |
| 452 | + */ | |
| 453 | + LIB3270_EXPORT const LIB3270_ACTION * lib3270_get_action(const char *name); | |
| 445 | 454 | |
| 446 | 455 | /** |
| 447 | 456 | * |
| ... | ... | @@ -449,7 +458,7 @@ |
| 449 | 458 | * |
| 450 | 459 | * @return Array with all the supported actions. |
| 451 | 460 | */ |
| 452 | - LIB3270_EXPORT const LIB3270_ACTION_ENTRY * lib3270_get_action_table(); | |
| 461 | + LIB3270_EXPORT const LIB3270_ACTION * lib3270_get_actions(); | |
| 453 | 462 | |
| 454 | 463 | /** |
| 455 | 464 | * |
| ... | ... | @@ -461,6 +470,7 @@ |
| 461 | 470 | * @return The action return code. |
| 462 | 471 | * |
| 463 | 472 | * @retval EPERM Action is disabled. |
| 473 | + * @retval ENOTSUP Action name is invalid. | |
| 464 | 474 | * |
| 465 | 475 | */ |
| 466 | 476 | LIB3270_EXPORT int lib3270_action(H3270 *hSession, const char *name); | ... | ... |
src/mkactions/mkactions.c
| ... | ... | @@ -189,7 +189,7 @@ int main(int argc, char *argv[]) { |
| 189 | 189 | " *\n" |
| 190 | 190 | " * @return Array with all the supported actions.\n" |
| 191 | 191 | " */\n" |
| 192 | - " LIB3270_EXPORT const LIB3270_ACTION_ENTRY * lib3270_get_action_table();\n" | |
| 192 | + " LIB3270_EXPORT const LIB3270_ACTION_ENTRY * lib3270_get_actions();\n" | |
| 193 | 193 | "\n" |
| 194 | 194 | "/**\n" |
| 195 | 195 | " *\n" | ... | ... |