Commit 36dc653d0911d94bc235819f5924c4523dbca8fc
1 parent
78332e33
Exists in
master
and in
5 other branches
Ajustes no módulo hllapi.
Showing
5 changed files
with
58 additions
and
19 deletions
Show diff stats
src/include/pw3270/hllapi.h
| ... | ... | @@ -41,7 +41,7 @@ extern "C" { |
| 41 | 41 | |
| 42 | 42 | #define HLLAPI_MAXLENGTH 4096 |
| 43 | 43 | |
| 44 | - /* Function codes */ | |
| 44 | + /* Function codes - Reference http://www.ibm.com/support/knowledgecenter/SSEQ5Y_6.0.0/com.ibm.pcomm.doc/books/html/emulator_programming08.htm */ | |
| 45 | 45 | #define HLLAPI_CMD_CONNECTPS 1 /**< connect presentation space */ |
| 46 | 46 | #define HLLAPI_CMD_DISCONNECTPS 2 /**< disconnect presentation space */ |
| 47 | 47 | #define HLLAPI_CMD_INPUTSTRING 3 /**< send string */ |
| ... | ... | @@ -50,7 +50,10 @@ extern "C" { |
| 50 | 50 | #define HLLAPI_CMD_SEARCHPS 6 /**< Search the presentation space for a specified string. */ |
| 51 | 51 | #define HLLAPI_CMD_QUERYCURSOR 7 /**< Determines the location of the cursor in the presentation space. */ |
| 52 | 52 | #define HLLAPI_CMD_COPYPSTOSTR 8 /**< Copy presentation space to string */ |
| 53 | + #define HLLAPI_SET_SESSION_PARAMETERS 9 /**< Lets you change certain default session options in EHLLAPI for all sessions. */ | |
| 53 | 54 | #define HLLAPI_CMD_COPYSTRTOPS 15 /**< Copies an ASCII string directly to a specified position in the presentation space. */ |
| 55 | + #define HLLAPI_CMD_PAUSE 18 /**< Waits for a specified amount of time. */ | |
| 56 | + #define HLLAPI_RESET_SYSTEM 21 /**< Reinitializes EHLLAPI to its starting state. */ | |
| 54 | 57 | #define HLLAPI_CMD_SETCURSOR 40 /**< Places the cursor at a specified position in presentation space.*/ |
| 55 | 58 | #define HLLAPI_CMD_SENDFILE 90 /**< Send file to the host */ |
| 56 | 59 | #define HLLAPI_CMD_RECEIVEFILE 91 /**< Receive a file from the host */ |
| ... | ... | @@ -149,6 +152,8 @@ extern "C" { |
| 149 | 152 | HLLAPI_API_CALL hllapi_init(LPSTR mode); |
| 150 | 153 | HLLAPI_API_CALL hllapi_deinit(void); |
| 151 | 154 | |
| 155 | + HLLAPI_API_CALL hllapi_reset(void); | |
| 156 | + | |
| 152 | 157 | HLLAPI_API_CALL hllapi_get_revision(void); |
| 153 | 158 | HLLAPI_API_CALL hllapi_get_datadir(LPSTR datadir); |
| 154 | 159 | ... | ... |
src/plugins/hllapi/Makefile.in
src/plugins/hllapi/calls.cc
src/plugins/hllapi/hllapi.c
| ... | ... | @@ -47,6 +47,8 @@ |
| 47 | 47 | static int search_ps(char *buffer, unsigned short *length, unsigned short *rc); |
| 48 | 48 | static int copy_ps(char *buffer, unsigned short *length, unsigned short *rc); |
| 49 | 49 | static int wait_system(char *buffer, unsigned short *length, unsigned short *rc); |
| 50 | + static int reset_system(char *buffer, unsigned short *length, unsigned short *rc); | |
| 51 | + static int pause_system(char *buffer, unsigned short *length, unsigned short *rc); | |
| 50 | 52 | |
| 51 | 53 | static int get_cursor_position(char *buffer, unsigned short *length, unsigned short *rc); |
| 52 | 54 | static int set_cursor_position(char *buffer, unsigned short *length, unsigned short *rc); |
| ... | ... | @@ -75,6 +77,8 @@ |
| 75 | 77 | { HLLAPI_CMD_COPYSTRTOPS, copy_str_to_ps }, |
| 76 | 78 | { HLLAPI_CMD_SENDFILE, invalid_request }, |
| 77 | 79 | { HLLAPI_CMD_RECEIVEFILE, invalid_request }, |
| 80 | + { HLLAPI_RESET_SYSTEM, reset_system }, | |
| 81 | + { HLLAPI_CMD_PAUSE, pause_system }, | |
| 78 | 82 | |
| 79 | 83 | }; |
| 80 | 84 | |
| ... | ... | @@ -409,14 +413,16 @@ static int wait_system(char *buffer, unsigned short *length, unsigned short *rc) |
| 409 | 413 | /* |
| 410 | 414 | * Return Code Definition |
| 411 | 415 | * |
| 412 | - * 0 The keyboard is unlocked and ready for input. | |
| 413 | - * 1 Your application program is not connected to a valid session. | |
| 414 | - * 4 Timeout while still in XCLOCK (X []) or XSYSTEM. | |
| 415 | - * 5 The keyboard is locked. | |
| 416 | - * 9 A system error was encountered. | |
| 416 | + * HLLAPI_STATUS_SUCCESS 0 The keyboard is unlocked and ready for input. | |
| 417 | + * HLLAPI_STATUS_DISCONNECTED 1 Your application program is not connected to a valid session. | |
| 418 | + * HLLAPI_STATUS_TIMEOUT 4 Timeout while still in XCLOCK (X []) or XSYSTEM. | |
| 419 | + * HLLAPI_STATUS_KEYBOARD_LOCKED 5 The keyboard is locked. | |
| 420 | + * HLLAPI_STATUS_SYSTEM_ERROR 9 A system error was encountered. | |
| 417 | 421 | * |
| 418 | 422 | */ |
| 419 | - time_t end = time(0) + 3600; | |
| 423 | + | |
| 424 | + /* | |
| 425 | + time_t end = time(0) + 60; | |
| 420 | 426 | |
| 421 | 427 | while(time(0) < end) |
| 422 | 428 | { |
| ... | ... | @@ -425,12 +431,16 @@ static int wait_system(char *buffer, unsigned short *length, unsigned short *rc) |
| 425 | 431 | if(state != HLLAPI_STATUS_WAITING) |
| 426 | 432 | return state; |
| 427 | 433 | |
| 428 | - if(hllapi_wait(1)) | |
| 429 | - return HLLAPI_STATUS_SYSTEM_ERROR; | |
| 434 | + hllapi_wait(1); | |
| 430 | 435 | |
| 431 | 436 | } |
| 432 | 437 | |
| 433 | 438 | return HLLAPI_STATUS_TIMEOUT; |
| 439 | + */ | |
| 440 | + | |
| 441 | + int state = hllapi_wait_for_ready(60); | |
| 442 | + return (state == HLLAPI_STATUS_WAITING ? HLLAPI_STATUS_TIMEOUT : state); | |
| 443 | + | |
| 434 | 444 | } |
| 435 | 445 | |
| 436 | 446 | static int copy_str_to_ps(char *text, unsigned short *length, unsigned short *ps) |
| ... | ... | @@ -438,19 +448,19 @@ static int copy_str_to_ps(char *text, unsigned short *length, unsigned short *ps |
| 438 | 448 | /* |
| 439 | 449 | * Call Parameters |
| 440 | 450 | * |
| 441 | - * Data String String of ASCII data to be copied into the host presentation space. | |
| 451 | + * Data String of ASCII data to be copied into the host presentation space. | |
| 442 | 452 | * Length Length, in number of bytes, of the source data string. Overridden if in EOT mode. |
| 443 | - * PS Position Position in the host presentation space to begin the copy, a value between 1 and the configured size of your host presentation space. | |
| 453 | + * PS Position in the host presentation space to begin the copy, a value between 1 and the configured size of your host presentation space. | |
| 444 | 454 | * |
| 445 | 455 | * Return Parameters |
| 446 | 456 | * |
| 447 | - * 0 The Copy String to Presentation Space function was successful. | |
| 448 | - * 1 Your program is not connected to a host session. | |
| 449 | - * 2 Parameter error or zero length for copy. | |
| 450 | - * 5 The target presentation space is protected or inhibited, or incorrect data was sent to the target presentation space (such as a field attribute byte). | |
| 451 | - * 6 The copy was completed, but the data was truncated. | |
| 452 | - * 7 The host presentation space position is not valid. | |
| 453 | - * 9 A system error was encountered. | |
| 457 | + * HLLAPI_STATUS_SUCCESS 0 The Copy String to Presentation Space function was successful. | |
| 458 | + * HLLAPI_STATUS_DISCONNECTED 1 Your program is not connected to a host session. | |
| 459 | + * HLLAPI_STATUS_BAD_PARAMETER 2 Parameter error or zero length for copy. | |
| 460 | + * HLLAPI_STATUS_KEYBOARD_LOCKED 5 The target presentation space is protected or inhibited, or incorrect data was sent to the target presentation space (such as a field attribute byte). | |
| 461 | + * 6 The copy was completed, but the data was truncated. | |
| 462 | + * 7 The host presentation space position is not valid. | |
| 463 | + * HLLAPI_STATUS_SYSTEM_ERROR 9 A system error was encountered. | |
| 454 | 464 | * |
| 455 | 465 | */ |
| 456 | 466 | size_t szText = strlen(text); |
| ... | ... | @@ -459,7 +469,7 @@ static int copy_str_to_ps(char *text, unsigned short *length, unsigned short *ps |
| 459 | 469 | szText = *length; |
| 460 | 470 | |
| 461 | 471 | if(!szText) |
| 462 | - return 2; | |
| 472 | + return HLLAPI_STATUS_BAD_PARAMETER; | |
| 463 | 473 | |
| 464 | 474 | switch(hllapi_get_message_id()) |
| 465 | 475 | { |
| ... | ... | @@ -483,3 +493,13 @@ static int copy_str_to_ps(char *text, unsigned short *length, unsigned short *ps |
| 483 | 493 | |
| 484 | 494 | return hllapi_emulate_input(text,szText,0); |
| 485 | 495 | } |
| 496 | + | |
| 497 | +static int reset_system(char *buffer, unsigned short *length, unsigned short *rc) | |
| 498 | +{ | |
| 499 | + return hllapi_reset(); | |
| 500 | +} | |
| 501 | + | |
| 502 | +static int pause_system(char *buffer, unsigned short *length, unsigned short *rc) | |
| 503 | +{ | |
| 504 | + return hllapi_wait_for_ready((*length) / 2); | |
| 505 | +} | ... | ... |
src/plugins/hllapi/testprogram.c