Commit 45207323450de74f8b75debfaaf3c420ee20f74b

Authored by perry.werneck@gmail.com
1 parent b573200e

Ajustes para evitar problemas na carga da classe sob windows

src/include/pw3270.h
... ... @@ -83,6 +83,8 @@
83 83 LIB3270_EXPORT gboolean pw3270_get_boolean(GtkWidget *widget, const gchar *group, const gchar *key, gboolean def);
84 84 LIB3270_EXPORT void pw3270_set_boolean(GtkWidget *widget, const gchar *group, const gchar *key, gint val);
85 85  
  86 + LIB3270_EXPORT gchar * pw3270_get_datadir(const gchar *first_element, ...);
  87 +
86 88 typedef enum pw3270_src
87 89 {
88 90 PW3270_SRC_ALL, /**< Screen contents */
... ...
src/plugins/rx3270/pluginmain.cc
... ... @@ -103,6 +103,7 @@
103 103 RexxThreadContext * threadContext;
104 104 RexxOption options[25];
105 105 RexxContextExit exits[2];
  106 + RexxLibraryPackage package;
106 107  
107 108 memset(options,0,sizeof(options));
108 109 memset(exits,0,sizeof(exits));
... ... @@ -110,12 +111,28 @@
110 111 exits[0].sysexit_code = RXSIO;
111 112 exits[0].handler = Rexx_IO_exit;
112 113  
  114 + // http://www.oorexx.org/docs/rexxpg/c2539.htm
  115 +
113 116 options[0].optionName = DIRECT_EXITS;
114 117 options[0].option = (void *) exits;
115 118  
116 119 options[1].optionName = APPLICATION_DATA;
117 120 options[1].option = (void *) &appdata;
118 121  
  122 +// options[0].optionName = LOAD_REQUIRED_LIBRARY;
  123 +// options[0].option = "rx3270";
  124 +
  125 + package.registeredName = "rx3270";
  126 + package.table = &rx3270_package_entry;
  127 +
  128 + options[2].optionName = REGISTER_LIBRARY;
  129 + options[2].option = (void *) &package;
  130 +
  131 + options[3].optionName = EXTERNAL_CALL_PATH;
  132 + options[3].option = pw3270_get_datadir(NULL);
  133 +
  134 + trace("Rexxdir: \"%s\"",(gchar *) ((void *) options[3].option));
  135 +
119 136 if(!RexxCreateInterpreter(&instance, &threadContext, options))
120 137 {
121 138 GtkWidget *dialog = gtk_message_dialog_new( GTK_WINDOW(gtk_widget_get_toplevel(widget)),
... ... @@ -198,6 +215,8 @@
198 215 trace("%s ends",__FUNCTION__);
199 216 }
200 217  
  218 + g_free(options[3].option);
  219 +
201 220 }
202 221  
203 222  
... ...
src/plugins/rx3270/rx3270.cls
... ... @@ -27,6 +27,8 @@
27 27 /* */
28 28 /*-------------------------------------------------------------------------------*/
29 29  
  30 +::requires "rx3270" LIBRARY
  31 +
30 32 /*-------------------------------------------------------------------------------*/
31 33 /* 3270 class */
32 34 /*-------------------------------------------------------------------------------*/
... ...
src/plugins/rx3270/rx3270.h
... ... @@ -124,6 +124,8 @@
124 124  
125 125 /*---[ Globals ]---------------------------------------------------------------------------------------------*/
126 126  
  127 + LIB3270_EXPORT RexxPackageEntry rx3270_package_entry;
  128 +
127 129 /*--[ 3270 Session ]-----------------------------------------------------------------------------------------*/
128 130  
129 131 #if defined (HAVE_GNUC_VISIBILITY)
... ...
src/plugins/rx3270/rxapimain.cc
... ... @@ -83,11 +83,13 @@ BOOL WINAPI DllMain(HANDLE hinst, DWORD dwcallpurpose, LPVOID lpvResvd)
83 83  
84 84 int librx3270_loaded(void)
85 85 {
  86 + trace("%s",__FUNCTION__);
86 87 return 0;
87 88 }
88 89  
89 90 int librx3270_unloaded(void)
90 91 {
  92 + trace("%s",__FUNCTION__);
91 93 return 0;
92 94 }
93 95  
... ... @@ -167,7 +169,7 @@ RexxPackageEntry rx3270_package_entry =
167 169 {
168 170 STANDARD_PACKAGE_HEADER
169 171 REXX_CURRENT_INTERPRETER_VERSION, // anything after 4.0.0 will work
170   - "pw3270", // name of the package
  172 + "rx3270", // name of the package
171 173 PACKAGE_VERSION, // package information
172 174 NULL, // no load/unload functions
173 175 NULL,
... ...
src/pw3270/tools.c
... ... @@ -185,3 +185,14 @@ LIB3270_EXPORT gchar * pw3270_get_filename(GtkWidget *widget, const gchar *group
185 185  
186 186 return filename;
187 187 }
  188 +
  189 +LIB3270_EXPORT gchar * pw3270_get_datadir(const gchar *first_element, ...)
  190 +{
  191 + va_list args;
  192 + gchar *path;
  193 +
  194 + va_start(args, first_element);
  195 + path = filename_from_va(first_element,args);
  196 + va_end(args);
  197 + return path;
  198 +}
... ...