Commit 8429a725ffbddcf17d6f228e988666b10783c5a9
1 parent
af992aa9
Exists in
master
and in
3 other branches
Packing C++ version preview
Showing
12 changed files
with
149 additions
and
43 deletions
Show diff stats
Makefile.in
| @@ -80,6 +80,12 @@ $(BINDBG)/lib@LIB3270_NAME@@DLLEXT@: \ | @@ -80,6 +80,12 @@ $(BINDBG)/lib@LIB3270_NAME@@DLLEXT@: \ | ||
| 80 | 80 | ||
| 81 | @$(MAKE) -C src/lib3270 $@ | 81 | @$(MAKE) -C src/lib3270 $@ |
| 82 | 82 | ||
| 83 | +$(BINDBG)/lib@LIB3270_NAME@++@DLLEXT@: \ | ||
| 84 | + src/lib3270++/* \ | ||
| 85 | + $(DEPENDS) | ||
| 86 | + | ||
| 87 | + @$(MAKE) -C src/lib3270++ $@ | ||
| 88 | + | ||
| 83 | #---[ Release Rules ]-------------------------------------------------------------------- | 89 | #---[ Release Rules ]-------------------------------------------------------------------- |
| 84 | 90 | ||
| 85 | $(BINRLS)/lib@LIB3270_NAME@@DLLEXT@: \ | 91 | $(BINRLS)/lib@LIB3270_NAME@@DLLEXT@: \ |
| @@ -88,6 +94,12 @@ $(BINRLS)/lib@LIB3270_NAME@@DLLEXT@: \ | @@ -88,6 +94,12 @@ $(BINRLS)/lib@LIB3270_NAME@@DLLEXT@: \ | ||
| 88 | 94 | ||
| 89 | @$(MAKE) -C src/lib3270 $@ | 95 | @$(MAKE) -C src/lib3270 $@ |
| 90 | 96 | ||
| 97 | +$(BINRLS)/lib@LIB3270_NAME@++@DLLEXT@: \ | ||
| 98 | + src/lib3270/* \ | ||
| 99 | + $(DEPENDS) | ||
| 100 | + | ||
| 101 | + @$(MAKE) -C src/lib3270++ $@ | ||
| 102 | + | ||
| 91 | 103 | ||
| 92 | #---[ Misc Rules ]----------------------------------------------------------------------- | 104 | #---[ Misc Rules ]----------------------------------------------------------------------- |
| 93 | 105 | ||
| @@ -105,12 +117,13 @@ $(POTDIR)/lib3270++.pot: \ | @@ -105,12 +117,13 @@ $(POTDIR)/lib3270++.pot: \ | ||
| 105 | 117 | ||
| 106 | #---[ Release Targets ]------------------------------------------------------------------ | 118 | #---[ Release Targets ]------------------------------------------------------------------ |
| 107 | 119 | ||
| 108 | -all: \ | ||
| 109 | - $(BINRLS)/lib@LIB3270_NAME@@DLLEXT@ \ | ||
| 110 | - lib@LIB3270_NAME@.pot | 120 | +all: |
| 121 | + @$(MAKE) -C src/lib3270 $@ | ||
| 122 | + @$(MAKE) -C src/lib3270++ $@ | ||
| 111 | 123 | ||
| 112 | Release: \ | 124 | Release: \ |
| 113 | - $(BINRLS)/lib@LIB3270_NAME@@DLLEXT@ | 125 | + $(BINRLS)/lib@LIB3270_NAME@@DLLEXT@ \ |
| 126 | + $(BINRLS)/lib@LIB3270_NAME@++@DLLEXT@ | ||
| 114 | 127 | ||
| 115 | #---[ Misc Targets ]--------------------------------------------------------------------- | 128 | #---[ Misc Targets ]--------------------------------------------------------------------- |
| 116 | 129 | ||
| @@ -127,10 +140,10 @@ lib@LIB3270_NAME@.pot: \ | @@ -127,10 +140,10 @@ lib@LIB3270_NAME@.pot: \ | ||
| 127 | 140 | ||
| 128 | #---[ Install Targets ]------------------------------------------------------------------ | 141 | #---[ Install Targets ]------------------------------------------------------------------ |
| 129 | 142 | ||
| 130 | -install: \ | ||
| 131 | - $(BINRLS)/lib@LIB3270_NAME@@DLLEXT@ | 143 | +install: |
| 132 | 144 | ||
| 133 | - @$(MAKE) DESTDIR=$(DESTDIR) -C src/lib3270 $@ | 145 | + $(MAKE) DESTDIR=$(DESTDIR) -C src/lib3270 $@ |
| 146 | + $(MAKE) DESTDIR=$(DESTDIR) -C src/lib3270++ $@ | ||
| 134 | 147 | ||
| 135 | #---[ Debug Targets ]-------------------------------------------------------------------- | 148 | #---[ Debug Targets ]-------------------------------------------------------------------- |
| 136 | 149 | ||
| @@ -150,11 +163,13 @@ cleanDebug: | @@ -150,11 +163,13 @@ cleanDebug: | ||
| 150 | 163 | ||
| 151 | @rm -fr $(BINDBG) | 164 | @rm -fr $(BINDBG) |
| 152 | @$(MAKE) -C src/lib3270 $@ | 165 | @$(MAKE) -C src/lib3270 $@ |
| 166 | + @$(MAKE) -C src/lib3270++ $@ | ||
| 153 | 167 | ||
| 154 | cleanRelease: | 168 | cleanRelease: |
| 155 | 169 | ||
| 156 | @rm -fr $(BINRLS) | 170 | @rm -fr $(BINRLS) |
| 157 | @$(MAKE) -C src/lib3270 $@ | 171 | @$(MAKE) -C src/lib3270 $@ |
| 172 | + @$(MAKE) -C src/lib3270++ $@ | ||
| 158 | 173 | ||
| 159 | clean: \ | 174 | clean: \ |
| 160 | cleanDebug \ | 175 | cleanDebug \ |
configure.ac
| @@ -452,6 +452,8 @@ AC_CONFIG_FILES(src/lib3270/Makefile) | @@ -452,6 +452,8 @@ AC_CONFIG_FILES(src/lib3270/Makefile) | ||
| 452 | AC_CONFIG_FILES(src/lib3270/version.c) | 452 | AC_CONFIG_FILES(src/lib3270/version.c) |
| 453 | AC_CONFIG_FILES(src/lib3270/lib3270.pc) | 453 | AC_CONFIG_FILES(src/lib3270/lib3270.pc) |
| 454 | 454 | ||
| 455 | +AC_CONFIG_FILES(src/lib3270++/lib3270++.pc) | ||
| 456 | + | ||
| 455 | AC_CONFIG_FILES(src/lib3270++/Makefile) | 457 | AC_CONFIG_FILES(src/lib3270++/Makefile) |
| 456 | 458 | ||
| 457 | dnl --------------------------------------------------------------------------- | 459 | dnl --------------------------------------------------------------------------- |
rpm/lib3270.spec
| 1 | # | 1 | # |
| 2 | -# spec file for package lib3270 | 2 | +# spec file for packages lib3270 and lib3270++ |
| 3 | # | 3 | # |
| 4 | # Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany. | 4 | # Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany. |
| 5 | # Copyright (C) <2008> <Banco do Brasil S.A.> | 5 | # Copyright (C) <2008> <Banco do Brasil S.A.> |
| @@ -23,7 +23,6 @@ | @@ -23,7 +23,6 @@ | ||
| 23 | 23 | ||
| 24 | %define _libvrs %{MAJOR_VERSION}_%{MINOR_VERSION} | 24 | %define _libvrs %{MAJOR_VERSION}_%{MINOR_VERSION} |
| 25 | 25 | ||
| 26 | -%define libname lib32705_2 | ||
| 27 | %define documentroot /srv/www/htdocs/mentor | 26 | %define documentroot /srv/www/htdocs/mentor |
| 28 | 27 | ||
| 29 | #Compat macro for new _fillupdir macro introduced in Nov 2017 | 28 | #Compat macro for new _fillupdir macro introduced in Nov 2017 |
| @@ -70,20 +69,40 @@ TN3270 access library originally designed as part of the pw3270 application. | @@ -70,20 +69,40 @@ TN3270 access library originally designed as part of the pw3270 application. | ||
| 70 | 69 | ||
| 71 | See more details at https://softwarepublico.gov.br/social/pw3270/ | 70 | See more details at https://softwarepublico.gov.br/social/pw3270/ |
| 72 | 71 | ||
| 72 | +#---[ C++ API ]------------------------------------------------------------------------------------------------------- | ||
| 73 | + | ||
| 74 | +%package -n lib3270++-%{_libvrs} | ||
| 75 | + | ||
| 76 | +Summary: TN3270 Access C++ library | ||
| 77 | +Group: Development/Libraries/C and C++ | ||
| 78 | + | ||
| 79 | +Requires: %{name} = %{version} | ||
| 80 | + | ||
| 81 | +Provides: lib3270++%{MAJOR_VERSION}_%{MINOR_VERSION} | ||
| 82 | +Conflicts: otherproviders(lib3270++%{MAJOR_VERSION}_%{MINOR_VERSION}) | ||
| 83 | + | ||
| 84 | +%description | ||
| 85 | + | ||
| 86 | +TN3270 access library originally designed as part of the pw3270 application (C++ Version). | ||
| 87 | + | ||
| 88 | +See more details at https://softwarepublico.gov.br/social/pw3270/ | ||
| 89 | + | ||
| 73 | #---[ Development ]--------------------------------------------------------------------------------------------------- | 90 | #---[ Development ]--------------------------------------------------------------------------------------------------- |
| 74 | 91 | ||
| 75 | %package devel | 92 | %package devel |
| 76 | 93 | ||
| 77 | Summary: TN3270 Access library development files | 94 | Summary: TN3270 Access library development files |
| 78 | Group: Development/Libraries/C and C++ | 95 | Group: Development/Libraries/C and C++ |
| 96 | + | ||
| 79 | Requires: %{name} = %{version} | 97 | Requires: %{name} = %{version} |
| 98 | +Requires: lib3270++-%{_libvrs} = %{version} | ||
| 80 | 99 | ||
| 81 | Provides: lib3270-devel = %{version} | 100 | Provides: lib3270-devel = %{version} |
| 82 | Conflicts: otherproviders(lib3270-devel) | 101 | Conflicts: otherproviders(lib3270-devel) |
| 83 | 102 | ||
| 84 | %description devel | 103 | %description devel |
| 85 | 104 | ||
| 86 | -TN3270 access library for C development files. | 105 | +TN3270 access library for C/C++ development files. |
| 87 | 106 | ||
| 88 | Originally designed as part of the pw3270 application. | 107 | Originally designed as part of the pw3270 application. |
| 89 | 108 | ||
| @@ -115,6 +134,12 @@ rm -rf $RPM_BUILD_ROOT | @@ -115,6 +134,12 @@ rm -rf $RPM_BUILD_ROOT | ||
| 115 | %{_libdir}/lib3270.so.5 | 134 | %{_libdir}/lib3270.so.5 |
| 116 | %{_libdir}/lib3270.so.5.2 | 135 | %{_libdir}/lib3270.so.5.2 |
| 117 | 136 | ||
| 137 | +%files -n lib3270++-%{_libvrs} | ||
| 138 | +%defattr(-,root,root) | ||
| 139 | + | ||
| 140 | +%{_libdir}/lib3270++.so.5 | ||
| 141 | +%{_libdir}/lib3270++.so.5.2 | ||
| 142 | + | ||
| 118 | %files devel | 143 | %files devel |
| 119 | %defattr(-,root,root) | 144 | %defattr(-,root,root) |
| 120 | 145 | ||
| @@ -127,6 +152,11 @@ rm -rf $RPM_BUILD_ROOT | @@ -127,6 +152,11 @@ rm -rf $RPM_BUILD_ROOT | ||
| 127 | %{_libdir}/lib3270.so | 152 | %{_libdir}/lib3270.so |
| 128 | %{_libdir}/lib3270.a | 153 | %{_libdir}/lib3270.a |
| 129 | 154 | ||
| 155 | +%{_includedir}/lib3270++.h | ||
| 156 | + | ||
| 157 | +%{_libdir}/lib3270++.so | ||
| 158 | +%{_libdir}/lib3270++.a | ||
| 159 | + | ||
| 130 | %pre | 160 | %pre |
| 131 | /sbin/ldconfig | 161 | /sbin/ldconfig |
| 132 | exit 0 | 162 | exit 0 |
| @@ -139,4 +169,12 @@ exit 0 | @@ -139,4 +169,12 @@ exit 0 | ||
| 139 | /sbin/ldconfig | 169 | /sbin/ldconfig |
| 140 | exit 0 | 170 | exit 0 |
| 141 | 171 | ||
| 172 | +%post -n lib3270++-%{_libvrs} | ||
| 173 | +/sbin/ldconfig | ||
| 174 | +exit 0 | ||
| 175 | + | ||
| 176 | +%postun -n lib3270++-%{_libvrs} | ||
| 177 | +/sbin/ldconfig | ||
| 178 | +exit 0 | ||
| 179 | + | ||
| 142 | %changelog | 180 | %changelog |
src/include/lib3270++.h
| @@ -121,7 +121,7 @@ | @@ -121,7 +121,7 @@ | ||
| 121 | 121 | ||
| 122 | MESSAGE_X = LIB3270_MESSAGE_X, ///< @brief -- | 122 | MESSAGE_X = LIB3270_MESSAGE_X, ///< @brief -- |
| 123 | MESSAGE_RESOLVING = LIB3270_MESSAGE_RESOLVING, ///< @brief Resolving hostname (running DNS query) | 123 | MESSAGE_RESOLVING = LIB3270_MESSAGE_RESOLVING, ///< @brief Resolving hostname (running DNS query) |
| 124 | -// MESSAGE_CONNECTING, = LIB3270_MESSAGE_CONNECTING ///< @brief Connecting to host | 124 | + MESSAGE_CONNECTING = LIB3270_MESSAGE_CONNECTING ///< @brief Connecting to host |
| 125 | 125 | ||
| 126 | }; | 126 | }; |
| 127 | 127 |
src/lib3270++/Makefile.in
| @@ -95,9 +95,11 @@ CFLAGS= \ | @@ -95,9 +95,11 @@ CFLAGS= \ | ||
| 95 | 95 | ||
| 96 | LIBS= \ | 96 | LIBS= \ |
| 97 | @LIBS@ \ | 97 | @LIBS@ \ |
| 98 | + @LIBSSL_LIBS@ \ | ||
| 98 | @LIBICONV@ \ | 99 | @LIBICONV@ \ |
| 99 | @INTL_LIBS@ | 100 | @INTL_LIBS@ |
| 100 | 101 | ||
| 102 | + | ||
| 101 | #---[ Debug Rules ]---------------------------------------------------------------------- | 103 | #---[ Debug Rules ]---------------------------------------------------------------------- |
| 102 | 104 | ||
| 103 | $(OBJDBG)/%.o: \ | 105 | $(OBJDBG)/%.o: \ |
| @@ -166,13 +168,14 @@ $(POTDIR)/$(LIBNAME)/%.pot: \ | @@ -166,13 +168,14 @@ $(POTDIR)/$(LIBNAME)/%.pot: \ | ||
| 166 | 168 | ||
| 167 | all: \ | 169 | all: \ |
| 168 | $(BINRLS)/$(LIBNAME)@DLLEXT@ \ | 170 | $(BINRLS)/$(LIBNAME)@DLLEXT@ \ |
| 169 | - $(BINRLS)/$(LIBNAME).a \ | 171 | + $(BINRLS)/static/$(LIBNAME).a \ |
| 170 | $(POTDIR)/$(LIBNAME).pot | 172 | $(POTDIR)/$(LIBNAME).pot |
| 171 | 173 | ||
| 172 | 174 | ||
| 173 | Release: \ | 175 | Release: \ |
| 174 | $(BINRLS)/$(LIBNAME)@DLLEXT@ \ | 176 | $(BINRLS)/$(LIBNAME)@DLLEXT@ \ |
| 175 | - $(BINRLS)/$(LIBNAME).a | 177 | + $(BINRLS)/static/$(LIBNAME).a |
| 178 | + | ||
| 176 | 179 | ||
| 177 | $(BINRLS)/$(LIBNAME)@DLLEXT@: \ | 180 | $(BINRLS)/$(LIBNAME)@DLLEXT@: \ |
| 178 | $(BINRLS)/$(LIBNAME)@DLLEXT@.@PACKAGE_MAJOR_VERSION@ | 181 | $(BINRLS)/$(LIBNAME)@DLLEXT@.@PACKAGE_MAJOR_VERSION@ |
| @@ -196,15 +199,18 @@ $(BINRLS)/$(LIBNAME)@DLLEXT@.@PACKAGE_MAJOR_VERSION@.@PACKAGE_MINOR_VERSION@: \ | @@ -196,15 +199,18 @@ $(BINRLS)/$(LIBNAME)@DLLEXT@.@PACKAGE_MAJOR_VERSION@.@PACKAGE_MINOR_VERSION@: \ | ||
| 196 | 199 | ||
| 197 | @$(MKDIR) `dirname $@` | 200 | @$(MKDIR) `dirname $@` |
| 198 | @echo $< ... | 201 | @echo $< ... |
| 202 | + | ||
| 199 | @$(LD) \ | 203 | @$(LD) \ |
| 200 | - -shared -Wl,-soname,$(@F) \ | 204 | + -shared \ |
| 205 | + -Wl,-soname,$(@F) \ | ||
| 201 | -o $@ \ | 206 | -o $@ \ |
| 202 | $(LDFLAGS) \ | 207 | $(LDFLAGS) \ |
| 203 | $(foreach SRC, $(basename $(SOURCES)), $(OBJRLS)/$(SRC).o) \ | 208 | $(foreach SRC, $(basename $(SOURCES)), $(OBJRLS)/$(SRC).o) \ |
| 204 | -L$(BINRLS) \ | 209 | -L$(BINRLS) \ |
| 205 | - $(LIBS) | 210 | + $(LIBS) \ |
| 211 | + -l3270 | ||
| 206 | 212 | ||
| 207 | -$(BINRLS)/$(LIBNAME).a: \ | 213 | +$(BINRLS)/static/$(LIBNAME).a: \ |
| 208 | $(foreach SRC, $(basename $(SOURCES)), $(OBJRLS)/$(SRC).o) | 214 | $(foreach SRC, $(basename $(SOURCES)), $(OBJRLS)/$(SRC).o) |
| 209 | 215 | ||
| 210 | @echo $@ ... | 216 | @echo $@ ... |
| @@ -216,7 +222,7 @@ $(BINRLS)/$(LIBNAME).a: \ | @@ -216,7 +222,7 @@ $(BINRLS)/$(LIBNAME).a: \ | ||
| 216 | 222 | ||
| 217 | install: \ | 223 | install: \ |
| 218 | $(BINRLS)/$(LIBNAME)@DLLEXT@ \ | 224 | $(BINRLS)/$(LIBNAME)@DLLEXT@ \ |
| 219 | - $(BINRLS)/$(LIBNAME).a | 225 | + $(BINRLS)/static/$(LIBNAME).a |
| 220 | 226 | ||
| 221 | # Install library | 227 | # Install library |
| 222 | @mkdir -p $(DESTDIR)$(libdir) | 228 | @mkdir -p $(DESTDIR)$(libdir) |
| @@ -236,17 +242,10 @@ install: \ | @@ -236,17 +242,10 @@ install: \ | ||
| 236 | 242 | ||
| 237 | # Install static library | 243 | # Install static library |
| 238 | @$(INSTALL_DATA) \ | 244 | @$(INSTALL_DATA) \ |
| 239 | - $(BINRLS)/$(LIBNAME).a \ | 245 | + $(BINRLS)/static/$(LIBNAME).a \ |
| 240 | $(DESTDIR)$(libdir) | 246 | $(DESTDIR)$(libdir) |
| 241 | 247 | ||
| 242 | # Install SDK | 248 | # Install SDK |
| 243 | - | ||
| 244 | - @mkdir -p $(DESTDIR)$(includedir)/$(LIBNAME) | ||
| 245 | - | ||
| 246 | - @$(INSTALL_DATA) \ | ||
| 247 | - ../include/$(LIBNAME)/*.h \ | ||
| 248 | - $(DESTDIR)$(includedir)/$(LIBNAME) | ||
| 249 | - | ||
| 250 | @$(INSTALL_DATA) \ | 249 | @$(INSTALL_DATA) \ |
| 251 | ../include/$(LIBNAME).h \ | 250 | ../include/$(LIBNAME).h \ |
| 252 | $(DESTDIR)$(includedir)/$(LIBNAME).h | 251 | $(DESTDIR)$(includedir)/$(LIBNAME).h |
| @@ -361,12 +360,18 @@ clean: \ | @@ -361,12 +360,18 @@ clean: \ | ||
| 361 | cleanDebug: | 360 | cleanDebug: |
| 362 | 361 | ||
| 363 | @rm -fr $(OBJDBG) | 362 | @rm -fr $(OBJDBG) |
| 364 | - @rm -fr $(BINDBG) | 363 | + @rm -f $(BINDBG)/$(LIBNAME)@DLLEXT@.@PACKAGE_MAJOR_VERSION@.@PACKAGE_MINOR_VERSION@ |
| 364 | + @rm -f $(BINDBG)/$(LIBNAME)@DLLEXT@.@PACKAGE_MAJOR_VERSION@ | ||
| 365 | + @rm -f $(BINDBG)/$(LIBNAME)@DLLEXT@ | ||
| 365 | 366 | ||
| 366 | cleanRelease: | 367 | cleanRelease: |
| 367 | 368 | ||
| 368 | @rm -fr $(OBJRLS) | 369 | @rm -fr $(OBJRLS) |
| 369 | - @rm -fr $(BINRLS) | 370 | + |
| 371 | + @rm -f $(BINRLS)/$(LIBNAME)@DLLEXT@.@PACKAGE_MAJOR_VERSION@.@PACKAGE_MINOR_VERSION@ | ||
| 372 | + @rm -f $(BINRLS)/$(LIBNAME)@DLLEXT@.@PACKAGE_MAJOR_VERSION@ | ||
| 373 | + @rm -f $(BINRLS)/$(LIBNAME)@DLLEXT@ | ||
| 374 | + | ||
| 370 | @rm -fr $(POTDIR) | 375 | @rm -fr $(POTDIR) |
| 371 | @rm -f lib$(LIBNAME).pot | 376 | @rm -f lib$(LIBNAME).pot |
| 372 | 377 |
src/lib3270++/abstract.cc
| @@ -110,10 +110,10 @@ | @@ -110,10 +110,10 @@ | ||
| 110 | 110 | ||
| 111 | if(in && converter != (iconv_t)(-1)) { | 111 | if(in && converter != (iconv_t)(-1)) { |
| 112 | 112 | ||
| 113 | - size_t out = (in << 1); | ||
| 114 | - char * ptr; | ||
| 115 | - char * outBuffer = (char *) malloc(out); | ||
| 116 | - char * inBuffer = (char *) str; | 113 | + size_t out = (in << 1); |
| 114 | + char * ptr; | ||
| 115 | + char * outBuffer = (char *) malloc(out); | ||
| 116 | + ICONV_CONST char * inBuffer = (ICONV_CONST char *) str; | ||
| 117 | 117 | ||
| 118 | memset(ptr=outBuffer,0,out); | 118 | memset(ptr=outBuffer,0,out); |
| 119 | 119 |
src/lib3270++/lib3270++.cbp
| @@ -40,6 +40,7 @@ | @@ -40,6 +40,7 @@ | ||
| 40 | <Linker> | 40 | <Linker> |
| 41 | <Add option="`pkg-config --libs lib3270`" /> | 41 | <Add option="`pkg-config --libs lib3270`" /> |
| 42 | </Linker> | 42 | </Linker> |
| 43 | + <Unit filename="../include/config.h.in" /> | ||
| 43 | <Unit filename="../include/lib3270++.h" /> | 44 | <Unit filename="../include/lib3270++.h" /> |
| 44 | <Unit filename="../include/lib3270.h" /> | 45 | <Unit filename="../include/lib3270.h" /> |
| 45 | <Unit filename="../include/lib3270/action_table.h" /> | 46 | <Unit filename="../include/lib3270/action_table.h" /> |
src/lib3270++/local/events.cc
| @@ -37,6 +37,7 @@ | @@ -37,6 +37,7 @@ | ||
| 37 | */ | 37 | */ |
| 38 | 38 | ||
| 39 | #include "../private.h" | 39 | #include "../private.h" |
| 40 | + #include <stdio.h> | ||
| 40 | 41 | ||
| 41 | extern "C" { | 42 | extern "C" { |
| 42 | #include <lib3270/actions.h> | 43 | #include <lib3270/actions.h> |
| @@ -47,6 +48,35 @@ | @@ -47,6 +48,35 @@ | ||
| 47 | 48 | ||
| 48 | /*---[ Implement ]----------------------------------------------------------------------------------*/ | 49 | /*---[ Implement ]----------------------------------------------------------------------------------*/ |
| 49 | 50 | ||
| 51 | +#ifndef HAVE_VASPRINTF | ||
| 52 | + int vasprintf(char **strp, const char *fmt, va_list ap) { | ||
| 53 | + char buf[1024]; | ||
| 54 | + | ||
| 55 | + int nc = vsnprintf(buf, sizeof(buf), fmt, args); | ||
| 56 | + | ||
| 57 | + if(nc < 0) { | ||
| 58 | + | ||
| 59 | + *strp = strdup(_("Error in vasprintf")); | ||
| 60 | + | ||
| 61 | + } else if (nc < sizeof(buf)) { | ||
| 62 | + | ||
| 63 | + *strp = malloc(nc+1); | ||
| 64 | + strcpy(*strp, buf); | ||
| 65 | + | ||
| 66 | + } else { | ||
| 67 | + | ||
| 68 | + *strp = malloc(nc + 1); | ||
| 69 | + if(vsnprintf(*strp, nc, fmt, args) < 0) { | ||
| 70 | + free(*strp); | ||
| 71 | + *strp = strdup(NULL,_( "Out of memory in vasprintf" ) ); | ||
| 72 | + } | ||
| 73 | + | ||
| 74 | + } | ||
| 75 | + | ||
| 76 | + return nc; | ||
| 77 | + } | ||
| 78 | +#endif // !HAVE_VASPRINTF | ||
| 79 | + | ||
| 50 | namespace TN3270 { | 80 | namespace TN3270 { |
| 51 | 81 | ||
| 52 | /// @brief Popup Handler. | 82 | /// @brief Popup Handler. |
| @@ -55,7 +85,7 @@ | @@ -55,7 +85,7 @@ | ||
| 55 | Local::Session * session = (Local::Session *) lib3270_get_user_data(h3270); | 85 | Local::Session * session = (Local::Session *) lib3270_get_user_data(h3270); |
| 56 | 86 | ||
| 57 | if(!session) { | 87 | if(!session) { |
| 58 | - throw std::runtime_error("Invalid session handler"); | 88 | + throw std::runtime_error(_( "Invalid session handler" )); |
| 59 | } | 89 | } |
| 60 | 90 | ||
| 61 | class PopupEvent : public TN3270::Event { | 91 | class PopupEvent : public TN3270::Event { |
| @@ -108,7 +138,7 @@ | @@ -108,7 +138,7 @@ | ||
| 108 | Local::Session * session = (Local::Session *) lib3270_get_user_data(h3270); | 138 | Local::Session * session = (Local::Session *) lib3270_get_user_data(h3270); |
| 109 | 139 | ||
| 110 | if(!session) { | 140 | if(!session) { |
| 111 | - throw std::runtime_error("Invalid session handler"); | 141 | + throw std::runtime_error(_("Invalid session handler")); |
| 112 | } | 142 | } |
| 113 | 143 | ||
| 114 | class ConnectionEvent : public TN3270::Event { | 144 | class ConnectionEvent : public TN3270::Event { |
| @@ -130,7 +160,7 @@ | @@ -130,7 +160,7 @@ | ||
| 130 | 160 | ||
| 131 | /// @brief Get event description. | 161 | /// @brief Get event description. |
| 132 | std::string toString() const override { | 162 | std::string toString() const override { |
| 133 | - return this->connected ? "connected" : "disconnected"; | 163 | + return this->connected ? _("connected") : _("disconnected"); |
| 134 | } | 164 | } |
| 135 | 165 | ||
| 136 | }; | 166 | }; |
src/lib3270++/local/session.cc
| @@ -65,7 +65,7 @@ | @@ -65,7 +65,7 @@ | ||
| 65 | 65 | ||
| 66 | cbk = lib3270_get_session_callbacks(this->hSession,sizeof(struct lib3270_session_callbacks)); | 66 | cbk = lib3270_get_session_callbacks(this->hSession,sizeof(struct lib3270_session_callbacks)); |
| 67 | if(!cbk) { | 67 | if(!cbk) { |
| 68 | - throw std::runtime_error( "Invalid callback table, possible version mismatch in lib3270" ); | 68 | + throw std::runtime_error( _("Invalid callback table, possible version mismatch in lib3270") ); |
| 69 | } | 69 | } |
| 70 | 70 | ||
| 71 | cbk->update_connect = connectHandler; | 71 | cbk->update_connect = connectHandler; |
| @@ -120,7 +120,7 @@ | @@ -120,7 +120,7 @@ | ||
| 120 | char * text = lib3270_get_text(hSession, baddr, len, lf); | 120 | char * text = lib3270_get_text(hSession, baddr, len, lf); |
| 121 | 121 | ||
| 122 | if(!text) { | 122 | if(!text) { |
| 123 | - throw std::runtime_error("Can't get screen contents"); | 123 | + throw std::runtime_error( _("Can't get screen contents") ); |
| 124 | } | 124 | } |
| 125 | 125 | ||
| 126 | string rc = convertFromHost(text); | 126 | string rc = convertFromHost(text); |
| @@ -138,7 +138,7 @@ | @@ -138,7 +138,7 @@ | ||
| 138 | char * text = lib3270_get_text_at(hSession, row, col, sz, lf); | 138 | char * text = lib3270_get_text_at(hSession, row, col, sz, lf); |
| 139 | 139 | ||
| 140 | if(!text) { | 140 | if(!text) { |
| 141 | - throw std::runtime_error("Can't get screen contents"); | 141 | + throw std::runtime_error( _("Can't get screen contents") ); |
| 142 | } | 142 | } |
| 143 | 143 | ||
| 144 | string rc = convertFromHost(text); | 144 | string rc = convertFromHost(text); |
src/lib3270++/private.h
| @@ -41,12 +41,27 @@ | @@ -41,12 +41,27 @@ | ||
| 41 | #define PRIVATE_H_INCLUDED | 41 | #define PRIVATE_H_INCLUDED |
| 42 | 42 | ||
| 43 | #include <config.h> | 43 | #include <config.h> |
| 44 | + | ||
| 45 | + #ifdef WIN32 | ||
| 46 | + #include <winsock2.h> | ||
| 47 | + #include <windows.h> | ||
| 48 | + #include <ws2tcpip.h> | ||
| 49 | + #endif // WIN32 | ||
| 50 | + | ||
| 44 | #include <mutex> | 51 | #include <mutex> |
| 45 | #include <lib3270++.h> | 52 | #include <lib3270++.h> |
| 46 | #include <lib3270/popup.h> | 53 | #include <lib3270/popup.h> |
| 47 | #include <system_error> | 54 | #include <system_error> |
| 48 | #include <stdexcept> | 55 | #include <stdexcept> |
| 49 | 56 | ||
| 57 | +#ifdef HAVE_LIBINTL | ||
| 58 | + #include <libintl.h> | ||
| 59 | + #define _( x ) gettext(x) | ||
| 60 | + #define N_( x ) x | ||
| 61 | +#else | ||
| 62 | + #define _( x ) x | ||
| 63 | + #define N_( x ) x | ||
| 64 | +#endif // HAVE_LIBINTL | ||
| 50 | 65 | ||
| 51 | #ifdef HAVE_ICONV | 66 | #ifdef HAVE_ICONV |
| 52 | #include <iconv.h> | 67 | #include <iconv.h> |
src/lib3270/Makefile.in
| @@ -168,13 +168,13 @@ $(POTDIR)/$(LIBNAME)/%.pot: \ | @@ -168,13 +168,13 @@ $(POTDIR)/$(LIBNAME)/%.pot: \ | ||
| 168 | 168 | ||
| 169 | all: \ | 169 | all: \ |
| 170 | $(BINRLS)/$(LIBNAME)@DLLEXT@ \ | 170 | $(BINRLS)/$(LIBNAME)@DLLEXT@ \ |
| 171 | - $(BINRLS)/$(LIBNAME).a \ | 171 | + $(BINRLS)/static/$(LIBNAME).a \ |
| 172 | $(POTDIR)/$(LIBNAME).pot | 172 | $(POTDIR)/$(LIBNAME).pot |
| 173 | 173 | ||
| 174 | 174 | ||
| 175 | Release: \ | 175 | Release: \ |
| 176 | $(BINRLS)/$(LIBNAME)@DLLEXT@ \ | 176 | $(BINRLS)/$(LIBNAME)@DLLEXT@ \ |
| 177 | - $(BINRLS)/$(LIBNAME).a | 177 | + $(BINRLS)/static/$(LIBNAME).a |
| 178 | 178 | ||
| 179 | $(BINRLS)/$(LIBNAME)@DLLEXT@: \ | 179 | $(BINRLS)/$(LIBNAME)@DLLEXT@: \ |
| 180 | $(BINRLS)/$(LIBNAME)@DLLEXT@.@PACKAGE_MAJOR_VERSION@ | 180 | $(BINRLS)/$(LIBNAME)@DLLEXT@.@PACKAGE_MAJOR_VERSION@ |
| @@ -205,7 +205,7 @@ $(BINRLS)/$(LIBNAME)@DLLEXT@.@PACKAGE_MAJOR_VERSION@.@PACKAGE_MINOR_VERSION@: \ | @@ -205,7 +205,7 @@ $(BINRLS)/$(LIBNAME)@DLLEXT@.@PACKAGE_MAJOR_VERSION@.@PACKAGE_MINOR_VERSION@: \ | ||
| 205 | $(foreach SRC, $(basename $(SOURCES)), $(OBJRLS)/$(SRC).o) \ | 205 | $(foreach SRC, $(basename $(SOURCES)), $(OBJRLS)/$(SRC).o) \ |
| 206 | $(LIBS) | 206 | $(LIBS) |
| 207 | 207 | ||
| 208 | -$(BINRLS)/$(LIBNAME).a: \ | 208 | +$(BINRLS)/static/$(LIBNAME).a: \ |
| 209 | $(foreach SRC, $(basename $(SOURCES)), $(OBJRLS)/$(SRC).o) | 209 | $(foreach SRC, $(basename $(SOURCES)), $(OBJRLS)/$(SRC).o) |
| 210 | 210 | ||
| 211 | @echo $@ ... | 211 | @echo $@ ... |
| @@ -217,7 +217,7 @@ $(BINRLS)/$(LIBNAME).a: \ | @@ -217,7 +217,7 @@ $(BINRLS)/$(LIBNAME).a: \ | ||
| 217 | 217 | ||
| 218 | install: \ | 218 | install: \ |
| 219 | $(BINRLS)/$(LIBNAME)@DLLEXT@ \ | 219 | $(BINRLS)/$(LIBNAME)@DLLEXT@ \ |
| 220 | - $(BINRLS)/$(LIBNAME).a | 220 | + $(BINRLS)/static/$(LIBNAME).a |
| 221 | 221 | ||
| 222 | # Install library | 222 | # Install library |
| 223 | @mkdir -p $(DESTDIR)$(libdir) | 223 | @mkdir -p $(DESTDIR)$(libdir) |
| @@ -237,7 +237,7 @@ install: \ | @@ -237,7 +237,7 @@ install: \ | ||
| 237 | 237 | ||
| 238 | # Install static library | 238 | # Install static library |
| 239 | @$(INSTALL_DATA) \ | 239 | @$(INSTALL_DATA) \ |
| 240 | - $(BINRLS)/$(LIBNAME).a \ | 240 | + $(BINRLS)/static/$(LIBNAME).a \ |
| 241 | $(DESTDIR)$(libdir) | 241 | $(DESTDIR)$(libdir) |
| 242 | 242 | ||
| 243 | # Install SDK | 243 | # Install SDK |
src/lib3270/lib3270.pc.in
| @@ -11,6 +11,6 @@ Name: @PACKAGE_NAME@ | @@ -11,6 +11,6 @@ Name: @PACKAGE_NAME@ | ||
| 11 | Description: @PACKAGE_DESCRIPTION@ | 11 | Description: @PACKAGE_DESCRIPTION@ |
| 12 | Version: @PACKAGE_VERSION@ | 12 | Version: @PACKAGE_VERSION@ |
| 13 | Libs: -L\@libdir@ -l@LIB3270_NAME@ | 13 | Libs: -L\@libdir@ -l@LIB3270_NAME@ |
| 14 | -Libs.private: @LIBSSL_LIBS@ | 14 | +Libs.private: @LIBSSL_LIBS@ @INTL_LIBS@ |
| 15 | Cflags: -I@includedir@ | 15 | Cflags: -I@includedir@ |
| 16 | 16 |