Commit b11cde6a74900bcffcbc3080a3687119178b2855
1 parent
8a5290e7
Exists in
master
and in
5 other branches
Tentando implementar api rexx
Showing
5 changed files
with
67 additions
and
96 deletions
Show diff stats
src/include/plugin.mak.in
... | ... | @@ -44,6 +44,7 @@ OBJEXT = o |
44 | 44 | |
45 | 45 | MKDIR=@MKDIR_P@ |
46 | 46 | CC=@CC@ |
47 | +CXX=@CXX@ | |
47 | 48 | LD=@CC@ |
48 | 49 | MSGCAT=@MSGCAT@ |
49 | 50 | XGETTEXT=@XGETTEXT@ |
... | ... | @@ -86,11 +87,20 @@ $(OBJDBG)/%.o: %.c $(DEPENDS) |
86 | 87 | @$(MKDIR) `dirname $@` |
87 | 88 | @$(CC) $(DLL_CFLAGS) $(CFLAGS) $(DEBUG_CFLAGS) $(PW3270_CFLAGS) $(GTK_CFLAGS) -o $@ -c $< |
88 | 89 | |
90 | +$(OBJDBG)/%.o: %.cc $(DEPENDS) | |
91 | + @echo " CC `basename $@`" | |
92 | + @$(MKDIR) `dirname $@` | |
93 | + @$(CXX) $(DLL_CFLAGS) $(CFLAGS) $(DEBUG_CFLAGS) $(PW3270_CFLAGS) $(GTK_CFLAGS) -o $@ -c $< | |
94 | + | |
89 | 95 | $(OBJRLS)/%.o: %.c $(DEPENDS) |
90 | 96 | @echo " CC `basename $@`" |
91 | 97 | @$(MKDIR) `dirname $@` |
92 | 98 | @$(CC) $(DLL_CFLAGS) $(CFLAGS) $(PW3270_CFLAGS) $(GTK_CFLAGS) -o $@ -c $< |
93 | 99 | |
100 | +$(OBJRLS)/%.o: %.cc $(DEPENDS) | |
101 | + @echo " CC `basename $@`" | |
102 | + @$(MKDIR) `dirname $@` | |
103 | + @$(CXX) $(DLL_CFLAGS) $(CFLAGS) $(PW3270_CFLAGS) $(GTK_CFLAGS) -o $@ -c $< | |
94 | 104 | |
95 | 105 | #---[ Targets ]---------------------------------------------------------------- |
96 | 106 | ... | ... |
src/include/pw3270/plugin.h
... | ... | @@ -36,11 +36,19 @@ |
36 | 36 | #include <gtk/gtk.h> |
37 | 37 | #include <lib3270.h> |
38 | 38 | |
39 | +#ifdef __cplusplus | |
40 | + extern "C" { | |
41 | +#endif | |
42 | + | |
39 | 43 | LIB3270_EXPORT int pw3270_plugin_init(GtkWidget *window); |
40 | 44 | LIB3270_EXPORT int pw3270_plugin_deinit(GtkWidget *window); |
41 | 45 | |
42 | 46 | LIB3270_EXPORT void pw3270_plugin_start(GtkWidget *window); |
43 | 47 | LIB3270_EXPORT void pw3270_plugin_stop(GtkWidget *window); |
44 | 48 | |
49 | +#ifdef __cplusplus | |
50 | + } | |
51 | +#endif | |
52 | + | |
45 | 53 | #endif // PW3270_PLUGIN_INCLUDED |
46 | 54 | ... | ... |
src/plugins/rx3270/pluginmain.c
... | ... | @@ -1,43 +0,0 @@ |
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 pluginmain.c 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 | - * | |
28 | - */ | |
29 | - | |
30 | - #include <pw3270.h> | |
31 | - #include <pw3270/plugin.h> | |
32 | - | |
33 | - #include "rx3270.h" | |
34 | - | |
35 | -/*--[ Implement ]------------------------------------------------------------------------------------*/ | |
36 | - | |
37 | - LIB3270_EXPORT int pw3270_plugin_init(GtkWidget *window) | |
38 | - { | |
39 | - trace("%s called for window %p",__FUNCTION__,window); | |
40 | - | |
41 | - return 0; | |
42 | - } | |
43 | - |
src/plugins/rx3270/rx3270.h
... | ... | @@ -32,6 +32,7 @@ |
32 | 32 | #define RX3270_H_INCLUDED 1 |
33 | 33 | |
34 | 34 | #include <errno.h> |
35 | + #include <stdio.h> | |
35 | 36 | #include <lib3270/config.h> |
36 | 37 | #include <lib3270.h> |
37 | 38 | #include <lib3270/log.h> |
... | ... | @@ -45,4 +46,10 @@ |
45 | 46 | /*---[ Globals ]---------------------------------------------------------------------------------------------*/ |
46 | 47 | |
47 | 48 | |
49 | +/*--[ Prototipes ]-------------------------------------------------------------------------------------------*/ | |
50 | + | |
51 | + LIB3270_EXPORT REXX_TYPED_ROUTINE_PROTOTYPE(rx3270version); | |
52 | + | |
53 | + | |
54 | + | |
48 | 55 | #endif // RX3270_H_INCLUDED | ... | ... |
src/plugins/rx3270/rxapimain.c
... | ... | @@ -28,66 +28,32 @@ |
28 | 28 | */ |
29 | 29 | |
30 | 30 | /* |
31 | + * | |
31 | 32 | * Reference: |
32 | 33 | * |
33 | 34 | * http://www.oorexx.org/docs/rexxpg/x2950.htm |
34 | 35 | * |
35 | 36 | */ |
36 | 37 | |
37 | - #include <pw3270.h> | |
38 | - #include <pw3270/plugin.h> | |
39 | - #include <oorexxapi.h> | |
40 | - | |
41 | 38 | #include "rx3270.h" |
42 | 39 | |
43 | -// create function declarations for the linker | |
44 | -REXX_TYPED_ROUTINE_PROTOTYPE(rx3270LoadFuncs); | |
45 | -REXX_TYPED_ROUTINE_PROTOTYPE(rx3270DropFuncs); | |
46 | -REXX_TYPED_ROUTINE_PROTOTYPE(rx3270Version); | |
47 | - | |
48 | -/*--[ Globals ]--------------------------------------------------------------------------------------*/ | |
49 | - | |
50 | 40 | #if defined WIN32 |
51 | - BOOL WINAPI DllMain(HANDLE hinst, DWORD dwcallpurpose, LPVOID lpvResvd); | |
52 | - static int librx3270_loaded(void); | |
53 | - static int librx3270_unloaded(void); | |
41 | + BOOL WINAPI DllMain(HANDLE hinst, DWORD dwcallpurpose, LPVOID lpvResvd); | |
42 | + static int librx3270_loaded(void); | |
43 | + static int librx3270_unloaded(void); | |
54 | 44 | #else |
55 | - int librx3270_loaded(void) __attribute__((constructor)); | |
56 | - int librx3270_unloaded(void) __attribute__((destructor)); | |
45 | + int librx3270_loaded(void) __attribute__((constructor)); | |
46 | + int librx3270_unloaded(void) __attribute__((destructor)); | |
57 | 47 | #endif |
58 | - | |
59 | -/*--[ Rexx Package description ]---------------------------------------------------------------------*/ | |
60 | - | |
61 | - | |
62 | -// now build the actual entry list | |
63 | -RexxRoutineEntry rx3270_functions[] = | |
64 | -{ | |
65 | - REXX_TYPED_ROUTINE(rx3270Version, rx3270Version), | |
66 | - REXX_LAST_ROUTINE() | |
67 | -}; | |
68 | - | |
69 | -RexxPackageEntry rx3270_package_entry = | |
70 | -{ | |
71 | - STANDARD_PACKAGE_HEADER | |
72 | - REXX_INTERPRETER_4_0_0, /**> anything after 4.0.0 will work */ | |
73 | - "RX3270", /**> name of the package */ | |
74 | - PACKAGE_VERSION, /**> package information */ | |
75 | - NULL, /**> no load/unload functions */ | |
76 | - NULL, /**> no load/unload functions */ | |
77 | - rx3270_functions, /**> the exported functions */ | |
78 | - NULL /**> no methods in rx3270. */ | |
79 | -}; | |
80 | - | |
81 | -// package loading stub. | |
82 | -OOREXX_GET_PACKAGE(rx3270); | |
83 | - | |
84 | 48 | /*--[ Implement ]------------------------------------------------------------------------------------*/ |
85 | 49 | |
86 | 50 | #if defined WIN32 |
87 | 51 | BOOL WINAPI DllMain(HANDLE hinst, DWORD dwcallpurpose, LPVOID lpvResvd) |
88 | 52 | { |
89 | - switch(dwcallpurpose) | |
90 | - { | |
53 | +// Trace("%s - Library %s",__FUNCTION__,(dwcallpurpose == DLL_PROCESS_ATTACH) ? "Loaded" : "Unloaded"); | |
54 | + | |
55 | + switch(dwcallpurpose) | |
56 | + { | |
91 | 57 | case DLL_PROCESS_ATTACH: |
92 | 58 | librx3270_loaded(); |
93 | 59 | break; |
... | ... | @@ -95,26 +61,49 @@ BOOL WINAPI DllMain(HANDLE hinst, DWORD dwcallpurpose, LPVOID lpvResvd) |
95 | 61 | case DLL_PROCESS_DETACH: |
96 | 62 | librx3270_unloaded(); |
97 | 63 | break; |
98 | - } | |
99 | - | |
100 | - return TRUE; | |
64 | + } | |
65 | + return TRUE; | |
101 | 66 | } |
102 | -#endif // WIN32 | |
67 | +#endif | |
103 | 68 | |
104 | 69 | int librx3270_loaded(void) |
105 | 70 | { |
106 | - trace("%s %s %s",__FUNCTION__,__DATE__,__TIME__); | |
107 | - return 0; | |
71 | + trace("%s",__FUNCTION__); | |
72 | + return 0; | |
108 | 73 | } |
109 | 74 | |
110 | 75 | int librx3270_unloaded(void) |
111 | 76 | { |
112 | 77 | trace("%s",__FUNCTION__); |
113 | - return 0; | |
78 | + return 0; | |
114 | 79 | } |
115 | 80 | |
116 | -RexxRoutine0(CSTRING, rx3270Version) | |
81 | +RexxRoutine0(CSTRING, rx3270version) | |
117 | 82 | { |
118 | - return "teste"; // lib3270_get_version(); | |
83 | + return "Teste"; | |
119 | 84 | } |
120 | 85 | |
86 | + | |
87 | +// now build the actual entry list | |
88 | +RexxRoutineEntry rx3270_functions[] = | |
89 | +{ | |
90 | + REXX_TYPED_ROUTINE(rx3270version, rx3270version), | |
91 | + REXX_LAST_METHOD() | |
92 | +}; | |
93 | + | |
94 | +RexxPackageEntry rxmath_package_entry = | |
95 | +{ | |
96 | + STANDARD_PACKAGE_HEADER | |
97 | + REXX_INTERPRETER_4_0_0, // anything after 4.0.0 will work | |
98 | + "RX3270", // name of the package | |
99 | + "5.0", // package information | |
100 | + NULL, // no load/unload functions | |
101 | + NULL, | |
102 | + rx3270_functions, // the exported functions | |
103 | + NULL // no methods in rxmath. | |
104 | +}; | |
105 | + | |
106 | +// package loading stub. | |
107 | +OOREXX_GET_PACKAGE(rx3270); | |
108 | + | |
109 | + | ... | ... |