Commit 262966b29b7287f1ffbbcee9ce8affdd1e66bd3a
1 parent
bccefb08
Exists in
master
Refactoring .NET api native module.
Showing
8 changed files
with
340 additions
and
212 deletions
Show diff stats
src/native/actions.cc
| ... | ... | @@ -27,79 +27,105 @@ |
| 27 | 27 | * |
| 28 | 28 | */ |
| 29 | 29 | |
| 30 | + /** | |
| 31 | + * @file actions.cc | |
| 32 | + * | |
| 33 | + * @brief Actions wrapper. | |
| 34 | + * | |
| 35 | + * @author Perry Werneck <perry.werneck@gmail.com> | |
| 36 | + * | |
| 37 | + */ | |
| 38 | + | |
| 30 | 39 | #include "private.h" |
| 31 | 40 | |
| 32 | 41 | /*---[ Implement ]----------------------------------------------------------------------------------*/ |
| 33 | 42 | |
| 34 | -int tn3270_enter(h3270::session *ses) { | |
| 35 | - try { | |
| 36 | - return ses->enter(); | |
| 37 | - } catch(std::exception &e) { | |
| 38 | - tn3270_lasterror = e.what(); | |
| 39 | - return -1; | |
| 43 | +static int do_action(TN3270::Session *ses, TN3270::Action action) { | |
| 44 | + | |
| 45 | + if(ses) { | |
| 46 | + | |
| 47 | + try { | |
| 48 | + | |
| 49 | + ses->push(action); | |
| 50 | + return 0; | |
| 51 | + | |
| 52 | + } catch(const exception &e) { | |
| 53 | + | |
| 54 | + tn3270_lasterror = e.what(); | |
| 55 | + return -1; | |
| 56 | + | |
| 57 | + } | |
| 58 | + | |
| 40 | 59 | } |
| 60 | + | |
| 61 | + return -1; | |
| 62 | + | |
| 41 | 63 | } |
| 42 | 64 | |
| 43 | -int tn3270_pfkey(h3270::session *ses, int key) { | |
| 44 | - try { | |
| 45 | - return ses->pfkey(key); | |
| 46 | - } catch(std::exception &e) { | |
| 47 | - tn3270_lasterror = e.what(); | |
| 48 | - return -1; | |
| 49 | - } | |
| 65 | +int tn3270_enter(TN3270::Session *ses) { | |
| 66 | + return do_action(ses,TN3270::ENTER); | |
| 50 | 67 | } |
| 51 | 68 | |
| 52 | -int tn3270_pakey(h3270::session *ses, int key) { | |
| 69 | +int tn3270_pfkey(TN3270::Session *ses, int key) { | |
| 70 | + | |
| 53 | 71 | try { |
| 54 | - return ses->pakey(key); | |
| 55 | - } catch(std::exception &e) { | |
| 72 | + | |
| 73 | + ses->pfkey(key); | |
| 74 | + return 0; | |
| 75 | + | |
| 76 | + } catch(const exception &e) { | |
| 77 | + | |
| 56 | 78 | tn3270_lasterror = e.what(); |
| 57 | - return -1; | |
| 79 | + | |
| 58 | 80 | } |
| 81 | + return -1; | |
| 82 | + | |
| 59 | 83 | } |
| 60 | 84 | |
| 61 | -int tn3270_action(h3270::session *ses, const char *name) { | |
| 85 | +int tn3270_pakey(TN3270::Session *ses, int key) { | |
| 86 | + | |
| 62 | 87 | try { |
| 63 | - return ses->action(name); | |
| 64 | - } catch(std::exception &e) { | |
| 88 | + | |
| 89 | + ses->pakey(key); | |
| 90 | + return 0; | |
| 91 | + | |
| 92 | + } catch(const exception &e) { | |
| 93 | + | |
| 65 | 94 | tn3270_lasterror = e.what(); |
| 66 | - return -1; | |
| 95 | + | |
| 67 | 96 | } |
| 97 | + return -1; | |
| 68 | 98 | } |
| 69 | 99 | |
| 70 | -int tn3270_erase(h3270::session *ses) { | |
| 100 | +int tn3270_action(TN3270::Session *ses, const char *name) { | |
| 101 | + | |
| 71 | 102 | try { |
| 72 | - return ses->erase(); | |
| 73 | - } catch(std::exception &e) { | |
| 103 | + | |
| 104 | + ses->action(name); | |
| 105 | + return 0; | |
| 106 | + | |
| 107 | + } catch(const exception &e) { | |
| 108 | + | |
| 74 | 109 | tn3270_lasterror = e.what(); |
| 75 | - return -1; | |
| 110 | + | |
| 76 | 111 | } |
| 112 | + return -1; | |
| 113 | + | |
| 77 | 114 | } |
| 78 | 115 | |
| 79 | -int tn3270_erase_eof(h3270::session *ses) { | |
| 80 | - try { | |
| 81 | - return ses->erase_eof(); | |
| 82 | - } catch(std::exception &e) { | |
| 83 | - tn3270_lasterror = e.what(); | |
| 84 | - return -1; | |
| 85 | - } | |
| 116 | +int tn3270_erase(TN3270::Session *ses) { | |
| 117 | + return do_action(ses,TN3270::ERASE); | |
| 86 | 118 | } |
| 87 | 119 | |
| 88 | -int tn3270_erase_eol(h3270::session *ses) { | |
| 89 | - try { | |
| 90 | - return ses->erase_eol(); | |
| 91 | - } catch(std::exception &e) { | |
| 92 | - tn3270_lasterror = e.what(); | |
| 93 | - return -1; | |
| 94 | - } | |
| 120 | +int tn3270_erase_eof(TN3270::Session *ses) { | |
| 121 | + return do_action(ses,TN3270::ERASE_EOF); | |
| 95 | 122 | } |
| 96 | 123 | |
| 97 | -int tn3270_erase_input(h3270::session *ses) { | |
| 98 | - try { | |
| 99 | - return ses->erase_input(); | |
| 100 | - } catch(std::exception &e) { | |
| 101 | - tn3270_lasterror = e.what(); | |
| 102 | - return -1; | |
| 103 | - } | |
| 124 | +int tn3270_erase_eol(TN3270::Session *ses) { | |
| 125 | + return do_action(ses,TN3270::ERASE_EOL); | |
| 126 | +} | |
| 127 | + | |
| 128 | +int tn3270_erase_input(TN3270::Session *ses) { | |
| 129 | + return do_action(ses,TN3270::ERASE_INPUT); | |
| 104 | 130 | } |
| 105 | 131 | ... | ... |
src/native/get.cc
| ... | ... | @@ -36,17 +36,21 @@ |
| 36 | 36 | * @brief Obtém a versão da biblioteca. |
| 37 | 37 | * |
| 38 | 38 | */ |
| 39 | - int tn3270_get_version(h3270::session *ses, char* str, int strlen) { | |
| 39 | + int tn3270_get_version(TN3270::Session *ses, char* str, int strlen) { | |
| 40 | 40 | |
| 41 | 41 | if(!ses) { |
| 42 | 42 | return -1; |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | try { |
| 46 | - strncpy(str,ses->get_version().c_str(),strlen); | |
| 47 | - } catch(std::exception &e) { | |
| 46 | + | |
| 47 | + strncpy(str,ses->getVersion().c_str(),strlen); | |
| 48 | + | |
| 49 | + } catch(const exception &e) { | |
| 50 | + | |
| 48 | 51 | tn3270_lasterror = e.what(); |
| 49 | 52 | return -1; |
| 53 | + | |
| 50 | 54 | } |
| 51 | 55 | return 0; |
| 52 | 56 | } |
| ... | ... | @@ -55,120 +59,133 @@ |
| 55 | 59 | * @brief Obtém a revisão da biblioteca. |
| 56 | 60 | * |
| 57 | 61 | */ |
| 58 | - int tn3270_get_revision(h3270::session *ses, char* str, int strlen) { | |
| 62 | + int tn3270_get_revision(TN3270::Session *ses, char* str, int strlen) { | |
| 59 | 63 | |
| 60 | 64 | if(!ses) { |
| 61 | 65 | return -1; |
| 62 | 66 | } |
| 63 | 67 | |
| 64 | 68 | try { |
| 65 | - strncpy(str,ses->get_revision().c_str(),strlen); | |
| 66 | - } catch(std::exception &e) { | |
| 69 | + | |
| 70 | + strncpy(str,ses->getRevision().c_str(),strlen); | |
| 71 | + | |
| 72 | + } catch(const exception &e) { | |
| 73 | + | |
| 67 | 74 | tn3270_lasterror = e.what(); |
| 68 | 75 | return -1; |
| 76 | + | |
| 69 | 77 | } |
| 70 | 78 | return 0; |
| 71 | 79 | } |
| 72 | 80 | |
| 73 | - int tn3270_get_cstate(h3270::session *ses) { | |
| 81 | + int tn3270_get_cstate(TN3270::Session *ses) { | |
| 74 | 82 | |
| 75 | 83 | if(!ses) { |
| 76 | 84 | return -1; |
| 77 | 85 | } |
| 78 | 86 | |
| 79 | - trace_to_file("%s: %d",__FUNCTION__,(int) ses->get_cstate()); | |
| 80 | - | |
| 81 | 87 | try { |
| 82 | - return (int) ses->get_cstate(); | |
| 83 | - } catch(std::exception &e) { | |
| 88 | + | |
| 89 | + return (int) ses->getConnectionState(); | |
| 90 | + | |
| 91 | + } catch(const exception &e) { | |
| 92 | + | |
| 84 | 93 | tn3270_lasterror = e.what(); |
| 94 | + | |
| 85 | 95 | } |
| 86 | 96 | return -1; |
| 87 | 97 | |
| 88 | 98 | } |
| 89 | 99 | |
| 90 | - int tn3270_get_program_message(h3270::session *ses) { | |
| 100 | + int tn3270_get_program_message(TN3270::Session *ses) { | |
| 91 | 101 | |
| 92 | 102 | if(!ses) { |
| 93 | 103 | return -1; |
| 94 | 104 | } |
| 95 | 105 | |
| 96 | 106 | try { |
| 97 | - return (int) ses->get_program_message(); | |
| 98 | - } catch(std::exception &e) { | |
| 107 | + | |
| 108 | + return (int) ses->getProgramMessage(); | |
| 109 | + | |
| 110 | + } catch(const exception &e) { | |
| 99 | 111 | tn3270_lasterror = e.what(); |
| 100 | 112 | } |
| 101 | 113 | return -1; |
| 102 | 114 | |
| 103 | 115 | } |
| 104 | 116 | |
| 105 | - int tn3270_get_secure(h3270::session *ses) { | |
| 117 | + int tn3270_get_secure(TN3270::Session *ses) { | |
| 106 | 118 | |
| 119 | + /* | |
| 107 | 120 | if(!ses) { |
| 108 | 121 | return -1; |
| 109 | 122 | } |
| 110 | 123 | |
| 111 | 124 | try { |
| 125 | + | |
| 112 | 126 | return (int) ses->get_secure(); |
| 113 | - } catch(std::exception &e) { | |
| 127 | + | |
| 128 | + } catch(const exception &e) { | |
| 114 | 129 | tn3270_lasterror = e.what(); |
| 115 | 130 | } |
| 131 | + */ | |
| 132 | + | |
| 116 | 133 | return -1; |
| 117 | 134 | |
| 118 | 135 | } |
| 119 | 136 | |
| 120 | - int tn3270_get_width(h3270::session *ses) { | |
| 137 | + int tn3270_get_width(TN3270::Session *ses) { | |
| 121 | 138 | |
| 122 | 139 | if(!ses) { |
| 123 | 140 | return 0; |
| 124 | 141 | } |
| 125 | 142 | |
| 126 | 143 | try { |
| 127 | - return (int) ses->get_width(); | |
| 128 | - } catch(std::exception &e) { | |
| 144 | + return (int) ses->getScreenWidth(); | |
| 145 | + } catch(const exception &e) { | |
| 129 | 146 | tn3270_lasterror = e.what(); |
| 130 | 147 | } |
| 131 | 148 | return -1; |
| 132 | 149 | |
| 133 | 150 | } |
| 134 | 151 | |
| 135 | - int tn3270_get_height(h3270::session *ses) { | |
| 152 | + int tn3270_get_height(TN3270::Session *ses) { | |
| 136 | 153 | |
| 137 | 154 | if(!ses) { |
| 138 | 155 | return 0; |
| 139 | 156 | } |
| 140 | 157 | |
| 141 | 158 | try { |
| 142 | - return (int) ses->get_height(); | |
| 143 | - } catch(std::exception &e) { | |
| 159 | + return (int) ses->getScreenHeight(); | |
| 160 | + } catch(const exception &e) { | |
| 144 | 161 | tn3270_lasterror = e.what(); |
| 145 | 162 | } |
| 146 | 163 | return -1; |
| 147 | 164 | |
| 148 | 165 | } |
| 149 | 166 | |
| 150 | - int tn3270_get_length(h3270::session *ses) { | |
| 167 | + int tn3270_get_length(TN3270::Session *ses) { | |
| 151 | 168 | |
| 152 | 169 | if(!ses) { |
| 153 | 170 | return 0; |
| 154 | 171 | } |
| 155 | 172 | |
| 156 | 173 | try { |
| 157 | - return (int) ses->get_length(); | |
| 158 | - } catch(std::exception &e) { | |
| 174 | + return (int) ses->getScreenLength(); | |
| 175 | + } catch(const exception &e) { | |
| 159 | 176 | tn3270_lasterror = e.what(); |
| 160 | 177 | } |
| 161 | 178 | return -1; |
| 162 | 179 | |
| 163 | 180 | } |
| 164 | 181 | |
| 165 | - int tn3270_get_cursor_addr(h3270::session *ses) { | |
| 182 | + int tn3270_get_cursor_addr(TN3270::Session *ses) { | |
| 166 | 183 | |
| 167 | 184 | if(ses) { |
| 168 | 185 | |
| 169 | 186 | try { |
| 170 | - return (int) ses->get_cursor_addr(); | |
| 171 | - } catch(std::exception &e) { | |
| 187 | + return (int) ses->getCursorAddress(); | |
| 188 | + } catch(const exception &e) { | |
| 172 | 189 | tn3270_lasterror = e.what(); |
| 173 | 190 | } |
| 174 | 191 | |
| ... | ... | @@ -177,16 +194,16 @@ |
| 177 | 194 | |
| 178 | 195 | } |
| 179 | 196 | |
| 180 | - int tn3270_get_url(h3270::session *ses, char* str, int strlen) { | |
| 197 | + int tn3270_get_url(TN3270::Session *ses, char* str, int strlen) { | |
| 181 | 198 | |
| 182 | 199 | if(ses) { |
| 183 | 200 | |
| 184 | 201 | try { |
| 185 | 202 | |
| 186 | - strncpy(str,ses->get_url().c_str(),strlen); | |
| 203 | + strncpy(str,ses->getHostURL().c_str(),strlen); | |
| 187 | 204 | return 0; |
| 188 | 205 | |
| 189 | - } catch(std::exception &e) { | |
| 206 | + } catch(const exception &e) { | |
| 190 | 207 | tn3270_lasterror = e.what(); |
| 191 | 208 | } |
| 192 | 209 | |
| ... | ... | @@ -195,7 +212,7 @@ |
| 195 | 212 | |
| 196 | 213 | } |
| 197 | 214 | |
| 198 | - int tn3270_get_error_message(h3270::session *ses, char* str, int strlen) { | |
| 215 | + int tn3270_get_error_message(TN3270::Session *ses, char* str, int strlen) { | |
| 199 | 216 | |
| 200 | 217 | strncpy(str,tn3270_lasterror.c_str(),strlen); |
| 201 | 218 | return 0; | ... | ... |
src/native/init.cc
| ... | ... | @@ -41,16 +41,17 @@ |
| 41 | 41 | * @return Identificador da sessão criada. |
| 42 | 42 | * |
| 43 | 43 | */ |
| 44 | - h3270::session * tn3270_create_session(const char *name) { | |
| 45 | - | |
| 46 | - trace_to_file("%s(%s)",__FUNCTION__,name ? name : ""); | |
| 44 | + TN3270::Session * tn3270_create_session(const char *name) { | |
| 47 | 45 | |
| 48 | 46 | try { |
| 49 | - return h3270::session::create(name); | |
| 50 | - } catch(std::exception &e) { | |
| 47 | + | |
| 48 | + return TN3270::Session::create(name); | |
| 49 | + | |
| 50 | + } catch(const exception &e) { | |
| 51 | + | |
| 51 | 52 | tn3270_lasterror = e.what(); |
| 52 | - trace_to_file("%s(%s)",__FUNCTION__,e.what()); | |
| 53 | 53 | } |
| 54 | + | |
| 54 | 55 | return nullptr; |
| 55 | 56 | } |
| 56 | 57 | |
| ... | ... | @@ -58,36 +59,18 @@ |
| 58 | 59 | * @brief Destrói uma sessão. |
| 59 | 60 | * |
| 60 | 61 | */ |
| 61 | - int tn3270_destroy_session(h3270::session *ses) { | |
| 62 | - | |
| 63 | - trace_to_file("%s",__FUNCTION__); | |
| 62 | + int tn3270_destroy_session(TN3270::Session *ses) { | |
| 64 | 63 | |
| 65 | 64 | try { |
| 65 | + | |
| 66 | 66 | delete ses; |
| 67 | - } catch(std::exception &e) { | |
| 67 | + | |
| 68 | + } catch(const exception &e) { | |
| 69 | + | |
| 68 | 70 | tn3270_lasterror = e.what(); |
| 69 | 71 | return -1; |
| 72 | + | |
| 70 | 73 | } |
| 71 | 74 | return 0; |
| 72 | 75 | } |
| 73 | 76 | |
| 74 | -#ifdef ENABLE_TRACE_TO_FILE | |
| 75 | - void write_trace(const char *fmt, ...) { | |
| 76 | - | |
| 77 | - FILE *trace = fopen(PACKAGE_NAME ".trace","a"); | |
| 78 | - if(trace) { | |
| 79 | - va_list arg_ptr; | |
| 80 | - va_start(arg_ptr, fmt); | |
| 81 | - vfprintf(trace, fmt, arg_ptr); | |
| 82 | - fprintf(trace,"\n"); | |
| 83 | - va_end(arg_ptr); | |
| 84 | - fclose(trace); | |
| 85 | - } | |
| 86 | -#ifdef DEBUG | |
| 87 | - else { | |
| 88 | - perror(PACKAGE_NAME ".trace"); | |
| 89 | - } | |
| 90 | -#endif // DEBUG | |
| 91 | - | |
| 92 | - } | |
| 93 | -#endif // ENABLE_TRACE_TO_FILE | ... | ... |
| ... | ... | @@ -0,0 +1,50 @@ |
| 1 | +<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> | |
| 2 | +<CodeBlocks_project_file> | |
| 3 | + <FileVersion major="1" minor="6" /> | |
| 4 | + <Project> | |
| 5 | + <Option title="LIB3270 Native .NET Bindings" /> | |
| 6 | + <Option makefile_is_custom="1" /> | |
| 7 | + <Option pch_mode="2" /> | |
| 8 | + <Option compiler="gcc" /> | |
| 9 | + <Build> | |
| 10 | + <Target title="Debug"> | |
| 11 | + <Option output=".bin/Debug/LIB3270 Native " prefix_auto="1" extension_auto="1" /> | |
| 12 | + <Option object_output=".obj/Debug/" /> | |
| 13 | + <Option type="1" /> | |
| 14 | + <Option compiler="gcc" /> | |
| 15 | + <Compiler> | |
| 16 | + <Add option="-g" /> | |
| 17 | + </Compiler> | |
| 18 | + </Target> | |
| 19 | + <Target title="Release"> | |
| 20 | + <Option output=".bin/Release/LIB3270 Native " prefix_auto="1" extension_auto="1" /> | |
| 21 | + <Option object_output=".obj/Release/" /> | |
| 22 | + <Option type="1" /> | |
| 23 | + <Option compiler="gcc" /> | |
| 24 | + <Compiler> | |
| 25 | + <Add option="-O2" /> | |
| 26 | + </Compiler> | |
| 27 | + <Linker> | |
| 28 | + <Add option="-s" /> | |
| 29 | + </Linker> | |
| 30 | + </Target> | |
| 31 | + </Build> | |
| 32 | + <Compiler> | |
| 33 | + <Add option="-Wall" /> | |
| 34 | + </Compiler> | |
| 35 | + <Unit filename="actions.cc" /> | |
| 36 | + <Unit filename="get.cc" /> | |
| 37 | + <Unit filename="init.cc" /> | |
| 38 | + <Unit filename="network.cc" /> | |
| 39 | + <Unit filename="private.h" /> | |
| 40 | + <Unit filename="screen.cc" /> | |
| 41 | + <Unit filename="set.cc" /> | |
| 42 | + <Unit filename="windows/resources.rc.in" /> | |
| 43 | + <Extensions> | |
| 44 | + <code_completion /> | |
| 45 | + <envvars /> | |
| 46 | + <debugger /> | |
| 47 | + <lib_finder disable_auto="1" /> | |
| 48 | + </Extensions> | |
| 49 | + </Project> | |
| 50 | +</CodeBlocks_project_file> | ... | ... |
src/native/network.cc
| ... | ... | @@ -31,15 +31,24 @@ |
| 31 | 31 | |
| 32 | 32 | /*---[ Implement ]----------------------------------------------------------------------------------*/ |
| 33 | 33 | |
| 34 | -int tn3270_connect(h3270::session *ses, const char *host, time_t wait) { | |
| 34 | +int tn3270_connect(TN3270::Session *ses, const char *url, time_t timeout) { | |
| 35 | 35 | |
| 36 | 36 | if(ses) { |
| 37 | 37 | |
| 38 | 38 | try { |
| 39 | - debug("%s(%s,%d)",__FUNCTION__,host,(int) wait); | |
| 40 | - return ses->connect(host,wait); | |
| 41 | - } catch(std::exception &e) { | |
| 39 | + | |
| 40 | + ses->connect(url); | |
| 41 | + | |
| 42 | + if(timeout) { | |
| 43 | + ses->waitForReady(timeout); | |
| 44 | + } | |
| 45 | + | |
| 46 | + return 0; | |
| 47 | + | |
| 48 | + } catch(const exception &e) { | |
| 49 | + | |
| 42 | 50 | tn3270_lasterror = e.what(); |
| 51 | + | |
| 43 | 52 | } |
| 44 | 53 | |
| 45 | 54 | } |
| ... | ... | @@ -47,13 +56,16 @@ int tn3270_connect(h3270::session *ses, const char *host, time_t wait) { |
| 47 | 56 | return -1; |
| 48 | 57 | } |
| 49 | 58 | |
| 50 | -int tn3270_disconnect(h3270::session *ses) { | |
| 59 | +int tn3270_disconnect(TN3270::Session *ses) { | |
| 51 | 60 | |
| 52 | 61 | if(ses) { |
| 53 | 62 | |
| 54 | 63 | try { |
| 55 | - return ses->disconnect(); | |
| 56 | - } catch(std::exception &e) { | |
| 64 | + | |
| 65 | + ses->disconnect(); | |
| 66 | + return 0; | |
| 67 | + | |
| 68 | + } catch(const exception &e) { | |
| 57 | 69 | tn3270_lasterror = e.what(); |
| 58 | 70 | } |
| 59 | 71 | |
| ... | ... | @@ -62,13 +74,15 @@ int tn3270_disconnect(h3270::session *ses) { |
| 62 | 74 | return -1; |
| 63 | 75 | } |
| 64 | 76 | |
| 65 | -int tn3270_is_connected(h3270::session *ses) { | |
| 77 | +int tn3270_is_connected(TN3270::Session *ses) { | |
| 66 | 78 | |
| 67 | 79 | if(ses) { |
| 68 | 80 | |
| 69 | 81 | try { |
| 70 | - return (int) ses->is_connected(); | |
| 71 | - } catch(std::exception &e) { | |
| 82 | + | |
| 83 | + return (int) (ses->getConnectionState() == TN3270::CONNECTED_TN3270E ? 1 : 0); | |
| 84 | + | |
| 85 | + } catch(const exception &e) { | |
| 72 | 86 | tn3270_lasterror = e.what(); |
| 73 | 87 | } |
| 74 | 88 | |
| ... | ... | @@ -77,14 +91,18 @@ int tn3270_is_connected(h3270::session *ses) { |
| 77 | 91 | return -1; |
| 78 | 92 | } |
| 79 | 93 | |
| 80 | -int tn3270_is_ready(h3270::session *ses) { | |
| 94 | +int tn3270_is_ready(TN3270::Session *ses) { | |
| 81 | 95 | |
| 82 | 96 | if(ses) { |
| 83 | 97 | |
| 84 | 98 | try { |
| 85 | - return (int) ses->is_ready(); | |
| 86 | - } catch(std::exception &e) { | |
| 99 | + | |
| 100 | + return (int) (ses->getProgramMessage() == TN3270::MESSAGE_NONE ? 1 : 0); | |
| 101 | + | |
| 102 | + } catch(const exception &e) { | |
| 103 | + | |
| 87 | 104 | tn3270_lasterror = e.what(); |
| 105 | + | |
| 88 | 106 | } |
| 89 | 107 | |
| 90 | 108 | } |
| ... | ... | @@ -92,13 +110,16 @@ int tn3270_is_ready(h3270::session *ses) { |
| 92 | 110 | return -1; |
| 93 | 111 | } |
| 94 | 112 | |
| 95 | -int tn3270_wait_for_ready(h3270::session *ses, int seconds) { | |
| 113 | +int tn3270_wait_for_ready(TN3270::Session *ses, int seconds) { | |
| 96 | 114 | |
| 97 | 115 | if(ses) { |
| 98 | 116 | |
| 99 | 117 | try { |
| 100 | - return (int) ses->wait_for_ready(seconds); | |
| 101 | - } catch(std::exception &e) { | |
| 118 | + | |
| 119 | + ses->waitForReady(seconds); | |
| 120 | + return 0; | |
| 121 | + | |
| 122 | + } catch(const exception &e) { | |
| 102 | 123 | tn3270_lasterror = e.what(); |
| 103 | 124 | } |
| 104 | 125 | |
| ... | ... | @@ -107,13 +128,16 @@ int tn3270_wait_for_ready(h3270::session *ses, int seconds) { |
| 107 | 128 | |
| 108 | 129 | } |
| 109 | 130 | |
| 110 | -int tn3270_wait(h3270::session *ses, int seconds) { | |
| 131 | +int tn3270_wait(TN3270::Session *ses, int seconds) { | |
| 111 | 132 | |
| 112 | 133 | if(ses) { |
| 113 | 134 | |
| 114 | 135 | try { |
| 115 | - return (int) ses->wait(seconds); | |
| 116 | - } catch(std::exception &e) { | |
| 136 | + | |
| 137 | + ses->wait(seconds); | |
| 138 | + return 0; | |
| 139 | + | |
| 140 | + } catch(const exception &e) { | |
| 117 | 141 | tn3270_lasterror = e.what(); |
| 118 | 142 | } |
| 119 | 143 | ... | ... |
src/native/private.h
| ... | ... | @@ -31,6 +31,16 @@ |
| 31 | 31 | * http://tirania.org/blog/archive/2011/Dec-19.html |
| 32 | 32 | * |
| 33 | 33 | */ |
| 34 | + | |
| 35 | +/** | |
| 36 | + * @file private.h | |
| 37 | + * | |
| 38 | + * @brief Internal definitions for the .NET Native module. | |
| 39 | + * | |
| 40 | + * @author Perry Werneck <perry.werneck@gmail.com> | |
| 41 | + * | |
| 42 | + */ | |
| 43 | + | |
| 34 | 44 | #ifndef PRIVATE_H_INCLUDED |
| 35 | 45 | |
| 36 | 46 | #define PRIVATE_H_INCLUDED |
| ... | ... | @@ -65,77 +75,82 @@ |
| 65 | 75 | #define debug( fmt, ... ) /* */ |
| 66 | 76 | #endif // DEBUG |
| 67 | 77 | |
| 78 | + /* | |
| 68 | 79 | #ifdef ENABLE_TRACE_TO_FILE |
| 69 | 80 | DLL_PRIVATE void write_trace(const char *fmt, ...); |
| 70 | - #define trace_to_file( ... ) write_trace(__VA_ARGS__) | |
| 81 | + #define trace( ... ) write_trace(__VA_ARGS__) | |
| 71 | 82 | #else |
| 72 | - #define trace_to_file( ... ) /* */ | |
| 83 | + #define trace( ... ) | |
| 73 | 84 | #endif // ENABLE_TRACE_TO_FILE |
| 85 | + */ | |
| 74 | 86 | |
| 75 | - #include <pw3270/pw3270cpp.h> | |
| 87 | + #include <lib3270/ipc.h> | |
| 76 | 88 | #include <cerrno> |
| 77 | 89 | #include <cstring> |
| 78 | 90 | |
| 79 | - DLL_PRIVATE std::string tn3270_lasterror; | |
| 91 | + using std::string; | |
| 92 | + using std::exception; | |
| 93 | + | |
| 94 | + DLL_PRIVATE string tn3270_lasterror; | |
| 80 | 95 | |
| 81 | 96 | extern "C" { |
| 82 | 97 | |
| 83 | - DLL_PUBLIC h3270::session * tn3270_create_session(const char *name); | |
| 98 | + DLL_PUBLIC TN3270::Session * tn3270_create_session(const char *name); | |
| 84 | 99 | |
| 85 | - DLL_PUBLIC int tn3270_destroy_session(h3270::session *ses); | |
| 100 | + DLL_PUBLIC int tn3270_destroy_session(TN3270::Session *ses); | |
| 86 | 101 | |
| 87 | - DLL_PUBLIC int tn3270_get_version(h3270::session *ses, char* str, int strlen); | |
| 88 | - DLL_PUBLIC int tn3270_get_revision(h3270::session *ses, char* str, int strlen); | |
| 102 | + DLL_PUBLIC int tn3270_get_version(TN3270::Session *ses, char* str, int strlen); | |
| 103 | + DLL_PUBLIC int tn3270_get_revision(TN3270::Session *ses, char* str, int strlen); | |
| 89 | 104 | |
| 90 | - DLL_PUBLIC int tn3270_connect(h3270::session *ses, const char *host, time_t wait); | |
| 91 | - DLL_PUBLIC int tn3270_disconnect(h3270::session *ses); | |
| 92 | - DLL_PUBLIC int tn3270_is_connected(h3270::session *ses); | |
| 93 | - DLL_PUBLIC int tn3270_is_ready(h3270::session *ses); | |
| 105 | + DLL_PUBLIC int tn3270_connect(TN3270::Session *ses, const char *host, time_t wait); | |
| 106 | + DLL_PUBLIC int tn3270_disconnect(TN3270::Session *ses); | |
| 107 | + DLL_PUBLIC int tn3270_is_connected(TN3270::Session *ses); | |
| 108 | + DLL_PUBLIC int tn3270_is_ready(TN3270::Session *ses); | |
| 94 | 109 | |
| 95 | - DLL_PUBLIC int tn3270_set_url(h3270::session *ses, const char *url); | |
| 96 | - DLL_PUBLIC int tn3270_get_url(h3270::session *ses, char* str, int strlen); | |
| 110 | + DLL_PUBLIC int tn3270_set_url(TN3270::Session *ses, const char *url); | |
| 111 | + DLL_PUBLIC int tn3270_get_url(TN3270::Session *ses, char* str, int strlen); | |
| 97 | 112 | |
| 98 | - DLL_PUBLIC int tn3270_set_error_message(h3270::session *ses, const char *url); | |
| 99 | - DLL_PUBLIC int tn3270_get_error_message(h3270::session *ses, char* str, int strlen); | |
| 113 | + DLL_PUBLIC int tn3270_set_error_message(TN3270::Session *ses, const char *url); | |
| 114 | + DLL_PUBLIC int tn3270_get_error_message(TN3270::Session *ses, char* str, int strlen); | |
| 100 | 115 | |
| 101 | - DLL_PUBLIC int tn3270_set_cursor_addr(h3270::session *ses, int addr); | |
| 102 | - DLL_PUBLIC int tn3270_get_cursor_addr(h3270::session *ses); | |
| 116 | + DLL_PUBLIC int tn3270_set_cursor_addr(TN3270::Session *ses, int addr); | |
| 117 | + DLL_PUBLIC int tn3270_get_cursor_addr(TN3270::Session *ses); | |
| 103 | 118 | |
| 104 | - DLL_PUBLIC int tn3270_action(h3270::session *ses, const char *name); | |
| 119 | + DLL_PUBLIC int tn3270_action(TN3270::Session *ses, const char *name); | |
| 105 | 120 | |
| 106 | - DLL_PUBLIC int tn3270_erase(h3270::session *ses); | |
| 107 | - DLL_PUBLIC int tn3270_erase_eof(h3270::session *ses); | |
| 108 | - DLL_PUBLIC int tn3270_erase_eol(h3270::session *ses); | |
| 109 | - DLL_PUBLIC int tn3270_erase_input(h3270::session *ses); | |
| 121 | + DLL_PUBLIC int tn3270_erase(TN3270::Session *ses); | |
| 122 | + DLL_PUBLIC int tn3270_erase_eof(TN3270::Session *ses); | |
| 123 | + DLL_PUBLIC int tn3270_erase_eol(TN3270::Session *ses); | |
| 124 | + DLL_PUBLIC int tn3270_erase_input(TN3270::Session *ses); | |
| 110 | 125 | |
| 111 | - DLL_PUBLIC int tn3270_wait_for_ready(h3270::session *ses, int seconds); | |
| 112 | - DLL_PUBLIC int tn3270_wait(h3270::session *ses, int seconds); | |
| 126 | + DLL_PUBLIC int tn3270_wait_for_ready(TN3270::Session *ses, int seconds); | |
| 127 | + DLL_PUBLIC int tn3270_wait(TN3270::Session *ses, int seconds); | |
| 113 | 128 | |
| 114 | - DLL_PUBLIC int tn3270_get_cstate(h3270::session *ses); | |
| 115 | - DLL_PUBLIC int tn3270_get_program_message(h3270::session *ses); | |
| 116 | - DLL_PUBLIC int tn3270_get_secure(h3270::session *ses); | |
| 129 | + DLL_PUBLIC int tn3270_get_cstate(TN3270::Session *ses); | |
| 130 | + DLL_PUBLIC int tn3270_get_program_message(TN3270::Session *ses); | |
| 131 | + DLL_PUBLIC int tn3270_get_secure(TN3270::Session *ses); | |
| 117 | 132 | |
| 118 | - DLL_PUBLIC int tn3270_get_contents(h3270::session *ses, char* str, int strlen); | |
| 119 | - DLL_PUBLIC int tn3270_get_string(h3270::session *ses, int addr, char* str, int strlen); | |
| 120 | - DLL_PUBLIC int tn3270_get_string_at(h3270::session *ses, int row, int col, char* str, int strlen); | |
| 133 | + DLL_PUBLIC int tn3270_get_contents(TN3270::Session *ses, char* str, int strlen); | |
| 134 | + DLL_PUBLIC int tn3270_get_string(TN3270::Session *ses, int addr, char* str, int strlen); | |
| 135 | + DLL_PUBLIC int tn3270_get_string_at(TN3270::Session *ses, int row, int col, char* str, int strlen); | |
| 121 | 136 | |
| 122 | - DLL_PUBLIC int tn3270_set_string_at(h3270::session *ses, int row, int col, const char* str); | |
| 137 | + DLL_PUBLIC int tn3270_set_string_at(TN3270::Session *ses, int row, int col, const char* str); | |
| 123 | 138 | |
| 124 | - DLL_PUBLIC int tn3270_wait_for_string_at(h3270::session *ses, int row, int col, const char *key, int timeout); | |
| 125 | - DLL_PUBLIC int tn3270_cmp_string_at(h3270::session *ses, int row, int col, const char* str); | |
| 139 | + DLL_PUBLIC int tn3270_wait_for_string_at(TN3270::Session *ses, int row, int col, const char *key, int timeout); | |
| 140 | + DLL_PUBLIC int tn3270_cmp_string_at(TN3270::Session *ses, int row, int col, const char* str); | |
| 126 | 141 | |
| 127 | - DLL_PUBLIC int tn3270_set_unlock_delay(h3270::session *ses, int ms); | |
| 128 | - DLL_PUBLIC int tn3270_set_cursor_position(h3270::session *ses, int row, int col); | |
| 142 | + DLL_PUBLIC int tn3270_set_unlock_delay(TN3270::Session *ses, int ms); | |
| 143 | + DLL_PUBLIC int tn3270_set_cursor_position(TN3270::Session *ses, int row, int col); | |
| 129 | 144 | |
| 130 | - DLL_PUBLIC int tn3270_enter(h3270::session *ses); | |
| 131 | - DLL_PUBLIC int tn3270_pfkey(h3270::session *ses, int key); | |
| 132 | - DLL_PUBLIC int tn3270_pakey(h3270::session *ses, int key); | |
| 145 | + DLL_PUBLIC int tn3270_enter(TN3270::Session *ses); | |
| 146 | + DLL_PUBLIC int tn3270_pfkey(TN3270::Session *ses, int key); | |
| 147 | + DLL_PUBLIC int tn3270_pakey(TN3270::Session *ses, int key); | |
| 133 | 148 | |
| 134 | - DLL_PUBLIC int tn3270_get_width(h3270::session *ses); | |
| 135 | - DLL_PUBLIC int tn3270_get_height(h3270::session *ses); | |
| 136 | - DLL_PUBLIC int tn3270_get_length(h3270::session *ses); | |
| 149 | + DLL_PUBLIC int tn3270_get_width(TN3270::Session *ses); | |
| 150 | + DLL_PUBLIC int tn3270_get_height(TN3270::Session *ses); | |
| 151 | + DLL_PUBLIC int tn3270_get_length(TN3270::Session *ses); | |
| 137 | 152 | |
| 138 | - DLL_PUBLIC int tn3270_set_charset(h3270::session *ses, const char* str); | |
| 153 | + DLL_PUBLIC int tn3270_set_charset(TN3270::Session *ses, const char* str); | |
| 139 | 154 | |
| 140 | 155 | } |
| 141 | 156 | ... | ... |
src/native/screen.cc
| ... | ... | @@ -31,7 +31,7 @@ |
| 31 | 31 | |
| 32 | 32 | /*---[ Implement ]----------------------------------------------------------------------------------*/ |
| 33 | 33 | |
| 34 | -int tn3270_get_contents(h3270::session *ses, char* str, int sz) { | |
| 34 | +int tn3270_get_contents(TN3270::Session *ses, char* str, int sz) { | |
| 35 | 35 | |
| 36 | 36 | if(!ses) { |
| 37 | 37 | return -1; |
| ... | ... | @@ -39,7 +39,7 @@ int tn3270_get_contents(h3270::session *ses, char* str, int sz) { |
| 39 | 39 | |
| 40 | 40 | try { |
| 41 | 41 | |
| 42 | - std::string contents = ses->get_contents(); | |
| 42 | + std::string contents = ses->toString(0,sz); | |
| 43 | 43 | |
| 44 | 44 | memset(str,0,sz); |
| 45 | 45 | strncpy(str,contents.c_str(),sz); |
| ... | ... | @@ -48,7 +48,7 @@ int tn3270_get_contents(h3270::session *ses, char* str, int sz) { |
| 48 | 48 | return contents.size(); |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | - } catch(std::exception &e) { | |
| 51 | + } catch(const exception &e) { | |
| 52 | 52 | tn3270_lasterror = e.what(); |
| 53 | 53 | return -1; |
| 54 | 54 | } |
| ... | ... | @@ -57,7 +57,7 @@ int tn3270_get_contents(h3270::session *ses, char* str, int sz) { |
| 57 | 57 | |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | -int tn3270_get_string(h3270::session *ses, int addr, char* str, int strlen) { | |
| 60 | +int tn3270_get_string(TN3270::Session *ses, int addr, char* str, int strlen) { | |
| 61 | 61 | |
| 62 | 62 | if(!ses) { |
| 63 | 63 | return -1; |
| ... | ... | @@ -65,8 +65,8 @@ int tn3270_get_string(h3270::session *ses, int addr, char* str, int strlen) { |
| 65 | 65 | |
| 66 | 66 | try { |
| 67 | 67 | memset(str,0,strlen); |
| 68 | - strncpy(str,ses->get_string(addr,strlen).c_str(),strlen); | |
| 69 | - } catch(std::exception &e) { | |
| 68 | + strncpy(str,ses->toString(addr,strlen).c_str(),strlen); | |
| 69 | + } catch(const exception &e) { | |
| 70 | 70 | tn3270_lasterror = e.what(); |
| 71 | 71 | return -1; |
| 72 | 72 | } |
| ... | ... | @@ -74,67 +74,76 @@ int tn3270_get_string(h3270::session *ses, int addr, char* str, int strlen) { |
| 74 | 74 | return 0; |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | -int tn3270_get_string_at(h3270::session *ses, int row, int col, char* str, int sz) { | |
| 77 | +int tn3270_get_string_at(TN3270::Session *ses, int row, int col, char* str, int sz) { | |
| 78 | 78 | |
| 79 | 79 | if(!ses) { |
| 80 | 80 | return -1; |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | try { |
| 84 | + | |
| 84 | 85 | memset(str,0,sz+1); |
| 85 | - strncpy(str,ses->get_string_at(row,col,sz).c_str(),sz); | |
| 86 | - trace_to_file("%s(%d,%d,%d):\n%s\n",__FUNCTION__,row,col,sz,str); | |
| 87 | - } catch(std::exception &e) { | |
| 86 | + strncpy(str,ses->toString(row,col,(size_t) sz).c_str(),sz); | |
| 87 | + | |
| 88 | + } catch(const exception &e) { | |
| 88 | 89 | tn3270_lasterror = e.what(); |
| 89 | 90 | return -1; |
| 90 | 91 | } |
| 91 | 92 | return (int) strlen(str); |
| 92 | 93 | } |
| 93 | 94 | |
| 94 | -int tn3270_set_string_at(h3270::session *ses, int row, int col, const char* str) { | |
| 95 | +int tn3270_set_string_at(TN3270::Session *ses, int row, int col, const char* str) { | |
| 95 | 96 | |
| 96 | 97 | if(!ses) { |
| 97 | 98 | return -1; |
| 98 | 99 | } |
| 99 | 100 | |
| 100 | 101 | try { |
| 101 | - trace_to_file("%s(%d,%d):\n%s\n",__FUNCTION__,row,col,str); | |
| 102 | - debug("%s(%d,%d,\"%s\")",__FUNCTION__,row,col,str); | |
| 103 | - ses->set_string_at(row,col,str); | |
| 104 | - } catch(std::exception &e) { | |
| 102 | + | |
| 103 | + ses->push(row,col,str); | |
| 104 | + | |
| 105 | + } catch(const exception &e) { | |
| 105 | 106 | tn3270_lasterror = e.what(); |
| 106 | 107 | return -1; |
| 107 | 108 | } |
| 108 | 109 | return 0; |
| 109 | 110 | } |
| 110 | 111 | |
| 111 | -int tn3270_wait_for_string_at(h3270::session *ses, int row, int col, const char *key, int timeout) { | |
| 112 | +int tn3270_wait_for_string_at(TN3270::Session *ses, int row, int col, const char *key, int timeout) { | |
| 112 | 113 | |
| 114 | + /* | |
| 113 | 115 | if(ses) { |
| 114 | 116 | |
| 115 | 117 | try { |
| 116 | - return ses->wait_for_string_at(row,col,key,timeout); | |
| 117 | - } catch(std::exception &e) { | |
| 118 | + | |
| 119 | + return ses->wait(row,col,key,timeout); | |
| 120 | + | |
| 121 | + } catch(const exception &e) { | |
| 122 | + | |
| 118 | 123 | tn3270_lasterror = e.what(); |
| 124 | + | |
| 119 | 125 | } |
| 120 | 126 | |
| 121 | 127 | } |
| 128 | + */ | |
| 122 | 129 | |
| 123 | 130 | return -1; |
| 124 | 131 | |
| 125 | 132 | } |
| 126 | 133 | |
| 127 | -int tn3270_cmp_string_at(h3270::session *ses, int row, int col, const char* str) { | |
| 134 | +int tn3270_cmp_string_at(TN3270::Session *ses, int row, int col, const char* str) { | |
| 128 | 135 | |
| 136 | + /* | |
| 129 | 137 | if(ses) { |
| 130 | 138 | |
| 131 | 139 | try { |
| 132 | 140 | return ses->cmp_string_at(row,col,str); |
| 133 | - } catch(std::exception &e) { | |
| 141 | + } catch(const exception &e) { | |
| 134 | 142 | tn3270_lasterror = e.what(); |
| 135 | 143 | } |
| 136 | 144 | |
| 137 | 145 | } |
| 146 | + */ | |
| 138 | 147 | |
| 139 | 148 | return -1; |
| 140 | 149 | } | ... | ... |
src/native/set.cc
| ... | ... | @@ -31,64 +31,68 @@ |
| 31 | 31 | |
| 32 | 32 | /*---[ Implement ]----------------------------------------------------------------------------------*/ |
| 33 | 33 | |
| 34 | -int tn3270_set_unlock_delay(h3270::session *ses, int ms) { | |
| 34 | +int tn3270_set_unlock_delay(TN3270::Session *ses, int ms) { | |
| 35 | 35 | try { |
| 36 | - ses->set_unlock_delay((unsigned short) ms); | |
| 37 | - } catch(std::exception &e) { | |
| 36 | + ses->setUnlockDelay((unsigned short) ms); | |
| 37 | + } catch(const exception &e) { | |
| 38 | 38 | tn3270_lasterror = e.what(); |
| 39 | 39 | return -1; |
| 40 | 40 | } |
| 41 | 41 | return 0; |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | -int tn3270_set_cursor_position(h3270::session *ses, int row, int col) { | |
| 44 | +int tn3270_set_cursor_position(TN3270::Session *ses, int row, int col) { | |
| 45 | 45 | try { |
| 46 | - ses->set_cursor_position(row,col); | |
| 47 | - } catch(std::exception &e) { | |
| 46 | + ses->setCursor((unsigned short) row, (unsigned short) col); | |
| 47 | + } catch(const exception &e) { | |
| 48 | 48 | tn3270_lasterror = e.what(); |
| 49 | 49 | return -1; |
| 50 | 50 | } |
| 51 | 51 | return 0; |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | -int tn3270_set_cursor_addr(h3270::session *ses, int addr) { | |
| 54 | +int tn3270_set_cursor_addr(TN3270::Session *ses, int addr) { | |
| 55 | 55 | try { |
| 56 | - ses->set_cursor_addr(addr); | |
| 57 | - } catch(std::exception &e) { | |
| 56 | + ses->setCursor((unsigned short) addr); | |
| 57 | + } catch(const exception &e) { | |
| 58 | 58 | tn3270_lasterror = e.what(); |
| 59 | 59 | return -1; |
| 60 | 60 | } |
| 61 | 61 | return 0; |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | -int tn3270_set_charset(h3270::session *ses, const char* str) { | |
| 65 | - | |
| 66 | - if(!ses) { | |
| 67 | - return EINVAL; | |
| 68 | - } | |
| 64 | +int tn3270_set_charset(TN3270::Session *ses, const char* str) { | |
| 69 | 65 | |
| 70 | 66 | try { |
| 71 | - trace_to_file("%s: \"%s\" -> \"%s\"",__FUNCTION__,ses->get_display_charset().c_str(),str); | |
| 72 | - ses->set_display_charset(NULL, str); | |
| 73 | - } catch(std::exception &e) { | |
| 67 | + | |
| 68 | + ses->setCharSet(str); | |
| 69 | + | |
| 70 | + } catch(const exception &e) { | |
| 71 | + | |
| 74 | 72 | tn3270_lasterror = e.what(); |
| 75 | 73 | return -1; |
| 74 | + | |
| 76 | 75 | } |
| 76 | + | |
| 77 | 77 | return 0; |
| 78 | + | |
| 78 | 79 | } |
| 79 | 80 | |
| 80 | -int tn3270_set_url(h3270::session *ses, const char *url) { | |
| 81 | +int tn3270_set_url(TN3270::Session *ses, const char *url) { | |
| 82 | + | |
| 81 | 83 | try { |
| 82 | - debug("%s(%s)",__FUNCTION__,url); | |
| 83 | - ses->set_url(url); | |
| 84 | - } catch(std::exception &e) { | |
| 84 | + | |
| 85 | + ses->setHostURL(url); | |
| 86 | + | |
| 87 | + } catch(const exception &e) { | |
| 85 | 88 | tn3270_lasterror = e.what(); |
| 86 | 89 | return -1; |
| 87 | 90 | } |
| 91 | + | |
| 88 | 92 | return 0; |
| 89 | 93 | } |
| 90 | 94 | |
| 91 | -int tn3270_set_error_message(h3270::session *ses, const char *str) { | |
| 95 | +int tn3270_set_error_message(TN3270::Session *ses, const char *str) { | |
| 92 | 96 | tn3270_lasterror = str; |
| 93 | 97 | return 0; |
| 94 | 98 | } | ... | ... |