jfclere 2002/09/19 09:48:48
Modified: daemon/src/native/unix Makedefs.in configure.in
daemon/src/native/unix/native Makefile.in java.c
daemon/src/native/unix/support apsupport.m4
Log:
Add support of BS2000 and prepare the logic for other EBCDIC platforms.
Revision Changes Path
1.4 +2 -1 jakarta-commons-sandbox/daemon/src/native/unix/Makedefs.in
Index: Makedefs.in
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/daemon/src/native/unix/Makedefs.in,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Makedefs.in 17 Sep 2002 16:21:14 -0000 1.3
+++ Makedefs.in 19 Sep 2002 16:48:47 -0000 1.4
@@ -65,6 +65,7 @@
LDFLAGS = @LDFLAGS@
JAVACFLAGS = @JAVACFLAGS@
RANLIB = @RANLIB@
+LDCMD = @LDCMD@
.c.o:
$(CC) $(CFLAGS) -c $< -o $@
1.4 +9 -1 jakarta-commons-sandbox/daemon/src/native/unix/configure.in
Index: configure.in
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/daemon/src/native/unix/configure.in,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- configure.in 17 Sep 2002 16:21:14 -0000 1.3
+++ configure.in 19 Sep 2002 16:48:47 -0000 1.4
@@ -126,6 +126,14 @@
CFLAGS="$CFLAGS -Wall -Wstrict-prototypes"
AC_MSG_RESULT([gcc flags added])
fi
+dnl -------------------------------------------------------------------------
+dnl Add gcc specific CFLAGS.
+dnl -------------------------------------------------------------------------
+if test -z "$LDCMD"
+then
+ LDCMD="$CC"
+fi
+AC_SUBST(LDCMD)
dnl -------------------------------------------------------------------------
dnl Random programs we need to compile locally
1.5 +2 -2
jakarta-commons-sandbox/daemon/src/native/unix/native/Makefile.in
Index: Makefile.in
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/daemon/src/native/unix/native/Makefile.in,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- Makefile.in 17 Sep 2002 16:21:14 -0000 1.4
+++ Makefile.in 19 Sep 2002 16:48:47 -0000 1.5
@@ -79,7 +79,7 @@
jsvc: jsvc-unix.o libservice.a
mkdir -p ../../../../dist
- $(CC) $(LDFLAGS) jsvc-unix.o libservice.a -o ../../../../dist/jsvc
+ $(LDCMD) $(LDFLAGS) jsvc-unix.o libservice.a -o ../../../../dist/jsvc
clean:
rm -f $(OBJS) ../../../../dist/jsvc jsvc-unix.o libservice.a
1.4 +75 -19 jakarta-commons-sandbox/daemon/src/native/unix/native/java.c
Index: java.c
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/daemon/src/native/unix/native/java.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- java.c 17 Sep 2002 16:21:14 -0000 1.3
+++ java.c 19 Sep 2002 16:48:47 -0000 1.4
@@ -63,6 +63,17 @@
#endif
#include <jni.h>
+#ifdef CHARSET_EBCDIC
+#ifdef OSD_POSIX
+#include <ascii_ebcdic.h>
+#define jsvc_xlate_to_ascii(b) _e2a(b)
+#define jsvc_xlate_from_ascii(b) _a2e(b)
+#endif
+#else
+#define jsvc_xlate_to_ascii() /* NOOP */
+#define jsvc_xlate_from_ascii() /* NOOP */
+#endif
+
static JavaVM *jvm=NULL;
static JNIEnv *env=NULL;
static jclass cls=NULL;
@@ -121,6 +132,9 @@
char *libf=NULL;
jint ret;
int x;
+ char loaderclass[]=LOADER;
+ char shutdownclass[]="shutdown";
+ char shutdownparams[]="(Z)V";
/* Decide WHAT virtual machine we need to use */
libf=java_library(args,data);
@@ -182,7 +196,8 @@
} else {
opt=(JavaVMOption *)malloc(arg.nOptions*sizeof(JavaVMOption));
for (x=0; x<args->onum; x++) {
- opt[x].optionString=args->opts[x];
+ opt[x].optionString=strdup(args->opts[x]);
+ jsvc_xlate_to_ascii(opt[x].optionString);
opt[x].extraInfo=NULL;
}
arg.options=opt;
@@ -197,8 +212,10 @@
log_debug("| Extra options: %d",arg.nOptions);
for (x=0; x<args->onum; x++) {
+ jsvc_xlate_from_ascii(opt[x].optionString);
log_debug("| \"%s\" (0x%08x)",opt[x].optionString,
opt[x].extraInfo);
+ jsvc_xlate_to_ascii(opt[x].optionString);
}
log_debug("+-------------------------------------------------------");
}
@@ -211,15 +228,19 @@
}
log_debug("Java VM created successfully");
- cls=(*env)->FindClass(env,LOADER);
+ jsvc_xlate_to_ascii(loaderclass);
+ cls=(*env)->FindClass(env,loaderclass);
+ jsvc_xlate_from_ascii(loaderclass);
if (cls==NULL) {
- log_error("Cannot find daemon loader %s",LOADER);
+ log_error("Cannot find daemon loader %s",loaderclass);
return(false);
}
- log_debug("Class %s found",LOADER);
+ log_debug("Class %s found",loaderclass);
- nativemethod.name="shutdown";
- nativemethod.signature="(Z)V";
+ jsvc_xlate_to_ascii(shutdownclass);
+ nativemethod.name=shutdownclass;
+ jsvc_xlate_to_ascii(shutdownparams);
+ nativemethod.signature=shutdownparams;
nativemethod.fnPtr=shutdown;
if((*env)->RegisterNatives(env,cls,&nativemethod,1)!=0) {
log_error("Cannot register native methods");
@@ -234,20 +255,27 @@
bool java_destroy(int exit) {
jclass system=NULL;
jmethodID method;
-
- system=(*env)->FindClass(env,"java/lang/System");
+ char System[]="java/lang/System";
+ char exitclass[]="exit";
+ char exitparams[]="(I)V";
+
+ jsvc_xlate_to_ascii(System);
+ system=(*env)->FindClass(env,System);
+ jsvc_xlate_from_ascii(System);
if (system==NULL) {
- log_error("Cannot find class java/lang/System");
+ log_error("Cannot find class %s",System);
return(false);
}
- method=(*env)->GetStaticMethodID(env,system,"exit","(I)V");
+ jsvc_xlate_to_ascii(exitclass);
+ jsvc_xlate_to_ascii(exitparams);
+ method=(*env)->GetStaticMethodID(env,system,exitclass,exitparams);
if (method==NULL) {
log_error("Cannot found \"System.exit(int)\" entry point");
return(false);
}
- log_debug("Calling System.exit(%d)",exit);
+ log_debug("Calling System.exit(%d)",exitclass);
(*env)->CallStaticVoidMethod(env,cls,method,(jint)exit);
/* We shouldn't get here, but just in case... */
@@ -266,14 +294,21 @@
jmethodID method=NULL;
jboolean ret=FALSE;
int x;
+ char lang[]="java/lang/String";
+ char load[]="load";
+ char loadparams[]="(Ljava/lang/String;[Ljava/lang/String;)Z";
+ jsvc_xlate_to_ascii(args->clas);
className=(*env)->NewStringUTF(env,args->clas);
+ jsvc_xlate_from_ascii(args->clas);
if (className==NULL) {
log_error("Cannot create string for class name");
return(false);
}
- stringClass=(*env)->FindClass(env,"java/lang/String");
+ jsvc_xlate_to_ascii(lang);
+ stringClass=(*env)->FindClass(env,lang);
+ jsvc_xlate_from_ascii(lang);
if (stringClass==NULL) {
log_error("Cannot find class java/lang/String");
return(false);
@@ -286,7 +321,9 @@
}
for (x=0; x<args->anum; x++) {
+ jsvc_xlate_to_ascii(args->args[x]);
currentArgument=(*env)->NewStringUTF(env,args->args[x]);
+ jsvc_xlate_from_ascii(args->args[x]);
if (currentArgument==NULL) {
log_error("Cannot create string for argument %s",args->args[x]);
return(false);
@@ -294,8 +331,9 @@
(*env)->SetObjectArrayElement(env,stringArray,x,currentArgument);
}
- method=(*env)->GetStaticMethodID(env,cls,"load",
- "(Ljava/lang/String;[Ljava/lang/String;)Z");
+ jsvc_xlate_to_ascii(load);
+ jsvc_xlate_to_ascii(loadparams);
+ method=(*env)->GetStaticMethodID(env,cls,load,loadparams);
if (method==NULL) {
log_error("Cannot found Daemon Loader \"load\" entry point");
return(false);
@@ -315,8 +353,12 @@
bool java_start(void) {
jmethodID method;
jboolean ret;
+ char start[]="start";
+ char startparams[]="()Z";
- method=(*env)->GetStaticMethodID(env,cls,"start","()Z");
+ jsvc_xlate_to_ascii(start);
+ jsvc_xlate_to_ascii(startparams);
+ method=(*env)->GetStaticMethodID(env,cls,start,startparams);
if (method==NULL) {
log_error("Cannot found Daemon Loader \"start\" entry point");
return(false);
@@ -336,8 +378,12 @@
bool java_stop(void) {
jmethodID method;
jboolean ret;
+ char stop[]="stop";
+ char stopparams[]="()Z";
- method=(*env)->GetStaticMethodID(env,cls,"stop","()Z");
+ jsvc_xlate_to_ascii(stop);
+ jsvc_xlate_to_ascii(stopparams);
+ method=(*env)->GetStaticMethodID(env,cls,stop,stopparams);
if (method==NULL) {
log_error("Cannot found Daemon Loader \"stop\" entry point");
return(false);
@@ -356,8 +402,12 @@
/* Call the version method in our daemon loader */
bool java_version(void) {
jmethodID method;
+ char version[]="version";
+ char versionparams[]="()Z";
- method=(*env)->GetStaticMethodID(env,cls,"version","()V");
+ jsvc_xlate_to_ascii(version);
+ jsvc_xlate_to_ascii(versionparams);
+ method=(*env)->GetStaticMethodID(env,cls,version,versionparams);
if (method==NULL) {
log_error("Cannot found Daemon Loader \"version\" entry point");
return(false);
@@ -372,16 +422,22 @@
jstring className=NULL;
jmethodID method=NULL;
jboolean ret=FALSE;
+ char check[]="check";
+ char checkparams[]="(Ljava/lang/String;)Z";
log_debug("Checking daemon");
+ jsvc_xlate_to_ascii(args->clas);
className=(*env)->NewStringUTF(env,args->clas);
+ jsvc_xlate_from_ascii(args->clas);
if (className==NULL) {
log_error("Cannot create string for class name");
return(false);
}
- method=(*env)->GetStaticMethodID(env,cls,"check","(Ljava/lang/String;)Z");
+ jsvc_xlate_to_ascii(check);
+ jsvc_xlate_to_ascii(checkparams);
+ method=(*env)->GetStaticMethodID(env,cls,check,checkparams);
if (method==NULL) {
log_error("Cannot found Daemon Loader \"check\" entry point");
return(false);
1.4 +4 -2
jakarta-commons-sandbox/daemon/src/native/unix/support/apsupport.m4
Index: apsupport.m4
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/daemon/src/native/unix/support/apsupport.m4,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- apsupport.m4 17 Sep 2002 16:21:15 -0000 1.3
+++ apsupport.m4 19 Sep 2002 16:48:47 -0000 1.4
@@ -70,8 +70,10 @@
i?86)
CFLAGS="$CFLAGS -DCPU=\\\"i386\\\"" ;;
bs2000)
- CFLAGS="$CFLAGS -DCPU=\\\"osd\\\""
+ CFLAGS="$CFLAGS -DCPU=\\\"osd\\\" -DCHARSET_EBCDIC -DOSD_POSIX"
supported_os="osd"
+ LDFLAGS="-Kno_link_stdlibs -B llm4 -l BLSLIB $LDFLAGS"
+ LDCMD="cc"
;;
mips)
CFLAGS="$CFLAGS -DCPU=\\\"mips\\\""
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>