diff --git a/Makefile.in b/Makefile.in index a8801eb..33e451c 100644 --- a/Makefile.in +++ b/Makefile.in @@ -95,9 +95,11 @@ CFLAGS= \ LIBS= \ @LIBS@ \ + @LIBSSL_LIBS@ \ @LIBICONV@ \ @INTL_LIBS@ + #---[ Debug Rules ]---------------------------------------------------------------------- $(OBJDBG)/%.o: \ @@ -166,13 +168,14 @@ $(POTDIR)/$(LIBNAME)/%.pot: \ all: \ $(BINRLS)/$(LIBNAME)@DLLEXT@ \ - $(BINRLS)/$(LIBNAME).a \ + $(BINRLS)/static/$(LIBNAME).a \ $(POTDIR)/$(LIBNAME).pot Release: \ $(BINRLS)/$(LIBNAME)@DLLEXT@ \ - $(BINRLS)/$(LIBNAME).a + $(BINRLS)/static/$(LIBNAME).a + $(BINRLS)/$(LIBNAME)@DLLEXT@: \ $(BINRLS)/$(LIBNAME)@DLLEXT@.@PACKAGE_MAJOR_VERSION@ @@ -196,15 +199,18 @@ $(BINRLS)/$(LIBNAME)@DLLEXT@.@PACKAGE_MAJOR_VERSION@.@PACKAGE_MINOR_VERSION@: \ @$(MKDIR) `dirname $@` @echo $< ... + @$(LD) \ - -shared -Wl,-soname,$(@F) \ + -shared \ + -Wl,-soname,$(@F) \ -o $@ \ $(LDFLAGS) \ $(foreach SRC, $(basename $(SOURCES)), $(OBJRLS)/$(SRC).o) \ -L$(BINRLS) \ - $(LIBS) + $(LIBS) \ + -l3270 -$(BINRLS)/$(LIBNAME).a: \ +$(BINRLS)/static/$(LIBNAME).a: \ $(foreach SRC, $(basename $(SOURCES)), $(OBJRLS)/$(SRC).o) @echo $@ ... @@ -216,7 +222,7 @@ $(BINRLS)/$(LIBNAME).a: \ install: \ $(BINRLS)/$(LIBNAME)@DLLEXT@ \ - $(BINRLS)/$(LIBNAME).a + $(BINRLS)/static/$(LIBNAME).a # Install library @mkdir -p $(DESTDIR)$(libdir) @@ -236,17 +242,10 @@ install: \ # Install static library @$(INSTALL_DATA) \ - $(BINRLS)/$(LIBNAME).a \ + $(BINRLS)/static/$(LIBNAME).a \ $(DESTDIR)$(libdir) # Install SDK - - @mkdir -p $(DESTDIR)$(includedir)/$(LIBNAME) - - @$(INSTALL_DATA) \ - ../include/$(LIBNAME)/*.h \ - $(DESTDIR)$(includedir)/$(LIBNAME) - @$(INSTALL_DATA) \ ../include/$(LIBNAME).h \ $(DESTDIR)$(includedir)/$(LIBNAME).h @@ -361,12 +360,18 @@ clean: \ cleanDebug: @rm -fr $(OBJDBG) - @rm -fr $(BINDBG) + @rm -f $(BINDBG)/$(LIBNAME)@DLLEXT@.@PACKAGE_MAJOR_VERSION@.@PACKAGE_MINOR_VERSION@ + @rm -f $(BINDBG)/$(LIBNAME)@DLLEXT@.@PACKAGE_MAJOR_VERSION@ + @rm -f $(BINDBG)/$(LIBNAME)@DLLEXT@ cleanRelease: @rm -fr $(OBJRLS) - @rm -fr $(BINRLS) + + @rm -f $(BINRLS)/$(LIBNAME)@DLLEXT@.@PACKAGE_MAJOR_VERSION@.@PACKAGE_MINOR_VERSION@ + @rm -f $(BINRLS)/$(LIBNAME)@DLLEXT@.@PACKAGE_MAJOR_VERSION@ + @rm -f $(BINRLS)/$(LIBNAME)@DLLEXT@ + @rm -fr $(POTDIR) @rm -f lib$(LIBNAME).pot diff --git a/abstract.cc b/abstract.cc index 5ceb99d..d65f3db 100644 --- a/abstract.cc +++ b/abstract.cc @@ -110,10 +110,10 @@ if(in && converter != (iconv_t)(-1)) { - size_t out = (in << 1); - char * ptr; - char * outBuffer = (char *) malloc(out); - char * inBuffer = (char *) str; + size_t out = (in << 1); + char * ptr; + char * outBuffer = (char *) malloc(out); + ICONV_CONST char * inBuffer = (ICONV_CONST char *) str; memset(ptr=outBuffer,0,out); diff --git a/lib3270++.cbp b/lib3270++.cbp index 566cef6..362c31a 100644 --- a/lib3270++.cbp +++ b/lib3270++.cbp @@ -40,6 +40,7 @@ + diff --git a/local/events.cc b/local/events.cc index 4d6c5ad..39cd2e2 100644 --- a/local/events.cc +++ b/local/events.cc @@ -37,6 +37,7 @@ */ #include "../private.h" + #include extern "C" { #include @@ -47,6 +48,35 @@ /*---[ Implement ]----------------------------------------------------------------------------------*/ +#ifndef HAVE_VASPRINTF + int vasprintf(char **strp, const char *fmt, va_list ap) { + char buf[1024]; + + int nc = vsnprintf(buf, sizeof(buf), fmt, args); + + if(nc < 0) { + + *strp = strdup(_("Error in vasprintf")); + + } else if (nc < sizeof(buf)) { + + *strp = malloc(nc+1); + strcpy(*strp, buf); + + } else { + + *strp = malloc(nc + 1); + if(vsnprintf(*strp, nc, fmt, args) < 0) { + free(*strp); + *strp = strdup(NULL,_( "Out of memory in vasprintf" ) ); + } + + } + + return nc; + } +#endif // !HAVE_VASPRINTF + namespace TN3270 { /// @brief Popup Handler. @@ -55,7 +85,7 @@ Local::Session * session = (Local::Session *) lib3270_get_user_data(h3270); if(!session) { - throw std::runtime_error("Invalid session handler"); + throw std::runtime_error(_( "Invalid session handler" )); } class PopupEvent : public TN3270::Event { @@ -108,7 +138,7 @@ Local::Session * session = (Local::Session *) lib3270_get_user_data(h3270); if(!session) { - throw std::runtime_error("Invalid session handler"); + throw std::runtime_error(_("Invalid session handler")); } class ConnectionEvent : public TN3270::Event { @@ -130,7 +160,7 @@ /// @brief Get event description. std::string toString() const override { - return this->connected ? "connected" : "disconnected"; + return this->connected ? _("connected") : _("disconnected"); } }; diff --git a/local/session.cc b/local/session.cc index aa8adcc..5318d5f 100644 --- a/local/session.cc +++ b/local/session.cc @@ -65,7 +65,7 @@ cbk = lib3270_get_session_callbacks(this->hSession,sizeof(struct lib3270_session_callbacks)); if(!cbk) { - throw std::runtime_error( "Invalid callback table, possible version mismatch in lib3270" ); + throw std::runtime_error( _("Invalid callback table, possible version mismatch in lib3270") ); } cbk->update_connect = connectHandler; @@ -120,7 +120,7 @@ char * text = lib3270_get_text(hSession, baddr, len, lf); if(!text) { - throw std::runtime_error("Can't get screen contents"); + throw std::runtime_error( _("Can't get screen contents") ); } string rc = convertFromHost(text); @@ -138,7 +138,7 @@ char * text = lib3270_get_text_at(hSession, row, col, sz, lf); if(!text) { - throw std::runtime_error("Can't get screen contents"); + throw std::runtime_error( _("Can't get screen contents") ); } string rc = convertFromHost(text); diff --git a/private.h b/private.h index 87aad4f..b4057b9 100644 --- a/private.h +++ b/private.h @@ -41,12 +41,27 @@ #define PRIVATE_H_INCLUDED #include + + #ifdef WIN32 + #include + #include + #include + #endif // WIN32 + #include #include #include #include #include +#ifdef HAVE_LIBINTL + #include + #define _( x ) gettext(x) + #define N_( x ) x +#else + #define _( x ) x + #define N_( x ) x +#endif // HAVE_LIBINTL #ifdef HAVE_ICONV #include -- libgit2 0.21.2