StaticGray and other stuff

Michael Koehne kraehe at bakunin.north.de
Wed Jul 29 21:27:07 PDT 1998


Hy Folks,

	"cvs diff" up and running ;-)

By Michael

PS : I've deleted the diff between my configure.
-- 
 mailto:kraehe at bakunin.north.de		http://human.is-bremen.de/~kraehe
		" CETERUM CENSEO MSDOS ESSE DELENDAM "
Index: ChangeLog
===================================================================
RCS file: /home/cvspublic/kaffe/ChangeLog,v
retrieving revision 1.78
diff -c -r1.78 ChangeLog
*** ChangeLog	1998/07/29 20:47:06	1.78
--- ChangeLog	1998/07/30 02:18:04
***************
*** 1,3 ****
--- 1,27 ----
+ 
+ Thu Jul 30 04:11:56  1998 Michael Koehne <kraehe at bakunin.north.de>
+ 
+ 	* its imho the easiest thing to add /usr/local to LDFLAGS
+ 	and CFLAGS in configure.in, if they are not set from the
+ 	user. Any stuff is installed there, kaffe also. So we should
+ 	force looking there. AWTLIB is now used for NOSHAREDLIBS as
+ 	intended to include the -ljpeg.
+ 
+ 	* AC_CHECK_LIBRARY should look for abs_invert, to fail on older
+ 	libgmp-1.3.2. Else it would fail during compile time, as we realy
+ 	use this new function somewhere in library/math.
+ 
+ 	* dirty patch for StaticGray support in awt/X/toolkit.h and
+ 	awt/X/clr.c. Improvement still needed in awt/X/img.c and some
+ 	other points.
+ 
+ 	* kaffe script is now nicer to dummy's like me. It sets a good
+ 	CLASSPATH, if there is none in environment.
+ 
+ 	* intension of KPREFIX constrained. kaffe should be kaffe,
+ 	and pizza should'nt be k_pizza, while the k_appletviewer is
+ 	our toy to play with.
+ 
  Wed Jul 29 14:41:09 1998  Godmar Back  <gback at marker.cs.utah.edu>
  
  	* libraries/javalib/java/io/File.java: fixed getParent to not 
Index: configure.in
===================================================================
RCS file: /home/cvspublic/kaffe/configure.in,v
retrieving revision 1.14
diff -c -r1.14 configure.in
*** configure.in	1998/07/28 22:52:25	1.14
--- configure.in	1998/07/30 02:18:57
***************
*** 69,78 ****
--- 69,90 ----
  if test "$LD" = "" ; then
  	LD=ld
  fi
+ if test "$LDFLAGS" = "" ; then
+ 	if test -d /usr/local/lib ; then
+ 		LDFLAGS=-L/usr/local/lib
+ 	fi
+ fi
+ if test "$CFLAGS" = "" ; then
+ 	if test -d /usr/local/include ; then
+ 		CFLAGS=-L/usr/local/include
+ 	fi
+ fi
  if test "$LINKLIB" = "" ; then
  	if test "$LIBEXT" = ".a" ; then
  		LINKLIB='$(AR) $(LIB) $(OBJECT)\
  		$(RANLIB) $(LIB)'
+ 	elif test "$LIBEXT" = ".o" ; then
+ 		LINKLIB='$(LD) $(LDFLAGS) -o $(LIB) $(OBJECT)'
  	else
  		LINKLIB='$(LD) $(LDFLAGS) -o $(LIB) $(OBJECT) $(LDTAIL)'
  	fi
***************
*** 375,381 ****
  
  AC_CHECK_LIBRARY(c,printf,STD_LIBRARIES)
  AC_CHECK_LIBRARY(m,sin,STD_LIBRARIES)
! AC_CHECK_LIBRARY(gmp,mpz_abs,STD_LIBRARIES)
  AC_SUBST(STD_LIBRARIES)
  
  dnl Checks for libraries for vm library.
--- 387,393 ----
  
  AC_CHECK_LIBRARY(c,printf,STD_LIBRARIES)
  AC_CHECK_LIBRARY(m,sin,STD_LIBRARIES)
! AC_CHECK_LIBRARY(gmp,mpz_invert,STD_LIBRARIES)
  AC_SUBST(STD_LIBRARIES)
  
  dnl Checks for libraries for vm library.
***************
*** 422,443 ****
  fi
  if test "${x_includes}" != NONE && test -n "${x_includes}"; then
  	X_INCLUDES=-I`echo ${x_includes} | sed -e "s/:/ -I/g"`
- 	# This hack looks for libjpeg.a in /usr/local/lib and for
- 	# jpeglib.h in /usr/local/include.
- 	# It is intended for users who do not set their LDFLAGS env
- 	# variable properly before invoking configure.
- 	#
- 	# The reason is that the config files are currently missing a 
- 	# HAVE_JPEGLIB flag which would allow conditional reference to
- 	# the functions in this library.
- 	GUESSWHEREJPEGLIBIS="/usr/local"
- 	for DIR in $GUESSWHEREJPEGLIBIS
- 	do
- 		if test -r $DIR/include/jpeglib.h -a -r $DIR/lib/libjpeg.a; then
- 			X_INCLUDES="$X_INCLUDES -I$DIR/include"
- 			JPEG_LIBRARIES="-L$DIR/lib -ljpeg"
- 		fi
- 	done
  fi
  AC_SUBST(X_INCLUDES)
  AC_SUBST(X_LIBRARIES)
--- 434,439 ----
***************
*** 665,671 ****
  	NOSHAREDLIBS="-L../kaffevm -lkaffevm $VM_LIBRARIES $STD_LIBRARIES"
  	KAFFE_LIBDEP=""
  else
! 	NOSHAREDLIBS="../kaffevm/libkaffevm$LIBEXT $JAVA_LIBRARIES $STD_LIBRARIES $ZIP_LIBRARIES $NET_LIBRARIES $X_LIBRARIES $AWTLIB"
  	KAFFE_LIBDEP="$KAFFE_LIBDEP ../kaffevm/libkaffevm$LIBEXT $JAVA_LIBRARIES"
  	PIC=""
  	PICVM=""
--- 661,667 ----
  	NOSHAREDLIBS="-L../kaffevm -lkaffevm $VM_LIBRARIES $STD_LIBRARIES"
  	KAFFE_LIBDEP=""
  else
! 	NOSHAREDLIBS="../kaffevm/libkaffevm$LIBEXT $JAVA_LIBRARIES $STD_LIBRARIES $ZIP_LIBRARIES $NET_LIBRARIES $AWTLIB"
  	KAFFE_LIBDEP="$KAFFE_LIBDEP ../kaffevm/libkaffevm$LIBEXT $JAVA_LIBRARIES"
  	PIC=""
  	PICVM=""
Index: kaffe/kaffeh/Makefile.in
===================================================================
RCS file: /home/cvspublic/kaffe/kaffe/kaffeh/Makefile.in,v
retrieving revision 1.2
diff -c -r1.2 Makefile.in
*** Makefile.in	1998/05/28 03:52:27	1.2
--- Makefile.in	1998/07/30 02:19:00
***************
*** 39,48 ****
  
  .SUFFIXES: .d
  
! all:		$(KPREFIX)kaffeh$(EXEEXT)
  
! $(KPREFIX)kaffeh$(EXEEXT):	$(OBJECT)
! 		$(CC) $(LDFLAGS) -o $(KPREFIX)kaffeh$(EXEEXT) $(OBJECT) $(LIBS)
  
  readClass$(OBJEXT):	$(srcdir)/../kaffevm/readClass.c
  		$(CC) $(ALL_CFLAGS) -c $<
--- 39,48 ----
  
  .SUFFIXES: .d
  
! all:		kaffeh$(EXEEXT)
  
! kaffeh$(EXEEXT):	$(OBJECT)
! 		$(CC) $(LDFLAGS) -o kaffeh$(EXEEXT) $(OBJECT) $(LIBS)
  
  readClass$(OBJEXT):	$(srcdir)/../kaffevm/readClass.c
  		$(CC) $(ALL_CFLAGS) -c $<
***************
*** 75,81 ****
  		cat $(DEPENDS) > .depend
  
  clean:
! 		rm -f $(KPREFIX)kaffeh$(EXEEXT) $(KPREFIX)kaffeh.core $(OBJECT)
  		rm -f $(DEPENDS) .depend
  		touch .depend
  
--- 75,81 ----
  		cat $(DEPENDS) > .depend
  
  clean:
! 		rm -f kaffeh$(EXEEXT) kaffeh.core $(OBJECT)
  		rm -f $(DEPENDS) .depend
  		touch .depend
  
***************
*** 85,91 ****
  
  install:
  		test -d $(bindir) || $(MKDIR) $(bindir)
! 		$(INSTALL_PROGRAM) $(KPREFIX)kaffeh$(EXEEXT) $(bindir)/$(KPREFIX)kaffeh$(EXEEXT)
  
  @INC_DEPEND@
  
--- 85,91 ----
  
  install:
  		test -d $(bindir) || $(MKDIR) $(bindir)
! 		$(INSTALL_PROGRAM) kaffeh$(EXEEXT) $(bindir)/kaffeh$(EXEEXT)
  
  @INC_DEPEND@
  
Index: kaffe/scripts/Makefile.in
===================================================================
RCS file: /home/cvspublic/kaffe/kaffe/scripts/Makefile.in,v
retrieving revision 1.4
diff -c -r1.4 Makefile.in
*** Makefile.in	1998/07/14 20:54:53	1.4
--- Makefile.in	1998/07/30 02:19:02
***************
*** 47,53 ****
  install-pizza:
  		for i in $(SCRIPTFILES_PIZZA) ;\
  		do \
! 			$(INSTALL_SCRIPT) $(srcdir)/$(SCREXT)/$$i $(bindir)/$(KPREFIX)$$i$(SCREXT)  ;\
  		done
  
  install-compat:
--- 47,53 ----
  install-pizza:
  		for i in $(SCRIPTFILES_PIZZA) ;\
  		do \
! 			$(INSTALL_SCRIPT) $(srcdir)/$(SCREXT)/$$i $(bindir)/$$i  ;\
  		done
  
  install-compat:
***************
*** 59,65 ****
  install-jars:
  		for i in $(PSCRIPTFILES) ;\
  		do \
! 			$(INSTALL_SCRIPT) $$i $(bindir)/$(KPREFIX)$$i ;\
  		done
  
  depend:
--- 59,65 ----
  install-jars:
  		for i in $(PSCRIPTFILES) ;\
  		do \
! 			$(INSTALL_SCRIPT) $$i $(bindir)/$$i ;\
  		done
  
  depend:
Index: kaffe/scripts/kaffe.in
===================================================================
RCS file: /home/cvspublic/kaffe/kaffe/scripts/kaffe.in,v
retrieving revision 1.2
diff -c -r1.2 kaffe.in
*** kaffe.in	1998/07/29 16:37:23	1.2
--- kaffe.in	1998/07/30 02:19:02
***************
*** 6,10 ****
--- 6,14 ----
  # Pretend Kaffe is Java
  LD_LIBRARY_PATH=$KAFFE_LIB:$LD_LIBRARY_PATH
  export LD_LIBRARY_PATH
+ [ "$CLASSPATH" = "" ] && {
+ 	CLASSPATH=@prefix@/share/kaffe/Klasses.jar:@prefix@/share/kaffe/pizza.jar:.
+ 	export CLASSPATH
+ 	}
  
  exec Kaffe "$@"
Index: libraries/clib/awt/X/clr.c
===================================================================
RCS file: /home/cvspublic/kaffe/libraries/clib/awt/X/clr.c,v
retrieving revision 1.1
diff -c -r1.1 clr.c
*** clr.c	1998/07/14 17:24:14	1.1
--- clr.c	1998/07/30 02:19:08
***************
*** 16,21 ****
--- 16,22 ----
  #include "toolkit.h"
  
  #define CLR_DIST 8.0
+ #define DEBUG 1
  
  /********************************************************************************
   * auxiliary functions
***************
*** 416,422 ****
--- 417,438 ----
    return map;
  }
  
+ /********************************************************************************
+  * NoColor (RGB) visual
+  */
+ 
+ Rgb2Mono*
+ initRgb2Mono ( JNIEnv* env, Toolkit* X )
+ {
+   Visual *v = DefaultVisualOfScreen( DefaultScreenOfDisplay( X->dsp));
+   Rgb2Mono *mclr = (Rgb2Mono*) malloc( sizeof(Rgb2Mono));
  
+   mclr->map_entries = v->map_entries;
+   mclr->treshold    = 196;
+ 
+   return mclr;
+ }
+ 
  /********************************************************************************
   * common funcs
   */
***************
*** 441,451 ****
  
    switch ( v->class ) {
    case DirectColor:
!   case TrueColor:	 X->tclr = initRgb2True( X); break;
!   case PseudoColor:  X->pclr = initRgb2Pseudo( env, X); break;
    }
  }
- 
  
  /********************************************************************************
   * exported functions
--- 457,467 ----
  
    switch ( v->class ) {
    case DirectColor:
!   case TrueColor:	X->tclr = initRgb2True( X); break;
!   case PseudoColor:	X->pclr = initRgb2Pseudo( env, X); break;
!   case StaticGray:	X->mclr = initRgb2Mono( env, X); break;
    }
  }
  
  /********************************************************************************
   * exported functions
Index: libraries/clib/awt/X/toolkit.h
===================================================================
RCS file: /home/cvspublic/kaffe/libraries/clib/awt/X/toolkit.h,v
retrieving revision 1.2
diff -c -r1.2 toolkit.h
*** toolkit.h	1998/07/15 04:24:29	1.2
--- toolkit.h	1998/07/30 02:19:10
***************
*** 20,25 ****
--- 20,31 ----
   *
   */
  
+ typedef struct _RgbColor {
+   unsigned char r;
+   unsigned char g;
+   unsigned char b;
+ } RgbColor;
+ 
  typedef struct _Rgb2True {
    unsigned int   redMask;
    unsigned int   greenMask;
***************
*** 29,47 ****
    char           greenShift;
  } Rgb2True;
  
- 
- typedef struct _RgbColor {
-   unsigned char r;
-   unsigned char g;
-   unsigned char b;
- } RgbColor;
- 
- 
  typedef struct _Rgb2Pseudo {
    RgbColor       rgb[256];
    unsigned char  pix[8][8][8];
  } Rgb2Pseudo;
  
  
  typedef struct _Image {
    Pixmap         pix;
--- 35,49 ----
    char           greenShift;
  } Rgb2True;
  
  typedef struct _Rgb2Pseudo {
    RgbColor       rgb[256];
    unsigned char  pix[8][8][8];
  } Rgb2Pseudo;
  
+ typedef struct _Rgb2Mono {
+   unsigned int	map_entries;
+   unsigned int	treshold;
+ } Rgb2Mono;
  
  typedef struct _Image {
    Pixmap         pix;
***************
*** 62,67 ****
--- 64,70 ----
    int            visualClass;
    Rgb2True       *tclr;
    Rgb2Pseudo     *pclr;
+   Rgb2Mono       *mclr;
  
    Cursor         cursors[14];
  
***************
*** 208,213 ****
--- 211,227 ----
  
    case PseudoColor:
  	return X->pclr->pix [JI8(JRED(rgb))] [JI8(JGREEN(rgb))] [JI8(JBLUE(rgb))];
+ 
+   case StaticGray:
+   	/*
+   	return (JRED(rgb)*JRED(rgb)+
+   	        JGREEN(rgb)*JGREEN(rgb)+
+   	        JBLUE(rgb)*JBLUE(rgb) < 16384);
+   	*/
+   	if (X->mclr->map_entries == 2) /* more contrast */
+   		return (JRED(rgb)+ JGREEN(rgb)+ JBLUE(rgb) < X->mclr->treshold);
+   	else /* just distributing */
+   		return((JRED(rgb)+ JGREEN(rgb)+ JBLUE(rgb))*(X->mclr->map_entries)/768);
    }
  }
  
***************
*** 233,238 ****
--- 247,257 ----
  	*g = X->pclr->rgb[(unsigned char)pixel].g;
  	*b = X->pclr->rgb[(unsigned char)pixel].b;
  	break;
+   
+   case StaticGray:
+    	*r = *g = *b = (JRED(pixel)+JGREEN(pixel)+JBLUE(pixel)/3);
+    	break;
+   
    }
  }
  


More information about the kaffe mailing list