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 39 sbindir=@sbindir@
40 40 libdir=@libdir@
41 41 datarootdir=@datarootdir@
  42 +jardir=@jvmjardir@
  43 +jnidir=@jnidir@
42 44  
43 45 BASEDIR=@BASEDIR@
44 46 SRCDIR=$(BASEDIR)/.src/$(PACKAGE_TARNAME)-$(PACKAGE_VERSION)
... ... @@ -68,7 +70,11 @@ CC=@CC@
68 70 LD=@CXX@
69 71  
70 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 78 LDFLAGS=@LDFLAGS@
73 79  
74 80 #---[ Rules ]----------------------------------------------------------------------------
... ...
src/plugin/call.cc
... ... @@ -34,7 +34,7 @@
34 34 #include <lib3270/log.h>
35 35 #include <pw3270/v3270.h>
36 36  
37   - using j3270::exception;
  37 + using PW3270_NAMESPACE::exception;
38 38  
39 39 /*---[ Implement ]----------------------------------------------------------------------------------*/
40 40  
... ...
src/plugin/plugin.cc
... ... @@ -72,35 +72,31 @@
72 72  
73 73 /*---[ Implement ]----------------------------------------------------------------------------------*/
74 74  
75   -namespace PW3270_NAMESPACE {
76   -
77   - void lock() {
  75 +void lock() {
78 76 #if GTK_CHECK_VERSION(2,32,0)
79   - g_mutex_lock(&mutex);
  77 + g_mutex_lock(&mutex);
80 78 #else
81   - g_static_mutex_lock(&mutex);
  79 + g_static_mutex_lock(&mutex);
82 80 #endif // GTK_CHECK_VERSION
83   - }
  81 +}
84 82  
85   - void unlock() {
  83 +void unlock() {
86 84 #if GTK_CHECK_VERSION(2,32,0)
87   - g_mutex_unlock(&mutex);
  85 + g_mutex_unlock(&mutex);
88 86 #else
89   - g_static_mutex_unlock(&mutex);
  87 + g_static_mutex_unlock(&mutex);
90 88 #endif // GTK_CHECK_VERSION
91   - }
  89 +}
92 90  
93   - bool trylock() {
  91 +bool trylock() {
94 92 #if GTK_CHECK_VERSION(2,32,0)
95   - return g_mutex_trylock(&mutex);
  93 + return g_mutex_trylock(&mutex);
96 94 #else
97   - return g_static_mutex_trylock(&mutex);
  95 + return g_static_mutex_trylock(&mutex);
98 96 #endif // GTK_CHECK_VERSION
99   - }
100   -
101 97 }
102 98  
103   -using namespace PW3270_NAMESPACE;
  99 +using PW3270_NAMESPACE::exception;
104 100  
105 101 extern "C" {
106 102  
... ... @@ -119,14 +115,14 @@ extern &quot;C&quot; {
119 115  
120 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 127 #if GTK_CHECK_VERSION(2,32,0)
132 128 g_mutex_clear(&mutex);
... ...
src/plugin/private.h
... ... @@ -44,8 +44,8 @@
44 44 #include <glib/gi18n.h>
45 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 50 G_GNUC_INTERNAL bool load_jvm(GtkWidget *widget);
51 51 G_GNUC_INTERNAL void call(GtkWidget *widget, const char *classname);
... ...
src/plugin/startstop.cc
... ... @@ -50,7 +50,7 @@
50 50  
51 51 #include <pw3270.h>
52 52 #include <pw3270/plugin.h>
53   - #include <v3270.h>
  53 + #include <pw3270/v3270.h>
54 54 #include <lib3270/actions.h>
55 55 #include <lib3270/log.h>
56 56 #include <lib3270/trace.h>
... ... @@ -60,8 +60,6 @@
60 60  
61 61 /*---[ Implement ]----------------------------------------------------------------------------------*/
62 62  
63   -using namespace PW3270_NAMESPACE::java;
64   -
65 63 extern "C" {
66 64  
67 65 static void trace_cleanup(GtkWidget *widget, GtkWidget **window) {
... ... @@ -106,7 +104,7 @@ extern &quot;C&quot; {
106 104  
107 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 109 if(classname)
112 110 {
... ...