Commit a9d34e0ffec92e2b5f1d2a560e5bc92387d561f2
1 parent
3ad93b32
Exists in
master
and in
1 other branch
Debugging hllapi_get_cursor_address
Showing
2 changed files
with
26 additions
and
16 deletions
Show diff stats
src/core/cursor.cc
@@ -86,17 +86,11 @@ | @@ -86,17 +86,11 @@ | ||
86 | 86 | ||
87 | try { | 87 | try { |
88 | 88 | ||
89 | - TN3270::Host &host = getSession(); | ||
90 | - | ||
91 | - if(!host.isConnected()) | ||
92 | - return 0; | ||
93 | - | ||
94 | - return (DWORD) (host.getCursorAddress()+1); | 89 | + return (DWORD) (getSession().getCursorAddress()+1); |
95 | 90 | ||
96 | } catch(std::exception &e) { | 91 | } catch(std::exception &e) { |
97 | 92 | ||
98 | hllapi_lasterror = e.what(); | 93 | hllapi_lasterror = e.what(); |
99 | - return -1; | ||
100 | 94 | ||
101 | } | 95 | } |
102 | 96 |
src/testprogram/testprogram.cc
@@ -143,19 +143,35 @@ | @@ -143,19 +143,35 @@ | ||
143 | } else if(strncasecmp(cmdline.c_str(),"cursor",6) == 0) { | 143 | } else if(strncasecmp(cmdline.c_str(),"cursor",6) == 0) { |
144 | 144 | ||
145 | unsigned int row, col; | 145 | unsigned int row, col; |
146 | + const char * arg = cmdline.c_str()+6; | ||
147 | + | ||
148 | + while(*arg && isspace(*arg)) | ||
149 | + arg++; | ||
150 | + | ||
151 | + if(*arg) { | ||
152 | + | ||
153 | + switch(std::sscanf(arg,"%u,%u",&row,&col)) { | ||
154 | + case 1: | ||
155 | + cout << "Moving cursor to " << row << endl; | ||
156 | + rc = hllapi_set_cursor_address((WORD) row); | ||
157 | + break; | ||
158 | + | ||
159 | + case 2: | ||
160 | + cout << "Moving cursor to " << row << "," << col << endl; | ||
161 | + rc = hllapi_set_cursor_position((WORD) row, (WORD) col); | ||
162 | + break; | ||
163 | + } | ||
164 | + | ||
165 | + } else { | ||
166 | + | ||
167 | + int addr = hllapi_get_cursor_address(); | ||
168 | + | ||
169 | + cout << "Cursor address=" << addr << endl; | ||
146 | 170 | ||
147 | - switch(std::sscanf(cmdline.c_str()+6,"%u,%u",&row,&col)) { | ||
148 | - case 1: | ||
149 | - cout << "Moving cursor to " << row << endl; | ||
150 | - rc = hllapi_set_cursor_address((WORD) row); | ||
151 | - break; | ||
152 | 171 | ||
153 | - case 2: | ||
154 | - cout << "Moving cursor to " << row << "," << col << endl; | ||
155 | - rc = hllapi_set_cursor_position((WORD) row, (WORD) col); | ||
156 | - break; | ||
157 | } | 172 | } |
158 | 173 | ||
174 | + | ||
159 | } else if(strncasecmp(cmdline.c_str(),"at",2) == 0) { | 175 | } else if(strncasecmp(cmdline.c_str(),"at",2) == 0) { |
160 | 176 | ||
161 | unsigned int row, col, len; | 177 | unsigned int row, col, len; |