Commit c718423ca3fe2f540580634f07db4c9ae8343204

Authored by Perry Werneck
1 parent fbaa8470
Exists in master

Implementando plugin e extensão java como projeto separado.

src/plugin/Makefile.in
@@ -39,6 +39,8 @@ bindir=@bindir@ @@ -39,6 +39,8 @@ bindir=@bindir@
39 sbindir=@sbindir@ 39 sbindir=@sbindir@
40 libdir=@libdir@ 40 libdir=@libdir@
41 datarootdir=@datarootdir@ 41 datarootdir=@datarootdir@
  42 +jardir=@jvmjardir@
  43 +jnidir=@jnidir@
42 44
43 BASEDIR=@BASEDIR@ 45 BASEDIR=@BASEDIR@
44 SRCDIR=$(BASEDIR)/.src/$(PACKAGE_TARNAME)-$(PACKAGE_VERSION) 46 SRCDIR=$(BASEDIR)/.src/$(PACKAGE_TARNAME)-$(PACKAGE_VERSION)
@@ -68,7 +70,11 @@ CC=@CC@ @@ -68,7 +70,11 @@ CC=@CC@
68 LD=@CXX@ 70 LD=@CXX@
69 71
70 LIBS=-lpw3270cpp @LIBS@ @GTK_LIBS@ 72 LIBS=-lpw3270cpp @LIBS@ @GTK_LIBS@
71 -CXXFLAGS=@CXXFLAGS@ @GTK_CFLAGS@ -I../include 73 +CXXFLAGS=@CXXFLAGS@ @GTK_CFLAGS@ \
  74 + -I../include \
  75 + -DJARDIR="\"${jardir}\"" \
  76 + -DJNIDIR="\"${jnidir}\""
  77 +
72 LDFLAGS=@LDFLAGS@ 78 LDFLAGS=@LDFLAGS@
73 79
74 #---[ Rules ]---------------------------------------------------------------------------- 80 #---[ Rules ]----------------------------------------------------------------------------
src/plugin/call.cc
@@ -34,7 +34,7 @@ @@ -34,7 +34,7 @@
34 #include <lib3270/log.h> 34 #include <lib3270/log.h>
35 #include <pw3270/v3270.h> 35 #include <pw3270/v3270.h>
36 36
37 - using j3270::exception; 37 + using PW3270_NAMESPACE::exception;
38 38
39 /*---[ Implement ]----------------------------------------------------------------------------------*/ 39 /*---[ Implement ]----------------------------------------------------------------------------------*/
40 40
src/plugin/plugin.cc
@@ -72,35 +72,31 @@ @@ -72,35 +72,31 @@
72 72
73 /*---[ Implement ]----------------------------------------------------------------------------------*/ 73 /*---[ Implement ]----------------------------------------------------------------------------------*/
74 74
75 -namespace PW3270_NAMESPACE {  
76 -  
77 - void lock() { 75 +void lock() {
78 #if GTK_CHECK_VERSION(2,32,0) 76 #if GTK_CHECK_VERSION(2,32,0)
79 - g_mutex_lock(&mutex); 77 + g_mutex_lock(&mutex);
80 #else 78 #else
81 - g_static_mutex_lock(&mutex); 79 + g_static_mutex_lock(&mutex);
82 #endif // GTK_CHECK_VERSION 80 #endif // GTK_CHECK_VERSION
83 - } 81 +}
84 82
85 - void unlock() { 83 +void unlock() {
86 #if GTK_CHECK_VERSION(2,32,0) 84 #if GTK_CHECK_VERSION(2,32,0)
87 - g_mutex_unlock(&mutex); 85 + g_mutex_unlock(&mutex);
88 #else 86 #else
89 - g_static_mutex_unlock(&mutex); 87 + g_static_mutex_unlock(&mutex);
90 #endif // GTK_CHECK_VERSION 88 #endif // GTK_CHECK_VERSION
91 - } 89 +}
92 90
93 - bool trylock() { 91 +bool trylock() {
94 #if GTK_CHECK_VERSION(2,32,0) 92 #if GTK_CHECK_VERSION(2,32,0)
95 - return g_mutex_trylock(&mutex); 93 + return g_mutex_trylock(&mutex);
96 #else 94 #else
97 - return g_static_mutex_trylock(&mutex); 95 + return g_static_mutex_trylock(&mutex);
98 #endif // GTK_CHECK_VERSION 96 #endif // GTK_CHECK_VERSION
99 - }  
100 -  
101 } 97 }
102 98
103 -using namespace PW3270_NAMESPACE; 99 +using PW3270_NAMESPACE::exception;
104 100
105 extern "C" { 101 extern "C" {
106 102
@@ -119,14 +115,14 @@ extern &quot;C&quot; { @@ -119,14 +115,14 @@ extern &quot;C&quot; {
119 115
120 LIB3270_EXPORT int pw3270_plugin_stop(GtkWidget *window, GtkWidget *terminal) { 116 LIB3270_EXPORT int pw3270_plugin_stop(GtkWidget *window, GtkWidget *terminal) {
121 117
122 - java::lock(); 118 + lock();
123 119
124 - if(java::jvm) {  
125 - java::jvm->DestroyJavaVM();  
126 - java::jvm = NULL; 120 + if(jvm) {
  121 + jvm->DestroyJavaVM();
  122 + jvm = NULL;
127 } 123 }
128 124
129 - java::unlock(); 125 + unlock();
130 126
131 #if GTK_CHECK_VERSION(2,32,0) 127 #if GTK_CHECK_VERSION(2,32,0)
132 g_mutex_clear(&mutex); 128 g_mutex_clear(&mutex);
src/plugin/private.h
@@ -44,8 +44,8 @@ @@ -44,8 +44,8 @@
44 #include <glib/gi18n.h> 44 #include <glib/gi18n.h>
45 #include <gtk/gtk.h> 45 #include <gtk/gtk.h>
46 46
47 - G_GNUC_INTERNAL JavaVM * jvm;  
48 - G_GNUC_INTERNAL JNIEnv * env; 47 + extern JavaVM * jvm;
  48 + extern JNIEnv * env;
49 49
50 G_GNUC_INTERNAL bool load_jvm(GtkWidget *widget); 50 G_GNUC_INTERNAL bool load_jvm(GtkWidget *widget);
51 G_GNUC_INTERNAL void call(GtkWidget *widget, const char *classname); 51 G_GNUC_INTERNAL void call(GtkWidget *widget, const char *classname);
src/plugin/startstop.cc
@@ -50,7 +50,7 @@ @@ -50,7 +50,7 @@
50 50
51 #include <pw3270.h> 51 #include <pw3270.h>
52 #include <pw3270/plugin.h> 52 #include <pw3270/plugin.h>
53 - #include <v3270.h> 53 + #include <pw3270/v3270.h>
54 #include <lib3270/actions.h> 54 #include <lib3270/actions.h>
55 #include <lib3270/log.h> 55 #include <lib3270/log.h>
56 #include <lib3270/trace.h> 56 #include <lib3270/trace.h>
@@ -60,8 +60,6 @@ @@ -60,8 +60,6 @@
60 60
61 /*---[ Implement ]----------------------------------------------------------------------------------*/ 61 /*---[ Implement ]----------------------------------------------------------------------------------*/
62 62
63 -using namespace PW3270_NAMESPACE::java;  
64 -  
65 extern "C" { 63 extern "C" {
66 64
67 static void trace_cleanup(GtkWidget *widget, GtkWidget **window) { 65 static void trace_cleanup(GtkWidget *widget, GtkWidget **window) {
@@ -106,7 +104,7 @@ extern &quot;C&quot; { @@ -106,7 +104,7 @@ extern &quot;C&quot; {
106 104
107 gchar *classname = (gchar *) g_object_get_data(G_OBJECT(action),"src"); 105 gchar *classname = (gchar *) g_object_get_data(G_OBJECT(action),"src");
108 106
109 - lib3270_trace_event(v3270_get_session(widget),"Action %s activated on widget %p\n",gtk_action_get_name(action),widget); 107 +// lib3270_trace_event(v3270_get_session(widget),"Action %s activated on widget %p\n",gtk_action_get_name(action),widget);
110 108
111 if(classname) 109 if(classname)
112 { 110 {