From bdfd1735c5fb880b732ca241203e8cd11778284a Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Sat, 30 Aug 2003 14:25:10 +0000 Subject: [PATCH] Various org.lwjgl.vector bugs found by cfmdobbie fixed --- src/java/org/lwjgl/vector/Matrix3f.java | 31 ++++---- src/java/org/lwjgl/vector/Matrix4f.java | 43 +++++------ src/java/org/lwjgl/vector/Vector.java | 2 +- src/java/org/lwjgl/vector/Vector2f.java | 15 +++- src/native/Makefile.am | 14 +--- src/native/autogen.sh | 3 +- src/native/common/Makefile.am | 7 -- src/native/config.h.in | 67 ----------------- src/native/configure.in | 96 ++++++++----------------- src/native/dummy.cpp | 4 -- 10 files changed, 85 insertions(+), 197 deletions(-) delete mode 100644 src/native/config.h.in delete mode 100644 src/native/dummy.cpp diff --git a/src/java/org/lwjgl/vector/Matrix3f.java b/src/java/org/lwjgl/vector/Matrix3f.java index a018abce..51922f44 100644 --- a/src/java/org/lwjgl/vector/Matrix3f.java +++ b/src/java/org/lwjgl/vector/Matrix3f.java @@ -330,25 +330,22 @@ public class Matrix3f extends Matrix implements Serializable { * @return the transposed matrix */ public Matrix3f transpose(Matrix3f dest) { - - if (dest == null) + if (dest == null) { dest = new Matrix3f(); - - if (this != dest) { - m00 = dest.m00; - m01 = dest.m10; - m02 = dest.m20; - m10 = dest.m01; - m11 = dest.m11; - m12 = dest.m21; - m20 = dest.m02; - m21 = dest.m12; - m22 = dest.m22; - } else + dest.m00 = m00; + dest.m01 = m10; + dest.m02 = m20; + dest.m10 = m01; + dest.m11 = m11; + dest.m12 = m21; + dest.m20 = m02; + dest.m21 = m12; + dest.m22 = m22; + return dest; + } else { transpose(); - - return this; - + return this; + } } /** diff --git a/src/java/org/lwjgl/vector/Matrix4f.java b/src/java/org/lwjgl/vector/Matrix4f.java index fe606ca0..c46923db 100644 --- a/src/java/org/lwjgl/vector/Matrix4f.java +++ b/src/java/org/lwjgl/vector/Matrix4f.java @@ -635,28 +635,29 @@ public class Matrix4f extends Matrix implements Serializable { * @return the transposed matrix */ public Matrix4f transpose(Matrix4f dest) { - - if (this != dest) { - m00 = dest.m00; - m01 = dest.m10; - m02 = dest.m20; - m03 = dest.m30; - m10 = dest.m01; - m11 = dest.m11; - m12 = dest.m21; - m13 = dest.m31; - m20 = dest.m02; - m21 = dest.m12; - m22 = dest.m22; - m23 = dest.m32; - m30 = dest.m03; - m31 = dest.m13; - m32 = dest.m23; - m33 = dest.m33; - } else + if (dest == null) { + dest = new Matrix4f(); + dest.m00 = m00; + dest.m01 = m10; + dest.m02 = m20; + dest.m03 = m30; + dest.m10 = m01; + dest.m11 = m11; + dest.m12 = m21; + dest.m13 = m31; + dest.m20 = m02; + dest.m21 = m12; + dest.m22 = m22; + dest.m23 = m32; + dest.m30 = m03; + dest.m31 = m13; + dest.m32 = m23; + dest.m33 = m33; + return dest; + } else { transpose(); - - return dest; + return this; + } } /** diff --git a/src/java/org/lwjgl/vector/Vector.java b/src/java/org/lwjgl/vector/Vector.java index 9899baf6..679f9221 100644 --- a/src/java/org/lwjgl/vector/Vector.java +++ b/src/java/org/lwjgl/vector/Vector.java @@ -82,7 +82,7 @@ public abstract class Vector implements Serializable { * Normalise this vector * @return this */ - public final Vector normalize() { + public final Vector normalise() { float len = length(); if (len != 0.0f) { float l = 1.0f / len; diff --git a/src/java/org/lwjgl/vector/Vector2f.java b/src/java/org/lwjgl/vector/Vector2f.java index b98e8969..e97d9eaf 100644 --- a/src/java/org/lwjgl/vector/Vector2f.java +++ b/src/java/org/lwjgl/vector/Vector2f.java @@ -60,7 +60,7 @@ public class Vector2f extends Vector implements Serializable { public Vector2f(Vector2f src) { set(src); } - + /** * Constructor */ @@ -241,4 +241,17 @@ public class Vector2f extends Vector implements Serializable { return this; } + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + public String toString() { + StringBuffer sb = new StringBuffer(64); + + sb.append("Vector2f["); + sb.append(x); + sb.append(", "); + sb.append(y); + sb.append(']'); + return sb.toString(); + } } diff --git a/src/native/Makefile.am b/src/native/Makefile.am index dddba036..0dfab6db 100644 --- a/src/native/Makefile.am +++ b/src/native/Makefile.am @@ -1,16 +1,4 @@ SUBDIRS = common linux lib_LTLIBRARIES = liblwjgl.la - -#liblwjgl_la_LDFLAGS = \ -# -release $(LT_RELEASE) \ -# -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) -liblwjgl_la_SOURCES = \ - dummy.cpp -liblwjgl_la_CPPFLAGS = -D_DEBUG -liblwjgl_la_LIBADD = \ - common/libcommon.la \ - linux/liblinux.la -liblwjgl_la_DEPENDENCIES = \ - common/libcommon.la \ - linux/liblinux.la +liblwjgl_LDADD diff --git a/src/native/autogen.sh b/src/native/autogen.sh index 6034890e..0d3ba69a 100755 --- a/src/native/autogen.sh +++ b/src/native/autogen.sh @@ -1,7 +1,8 @@ #export WANT_AUTOCONF_2_5=1 #WANT_AUTOMAKE_1_5=1 -autoheader linux +#autoheader linux +libtoolize --force aclocal automake --foreign --include-deps --add-missing --copy autoconf diff --git a/src/native/common/Makefile.am b/src/native/common/Makefile.am index 27f46385..1abfca99 100644 --- a/src/native/common/Makefile.am +++ b/src/native/common/Makefile.am @@ -1,15 +1,8 @@ -#SUBDIRS = callbacks - noinst_LTLIBRARIES = libcommon.la libcommon_la_SOURCES = $(COMMON) libcommon_la_CPPFLAGS = -D_DEBUG -#libcommon_la_LIBADD = \ -# callbacks/libcallbacks.la -#libcommon_la_DEPENDENCIES = \ -# callbacks/libcallbacks.la - COMMON = \ extal.cpp \ extal.h \ diff --git a/src/native/config.h.in b/src/native/config.h.in deleted file mode 100644 index babdb6c3..00000000 --- a/src/native/config.h.in +++ /dev/null @@ -1,67 +0,0 @@ -/* config.h.in. Generated from configure.in by autoheader. */ - -/* Define to 1 if you have the header file. */ -#undef HAVE_DLFCN_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_INTTYPES_H - -/* Define to 1 if you have the `pthread' library (-lpthread). */ -#undef HAVE_LIBPTHREAD - -/* Define to 1 if you have the `X11' library (-lX11). */ -#undef HAVE_LIBX11 - -/* Define to 1 if you have the `Xext' library (-lXext). */ -#undef HAVE_LIBXEXT - -/* Define to 1 if you have the `Xxf86vm' library (-lXxf86vm). */ -#undef HAVE_LIBXXF86VM - -/* Define to 1 if you have the header file. */ -#undef HAVE_MEMORY_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDINT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDLIB_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRINGS_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRING_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_STAT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_TYPES_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_UNISTD_H - -/* Name of package */ -#undef PACKAGE - -/* Define to the address where bug reports for this package should be sent. */ -#undef PACKAGE_BUGREPORT - -/* Define to the full name of this package. */ -#undef PACKAGE_NAME - -/* Define to the full name and version of this package. */ -#undef PACKAGE_STRING - -/* Define to the one symbol short name of this package. */ -#undef PACKAGE_TARNAME - -/* Define to the version of this package. */ -#undef PACKAGE_VERSION - -/* Define to 1 if you have the ANSI C header files. */ -#undef STDC_HEADERS - -/* Version number of package */ -#undef VERSION diff --git a/src/native/configure.in b/src/native/configure.in index c2f1bb91..ce1194e5 100644 --- a/src/native/configure.in +++ b/src/native/configure.in @@ -1,76 +1,42 @@ -dnl Process this file with autoconf to produce a configure script. -AC_INIT(dummy.cpp) +# -*- Autoconf -*- +# Process this file with autoconf to produce a configure script. -dnl These should be changed =) -LWJGL_MAJOR_VERSION=0 -LWJGL_MINOR_VERSION=0 -LWJGL_MICRO_VERSION=0 -LWJGL_INTERFACE_AGE=1 -LWJGL_BINARY_AGE=1 -LWJGL_VERSION=$LWJGL_MAJOR_VERSION.$LWJGL_MINOR_VERSION.$LWJGL_MICRO_VERSION +AC_PREREQ(2.57) +AC_INIT +AM_INIT_AUTOMAKE(LWJGL, 0.7) +AC_CONFIG_SRCDIR([autogen.sh]) -AC_SUBST(LWJGL_MAJOR_VERSION) -AC_SUBST(LWJGL_MINOR_VERSION) -AC_SUBST(LWJGL_MICRO_VERSION) -AC_SUBST(LWJGL_INTERFACE_AGE) -AC_SUBST(LWJGL_BINARY_AGE) -AC_SUBST(LWJGL_VERSION) +AC_DISABLE_STATIC +AC_LIBTOOL_DLOPEN -# libtool versioning -LT_RELEASE=$LWJGL_MAJOR_VERSION.$LWJGL_MINOR_VERSION -LT_CURRENT=`expr $LWJGL_MICRO_VERSION - $LWJGL_INTERFACE_AGE` -LT_REVISION=$LWJGL_INTERFACE_AGE -LT_AGE=`expr $LWJGL_BINARY_AGE - $LWJGL_INTERFACE_AGE` - -AC_SUBST(LT_RELEASE) -AC_SUBST(LT_CURRENT) -AC_SUBST(LT_REVISION) -AC_SUBST(LT_AGE) - -AC_CONFIG_AUX_DIR(admin) - -#AC_CONFIG_SRCDIR(common/org_lwjgl_opengl_CoreGL.cpp) - -AM_INIT_AUTOMAKE(lwjgl, $LWJGL_VERSION) - -AM_CONFIG_HEADER(config.h) - -dnl Checks for programs. -dnl AC_PROG_CC -AC_PROG_RANLIB -AM_PROG_LIBTOOL -AC_PROG_MAKE_SET -AC_PROG_CPP +# Checks for programs. AC_PROG_CXX +AC_PROG_CC +AC_PROG_CPP +AC_PROG_INSTALL +AC_PROG_LN_S +AC_PROG_MAKE_SET +AC_PROG_LIBTOOL -AC_REQUIRE_CPP -AC_MSG_CHECKING(for JAVA_HOME) -if test "x$JAVA_HOME" = x; then - AC_MSG_ERROR([*** Please set the JAVA_HOME environment variable ]) -else - AC_MSG_RESULT($JAVA_HOME) - JAVA_HOME="$JAVA_HOME" - CPPFLAGS="$CPPFLAGS -D_DEBUG -fno-rtti -fno-exceptions -pthread -D_X11 -Wall -I$JAVA_HOME/include -I$JAVA_HOME/include/linux" - CFLAGS="$CFLAGS -D_DEBUG -pthread -D_X11 -Wall -I$JAVA_HOME/include -I$JAVA_HOME/include/linux" -fi +# Checks for libraries. -dnl Checks for libraries. -LIBS='-L/usr/X11R6/lib' +# Checks for header files. AC_PATH_X -dnl Replace `main' with a function in -lX11: -AC_CHECK_LIB(X11, main,, AC_MSG_ERROR(X11 is required)) -dnl Replace `main' with a function in -lXext: -AC_CHECK_LIB(Xext, main,, AC_MSG_ERROR(Xext is required)) -dnl Replace `main' with a function in -lXxf86vm: -AC_CHECK_LIB(Xxf86vm, main,, AC_MSG_ERROR(Xxf86vm is required)) -dnl Replace `main' with a function in -tpthread: -AC_CHECK_LIB(pthread, main,, AC_MSG_ERROR(pthread is required)) +AC_HEADER_STDC +AC_CHECK_HEADERS([stddef.h stdlib.h string.h sys/time.h]) -dnl Checks for header files. +# Checks for typedefs, structures, and compiler characteristics. +AC_HEADER_STDBOOL +AC_C_CONST +AC_C_INLINE +AC_HEADER_TIME -dnl Checks for typedefs, structures, and compiler characteristics. +# Checks for library functions. +AC_FUNC_MALLOC +AC_CHECK_FUNCS([gettimeofday memset strchr strstr]) -dnl Checks for library functions. - -AC_OUTPUT([Makefile common/Makefile linux/Makefile]) +AC_CONFIG_FILES([Makefile + common/Makefile + linux/Makefile]) +AC_OUTPUT diff --git a/src/native/dummy.cpp b/src/native/dummy.cpp deleted file mode 100644 index 14592983..00000000 --- a/src/native/dummy.cpp +++ /dev/null @@ -1,4 +0,0 @@ -/* This is needed for automake, so that it can build an empty archive */ - -int pointless_symbol_so_the_archive_doesnt_look_empty; -