Commit b73502013a146f000ad1658b28217e8061f97a31
1 parent
f8854827
Exists in
master
and in
5 other branches
Estudando possibilidade de isolar "dispatcher" por sessão.
Showing
44 changed files
with
377 additions
and
351 deletions
Show diff stats
pw3270.cbp
... | ... | @@ -214,6 +214,9 @@ |
214 | 214 | <Option compilerVar="CC" /> |
215 | 215 | </Unit> |
216 | 216 | <Unit filename="src/lib3270/ctlrc.h" /> |
217 | + <Unit filename="src/lib3270/dispatcher.c"> | |
218 | + <Option compilerVar="CC" /> | |
219 | + </Unit> | |
217 | 220 | <Unit filename="src/lib3270/ft.c"> |
218 | 221 | <Option compilerVar="CC" /> |
219 | 222 | </Unit> | ... | ... |
src/include/lib3270.h
... | ... | @@ -809,14 +809,6 @@ |
809 | 809 | LIB3270_EXPORT void * lib3270_get_user_data(H3270 *h); |
810 | 810 | |
811 | 811 | /** |
812 | - * @brief Iterate internal's lib3270 event loop. | |
813 | - * | |
814 | - * Use it only if the internal I/O calls wasn't replaced. | |
815 | - * | |
816 | - */ | |
817 | - LIB3270_EXPORT void lib3270_iterate(int block); | |
818 | - | |
819 | - /** | |
820 | 812 | * Wait for "N" seconds keeping main loop active. |
821 | 813 | * |
822 | 814 | * @param seconds Number of seconds to wait. | ... | ... |
src/include/lib3270/session.h
... | ... | @@ -173,7 +173,7 @@ |
173 | 173 | // Screen contents |
174 | 174 | void * buffer[2]; /**< Internal buffers */ |
175 | 175 | struct lib3270_ea * ea_buf; /**< 3270 device buffer. ea_buf[-1] is the dummy default field attribute */ |
176 | - struct lib3270_ea * aea_buf; /** alternate 3270 extended attribute buffer */ | |
176 | + struct lib3270_ea * aea_buf; /**< alternate 3270 extended attribute buffer */ | |
177 | 177 | struct lib3270_text * text; /**< Converted 3270 chars */ |
178 | 178 | |
179 | 179 | // host.c | ... | ... |
src/lib3270/Makefile.in
... | ... | @@ -113,73 +113,102 @@ include sources.mak |
113 | 113 | |
114 | 114 | #---[ Misc targets ]----------------------------------------------------------- |
115 | 115 | |
116 | -Release: $(BINRLS)/lib3270@DLLEXT@ | |
116 | +Release: \ | |
117 | + $(BINRLS)/lib3270@DLLEXT@ | |
118 | + | |
119 | +install: \ | |
120 | + Release | |
117 | 121 | |
118 | -install: Release | |
119 | 122 | $(MKDIR) $(DESTDIR)$(libdir) |
120 | 123 | $(INSTALL_PROGRAM) $(BINRLS)/lib3270@DLLEXT@.$(PACKAGE_VERSION) $(DESTDIR)$(libdir) |
121 | 124 | $(LN_S) lib3270@DLLEXT@.$(PACKAGE_VERSION) $(DESTDIR)$(libdir)/lib3270@DLLEXT@.@MAJOR_VERSION@ |
122 | 125 | $(LN_S) lib3270@DLLEXT@.@MAJOR_VERSION@ $(DESTDIR)$(libdir)/lib3270@DLLEXT@ |
123 | 126 | |
124 | -Debug: $(BINDBG)/lib3270@DLLEXT@ | |
127 | +Debug: \ | |
128 | + $(BINDBG)/lib3270@DLLEXT@ | |
129 | + | |
130 | +$(BINDBG)/lib3270@DLLEXT@: \ | |
131 | + $(BINDBG)/lib3270@DLLEXT@.$(PACKAGE_VERSION) | |
125 | 132 | |
126 | -$(BINDBG)/lib3270@DLLEXT@: $(BINDBG)/lib3270@DLLEXT@.$(PACKAGE_VERSION) | |
127 | 133 | @rm -f $@ |
128 | 134 | @cd $(BINDBG) && $(LN_S) lib3270@DLLEXT@.$(PACKAGE_VERSION) lib3270@DLLEXT@ |
129 | 135 | |
130 | -$(BINDBG)/lib3270@DLLEXT@.$(PACKAGE_VERSION): $(foreach SRC, $(basename $(SOURCES)), $(OBJDBG)/$(SRC)@OBJEXT@) | |
136 | +$(BINDBG)/lib3270@DLLEXT@.$(PACKAGE_VERSION): \ | |
137 | + $(foreach SRC, $(basename $(SOURCES)), $(OBJDBG)/$(SRC)@OBJEXT@) | |
138 | + | |
131 | 139 | @echo " CCLD `basename $@`" |
132 | 140 | @$(MKDIR) `dirname $@` |
133 | 141 | @$(LD) $(DLL_FLAGS) $(LDFLAGS) @LDSOFLAGS@ @LDLIBFLAGS@ -o $@ $^ $(LIBS) |
134 | 142 | |
135 | -$(BINRLS)/lib3270@DLLEXT@: $(BINRLS)/lib3270@DLLEXT@.$(PACKAGE_VERSION) | |
143 | +$(BINRLS)/lib3270@DLLEXT@: \ | |
144 | + $(BINRLS)/lib3270@DLLEXT@.$(PACKAGE_VERSION) | |
145 | + | |
136 | 146 | @rm -f $@ |
137 | 147 | @cd $(BINRLS) && $(LN_S) lib3270@DLLEXT@.$(PACKAGE_VERSION) lib3270@DLLEXT@ |
138 | 148 | |
139 | -$(BINRLS)/lib3270@DLLEXT@.$(PACKAGE_VERSION): $(foreach SRC, $(basename $(SOURCES)), $(OBJRLS)/$(SRC)@OBJEXT@) | |
149 | +$(BINRLS)/lib3270@DLLEXT@.$(PACKAGE_VERSION): \ | |
150 | + $(foreach SRC, $(basename $(SOURCES)), $(OBJRLS)/$(SRC)@OBJEXT@) | |
151 | + | |
140 | 152 | @echo " CCLD `basename $@`" |
141 | 153 | @$(MKDIR) `dirname $@` |
142 | 154 | @$(LD) $(DLL_FLAGS) $(LDFLAGS) @LDSOFLAGS@ @LDLIBFLAGS@ -o $@ $^ $(LIBS) |
143 | 155 | @$(STRIP) $@ |
144 | 156 | |
145 | -$(BINDBG)/testprogram$(EXEEXT): $(OBJDBG)/testprogram.o $(foreach SRC, $(basename $(SOURCES)), $(OBJDBG)/$(SRC)@OBJEXT@) | |
157 | +$(BINDBG)/testprogram$(EXEEXT): \ | |
158 | + $(OBJDBG)/testprogram.o $(foreach SRC, $(basename $(SOURCES)), $(OBJDBG)/$(SRC)@OBJEXT@) | |
159 | + | |
146 | 160 | @echo " CCLD `basename $@`" |
147 | 161 | @$(MKDIR) `dirname $@` |
148 | 162 | @$(LD) -o $@ $^ $(LIBS) |
149 | 163 | |
150 | -$(BINDIR)/pot/lib3270.pot: $(foreach SRC, $(basename $(SOURCES)), $(TMPDIR)/pot/$(SRC).pot) | |
164 | +$(BINDIR)/pot/lib3270.pot: \ | |
165 | + $(foreach SRC, $(basename $(SOURCES)), $(TMPDIR)/pot/$(SRC).pot) | |
166 | + | |
151 | 167 | @rm -f $@ |
152 | 168 | @mkdir -p `dirname $@` |
153 | 169 | @$(MSGCAT) --sort-output $^ > $@ |
154 | 170 | |
155 | -test: $(BINDBG)/testprogram$(EXEEXT) | |
171 | +test: \ | |
172 | + $(BINDBG)/testprogram$(EXEEXT) | |
173 | + | |
174 | +run: \ | |
175 | + $(BINDBG)/testprogram$(EXEEXT) | |
156 | 176 | |
157 | -run: $(BINDBG)/testprogram$(EXEEXT) | |
158 | 177 | ifeq ($(VALGRIND),no) |
159 | 178 | @PATH="$(BINDIR)/Debug@DLLDIR@:$(PATH)" "$(BINDBG)/testprogram$(EXEEXT)" |
160 | 179 | else |
161 | 180 | @PATH="$(BINDIR)/Debug@DLLDIR@:$(PATH)" G_DEBUG=gc-friendly G_SLICE=always-malloc \$(VALGRIND) --leak-check=full --suppressions=valgrind.suppression --gen-suppressions=all $(BINDBG)/testprogram$(EXEEXT) |
162 | 181 | endif |
163 | 182 | |
164 | -memchk: $(BINDBG)/testprogram$(EXEEXT) | |
183 | +memchk: \ | |
184 | + $(BINDBG)/testprogram$(EXEEXT) | |
185 | + | |
165 | 186 | ifeq ($(VALGRIND),no) |
166 | 187 | @cd "$(ROOTDIR)" ; .bin/Debug/testprogram$(EXEEXT) |
167 | 188 | else |
168 | 189 | @cd "$(ROOTDIR)" ; \$(VALGRIND) --leak-check=full --gen-suppressions=all $(BINDBG)/testprogram$(EXEEXT) |
169 | 190 | endif |
170 | 191 | |
171 | -version.c: ./mkversion.sh | |
192 | +version.c: \ | |
193 | + ./mkversion.sh | |
194 | + | |
172 | 195 | @echo " GEN $@" |
173 | 196 | @chmod +x ./mkversion.sh |
174 | 197 | @./mkversion.sh |
175 | 198 | |
176 | -fallbacks.c: X3270.xad mkfb.c | |
199 | +fallbacks.c: \ | |
200 | + X3270.xad mkfb.c | |
201 | + | |
177 | 202 | @echo " GEN $@" |
178 | 203 | @$(MKDIR) $(BINDIR) |
179 | 204 | @$(HOST_CC) -g -o $(BINDIR)/mkfb@EXEEXT@ mkfb.c |
180 | 205 | @$(BINDIR)/mkfb@EXEEXT@ -c X3270.xad $@ |
181 | 206 | |
182 | -cleantest: clean | |
207 | +cleantest: \ | |
208 | + clean | |
209 | + | |
210 | +cleanDebug: \ | |
211 | + clean | |
183 | 212 | |
184 | 213 | clean: |
185 | 214 | @rm -fr .obj |
... | ... | @@ -190,3 +219,4 @@ clean: |
190 | 219 | @rm -f fallbacks.c |
191 | 220 | @rm -f lib3270.pot |
192 | 221 | @rm -fr debian |
222 | + | ... | ... |
src/lib3270/actions.c
src/lib3270/ansi.c
src/lib3270/bounds.c
src/lib3270/charset.c
src/lib3270/connect.c
src/lib3270/ctlr.c
src/lib3270/ft.c
src/lib3270/ft_cut.c
src/lib3270/ft_dft.c
src/lib3270/globals.h
... | ... | @@ -1,271 +0,0 @@ |
1 | -/* | |
2 | - * "Software G3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 | |
3 | - * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a | |
4 | - * aplicativos mainframe. Registro no INPI sob o nome G3270. | |
5 | - * | |
6 | - * Copyright (C) <2008> <Banco do Brasil S.A.> | |
7 | - * | |
8 | - * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob | |
9 | - * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela | |
10 | - * Free Software Foundation. | |
11 | - * | |
12 | - * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER | |
13 | - * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO | |
14 | - * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para | |
15 | - * obter mais detalhes. | |
16 | - * | |
17 | - * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este | |
18 | - * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin | |
19 | - * St, Fifth Floor, Boston, MA 02110-1301 USA | |
20 | - * | |
21 | - * Este programa está nomeado como globals.h e possui 315 linhas de código. | |
22 | - * | |
23 | - * Contatos: | |
24 | - * | |
25 | - * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | |
26 | - * erico.mendonca@gmail.com (Erico Mascarenhas de Mendonça) | |
27 | - * licinio@bb.com.br (Licínio Luis Branco) | |
28 | - * kraucer@bb.com.br (Kraucer Fernandes Mazuco) | |
29 | - * macmiranda@bb.com.br (Marco Aurélio Caldas Miranda) | |
30 | - * | |
31 | - */ | |
32 | - | |
33 | -/* Autoconf settings. */ | |
34 | -#include <lib3270/config.h> /* autoconf settings */ | |
35 | -#include <lib3270.h> /* lib3270 API calls and defs */ | |
36 | -#include "api.h" | |
37 | - | |
38 | -#if defined(X3270_TN3270E) && !defined(X3270_ANSI) /*[*/ | |
39 | - #define X3270_ANSI 1 /* RFC2355 requires NVT mode */ | |
40 | -#endif /*]*/ | |
41 | - | |
42 | -#if defined(HAVE_VASPRINTF) && !defined(_GNU_SOURCE) /*[*/ | |
43 | - #define _GNU_SOURCE /* vasprintf isn't POSIX */ | |
44 | -#endif /*]*/ | |
45 | - | |
46 | -/* | |
47 | - * gettext stuff | |
48 | - */ | |
49 | -#ifdef ANDROID | |
50 | - #undef HAVE_LIBINTL | |
51 | - #undef HAVE_LIBSSL | |
52 | -#endif | |
53 | - | |
54 | -#ifdef HAVE_LIBINTL | |
55 | - #include <libintl.h> | |
56 | - #define _( x ) gettext(x) | |
57 | - #define N_( x ) x | |
58 | -#else | |
59 | - #define _( x ) x | |
60 | - #define N_( x ) x | |
61 | -#endif // HAVE_LIBINTL | |
62 | - | |
63 | -#define action_name(x) #x | |
64 | - | |
65 | -/* | |
66 | - * OS-specific #defines. Except for the blocking-connect workarounds, these | |
67 | - * should be replaced with autoconf probes as soon as possible. | |
68 | - */ | |
69 | - | |
70 | -/* | |
71 | - * BLOCKING_CONNECT_ONLY | |
72 | - * Use only blocking sockets. | |
73 | - */ | |
74 | -#if defined(sco) /*[*/ | |
75 | - #define BLOCKING_CONNECT_ONLY 1 | |
76 | -#endif /*]*/ | |
77 | - | |
78 | -#if defined(apollo) /*[*/ | |
79 | - #define BLOCKING_CONNECT_ONLY 1 | |
80 | -#endif /*]*/ | |
81 | - | |
82 | -/* | |
83 | - * Compiler-specific #defines. | |
84 | - */ | |
85 | - | |
86 | -/* 'unused' explicitly flags an unused parameter */ | |
87 | -#if defined(__GNUC__) /*[*/ | |
88 | - #define unused __attribute__((__unused__)) | |
89 | - #define printflike(s,f) __attribute__ ((__format__ (__printf__, s, f))) | |
90 | -#else /*][*/ | |
91 | - #define unused /* nothing */ | |
92 | - #define printflike(s, f) /* nothing */ | |
93 | -#endif /*]*/ | |
94 | - | |
95 | - | |
96 | - | |
97 | -/* | |
98 | - * Prerequisite #includes. | |
99 | - */ | |
100 | -#include <stdio.h> /* Unix standard I/O library */ | |
101 | -#include <unistd.h> /* Unix system calls */ | |
102 | -#include <ctype.h> /* Character classes */ | |
103 | -#include <string.h> /* String manipulations */ | |
104 | -#include <sys/types.h> /* Basic system data types */ | |
105 | -#include <sys/time.h> /* System time-related data types */ | |
106 | -#include <time.h> /* C library time functions */ | |
107 | -#include "localdefs.h" /* {s,tcl,c}3270-specific defines */ | |
108 | - | |
109 | -/* | |
110 | - * Cancel out contradictory parts. | |
111 | - */ | |
112 | -#if !defined(X3270_DISPLAY) /*[*/ | |
113 | - #undef X3270_KEYPAD | |
114 | - #undef X3270_MENUS | |
115 | -#endif /*]*/ | |
116 | - | |
117 | -/* Functions we may need to supply. */ | |
118 | -#if defined(NEED_STRTOK_R) /*[*/ | |
119 | - extern char *strtok_r(char *str, const char *sep, char **last); | |
120 | -#endif /*]*/ | |
121 | - | |
122 | -/* types of internal actions */ | |
123 | -enum iaction { | |
124 | - IA_STRING, IA_PASTE, IA_REDRAW, | |
125 | - IA_KEYPAD, IA_DEFAULT, IA_KEY, | |
126 | - IA_MACRO, IA_SCRIPT, IA_PEEK, | |
127 | - IA_TYPEAHEAD, IA_FT, IA_COMMAND, IA_KEYMAP, | |
128 | - IA_IDLE | |
129 | -}; | |
130 | - | |
131 | -// Version strings | |
132 | -LIB3270_INTERNAL const char * build; | |
133 | -LIB3270_INTERNAL const char * app_defaults_version; | |
134 | -LIB3270_INTERNAL const char * sccsid; | |
135 | -LIB3270_INTERNAL const char * build_rpq_timestamp; | |
136 | -LIB3270_INTERNAL const char * build_rpq_version; | |
137 | -LIB3270_INTERNAL const char * build_rpq_revision; | |
138 | - | |
139 | -#if defined(X3270_DBCS) /*[*/ | |
140 | - LIB3270_INTERNAL Boolean dbcs; | |
141 | -#endif /*]*/ | |
142 | - | |
143 | - | |
144 | -#if defined(X3270_DBCS) /*[*/ | |
145 | - LIB3270_INTERNAL char *full_efontname_dbcs; | |
146 | -#endif /*]*/ | |
147 | - | |
148 | - | |
149 | -/* keyboard modifer bitmap */ | |
150 | -#define ShiftKeyDown 0x01 | |
151 | -#define MetaKeyDown 0x02 | |
152 | -#define AltKeyDown 0x04 | |
153 | - | |
154 | -/* toggle names */ | |
155 | -struct toggle_name { | |
156 | - const char *name; | |
157 | - int index; | |
158 | -}; | |
159 | - | |
160 | - | |
161 | -/* input key type */ | |
162 | - | |
163 | -/* Naming convention for private actions. */ | |
164 | -#define PA_PFX "PA-" | |
165 | - | |
166 | -/* Shorthand macros */ | |
167 | - | |
168 | -#define CN ((char *) NULL) | |
169 | -#define PN ((XtPointer) NULL) | |
170 | -#define Replace(var, value) { lib3270_free(var); var = (value); }; | |
171 | - | |
172 | -/* Configuration change masks. */ | |
173 | -#define NO_CHANGE 0x0000 /* no change */ | |
174 | -#define MODEL_CHANGE 0x0001 /* screen dimensions changed */ | |
175 | -#define FONT_CHANGE 0x0002 /* emulator font changed */ | |
176 | -#define COLOR_CHANGE 0x0004 /* color scheme or 3278/9 mode changed */ | |
177 | -#define SCROLL_CHANGE 0x0008 /* scrollbar snapped on or off */ | |
178 | -#define CHARSET_CHANGE 0x0010 /* character set changed */ | |
179 | -#define ALL_CHANGE 0xffff /* everything changed */ | |
180 | - | |
181 | -/* Portability macros */ | |
182 | - | |
183 | -/* Equivalent of setlinebuf */ | |
184 | - | |
185 | -#if defined(_IOLBF) /*[*/ | |
186 | - #define SETLINEBUF(s) setvbuf(s, (char *)NULL, _IOLBF, BUFSIZ) | |
187 | -#else /*][*/ | |
188 | - #define SETLINEBUF(s) setlinebuf(s) | |
189 | -#endif /*]*/ | |
190 | - | |
191 | -/* Motorola version of gettimeofday */ | |
192 | - | |
193 | -#if defined(MOTOROLA) | |
194 | - #define gettimeofday(tp,tz) gettimeofday(tp) | |
195 | -#endif | |
196 | - | |
197 | -/* Default DFT file transfer buffer size. */ | |
198 | -#if defined(X3270_FT) && !defined(DFT_BUF) /*[*/ | |
199 | - #define DFT_BUF (4 * 1024) | |
200 | -#endif /*]*/ | |
201 | - | |
202 | -/* DBCS Preedit Types */ | |
203 | -#if defined(X3270_DBCS) /*[*/ | |
204 | - #define PT_ROOT "Root" | |
205 | - #define PT_OVER_THE_SPOT "OverTheSpot" | |
206 | - #define PT_OFF_THE_SPOT "OffTheSpot" | |
207 | - #define PT_ON_THE_SPOT "OnTheSpot" | |
208 | -#endif /*]*/ | |
209 | - | |
210 | -/** input key type */ | |
211 | -enum keytype | |
212 | -{ | |
213 | - KT_STD, | |
214 | - KT_GE | |
215 | -}; | |
216 | - | |
217 | -LIB3270_INTERNAL struct _ansictl | |
218 | -{ | |
219 | - char vintr; | |
220 | - char vquit; | |
221 | - char verase; | |
222 | - char vkill; | |
223 | - char veof; | |
224 | - char vwerase; | |
225 | - char vrprnt; | |
226 | - char vlnext; | |
227 | -} ansictl; | |
228 | - | |
229 | -/* default charset translation tables */ | |
230 | -// LIB3270_INTERNAL const unsigned short ebc2asc0[256]; | |
231 | -// LIB3270_INTERNAL const unsigned short asc2ft0[256]; | |
232 | - | |
233 | - | |
234 | -/* Library internal calls */ | |
235 | -LIB3270_INTERNAL void key_ACharacter(H3270 *hSession, unsigned char c, enum keytype keytype, enum iaction cause,Boolean *skipped); | |
236 | -LIB3270_INTERNAL void lib3270_initialize(void); | |
237 | -LIB3270_INTERNAL int cursor_move(H3270 *session, int baddr); | |
238 | - | |
239 | -LIB3270_INTERNAL void toggle_rectselect(H3270 *session, struct lib3270_toggle *t, LIB3270_TOGGLE_TYPE tt); | |
240 | -LIB3270_INTERNAL void remove_input_calls(H3270 *session); | |
241 | - | |
242 | -LIB3270_INTERNAL int lib3270_sock_send(H3270 *hSession, unsigned const char *buf, int len); | |
243 | -LIB3270_INTERNAL void lib3270_sock_disconnect(H3270 *hSession); | |
244 | - | |
245 | -#if defined(DEBUG) | |
246 | - #define CHECK_SESSION_HANDLE(x) check_session_handle(&x,__FUNCTION__); | |
247 | - LIB3270_INTERNAL void check_session_handle(H3270 **hSession, const char *fname); | |
248 | -#else | |
249 | - #define CHECK_SESSION_HANDLE(x) check_session_handle(&x); | |
250 | - LIB3270_INTERNAL void check_session_handle(H3270 **hSession); | |
251 | -#endif // DEBUG | |
252 | - | |
253 | -LIB3270_INTERNAL int non_blocking(H3270 *session, Boolean on); | |
254 | - | |
255 | -#if defined(HAVE_LIBSSL) /*[*/ | |
256 | - | |
257 | - LIB3270_INTERNAL int ssl_init(H3270 *session); | |
258 | - LIB3270_INTERNAL int ssl_negotiate(H3270 *hSession); | |
259 | - LIB3270_INTERNAL void set_ssl_state(H3270 *session, LIB3270_SSL_STATE state); | |
260 | - | |
261 | - | |
262 | - #if OPENSSL_VERSION_NUMBER >= 0x00907000L /*[*/ | |
263 | - #define INFO_CONST const | |
264 | - #else /*][*/ | |
265 | - #define INFO_CONST | |
266 | - #endif /*]*/ | |
267 | - | |
268 | - LIB3270_INTERNAL void ssl_info_callback(INFO_CONST SSL *s, int where, int ret); | |
269 | - | |
270 | -#endif /*]*/ | |
271 | - |
src/lib3270/glue.c
src/lib3270/host.c
src/lib3270/html.c
src/lib3270/iocalls.c
... | ... | @@ -29,7 +29,7 @@ |
29 | 29 | * |
30 | 30 | */ |
31 | 31 | |
32 | -#include "globals.h" | |
32 | +#include "private.h" | |
33 | 33 | #include <sys/time.h> |
34 | 34 | #include <sys/types.h> |
35 | 35 | #include "xioc.h" |
... | ... | @@ -45,15 +45,14 @@ |
45 | 45 | /*---[ Standard calls ]-------------------------------------------------------------------------------------*/ |
46 | 46 | |
47 | 47 | // Timeout calls |
48 | -static void internal_remove_timeout(void *timer); | |
49 | -static void * internal_add_timeout(unsigned long interval_ms, H3270 *session, void (*proc)(H3270 *session)); | |
48 | +static void internal_remove_timeout(void *timer); | |
49 | +static void * internal_add_timeout(unsigned long interval_ms, H3270 *session, void (*proc)(H3270 *session)); | |
50 | 50 | |
51 | -static void * internal_add_poll(H3270 *session, int fd, LIB3270_IO_FLAG flag, void(*proc)(H3270 *, int, LIB3270_IO_FLAG, void *), void *userdata ); | |
52 | -static void internal_remove_poll(void *id); | |
51 | +static void * internal_add_poll(H3270 *session, int fd, LIB3270_IO_FLAG flag, void(*proc)(H3270 *, int, LIB3270_IO_FLAG, void *), void *userdata ); | |
52 | +static void internal_remove_poll(void *id); | |
53 | 53 | |
54 | 54 | static int internal_wait(H3270 *hSession, int seconds); |
55 | 55 | |
56 | -static int internal_event_dispatcher(H3270 *hSession, int block); | |
57 | 56 | static void internal_ring_bell(H3270 *); |
58 | 57 | |
59 | 58 | /*---[ Active callbacks ]-----------------------------------------------------------------------------------*/ |
... | ... | @@ -74,7 +73,7 @@ static void internal_ring_bell(H3270 *); |
74 | 73 | = internal_wait; |
75 | 74 | |
76 | 75 | static int (*event_dispatcher)(H3270 *hSession,int wait) |
77 | - = internal_event_dispatcher; | |
76 | + = lib3270_default_event_dispatcher; | |
78 | 77 | |
79 | 78 | static void (*ring_bell)(H3270 *) |
80 | 79 | = internal_ring_bell; |
... | ... | @@ -318,7 +317,7 @@ LIB3270_EXPORT void * lib3270_add_poll_fd(H3270 *session, int fd, LIB3270_IO_FL |
318 | 317 | } |
319 | 318 | |
320 | 319 | /* Event dispatcher. */ |
321 | -static int internal_event_dispatcher(H3270 *hSession, int block) | |
320 | +int lib3270_default_event_dispatcher(H3270 *hSession, int block) | |
322 | 321 | { |
323 | 322 | #if defined(_WIN32) |
324 | 323 | unsigned long long now; |
... | ... | @@ -704,11 +703,6 @@ LIB3270_EXPORT int lib3270_register_handlers(const struct lib3270_callbacks *cbk |
704 | 703 | |
705 | 704 | } |
706 | 705 | |
707 | - | |
708 | -LIB3270_EXPORT void lib3270_iterate(int block) { | |
709 | - event_dispatcher(NULL,block); | |
710 | -} | |
711 | - | |
712 | 706 | LIB3270_EXPORT void lib3270_main_iterate(H3270 *hSession, int block) |
713 | 707 | { |
714 | 708 | CHECK_SESSION_HANDLE(hSession); | ... | ... |
src/lib3270/kybd.c
src/lib3270/lib3270.cbp
... | ... | @@ -110,7 +110,6 @@ |
110 | 110 | <Unit filename="ft_dft_ds.h" /> |
111 | 111 | <Unit filename="ft_dftc.h" /> |
112 | 112 | <Unit filename="ftc.h" /> |
113 | - <Unit filename="globals.h" /> | |
114 | 113 | <Unit filename="glue.c"> |
115 | 114 | <Option compilerVar="CC" /> |
116 | 115 | </Unit> |
... | ... | @@ -135,6 +134,9 @@ |
135 | 134 | <Unit filename="macros.c"> |
136 | 135 | <Option compilerVar="CC" /> |
137 | 136 | </Unit> |
137 | + <Unit filename="mkfb.c"> | |
138 | + <Option compilerVar="CC" /> | |
139 | + </Unit> | |
138 | 140 | <Unit filename="mkversion.sh.in" /> |
139 | 141 | <Unit filename="objects.h" /> |
140 | 142 | <Unit filename="paste.c"> |
... | ... | @@ -149,6 +151,7 @@ |
149 | 151 | <Option compilerVar="CC" /> |
150 | 152 | </Unit> |
151 | 153 | <Unit filename="printerc.h" /> |
154 | + <Unit filename="private.h" /> | |
152 | 155 | <Unit filename="proxy.c"> |
153 | 156 | <Option compilerVar="CC" /> |
154 | 157 | </Unit> | ... | ... |
src/lib3270/macros.c
src/lib3270/mkfb.c
... | ... | @@ -386,7 +386,7 @@ main(int argc, char *argv[]) |
386 | 386 | fprintf(t, "/* This file was created automatically from %s by mkfb. */\n\n", |
387 | 387 | filename); |
388 | 388 | if (cmode) { |
389 | - fprintf(t, "#include \"globals.h\"\n"); | |
389 | + fprintf(t, "#include \"private.h\"\n"); | |
390 | 390 | fprintf(t, "static unsigned char fsd[] = {\n"); |
391 | 391 | } else { |
392 | 392 | fprintf(t, "unsigned char common_fallbacks[] = {\n"); |
... | ... | @@ -640,7 +640,7 @@ FILE * osx_tmpfile( void ) |
640 | 640 | { |
641 | 641 | int fd = -1; |
642 | 642 | FILE *file = NULL; |
643 | - | |
643 | + | |
644 | 644 | do |
645 | 645 | { |
646 | 646 | char *tempname = tempnam(NULL,"XXXXXX"); |
... | ... | @@ -648,8 +648,8 @@ FILE * osx_tmpfile( void ) |
648 | 648 | return NULL; |
649 | 649 | fd = open (tempname,O_CREAT | O_EXCL | O_RDWR,S_IREAD | S_IWRITE); |
650 | 650 | } while (fd < 0 && errno == EEXIST); |
651 | - | |
652 | - | |
651 | + | |
652 | + | |
653 | 653 | file = fdopen (fd, "w+b"); |
654 | 654 | if (file == NULL) |
655 | 655 | { |
... | ... | @@ -657,7 +657,7 @@ FILE * osx_tmpfile( void ) |
657 | 657 | close (fd); |
658 | 658 | errno = save_errno; |
659 | 659 | } |
660 | - | |
660 | + | |
661 | 661 | return file; |
662 | 662 | } |
663 | 663 | ... | ... |
src/lib3270/options.c
src/lib3270/paste.c
src/lib3270/print.c
src/lib3270/printer.c
... | ... | @@ -0,0 +1,273 @@ |
1 | +/* | |
2 | + * "Software G3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 | |
3 | + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a | |
4 | + * aplicativos mainframe. Registro no INPI sob o nome G3270. | |
5 | + * | |
6 | + * Copyright (C) <2008> <Banco do Brasil S.A.> | |
7 | + * | |
8 | + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob | |
9 | + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela | |
10 | + * Free Software Foundation. | |
11 | + * | |
12 | + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER | |
13 | + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO | |
14 | + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para | |
15 | + * obter mais detalhes. | |
16 | + * | |
17 | + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este | |
18 | + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin | |
19 | + * St, Fifth Floor, Boston, MA 02110-1301 USA | |
20 | + * | |
21 | + * Este programa está nomeado como private.h e possui - linhas de código. | |
22 | + * | |
23 | + * Contatos: | |
24 | + * | |
25 | + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | |
26 | + * erico.mendonca@gmail.com (Erico Mascarenhas de Mendonça) | |
27 | + * licinio@bb.com.br (Licínio Luis Branco) | |
28 | + * kraucer@bb.com.br (Kraucer Fernandes Mazuco) | |
29 | + * macmiranda@bb.com.br (Marco Aurélio Caldas Miranda) | |
30 | + * | |
31 | + */ | |
32 | + | |
33 | +/* Autoconf settings. */ | |
34 | +#include <lib3270/config.h> /* autoconf settings */ | |
35 | +#include <lib3270.h> /* lib3270 API calls and defs */ | |
36 | +#include "api.h" | |
37 | + | |
38 | +#if defined(X3270_TN3270E) && !defined(X3270_ANSI) /*[*/ | |
39 | + #define X3270_ANSI 1 /* RFC2355 requires NVT mode */ | |
40 | +#endif /*]*/ | |
41 | + | |
42 | +#if defined(HAVE_VASPRINTF) && !defined(_GNU_SOURCE) /*[*/ | |
43 | + #define _GNU_SOURCE /* vasprintf isn't POSIX */ | |
44 | +#endif /*]*/ | |
45 | + | |
46 | +/* | |
47 | + * gettext stuff | |
48 | + */ | |
49 | +#ifdef ANDROID | |
50 | + #undef HAVE_LIBINTL | |
51 | + #undef HAVE_LIBSSL | |
52 | +#endif | |
53 | + | |
54 | +#ifdef HAVE_LIBINTL | |
55 | + #include <libintl.h> | |
56 | + #define _( x ) gettext(x) | |
57 | + #define N_( x ) x | |
58 | +#else | |
59 | + #define _( x ) x | |
60 | + #define N_( x ) x | |
61 | +#endif // HAVE_LIBINTL | |
62 | + | |
63 | +#define action_name(x) #x | |
64 | + | |
65 | +/* | |
66 | + * OS-specific #defines. Except for the blocking-connect workarounds, these | |
67 | + * should be replaced with autoconf probes as soon as possible. | |
68 | + */ | |
69 | + | |
70 | +/* | |
71 | + * BLOCKING_CONNECT_ONLY | |
72 | + * Use only blocking sockets. | |
73 | + */ | |
74 | +#if defined(sco) /*[*/ | |
75 | + #define BLOCKING_CONNECT_ONLY 1 | |
76 | +#endif /*]*/ | |
77 | + | |
78 | +#if defined(apollo) /*[*/ | |
79 | + #define BLOCKING_CONNECT_ONLY 1 | |
80 | +#endif /*]*/ | |
81 | + | |
82 | +/* | |
83 | + * Compiler-specific #defines. | |
84 | + */ | |
85 | + | |
86 | +/* 'unused' explicitly flags an unused parameter */ | |
87 | +#if defined(__GNUC__) /*[*/ | |
88 | + #define unused __attribute__((__unused__)) | |
89 | + #define printflike(s,f) __attribute__ ((__format__ (__printf__, s, f))) | |
90 | +#else /*][*/ | |
91 | + #define unused /* nothing */ | |
92 | + #define printflike(s, f) /* nothing */ | |
93 | +#endif /*]*/ | |
94 | + | |
95 | + | |
96 | + | |
97 | +/* | |
98 | + * Prerequisite #includes. | |
99 | + */ | |
100 | +#include <stdio.h> /* Unix standard I/O library */ | |
101 | +#include <unistd.h> /* Unix system calls */ | |
102 | +#include <ctype.h> /* Character classes */ | |
103 | +#include <string.h> /* String manipulations */ | |
104 | +#include <sys/types.h> /* Basic system data types */ | |
105 | +#include <sys/time.h> /* System time-related data types */ | |
106 | +#include <time.h> /* C library time functions */ | |
107 | +#include "localdefs.h" /* {s,tcl,c}3270-specific defines */ | |
108 | + | |
109 | +/* | |
110 | + * Cancel out contradictory parts. | |
111 | + */ | |
112 | +#if !defined(X3270_DISPLAY) /*[*/ | |
113 | + #undef X3270_KEYPAD | |
114 | + #undef X3270_MENUS | |
115 | +#endif /*]*/ | |
116 | + | |
117 | +/* Functions we may need to supply. */ | |
118 | +#if defined(NEED_STRTOK_R) /*[*/ | |
119 | + extern char *strtok_r(char *str, const char *sep, char **last); | |
120 | +#endif /*]*/ | |
121 | + | |
122 | +/* types of internal actions */ | |
123 | +enum iaction { | |
124 | + IA_STRING, IA_PASTE, IA_REDRAW, | |
125 | + IA_KEYPAD, IA_DEFAULT, IA_KEY, | |
126 | + IA_MACRO, IA_SCRIPT, IA_PEEK, | |
127 | + IA_TYPEAHEAD, IA_FT, IA_COMMAND, IA_KEYMAP, | |
128 | + IA_IDLE | |
129 | +}; | |
130 | + | |
131 | +// Version strings | |
132 | +LIB3270_INTERNAL const char * build; | |
133 | +LIB3270_INTERNAL const char * app_defaults_version; | |
134 | +LIB3270_INTERNAL const char * sccsid; | |
135 | +LIB3270_INTERNAL const char * build_rpq_timestamp; | |
136 | +LIB3270_INTERNAL const char * build_rpq_version; | |
137 | +LIB3270_INTERNAL const char * build_rpq_revision; | |
138 | + | |
139 | +#if defined(X3270_DBCS) /*[*/ | |
140 | + LIB3270_INTERNAL Boolean dbcs; | |
141 | +#endif /*]*/ | |
142 | + | |
143 | + | |
144 | +#if defined(X3270_DBCS) /*[*/ | |
145 | + LIB3270_INTERNAL char *full_efontname_dbcs; | |
146 | +#endif /*]*/ | |
147 | + | |
148 | + | |
149 | +/* keyboard modifer bitmap */ | |
150 | +#define ShiftKeyDown 0x01 | |
151 | +#define MetaKeyDown 0x02 | |
152 | +#define AltKeyDown 0x04 | |
153 | + | |
154 | +/* toggle names */ | |
155 | +struct toggle_name { | |
156 | + const char *name; | |
157 | + int index; | |
158 | +}; | |
159 | + | |
160 | + | |
161 | +/* input key type */ | |
162 | + | |
163 | +/* Naming convention for private actions. */ | |
164 | +#define PA_PFX "PA-" | |
165 | + | |
166 | +/* Shorthand macros */ | |
167 | + | |
168 | +#define CN ((char *) NULL) | |
169 | +#define PN ((XtPointer) NULL) | |
170 | +#define Replace(var, value) { lib3270_free(var); var = (value); }; | |
171 | + | |
172 | +/* Configuration change masks. */ | |
173 | +#define NO_CHANGE 0x0000 /* no change */ | |
174 | +#define MODEL_CHANGE 0x0001 /* screen dimensions changed */ | |
175 | +#define FONT_CHANGE 0x0002 /* emulator font changed */ | |
176 | +#define COLOR_CHANGE 0x0004 /* color scheme or 3278/9 mode changed */ | |
177 | +#define SCROLL_CHANGE 0x0008 /* scrollbar snapped on or off */ | |
178 | +#define CHARSET_CHANGE 0x0010 /* character set changed */ | |
179 | +#define ALL_CHANGE 0xffff /* everything changed */ | |
180 | + | |
181 | +/* Portability macros */ | |
182 | + | |
183 | +/* Equivalent of setlinebuf */ | |
184 | + | |
185 | +#if defined(_IOLBF) /*[*/ | |
186 | + #define SETLINEBUF(s) setvbuf(s, (char *)NULL, _IOLBF, BUFSIZ) | |
187 | +#else /*][*/ | |
188 | + #define SETLINEBUF(s) setlinebuf(s) | |
189 | +#endif /*]*/ | |
190 | + | |
191 | +/* Motorola version of gettimeofday */ | |
192 | + | |
193 | +#if defined(MOTOROLA) | |
194 | + #define gettimeofday(tp,tz) gettimeofday(tp) | |
195 | +#endif | |
196 | + | |
197 | +/* Default DFT file transfer buffer size. */ | |
198 | +#if defined(X3270_FT) && !defined(DFT_BUF) /*[*/ | |
199 | + #define DFT_BUF (4 * 1024) | |
200 | +#endif /*]*/ | |
201 | + | |
202 | +/* DBCS Preedit Types */ | |
203 | +#if defined(X3270_DBCS) /*[*/ | |
204 | + #define PT_ROOT "Root" | |
205 | + #define PT_OVER_THE_SPOT "OverTheSpot" | |
206 | + #define PT_OFF_THE_SPOT "OffTheSpot" | |
207 | + #define PT_ON_THE_SPOT "OnTheSpot" | |
208 | +#endif /*]*/ | |
209 | + | |
210 | +/** input key type */ | |
211 | +enum keytype | |
212 | +{ | |
213 | + KT_STD, | |
214 | + KT_GE | |
215 | +}; | |
216 | + | |
217 | +LIB3270_INTERNAL struct _ansictl | |
218 | +{ | |
219 | + char vintr; | |
220 | + char vquit; | |
221 | + char verase; | |
222 | + char vkill; | |
223 | + char veof; | |
224 | + char vwerase; | |
225 | + char vrprnt; | |
226 | + char vlnext; | |
227 | +} ansictl; | |
228 | + | |
229 | +/* default charset translation tables */ | |
230 | +// LIB3270_INTERNAL const unsigned short ebc2asc0[256]; | |
231 | +// LIB3270_INTERNAL const unsigned short asc2ft0[256]; | |
232 | + | |
233 | + | |
234 | +/* Library internal calls */ | |
235 | +LIB3270_INTERNAL void key_ACharacter(H3270 *hSession, unsigned char c, enum keytype keytype, enum iaction cause,Boolean *skipped); | |
236 | +LIB3270_INTERNAL void lib3270_initialize(void); | |
237 | +LIB3270_INTERNAL int cursor_move(H3270 *session, int baddr); | |
238 | + | |
239 | +LIB3270_INTERNAL void toggle_rectselect(H3270 *session, struct lib3270_toggle *t, LIB3270_TOGGLE_TYPE tt); | |
240 | +LIB3270_INTERNAL void remove_input_calls(H3270 *session); | |
241 | + | |
242 | +LIB3270_INTERNAL int lib3270_sock_send(H3270 *hSession, unsigned const char *buf, int len); | |
243 | +LIB3270_INTERNAL void lib3270_sock_disconnect(H3270 *hSession); | |
244 | + | |
245 | +LIB3270_INTERNAL int lib3270_default_event_dispatcher(H3270 *hSession, int block); | |
246 | + | |
247 | +#if defined(DEBUG) | |
248 | + #define CHECK_SESSION_HANDLE(x) check_session_handle(&x,__FUNCTION__); | |
249 | + LIB3270_INTERNAL void check_session_handle(H3270 **hSession, const char *fname); | |
250 | +#else | |
251 | + #define CHECK_SESSION_HANDLE(x) check_session_handle(&x); | |
252 | + LIB3270_INTERNAL void check_session_handle(H3270 **hSession); | |
253 | +#endif // DEBUG | |
254 | + | |
255 | +LIB3270_INTERNAL int non_blocking(H3270 *session, Boolean on); | |
256 | + | |
257 | +#if defined(HAVE_LIBSSL) /*[*/ | |
258 | + | |
259 | + LIB3270_INTERNAL int ssl_init(H3270 *session); | |
260 | + LIB3270_INTERNAL int ssl_negotiate(H3270 *hSession); | |
261 | + LIB3270_INTERNAL void set_ssl_state(H3270 *session, LIB3270_SSL_STATE state); | |
262 | + | |
263 | + | |
264 | + #if OPENSSL_VERSION_NUMBER >= 0x00907000L /*[*/ | |
265 | + #define INFO_CONST const | |
266 | + #else /*][*/ | |
267 | + #define INFO_CONST | |
268 | + #endif /*]*/ | |
269 | + | |
270 | + LIB3270_INTERNAL void ssl_info_callback(INFO_CONST SSL *s, int where, int ret); | |
271 | + | |
272 | +#endif /*]*/ | |
273 | + | ... | ... |
src/lib3270/proxy.c
src/lib3270/resolver.c
src/lib3270/resources.c
src/lib3270/rpq.c
src/lib3270/screen.c
src/lib3270/see.c
src/lib3270/selection.c
src/lib3270/session.c
src/lib3270/sf.c
src/lib3270/ssl.c
src/lib3270/state.c
src/lib3270/telnet.c
src/lib3270/testprogram.c
1 | 1 | |
2 | 2 | #include <stdio.h> |
3 | 3 | #include <string.h> |
4 | +#include <stdlib.h> | |
4 | 5 | // #include <pthread.h> |
5 | 6 | |
6 | -#include "globals.h" | |
7 | +#include "private.h" | |
7 | 8 | #include <lib3270/macros.h> |
8 | 9 | |
9 | 10 | #define MAX_ARGS 10 |
... | ... | @@ -23,6 +24,7 @@ int main(int numpar, char *param[]) |
23 | 24 | { |
24 | 25 | H3270 * h; |
25 | 26 | int rc = 0; |
27 | + const char * url = getenv("LIB3270HOST"); | |
26 | 28 | // char line[4096]; |
27 | 29 | // pthread_t thread; |
28 | 30 | |
... | ... | @@ -36,7 +38,7 @@ int main(int numpar, char *param[]) |
36 | 38 | // pthread_create(&thread, NULL, mainloop, NULL); |
37 | 39 | // pthread_detach(thread); |
38 | 40 | |
39 | - lib3270_set_url(h,"tn3270://fandezhi.efglobe.com"); | |
41 | + lib3270_set_url(h,url ? url : "tn3270://fandezhi.efglobe.com"); | |
40 | 42 | rc = lib3270_connect(h,1); |
41 | 43 | |
42 | 44 | printf("\nConnect exits with rc=%d\n",rc); | ... | ... |
src/lib3270/toggles.c
src/lib3270/trace_ds.c
src/lib3270/utf8.c