Commit 4a5ece144763aadc4f76bb15483b1f1da94738cf

Authored by perry.werneck@gmail.com
1 parent 44b6f5fb

Iniciando "encaixe" dos modulos da versao 5

@@ -48,7 +48,7 @@ sysconfdir=@sysconfdir@ @@ -48,7 +48,7 @@ sysconfdir=@sysconfdir@
48 OBJDIR=.obj 48 OBJDIR=.obj
49 BINDIR=.bin 49 BINDIR=.bin
50 50
51 -DEPENDS=src/include/lib3270/* src/include/* Makefile 51 +DBGLIB=-L../../$(BINDIR)/Debug/lib -l3270
52 52
53 #---[ Tools ]------------------------------------------------------------------ 53 #---[ Tools ]------------------------------------------------------------------
54 54
@@ -59,11 +59,11 @@ MKDIR=@MKDIR_P@ @@ -59,11 +59,11 @@ MKDIR=@MKDIR_P@
59 59
60 Debug: $(BINDIR)/Debug/$(PACKAGE_TARNAME)$(EXEEXT) 60 Debug: $(BINDIR)/Debug/$(PACKAGE_TARNAME)$(EXEEXT)
61 61
62 -$(BINDIR)/Debug/$(PACKAGE_TARNAME)$(EXEEXT): src/gtk/* $(DEPENDS) $(BINDIR)/Debug/lib/@DLLPREFIX@3270@DLLEXT@  
63 - @$(MAKE) ROOTDIR="../.." -C src/gtk ../../$(BINDIR)/Debug/$(PACKAGE_TARNAME)$(EXEEXT) 62 +$(BINDIR)/Debug/$(PACKAGE_TARNAME)$(EXEEXT): src/gtk/* $(BINDIR)/Debug/lib/@DLLPREFIX@3270@DLLEXT@ $(DEPENDS)
  63 + @$(MAKE) ROOTDIR="../.." LIB3270_LIBS="$(DBGLIB)" LIB3270_CFLAGS="-I../../src/include" -C src/gtk ../../$(BINDIR)/Debug/$(PACKAGE_TARNAME)$(EXEEXT)
64 64
65 -$(BINDIR)/Debug/lib/@DLLPREFIX@3270@DLLEXT@: src/lib3270/* $(DEPENDS)  
66 - @echo $(MAKE) ROOTDIR="../.." BINDBG=../../.bin/Debug/lib -C src/lib3270 ../../.bin/Debug/lib/@DLLPREFIX@3270@DLLEXT@ 65 +$(BINDIR)/Debug/lib/@DLLPREFIX@3270@DLLEXT@: src/lib3270/* src/include/lib3270/* src/include/* Makefile
  66 + @$(MAKE) ROOTDIR="../.." BINDBG=../../.bin/Debug/lib -C src/lib3270 ../../.bin/Debug/lib/@DLLPREFIX@3270@DLLEXT@
67 67
68 #---[ Targets ]---------------------------------------------------------------- 68 #---[ Targets ]----------------------------------------------------------------
69 69
src/gtk/Makefile.in
@@ -71,7 +71,7 @@ $(BINDIR)/Debug/$(PACKAGE_TARNAME)$(EXEEXT): $(foreach SRC, $(basename $(SOURCES @@ -71,7 +71,7 @@ $(BINDIR)/Debug/$(PACKAGE_TARNAME)$(EXEEXT): $(foreach SRC, $(basename $(SOURCES
71 71
72 @echo $@ ... 72 @echo $@ ...
73 @$(MKDIR) `dirname $@` 73 @$(MKDIR) `dirname $@`
74 - @$(LD) -Wl,--rpath,.bin/Debug -o $@ $^ $(LIBS) $(LIB3270_LIBS) 74 + @$(LD) -Wl,--rpath,.bin/Debug/lib -o $@ $^ $(LIBS) $(LIB3270_LIBS)
75 75
76 run: $(BINDIR)/Debug/$(PACKAGE_TARNAME)$(EXEEXT) 76 run: $(BINDIR)/Debug/$(PACKAGE_TARNAME)$(EXEEXT)
77 @cd "$(ROOTDIR)" ; .bin/Debug/$(PACKAGE_TARNAME)$(EXEEXT) 77 @cd "$(ROOTDIR)" ; .bin/Debug/$(PACKAGE_TARNAME)$(EXEEXT)
src/gtk/actions.c
@@ -31,6 +31,7 @@ @@ -31,6 +31,7 @@
31 31
32 #include "globals.h" 32 #include "globals.h"
33 #include "uiparser/parser.h" 33 #include "uiparser/parser.h"
  34 + #include <lib3270/actions.h>
34 35
35 /*--[ Implement ]------------------------------------------------------------------------------------*/ 36 /*--[ Implement ]------------------------------------------------------------------------------------*/
36 37
src/gtk/v3270/draw.c
@@ -28,6 +28,8 @@ @@ -28,6 +28,8 @@
28 */ 28 */
29 29
30 #include <gtk/gtk.h> 30 #include <gtk/gtk.h>
  31 + #include <lib3270.h>
  32 + #include <lib3270/session.h>
31 #include "v3270.h" 33 #include "v3270.h"
32 #include "private.h" 34 #include "private.h"
33 35
src/gtk/v3270/keyboard.c
@@ -31,6 +31,8 @@ @@ -31,6 +31,8 @@
31 */ 31 */
32 32
33 #include <pw3270.h> 33 #include <pw3270.h>
  34 + #include <lib3270.h>
  35 + #include <lib3270/actions.h>
34 #include <gtk/gtk.h> 36 #include <gtk/gtk.h>
35 #include <string.h> 37 #include <string.h>
36 #include <gdk/gdk.h> 38 #include <gdk/gdk.h>
src/gtk/v3270/oia.c
@@ -28,6 +28,8 @@ @@ -28,6 +28,8 @@
28 */ 28 */
29 29
30 #include <pw3270.h> 30 #include <pw3270.h>
  31 + #include <lib3270.h>
  32 + #include <lib3270/session.h>
31 #include <lib3270/config.h> 33 #include <lib3270/config.h>
32 #include <gtk/gtk.h> 34 #include <gtk/gtk.h>
33 #include <string.h> 35 #include <string.h>
@@ -914,7 +916,7 @@ void v3270_stop_timer(GtkWidget *widget) @@ -914,7 +916,7 @@ void v3270_stop_timer(GtkWidget *widget)
914 916
915 } 917 }
916 918
917 -void v3270_update_oia(H3270 *session, OIA_FLAG id, unsigned char on) 919 +void v3270_update_oia(H3270 *session, LIB3270_FLAG id, unsigned char on)
918 { 920 {
919 cairo_t *cr; 921 cairo_t *cr;
920 GdkRectangle *r; 922 GdkRectangle *r;
src/gtk/v3270/private.h
@@ -115,7 +115,7 @@ void v3270_update_cursor_rect(v3270 *widget, GdkRectangle *rect, unsigned cha @@ -115,7 +115,7 @@ void v3270_update_cursor_rect(v3270 *widget, GdkRectangle *rect, unsigned cha
115 void v3270_update_luname(GtkWidget *widget,const gchar *name); 115 void v3270_update_luname(GtkWidget *widget,const gchar *name);
116 void v3270_update_message(v3270 *widget, LIB3270_MESSAGE id); 116 void v3270_update_message(v3270 *widget, LIB3270_MESSAGE id);
117 void v3270_update_cursor(H3270 *session, unsigned short row, unsigned short col, unsigned char c, unsigned short attr); 117 void v3270_update_cursor(H3270 *session, unsigned short row, unsigned short col, unsigned char c, unsigned short attr);
118 -void v3270_update_oia(H3270 *session, OIA_FLAG id, unsigned char on); 118 +void v3270_update_oia(H3270 *session, LIB3270_FLAG id, unsigned char on);
119 119
120 // Keyboard & Mouse 120 // Keyboard & Mouse
121 gboolean v3270_key_press_event(GtkWidget *widget, GdkEventKey *event); 121 gboolean v3270_key_press_event(GtkWidget *widget, GdkEventKey *event);
src/gtk/v3270/widget.c
@@ -29,6 +29,8 @@ @@ -29,6 +29,8 @@
29 29
30 #include <gtk/gtk.h> 30 #include <gtk/gtk.h>
31 #include <pw3270.h> 31 #include <pw3270.h>
  32 + #include <lib3270.h>
  33 + #include <lib3270/session.h>
32 #include "v3270.h" 34 #include "v3270.h"
33 #include "private.h" 35 #include "private.h"
34 #include "marshal.h" 36 #include "marshal.h"
src/include/lib3270.h
@@ -564,6 +564,18 @@ @@ -564,6 +564,18 @@
564 */ 564 */
565 LIB3270_EXPORT int lib3270_call_thread(int(*callback)(H3270 *h, void *), H3270 *h, void *parm); 565 LIB3270_EXPORT int lib3270_call_thread(int(*callback)(H3270 *h, void *), H3270 *h, void *parm);
566 566
  567 + /**
  568 + * Get the session's widget.
  569 + *
  570 + * Get the handle to the GtkWidget who's handling this session.
  571 + *
  572 + * @param h Session handle
  573 + *
  574 + * @return Associated GtkWidget (can be null)
  575 + *
  576 + */
  577 + LIB3270_EXPORT void * lib3270_get_widget(H3270 *h);
  578 +
567 #ifdef __cplusplus 579 #ifdef __cplusplus
568 } 580 }
569 #endif 581 #endif
src/include/lib3270/session.h 0 → 100644
@@ -0,0 +1,134 @@ @@ -0,0 +1,134 @@
  1 +/*
  2 + * "Software pw3270, 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., 59 Temple
  19 + * Place, Suite 330, Boston, MA, 02111-1307, USA
  20 + *
  21 + * Este programa está nomeado como session.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 Mendonça)
  27 + * licinio@bb.com.br (Licínio Luis Branco)
  28 + * kraucer@bb.com.br (Kraucer Fernandes Mazuco)
  29 + *
  30 + */
  31 +
  32 + #ifndef LIB3270_SESSION_H_INCLUDED
  33 +
  34 + #define LIB3270_SESSION_H_INCLUDED 1
  35 +
  36 + #define LIB3270_LUNAME_LENGTH 16
  37 + #define LIB3270_FULL_MODEL_NAME_LENGTH 13
  38 +
  39 + struct _h3270
  40 + {
  41 + unsigned short sz; /**< Struct size */
  42 +
  43 + // Connection info
  44 + int secure_connection;
  45 + int sock; /**< Network socket */
  46 + int net_sock;
  47 + LIB3270_CSTATE cstate; /**< Connection state */
  48 +
  49 + #if defined(_WIN32) /*[*/
  50 + HANDLE sock_handle;
  51 + #endif /*]*/
  52 +
  53 + char * hostname;
  54 + char * connected_type;
  55 + char * connected_lu;
  56 + char luname[LIB3270_LUNAME_LENGTH+1];
  57 +
  58 + char full_model_name[LIB3270_FULL_MODEL_NAME_LENGTH+1];
  59 + char * model_name;
  60 + int model_num;
  61 + char * termtype;
  62 +
  63 + char * current_host; /**< the hostname part, stripped of qualifiers, luname and port number */
  64 + char * full_current_host; /**< the entire string, for use in reconnecting */
  65 + char * reconnect_host;
  66 + char * qualified_host;
  67 + char auto_reconnect_inprogress;
  68 +
  69 + LIB3270_MESSAGE oia_status;
  70 +
  71 + unsigned char oia_flag[LIB3270_FLAG_COUNT];
  72 +
  73 + unsigned short current_port;
  74 +
  75 + // screen info
  76 + int ov_rows;
  77 + int ov_cols;
  78 +// int first_changed;
  79 +// int last_changed;
  80 + int maxROWS;
  81 + int maxCOLS;
  82 + unsigned short rows;
  83 + unsigned short cols;
  84 + int cursor_addr;
  85 + char flipped;
  86 + int screen_alt; /**< alternate screen? */
  87 + int is_altbuffer;
  88 +
  89 + int formatted; /**< set in screen_disp */
  90 +
  91 + // host.c
  92 + char std_ds_host;
  93 + char no_login_host;
  94 + char non_tn3270e_host;
  95 + char passthru_host;
  96 + char ssl_host;
  97 + char ever_3270;
  98 +
  99 + // Widget info
  100 + void * widget;
  101 +
  102 + // xio
  103 + unsigned long ns_read_id;
  104 + unsigned long ns_exception_id;
  105 + char reading;
  106 + char excepting;
  107 +
  108 + /* State change callbacks. */
  109 + struct lib3270_state_callback *st_callbacks[LIB3270_STATE_USER];
  110 + struct lib3270_state_callback *st_last[LIB3270_STATE_USER];
  111 +
  112 + /* Session based callbacks */
  113 + void (*configure)(H3270 *session, unsigned short rows, unsigned short cols);
  114 + void (*update)(H3270 *session, int baddr, unsigned char c, unsigned short attr, unsigned char cursor);
  115 + void (*changed)(H3270 *session, int bstart, int bend);
  116 +
  117 + void (*update_cursor)(H3270 *session, unsigned short row, unsigned short col, unsigned char c, unsigned short attr);
  118 + void (*update_oia)(H3270 *session, LIB3270_FLAG id, unsigned char on);
  119 + void (*update_toggle)(H3270 *session, LIB3270_TOGGLE ix, unsigned char value, LIB3270_TOGGLE_TYPE reason, const char *name);
  120 + void (*update_luname)(H3270 *session, const char *name);
  121 + void (*update_status)(H3270 *session, LIB3270_MESSAGE id);
  122 + void (*update_connect)(H3270 *session, unsigned char connected);
  123 + void (*update_model)(H3270 *session, const char *name, int model, int rows, int cols);
  124 +
  125 + void (*set_timer)(H3270 *session, unsigned char on);
  126 + void (*erase)(H3270 *session);
  127 + void (*cursor)(H3270 *session, LIB3270_CURSOR id);
  128 +
  129 + };
  130 +
  131 +
  132 +#endif // LIB3270_SESSION_H_INCLUDED
  133 +
  134 +
src/lib3270/XtGlue.c
@@ -946,6 +946,12 @@ LIB3270_EXPORT int lib3270_in_e(H3270 *h) @@ -946,6 +946,12 @@ LIB3270_EXPORT int lib3270_in_e(H3270 *h)
946 return (h->cstate >= CONNECTED_INITIAL_E); 946 return (h->cstate >= CONNECTED_INITIAL_E);
947 } 947 }
948 948
  949 +LIB3270_EXPORT void * lib3270_get_widget(H3270 *h)
  950 +{
  951 + CHECK_SESSION_HANDLE(h);
  952 + return h->widget;
  953 +}
  954 +
949 LIB3270_EXPORT int lib3270_call_thread(int(*callback)(H3270 *h, void *), H3270 *h, void *parm) 955 LIB3270_EXPORT int lib3270_call_thread(int(*callback)(H3270 *h, void *), H3270 *h, void *parm)
950 { 956 {
951 int rc; 957 int rc;
src/lib3270/api.h
@@ -109,8 +109,8 @@ @@ -109,8 +109,8 @@
109 #endif 109 #endif
110 110
111 /** 3270 connection handle */ 111 /** 3270 connection handle */
112 - #define LUNAME_SIZE 16  
113 - #define FULL_MODEL_NAME_SIZE 13 112 +// #define LUNAME_SIZE 16
  113 +// #define FULL_MODEL_NAME_SIZE 13
114 114
115 #define ST_RESOLVING LIB3270_STATE_RESOLVING 115 #define ST_RESOLVING LIB3270_STATE_RESOLVING
116 #define ST_HALF_CONNECT LIB3270_STATE_HALF_CONNECT 116 #define ST_HALF_CONNECT LIB3270_STATE_HALF_CONNECT
@@ -168,97 +168,7 @@ @@ -168,97 +168,7 @@
168 168
169 typedef struct _h3270 H3270; 169 typedef struct _h3270 H3270;
170 170
171 - struct _h3270  
172 - {  
173 - unsigned short sz; /**< Struct size */  
174 -  
175 - // Connection info  
176 - int secure_connection;  
177 - int sock; /**< Network socket */  
178 - int net_sock;  
179 - LIB3270_CSTATE cstate; /**< Connection state */  
180 -  
181 - #if defined(_WIN32) /*[*/  
182 - HANDLE sock_handle;  
183 - #endif /*]*/  
184 -  
185 - char * hostname;  
186 - char * connected_type;  
187 - char * connected_lu;  
188 - char luname[LUNAME_SIZE+1];  
189 -  
190 - char full_model_name[FULL_MODEL_NAME_SIZE+1];  
191 - char * model_name;  
192 - int model_num;  
193 - char * termtype;  
194 -  
195 - char * current_host; /**< the hostname part, stripped of qualifiers, luname and port number */  
196 - char * full_current_host; /**< the entire string, for use in reconnecting */  
197 - char * reconnect_host;  
198 - char * qualified_host;  
199 - char auto_reconnect_inprogress;  
200 -  
201 - LIB3270_MESSAGE oia_status;  
202 -  
203 - unsigned char oia_flag[LIB3270_FLAG_COUNT];  
204 -  
205 - unsigned short current_port;  
206 -  
207 - // screen info  
208 - int ov_rows;  
209 - int ov_cols;  
210 -// int first_changed;  
211 -// int last_changed;  
212 - int maxROWS;  
213 - int maxCOLS;  
214 - unsigned short rows;  
215 - unsigned short cols;  
216 - int cursor_addr;  
217 - char flipped;  
218 - int screen_alt; /**< alternate screen? */  
219 - int is_altbuffer;  
220 -  
221 - int formatted; /**< set in screen_disp */  
222 -  
223 - // host.c  
224 - char std_ds_host;  
225 - char no_login_host;  
226 - char non_tn3270e_host;  
227 - char passthru_host;  
228 - char ssl_host;  
229 - char ever_3270;  
230 -  
231 - // Widget info  
232 - void * widget;  
233 -  
234 - // xio  
235 - unsigned long ns_read_id;  
236 - unsigned long ns_exception_id;  
237 - char reading;  
238 - char excepting;  
239 -  
240 - /* State change callbacks. */  
241 - struct lib3270_state_callback *st_callbacks[N_ST];  
242 - struct lib3270_state_callback *st_last[N_ST];  
243 -  
244 - /* Session based callbacks */  
245 - void (*configure)(H3270 *session, unsigned short rows, unsigned short cols);  
246 - void (*update)(H3270 *session, int baddr, unsigned char c, unsigned short attr, unsigned char cursor);  
247 - void (*changed)(H3270 *session, int bstart, int bend);  
248 -  
249 - void (*update_cursor)(H3270 *session, unsigned short row, unsigned short col, unsigned char c, unsigned short attr);  
250 - void (*update_oia)(H3270 *session, OIA_FLAG id, unsigned char on);  
251 - void (*update_toggle)(H3270 *session, LIB3270_TOGGLE ix, unsigned char value, LIB3270_TOGGLE_TYPE reason, const char *name);  
252 - void (*update_luname)(H3270 *session, const char *name);  
253 - void (*update_status)(H3270 *session, LIB3270_STATUS id);  
254 - void (*update_connect)(H3270 *session, unsigned char connected);  
255 - void (*update_model)(H3270 *session, const char *name, int model, int rows, int cols);  
256 -  
257 - void (*set_timer)(H3270 *session, unsigned char on);  
258 - void (*erase)(H3270 *session);  
259 - void (*cursor)(H3270 *session, LIB3270_CURSOR id);  
260 -  
261 - }; 171 + #include <lib3270/session.h>
262 172
263 struct lib3270_state_callback 173 struct lib3270_state_callback
264 { 174 {
src/lib3270/glue.c
@@ -181,7 +181,7 @@ static void lib3270_session_init(H3270 *hSession, const char *model) @@ -181,7 +181,7 @@ static void lib3270_session_init(H3270 *hSession, const char *model)
181 hSession->cstate = NOT_CONNECTED; 181 hSession->cstate = NOT_CONNECTED;
182 hSession->oia_status = -1; 182 hSession->oia_status = -1;
183 183
184 - strncpy(hSession->full_model_name,"IBM-",FULL_MODEL_NAME_SIZE); 184 + strncpy(hSession->full_model_name,"IBM-",LIB3270_FULL_MODEL_NAME_LENGTH);
185 hSession->model_name = &hSession->full_model_name[4]; 185 hSession->model_name = &hSession->full_model_name[4];
186 186
187 /* 187 /*
src/lib3270/host.c
@@ -339,7 +339,7 @@ split_host(char *s, char *ansi, char *std_ds, char *passthru, @@ -339,7 +339,7 @@ split_host(char *s, char *ansi, char *std_ds, char *passthru,
339 } 339 }
340 break; 340 break;
341 } 341 }
342 - if (t - s < LUNAME_SIZE) { 342 + if (t - s < LIB3270_LUNAME_LENGTH) {
343 xluname[t - s] = *t; 343 xluname[t - s] = *t;
344 } 344 }
345 } 345 }