diff --git a/src/native/actions.cc b/src/native/actions.cc index c75d2e5..1b1bb02 100644 --- a/src/native/actions.cc +++ b/src/native/actions.cc @@ -18,7 +18,7 @@ * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin * St, Fifth Floor, Boston, MA 02110-1301 USA * - * Este programa está nomeado como set.cc e possui - linhas de código. + * Este programa está nomeado como actions.cc e possui - linhas de código. * * Contatos: * diff --git a/src/native/get.cc b/src/native/get.cc index 502eda1..92e18d0 100644 --- a/src/native/get.cc +++ b/src/native/get.cc @@ -36,16 +36,18 @@ * @brief Obtém a versão da biblioteca. * */ - void tn3270_get_version(h3270::session *ses, char* str, int strlen) { + int tn3270_get_version(h3270::session *ses, char* str, int strlen) { strncpy(str,ses->get_version().c_str(),strlen); + return 0; } /** * @brief Obtém a revisão da biblioteca. * */ - void tn3270_get_revision(h3270::session *ses, char* str, int strlen) { + int tn3270_get_revision(h3270::session *ses, char* str, int strlen) { strncpy(str,ses->get_revision().c_str(),strlen); + return 0; } int tn3270_get_cstate(h3270::session *ses) { diff --git a/src/native/init.cc b/src/native/init.cc index 5e9c58a..3e5816d 100644 --- a/src/native/init.cc +++ b/src/native/init.cc @@ -18,7 +18,7 @@ * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin * St, Fifth Floor, Boston, MA 02110-1301 USA * - * Este programa está nomeado como private.h e possui - linhas de código. + * Este programa está nomeado como init.cc e possui - linhas de código. * * Contatos: * @@ -47,7 +47,8 @@ * @brief Destrói uma sessão. * */ - void tn3270_destroy_session(h3270::session *ses) { + int tn3270_destroy_session(h3270::session *ses) { delete ses; + return 0; } diff --git a/src/native/private.h b/src/native/private.h index fa631f0..f073632 100644 --- a/src/native/private.h +++ b/src/native/private.h @@ -70,10 +70,10 @@ DLL_PUBLIC h3270::session * tn3270_create_session(const char *name); - DLL_PUBLIC void tn3270_destroy_session(h3270::session *ses); + DLL_PUBLIC int tn3270_destroy_session(h3270::session *ses); - DLL_PUBLIC void tn3270_get_version(h3270::session *ses, char* str, int strlen); - DLL_PUBLIC void tn3270_get_revision(h3270::session *ses, char* str, int strlen); + DLL_PUBLIC int tn3270_get_version(h3270::session *ses, char* str, int strlen); + DLL_PUBLIC int tn3270_get_revision(h3270::session *ses, char* str, int strlen); DLL_PUBLIC int tn3270_connect(h3270::session *ses, const char *host, time_t wait); DLL_PUBLIC int tn3270_disconnect(h3270::session *ses); @@ -86,17 +86,17 @@ DLL_PUBLIC int tn3270_get_program_message(h3270::session *ses); DLL_PUBLIC int tn3270_get_secure(h3270::session *ses); - DLL_PUBLIC void tn3270_get_string(h3270::session *ses, int addr, char* str, int strlen); - DLL_PUBLIC void tn3270_get_string_at(h3270::session *ses, int row, int col, char* str, int strlen); + DLL_PUBLIC int tn3270_get_string(h3270::session *ses, int addr, char* str, int strlen); + DLL_PUBLIC int tn3270_get_string_at(h3270::session *ses, int row, int col, char* str, int strlen); - DLL_PUBLIC void tn3270_set_string_at(h3270::session *ses, int row, int col, const char* str); + DLL_PUBLIC int tn3270_set_string_at(h3270::session *ses, int row, int col, const char* str); DLL_PUBLIC int tn3270_wait_for_string_at(h3270::session *ses, int row, int col, const char *key, int timeout); DLL_PUBLIC int tn3270_cmp_string_at(h3270::session *ses, int row, int col, const char* str); - DLL_PUBLIC void tn3270_set_unlock_delay(h3270::session *ses, int ms); - DLL_PUBLIC void tn3270_set_cursor_position(h3270::session *ses, int row, int col); - DLL_PUBLIC void tn3270_set_cursor_addr(h3270::session *ses, int addr); + DLL_PUBLIC int tn3270_set_unlock_delay(h3270::session *ses, int ms); + DLL_PUBLIC int tn3270_set_cursor_position(h3270::session *ses, int row, int col); + DLL_PUBLIC int tn3270_set_cursor_addr(h3270::session *ses, int addr); DLL_PUBLIC int tn3270_enter(h3270::session *ses); DLL_PUBLIC int tn3270_pfkey(h3270::session *ses, int key); diff --git a/src/native/screen.cc b/src/native/screen.cc index 006b262..c7c603d 100644 --- a/src/native/screen.cc +++ b/src/native/screen.cc @@ -18,7 +18,7 @@ * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin * St, Fifth Floor, Boston, MA 02110-1301 USA * - * Este programa está nomeado como set.cc e possui - linhas de código. + * Este programa está nomeado como screen.cc e possui - linhas de código. * * Contatos: * @@ -31,18 +31,21 @@ /*---[ Implement ]----------------------------------------------------------------------------------*/ -void tn3270_get_string(h3270::session *ses, int addr, char* str, int strlen) { +int tn3270_get_string(h3270::session *ses, int addr, char* str, int strlen) { memset(str,0,strlen); strncpy(str,ses->get_string(addr,strlen).c_str(),strlen); + return 0; } -void tn3270_get_string_at(h3270::session *ses, int row, int col, char* str, int strlen) { +int tn3270_get_string_at(h3270::session *ses, int row, int col, char* str, int strlen) { memset(str,0,strlen); strncpy(str,ses->get_string_at(row,col,strlen).c_str(),strlen); + return 0; } -void tn3270_set_string_at(h3270::session *ses, int row, int col, const char* str) { +int tn3270_set_string_at(h3270::session *ses, int row, int col, const char* str) { ses->set_string_at(row,col,str); + return 0; } int tn3270_wait_for_string_at(h3270::session *ses, int row, int col, const char *key, int timeout) { diff --git a/src/native/set.cc b/src/native/set.cc index d7e172b..bc07362 100644 --- a/src/native/set.cc +++ b/src/native/set.cc @@ -31,15 +31,19 @@ /*---[ Implement ]----------------------------------------------------------------------------------*/ -void tn3270_set_unlock_delay(h3270::session *ses, int ms) { +int tn3270_set_unlock_delay(h3270::session *ses, int ms) { ses->set_unlock_delay((unsigned short) ms); + return 0; } -void tn3270_set_cursor_position(h3270::session *ses, int row, int col) { +int tn3270_set_cursor_position(h3270::session *ses, int row, int col) { ses->set_cursor_position(row,col); + return 0; } -void tn3270_set_cursor_addr(h3270::session *ses, int addr) { +int tn3270_set_cursor_addr(h3270::session *ses, int addr) { ses->set_cursor_addr(addr); + return 0; } + diff --git a/src/pw3270-sharp/pw3270-sharp.cs b/src/pw3270-sharp/pw3270-sharp.cs index e150af8..f3a6461 100644 --- a/src/pw3270-sharp/pw3270-sharp.cs +++ b/src/pw3270-sharp/pw3270-sharp.cs @@ -51,13 +51,13 @@ namespace pw3270 { extern static IntPtr tn3270_create_session(string name); [DllImport ("lib3270-mono",CallingConvention=CallingConvention.Cdecl)] - extern static void tn3270_destroy_session(IntPtr session); + extern static int tn3270_destroy_session(IntPtr session); [DllImport ("lib3270-mono",CallingConvention=CallingConvention.Cdecl)] - extern static void tn3270_get_version(IntPtr session, StringBuilder str, int strlen); + extern static int tn3270_get_version(IntPtr session, StringBuilder str, int strlen); [DllImport ("lib3270-mono",CallingConvention=CallingConvention.Cdecl)] - extern static void tn3270_get_revision(IntPtr session, StringBuilder str, int strlen); + extern static int tn3270_get_revision(IntPtr session, StringBuilder str, int strlen); [DllImport ("lib3270-mono",CallingConvention=CallingConvention.Cdecl)] extern static int tn3270_connect(IntPtr Session, string host, int wait); @@ -84,13 +84,13 @@ namespace pw3270 { extern static int tn3270_get_secure(IntPtr Session); [DllImport ("lib3270-mono",CallingConvention=CallingConvention.Cdecl)] - extern static void tn3270_get_string(IntPtr Session, int addr, StringBuilder str, int strlen); + extern static int tn3270_get_string(IntPtr Session, int addr, StringBuilder str, int strlen); [DllImport ("lib3270-mono",CallingConvention=CallingConvention.Cdecl)] - extern static void tn3270_get_string_at(IntPtr Session, int row, int col, StringBuilder str, int strlen); + extern static int tn3270_get_string_at(IntPtr Session, int row, int col, StringBuilder str, int strlen); [DllImport ("lib3270-mono",CallingConvention=CallingConvention.Cdecl)] - extern static void tn3270_set_string_at(IntPtr Session, int row, int col, string str); + extern static int tn3270_set_string_at(IntPtr Session, int row, int col, string str); [DllImport ("lib3270-mono",CallingConvention=CallingConvention.Cdecl)] extern static int tn3270_wait_for_string_at(IntPtr Session, int row, int col, string key, int timeout); @@ -99,13 +99,13 @@ namespace pw3270 { extern static int tn3270_cmp_string_at(IntPtr Session, int row, int col, string str); [DllImport ("lib3270-mono",CallingConvention=CallingConvention.Cdecl)] - extern static void tn3270_set_unlock_delay(IntPtr Session, int ms); + extern static int tn3270_set_unlock_delay(IntPtr Session, int ms); [DllImport ("lib3270-mono",CallingConvention=CallingConvention.Cdecl)] - extern static void tn3270_set_cursor_position(IntPtr Session, int row, int col); + extern static int tn3270_set_cursor_position(IntPtr Session, int row, int col); [DllImport ("lib3270-mono",CallingConvention=CallingConvention.Cdecl)] - extern static void tn3270_set_cursor_addr(IntPtr Session, int addr); + extern static int tn3270_set_cursor_addr(IntPtr Session, int addr); [DllImport ("lib3270-mono",CallingConvention=CallingConvention.Cdecl)] extern static int tn3270_enter(IntPtr Session); diff --git a/testprograms/vbclass.vb b/testprograms/vbclass.vb index dbbb719..e148be7 100644 --- a/testprograms/vbclass.vb +++ b/testprograms/vbclass.vb @@ -41,11 +41,87 @@ Public Class pw3270 End Function _ - Private Shared Function tn3270_get_version(ByVal hSession As IntPtr, ByVal buffer As StringBuilder, ByVal strlen as Integer) as Long + Private Shared Function tn3270_get_version(ByVal hSession As IntPtr, ByVal buffer As StringBuilder, ByVal strlen as Integer) as Integer End Function _ - Private Shared Function tn3270_get_revision(ByVal hSession As IntPtr, ByVal buffer As StringBuilder, ByVal strlen as Integer) as Long + Private Shared Function tn3270_get_revision(ByVal hSession As IntPtr, ByVal buffer As StringBuilder, ByVal strlen as Integer) as Integer + End Function + + _ + Private Shared Function tn3270_connect(ByVal hSession As IntPtr, ByVal buffer As StringBuilder, ByVal seconds as Integer) as Integer + End Function + + _ + Private Shared Function tn3270_is_connected(ByVal hSession As IntPtr) as Integer + End Function + + _ + Private Shared Function tn3270_disconnect(ByVal hSession As IntPtr) as Integer + End Function + + _ + Private Shared Function tn3270_wait_for_ready(ByVal hSession As IntPtr, ByVal seconds as Integer) as Integer + End Function + + _ + Private Shared Function tn3270_wait(ByVal hSession As IntPtr, ByVal seconds as Integer) as Integer + End Function + + _ + Private Shared Function tn3270_get_cstate(ByVal hSession As IntPtr) as Integer + End Function + + _ + Private Shared Function tn3270_get_program_message(ByVal hSession As IntPtr) as Integer + End Function + + _ + Private Shared Function tn3270_get_secure(ByVal hSession As IntPtr) as Integer + End Function + + _ + Private Shared Function tn3270_get_string(ByVal hSession As IntPtr, ByVal addr as Integer, ByVal buffer As StringBuilder, ByVal strlen as Integer) as Integer + End Function + + _ + Private Shared Function tn3270_get_string_at(ByVal hSession As IntPtr, ByVal row as Integer, ByVal col as Integer, ByVal buffer As StringBuilder, ByVal strlen as Integer) as Integer + End Function + + _ + Private Shared Function tn3270_set_string_at(ByVal hSession As IntPtr, ByVal row as Integer, ByVal col as Integer, ByVal buffer As StringBuilder) as Integer + End Function + + _ + Private Shared Function tn3270_wait_for_string_at(ByVal hSession As IntPtr, ByVal row as Integer, ByVal col as Integer, ByVal key As StringBuilder, ByVal timeout as Integer) as Integer + End Function + + _ + Private Shared Function tn3270_cmp_string_at(ByVal hSession As IntPtr, ByVal row as Integer, ByVal col as Integer, ByVal buffer As StringBuilder) as Integer + End Function + + _ + Private Shared Function tn3270_set_unlock_delay(ByVal hSession As IntPtr, ByVal ms as Integer) as Integer + End Function + + _ + Private Shared Function tn3270_set_cursor_position(ByVal hSession As IntPtr, ByVal row as Integer, ByVal col as Integer) as Integer + End Function + + _ + Private Shared Function tn3270_set_cursor_addr(ByVal hSession As IntPtr, ByVal addr as Integer) as Integer + End Function + + _ + Private Shared Function tn3270_enter(ByVal hSession As IntPtr) as Integer + End Function + + _ + Private Shared Function tn3270_pfkey(ByVal hSession As IntPtr, ByVal key as Integer) as Integer + End Function + + _ + Private Shared Function tn3270_pakey(ByVal hSession As IntPtr, ByVal key as Integer) as Integer End Function Private Shared hSession As IntPtr -- libgit2 0.21.2