Commit 3a06204104152c0a643b9ad16ea0e461fec7b830

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

Melhorando inicialização de scripts rexx

src/plugins/rx3270/pluginmain.cc
@@ -95,15 +95,14 @@ @@ -95,15 +95,14 @@
95 95
96 static void call_rexx_script(GtkAction *action, GtkWidget *widget, const gchar *filename) 96 static void call_rexx_script(GtkAction *action, GtkWidget *widget, const gchar *filename)
97 { 97 {
98 - const gchar * args = (const gchar *) g_object_get_data(G_OBJECT(action),"args"); 98 + const gchar * args = (const gchar *) g_object_get_data(G_OBJECT(action),"args");
99 99
100 - struct rexx_application_data appdata = { action, widget, filename }; 100 + struct rexx_application_data appdata = { action, widget, filename };
101 101
102 RexxInstance * instance; 102 RexxInstance * instance;
103 RexxThreadContext * threadContext; 103 RexxThreadContext * threadContext;
104 RexxOption options[25]; 104 RexxOption options[25];
105 RexxContextExit exits[2]; 105 RexxContextExit exits[2];
106 - RexxLibraryPackage package;  
107 106
108 memset(options,0,sizeof(options)); 107 memset(options,0,sizeof(options));
109 memset(exits,0,sizeof(exits)); 108 memset(exits,0,sizeof(exits));
@@ -122,11 +121,7 @@ @@ -122,11 +121,7 @@
122 // options[0].optionName = LOAD_REQUIRED_LIBRARY; 121 // options[0].optionName = LOAD_REQUIRED_LIBRARY;
123 // options[0].option = "rx3270"; 122 // options[0].option = "rx3270";
124 123
125 - package.registeredName = "rx3270";  
126 - package.table = &rx3270_package_entry;  
127 -  
128 - options[2].optionName = REGISTER_LIBRARY;  
129 - options[2].option = (void *) &package; 124 + rx3270_set_package_option(&options[2]);
130 125
131 options[3].optionName = EXTERNAL_CALL_PATH; 126 options[3].optionName = EXTERNAL_CALL_PATH;
132 options[3].option = pw3270_get_datadir(NULL); 127 options[3].option = pw3270_get_datadir(NULL);
src/plugins/rx3270/rx3270.h
@@ -124,8 +124,6 @@ @@ -124,8 +124,6 @@
124 124
125 /*---[ Globals ]---------------------------------------------------------------------------------------------*/ 125 /*---[ Globals ]---------------------------------------------------------------------------------------------*/
126 126
127 - LIB3270_EXPORT RexxPackageEntry rx3270_package_entry;  
128 -  
129 /*--[ 3270 Session ]-----------------------------------------------------------------------------------------*/ 127 /*--[ 3270 Session ]-----------------------------------------------------------------------------------------*/
130 128
131 #if defined (HAVE_GNUC_VISIBILITY) 129 #if defined (HAVE_GNUC_VISIBILITY)
@@ -212,4 +210,14 @@ @@ -212,4 +210,14 @@
212 210
213 rx3270 * create_lib3270_instance(void); 211 rx3270 * create_lib3270_instance(void);
214 212
  213 +#ifdef __cplusplus
  214 + extern "C" {
  215 +#endif
  216 +
  217 + LIB3270_EXPORT void rx3270_set_package_option(RexxOption *option);
  218 +
  219 +#ifdef __cplusplus
  220 + }
  221 +#endif
  222 +
215 #endif // RX3270_H_INCLUDED 223 #endif // RX3270_H_INCLUDED
src/plugins/rx3270/rxapimain.cc
@@ -183,6 +183,19 @@ OOREXX_GET_PACKAGE(rx3270); @@ -183,6 +183,19 @@ OOREXX_GET_PACKAGE(rx3270);
183 */ 183 */
184 184
185 BEGIN_EXTERN_C() 185 BEGIN_EXTERN_C()
  186 +
  187 +LIB3270_EXPORT void rx3270_set_package_option(RexxOption *option)
  188 +{
  189 + static const RexxLibraryPackage package = { "rx3270", &rx3270_package_entry };
  190 +
  191 +// package.registeredName = "rx3270";
  192 +// package.table = ;
  193 +
  194 + option->optionName = REGISTER_LIBRARY;
  195 + option->option = (void *) &package;
  196 +
  197 +}
  198 +
186 LIB3270_EXPORT RexxPackageEntry * RexxEntry RexxGetPackage(void) 199 LIB3270_EXPORT RexxPackageEntry * RexxEntry RexxGetPackage(void)
187 { 200 {
188 return &rx3270_package_entry; 201 return &rx3270_package_entry;