[llvm-commits] [llvm-gcc-4.2] r43913 [57/80] - in /llvm-gcc-4.2/trunk: boehm-gc/ boehm-gc/Mac_files/ boehm-gc/cord/ boehm-gc/doc/ boehm-gc/include/ boehm-gc/include/private/ boehm-gc/tests/ libffi/ libffi/include/ libffi/src/ libffi/src/alpha/ libffi/src/arm/ libffi/src/cris/ libffi/src/frv/ libffi/src/ia64/ libffi/src/m32r/ libffi/src/m68k/ libffi/src/mips/ libffi/src/pa/ libffi/src/powerpc/ libffi/src/s390/ libffi/src/sh/ libffi/src/sh64/ libffi/src/sparc/ libffi/src/x86/ libffi/testsuite/ libffi/testsuite/config/ li...

Bill Wendling isanbard at gmail.com
Thu Nov 8 14:57:11 PST 2007


Added: llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/mprec.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/mprec.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/mprec.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/mprec.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,1021 @@
+/****************************************************************
+ *
+ * The author of this software is David M. Gay.
+ *
+ * Copyright (c) 1991 by AT&T.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose without fee is hereby granted, provided that this entire notice
+ * is included in all copies of any software which is or includes a copy
+ * or modification of this software and in all copies of the supporting
+ * documentation for such software.
+ *
+ * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED
+ * WARRANTY.  IN PARTICULAR, NEITHER THE AUTHOR NOR AT&T MAKES ANY
+ * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
+ * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
+ *
+ ***************************************************************/
+
+/* Please send bug reports to
+	David M. Gay
+	AT&T Bell Laboratories, Room 2C-463
+	600 Mountain Avenue
+	Murray Hill, NJ 07974-2070
+	U.S.A.
+	dmg at research.att.com or research!dmg
+ */
+
+/* strtod for IEEE-, VAX-, and IBM-arithmetic machines.
+ *
+ * This strtod returns a nearest machine number to the input decimal
+ * string (or sets errno to ERANGE).  With IEEE arithmetic, ties are
+ * broken by the IEEE round-even rule.  Otherwise ties are broken by
+ * biased rounding (add half and chop).
+ *
+ * Inspired loosely by William D. Clinger's paper "How to Read Floating
+ * Point Numbers Accurately" [Proc. ACM SIGPLAN '90, pp. 92-101].
+ *
+ * Modifications:
+ *
+ *	1. We only require IEEE, IBM, or VAX double-precision
+ *		arithmetic (not IEEE double-extended).
+ *	2. We get by with floating-point arithmetic in a case that
+ *		Clinger missed -- when we're computing d * 10^n
+ *		for a small integer d and the integer n is not too
+ *		much larger than 22 (the maximum integer k for which
+ *		we can represent 10^k exactly), we may be able to
+ *		compute (d*10^k) * 10^(e-k) with just one roundoff.
+ *	3. Rather than a bit-at-a-time adjustment of the binary
+ *		result in the hard case, we use floating-point
+ *		arithmetic to determine the adjustment to within
+ *		one bit; only in really hard cases do we need to
+ *		compute a second residual.
+ *	4. Because of 3., we don't need a large table of powers of 10
+ *		for ten-to-e (just some small tables, e.g. of 10^k
+ *		for 0 <= k <= 22).
+ */
+
+/*
+ * #define IEEE_8087 for IEEE-arithmetic machines where the least
+ *	significant byte has the lowest address.
+ * #define IEEE_MC68k for IEEE-arithmetic machines where the most
+ *	significant byte has the lowest address.
+ * #define Sudden_Underflow for IEEE-format machines without gradual
+ *	underflow (i.e., that flush to zero on underflow).
+ * #define IBM for IBM mainframe-style floating-point arithmetic.
+ * #define VAX for VAX-style floating-point arithmetic.
+ * #define Unsigned_Shifts if >> does treats its left operand as unsigned.
+ * #define No_leftright to omit left-right logic in fast floating-point
+ *	computation of dtoa.
+ * #define Check_FLT_ROUNDS if FLT_ROUNDS can assume the values 2 or 3.
+ * #define RND_PRODQUOT to use rnd_prod and rnd_quot (assembly routines
+ *	that use extended-precision instructions to compute rounded
+ *	products and quotients) with IBM.
+ * #define ROUND_BIASED for IEEE-format with biased rounding.
+ * #define Inaccurate_Divide for IEEE-format with correctly rounded
+ *	products but inaccurate quotients, e.g., for Intel i860.
+ * #define Just_16 to store 16 bits per 32-bit long when doing high-precision
+ *	integer arithmetic.  Whether this speeds things up or slows things
+ *	down depends on the machine and the number being converted.
+ */
+
+/*#include <_ansi.h>*/
+#include <assert.h>
+#include <stdlib.h>
+#include <string.h>
+/* #include <reent.h> */
+#include "mprec.h"
+
+/* reent.c knows this value */
+/* #define _Kmax 15 */
+
+#define _reent _Jv_reent
+#define _Bigint _Jv_Bigint
+
+#define _REENT_CHECK_MP(x)
+#define _REENT_MP_FREELIST(x) ((x)->_freelist)
+#define _REENT_MP_P5S(x) ((x)->_p5s)
+
+typedef unsigned long __ULong;
+typedef long __Long;
+
+static void *
+mprec_calloc (void *ignore, size_t x1, size_t x2)
+{
+  char *result = (char *) malloc (x1 * x2);
+  memset (result, 0, x1 * x2);
+  return result;
+}
+
+_Bigint *
+_DEFUN (Balloc, (ptr, k), struct _reent *ptr _AND int k)
+{
+  int x;
+  _Bigint *rv ;
+  int new_k = k + 1;
+
+  _REENT_CHECK_MP(ptr);
+  if (_REENT_MP_FREELIST(ptr) == NULL)
+    {
+      /* Allocate a list of pointers to the mprec objects */
+      _REENT_MP_FREELIST(ptr) = (struct _Bigint **) mprec_calloc (ptr, 
+						      sizeof (struct _Bigint *),
+							       new_k);
+      if (_REENT_MP_FREELIST(ptr) == NULL)
+	{
+	  return NULL;
+	}
+      ptr->_max_k = new_k;
+    }
+  else if (new_k > ptr->_max_k)
+    {
+      struct _Bigint **new_list
+	= (struct _Bigint **) realloc (ptr->_freelist,
+				       new_k * sizeof (struct _Bigint *));
+      memset (&new_list[ptr->_max_k], 0,
+	      (new_k - ptr->_max_k) * sizeof (struct _Bigint *));
+      ptr->_freelist = new_list;
+      ptr->_max_k = new_k;
+
+    }
+
+  assert (k <= ptr->_max_k);
+
+  if ((rv = _REENT_MP_FREELIST(ptr)[k]) != 0)
+    {
+      _REENT_MP_FREELIST(ptr)[k] = rv->_next;
+    }
+  else
+    {
+      x = 1 << k;
+      /* Allocate an mprec Bigint and stick in in the freelist */
+      rv = (_Bigint *) mprec_calloc (ptr,
+				  1,
+				  sizeof (_Bigint) +
+				  (x-1) * sizeof(rv->_x));
+      if (rv == NULL) return NULL;
+      rv->_k = k;
+      rv->_maxwds = x;
+    }
+  rv->_sign = rv->_wds = 0;
+  return rv;
+}
+
+void
+_DEFUN (Bfree, (ptr, v), struct _reent *ptr _AND _Bigint * v)
+{
+  _REENT_CHECK_MP(ptr);
+  if (v)
+    {
+      v->_next = _REENT_MP_FREELIST(ptr)[v->_k];
+      _REENT_MP_FREELIST(ptr)[v->_k] = v;
+    }
+}
+
+_Bigint *
+_DEFUN (multadd, (ptr, b, m, a),
+	struct _reent *ptr _AND
+	_Bigint * b _AND
+	int m _AND
+	int a)
+{
+  int i, wds;
+  __ULong *x, y;
+#ifdef Pack_32
+  __ULong xi, z;
+#endif
+  _Bigint *b1;
+
+  wds = b->_wds;
+  x = b->_x;
+  i = 0;
+  do
+    {
+#ifdef Pack_32
+      xi = *x;
+      y = (xi & 0xffff) * m + a;
+      z = (xi >> 16) * m + (y >> 16);
+      a = (int) (z >> 16);
+      *x++ = (z << 16) + (y & 0xffff);
+#else
+      y = *x * m + a;
+      a = (int) (y >> 16);
+      *x++ = y & 0xffff;
+#endif
+    }
+  while (++i < wds);
+  if (a)
+    {
+      if (wds >= b->_maxwds)
+	{
+	  b1 = Balloc (ptr, b->_k + 1);
+	  Bcopy (b1, b);
+	  Bfree (ptr, b);
+	  b = b1;
+	}
+      b->_x[wds++] = a;
+      b->_wds = wds;
+    }
+  return b;
+}
+
+_Bigint *
+_DEFUN (s2b, (ptr, s, nd0, nd, y9),
+	struct _reent * ptr _AND
+	_CONST char *s _AND
+	int nd0 _AND
+	int nd _AND
+	__ULong y9)
+{
+  _Bigint *b;
+  int i, k;
+  __Long x, y;
+
+  x = (nd + 8) / 9;
+  for (k = 0, y = 1; x > y; y <<= 1, k++);
+#ifdef Pack_32
+  b = Balloc (ptr, k);
+  b->_x[0] = y9;
+  b->_wds = 1;
+#else
+  b = Balloc (ptr, k + 1);
+  b->_x[0] = y9 & 0xffff;
+  b->_wds = (b->_x[1] = y9 >> 16) ? 2 : 1;
+#endif
+
+  i = 9;
+  if (9 < nd0)
+    {
+      s += 9;
+      do
+	b = multadd (ptr, b, 10, *s++ - '0');
+      while (++i < nd0);
+      s++;
+    }
+  else
+    s += 10;
+  for (; i < nd; i++)
+    b = multadd (ptr, b, 10, *s++ - '0');
+  return b;
+}
+
+int
+_DEFUN (hi0bits,
+	(x), register __ULong x)
+{
+  register int k = 0;
+
+  if (!(x & 0xffff0000))
+    {
+      k = 16;
+      x <<= 16;
+    }
+  if (!(x & 0xff000000))
+    {
+      k += 8;
+      x <<= 8;
+    }
+  if (!(x & 0xf0000000))
+    {
+      k += 4;
+      x <<= 4;
+    }
+  if (!(x & 0xc0000000))
+    {
+      k += 2;
+      x <<= 2;
+    }
+  if (!(x & 0x80000000))
+    {
+      k++;
+      if (!(x & 0x40000000))
+	return 32;
+    }
+  return k;
+}
+
+int
+_DEFUN (lo0bits, (y), __ULong *y)
+{
+  register int k;
+  register __ULong x = *y;
+
+  if (x & 7)
+    {
+      if (x & 1)
+	return 0;
+      if (x & 2)
+	{
+	  *y = x >> 1;
+	  return 1;
+	}
+      *y = x >> 2;
+      return 2;
+    }
+  k = 0;
+  if (!(x & 0xffff))
+    {
+      k = 16;
+      x >>= 16;
+    }
+  if (!(x & 0xff))
+    {
+      k += 8;
+      x >>= 8;
+    }
+  if (!(x & 0xf))
+    {
+      k += 4;
+      x >>= 4;
+    }
+  if (!(x & 0x3))
+    {
+      k += 2;
+      x >>= 2;
+    }
+  if (!(x & 1))
+    {
+      k++;
+      x >>= 1;
+      if (!x & 1)
+	return 32;
+    }
+  *y = x;
+  return k;
+}
+
+_Bigint *
+_DEFUN (i2b, (ptr, i), struct _reent * ptr _AND int i)
+{
+  _Bigint *b;
+
+  b = Balloc (ptr, 1);
+  b->_x[0] = i;
+  b->_wds = 1;
+  return b;
+}
+
+_Bigint *
+_DEFUN (mult, (ptr, a, b), struct _reent * ptr _AND _Bigint * a _AND _Bigint * b)
+{
+  _Bigint *c;
+  int k, wa, wb, wc;
+  __ULong carry, y, z;
+  __ULong *x, *xa, *xae, *xb, *xbe, *xc, *xc0;
+#ifdef Pack_32
+  __ULong z2;
+#endif
+
+  if (a->_wds < b->_wds)
+    {
+      c = a;
+      a = b;
+      b = c;
+    }
+  k = a->_k;
+  wa = a->_wds;
+  wb = b->_wds;
+  wc = wa + wb;
+  if (wc > a->_maxwds)
+    k++;
+  c = Balloc (ptr, k);
+  for (x = c->_x, xa = x + wc; x < xa; x++)
+    *x = 0;
+  xa = a->_x;
+  xae = xa + wa;
+  xb = b->_x;
+  xbe = xb + wb;
+  xc0 = c->_x;
+#ifdef Pack_32
+  for (; xb < xbe; xb++, xc0++)
+    {
+      if ((y = *xb & 0xffff) != 0)
+	{
+	  x = xa;
+	  xc = xc0;
+	  carry = 0;
+	  do
+	    {
+	      z = (*x & 0xffff) * y + (*xc & 0xffff) + carry;
+	      carry = z >> 16;
+	      z2 = (*x++ >> 16) * y + (*xc >> 16) + carry;
+	      carry = z2 >> 16;
+	      Storeinc (xc, z2, z);
+	    }
+	  while (x < xae);
+	  *xc = carry;
+	}
+      if ((y = *xb >> 16) != 0)
+	{
+	  x = xa;
+	  xc = xc0;
+	  carry = 0;
+	  z2 = *xc;
+	  do
+	    {
+	      z = (*x & 0xffff) * y + (*xc >> 16) + carry;
+	      carry = z >> 16;
+	      Storeinc (xc, z, z2);
+	      z2 = (*x++ >> 16) * y + (*xc & 0xffff) + carry;
+	      carry = z2 >> 16;
+	    }
+	  while (x < xae);
+	  *xc = z2;
+	}
+    }
+#else
+  for (; xb < xbe; xc0++)
+    {
+      if (y = *xb++)
+	{
+	  x = xa;
+	  xc = xc0;
+	  carry = 0;
+	  do
+	    {
+	      z = *x++ * y + *xc + carry;
+	      carry = z >> 16;
+	      *xc++ = z & 0xffff;
+	    }
+	  while (x < xae);
+	  *xc = carry;
+	}
+    }
+#endif
+  for (xc0 = c->_x, xc = xc0 + wc; wc > 0 && !*--xc; --wc);
+  c->_wds = wc;
+  return c;
+}
+
+_Bigint *
+_DEFUN (pow5mult,
+	(ptr, b, k), struct _reent * ptr _AND _Bigint * b _AND int k)
+{
+  _Bigint *b1, *p5, *p51;
+  int i;
+  static _CONST int p05[3] = {5, 25, 125};
+
+  if ((i = k & 3) != 0)
+    b = multadd (ptr, b, p05[i - 1], 0);
+
+  if (!(k >>= 2))
+    return b;
+  _REENT_CHECK_MP(ptr);
+  if (!(p5 = _REENT_MP_P5S(ptr)))
+    {
+      /* first time */
+      p5 = _REENT_MP_P5S(ptr) = i2b (ptr, 625);
+      p5->_next = 0;
+    }
+  for (;;)
+    {
+      if (k & 1)
+	{
+	  b1 = mult (ptr, b, p5);
+	  Bfree (ptr, b);
+	  b = b1;
+	}
+      if (!(k >>= 1))
+	break;
+      if (!(p51 = p5->_next))
+	{
+	  p51 = p5->_next = mult (ptr, p5, p5);
+	  p51->_next = 0;
+	}
+      p5 = p51;
+    }
+  return b;
+}
+
+_Bigint *
+_DEFUN (lshift, (ptr, b, k), struct _reent * ptr _AND _Bigint * b _AND int k)
+{
+  int i, k1, n, n1;
+  _Bigint *b1;
+  __ULong *x, *x1, *xe, z;
+
+#ifdef Pack_32
+  n = k >> 5;
+#else
+  n = k >> 4;
+#endif
+  k1 = b->_k;
+  n1 = n + b->_wds + 1;
+  for (i = b->_maxwds; n1 > i; i <<= 1)
+    k1++;
+  b1 = Balloc (ptr, k1);
+  x1 = b1->_x;
+  for (i = 0; i < n; i++)
+    *x1++ = 0;
+  x = b->_x;
+  xe = x + b->_wds;
+#ifdef Pack_32
+  if (k &= 0x1f)
+    {
+      k1 = 32 - k;
+      z = 0;
+      do
+	{
+	  *x1++ = *x << k | z;
+	  z = *x++ >> k1;
+	}
+      while (x < xe);
+      if ((*x1 = z) != 0)
+	++n1;
+    }
+#else
+  if (k &= 0xf)
+    {
+      k1 = 16 - k;
+      z = 0;
+      do
+	{
+	  *x1++ = *x << k & 0xffff | z;
+	  z = *x++ >> k1;
+	}
+      while (x < xe);
+      if (*x1 = z)
+	++n1;
+    }
+#endif
+  else
+    do
+      *x1++ = *x++;
+    while (x < xe);
+  b1->_wds = n1 - 1;
+  Bfree (ptr, b);
+  return b1;
+}
+
+int
+_DEFUN (cmp, (a, b), _Bigint * a _AND _Bigint * b)
+{
+  __ULong *xa, *xa0, *xb, *xb0;
+  int i, j;
+
+  i = a->_wds;
+  j = b->_wds;
+#ifdef DEBUG
+  if (i > 1 && !a->_x[i - 1])
+    Bug ("cmp called with a->_x[a->_wds-1] == 0");
+  if (j > 1 && !b->_x[j - 1])
+    Bug ("cmp called with b->_x[b->_wds-1] == 0");
+#endif
+  if (i -= j)
+    return i;
+  xa0 = a->_x;
+  xa = xa0 + j;
+  xb0 = b->_x;
+  xb = xb0 + j;
+  for (;;)
+    {
+      if (*--xa != *--xb)
+	return *xa < *xb ? -1 : 1;
+      if (xa <= xa0)
+	break;
+    }
+  return 0;
+}
+
+_Bigint *
+_DEFUN (diff, (ptr, a, b), struct _reent * ptr _AND
+	_Bigint * a _AND _Bigint * b)
+{
+  _Bigint *c;
+  int i, wa, wb;
+  __Long borrow, y;		/* We need signed shifts here. */
+  __ULong *xa, *xae, *xb, *xbe, *xc;
+#ifdef Pack_32
+  __Long z;
+#endif
+
+  i = cmp (a, b);
+  if (!i)
+    {
+      c = Balloc (ptr, 0);
+      c->_wds = 1;
+      c->_x[0] = 0;
+      return c;
+    }
+  if (i < 0)
+    {
+      c = a;
+      a = b;
+      b = c;
+      i = 1;
+    }
+  else
+    i = 0;
+  c = Balloc (ptr, a->_k);
+  c->_sign = i;
+  wa = a->_wds;
+  xa = a->_x;
+  xae = xa + wa;
+  wb = b->_wds;
+  xb = b->_x;
+  xbe = xb + wb;
+  xc = c->_x;
+  borrow = 0;
+#ifdef Pack_32
+  do
+    {
+      y = (*xa & 0xffff) - (*xb & 0xffff) + borrow;
+      borrow = y >> 16;
+      Sign_Extend (borrow, y);
+      z = (*xa++ >> 16) - (*xb++ >> 16) + borrow;
+      borrow = z >> 16;
+      Sign_Extend (borrow, z);
+      Storeinc (xc, z, y);
+    }
+  while (xb < xbe);
+  while (xa < xae)
+    {
+      y = (*xa & 0xffff) + borrow;
+      borrow = y >> 16;
+      Sign_Extend (borrow, y);
+      z = (*xa++ >> 16) + borrow;
+      borrow = z >> 16;
+      Sign_Extend (borrow, z);
+      Storeinc (xc, z, y);
+    }
+#else
+  do
+    {
+      y = *xa++ - *xb++ + borrow;
+      borrow = y >> 16;
+      Sign_Extend (borrow, y);
+      *xc++ = y & 0xffff;
+    }
+  while (xb < xbe);
+  while (xa < xae)
+    {
+      y = *xa++ + borrow;
+      borrow = y >> 16;
+      Sign_Extend (borrow, y);
+      *xc++ = y & 0xffff;
+    }
+#endif
+  while (!*--xc)
+    wa--;
+  c->_wds = wa;
+  return c;
+}
+
+double
+_DEFUN (ulp, (_x), double _x)
+{
+  union double_union x, a;
+  register int32_t L;
+
+  x.d = _x;
+
+  L = (word0 (x) & Exp_mask) - (P - 1) * Exp_msk1;
+#ifndef Sudden_Underflow
+  if (L > 0)
+    {
+#endif
+#ifdef IBM
+      L |= Exp_msk1 >> 4;
+#endif
+      word0 (a) = L;
+#ifndef _DOUBLE_IS_32BITS
+      word1 (a) = 0;
+#endif
+
+#ifndef Sudden_Underflow
+    }
+  else
+    {
+      L = -L >> Exp_shift;
+      if (L < Exp_shift)
+	{
+	  word0 (a) = 0x80000 >> L;
+#ifndef _DOUBLE_IS_32BITS
+	  word1 (a) = 0;
+#endif
+	}
+      else
+	{
+	  word0 (a) = 0;
+	  L -= Exp_shift;
+#ifndef _DOUBLE_IS_32BITS
+         word1 (a) = L >= 31 ? 1 : 1 << (31 - L);
+#endif
+	}
+    }
+#endif
+  return a.d;
+}
+
+double
+_DEFUN (b2d, (a, e),
+	_Bigint * a _AND int *e)
+{
+  __ULong *xa, *xa0, w, y, z;
+  int k;
+  union double_union d;
+#ifdef VAX
+  __ULong d0, d1;
+#else
+#define d0 word0(d)
+#define d1 word1(d)
+#endif
+
+  xa0 = a->_x;
+  xa = xa0 + a->_wds;
+  y = *--xa;
+#ifdef DEBUG
+  if (!y)
+    Bug ("zero y in b2d");
+#endif
+  k = hi0bits (y);
+  *e = 32 - k;
+#ifdef Pack_32
+  if (k < Ebits)
+    {
+      d0 = Exp_1 | y >> (Ebits - k);
+      w = xa > xa0 ? *--xa : 0;
+#ifndef _DOUBLE_IS_32BITS
+      d1 = y << ((32 - Ebits) + k) | w >> (Ebits - k);
+#endif
+      goto ret_d;
+    }
+  z = xa > xa0 ? *--xa : 0;
+  if (k -= Ebits)
+    {
+      d0 = Exp_1 | y << k | z >> (32 - k);
+      y = xa > xa0 ? *--xa : 0;
+#ifndef _DOUBLE_IS_32BITS
+      d1 = z << k | y >> (32 - k);
+#endif
+    }
+  else
+    {
+      d0 = Exp_1 | y;
+#ifndef _DOUBLE_IS_32BITS
+      d1 = z;
+#endif
+    }
+#else
+  if (k < Ebits + 16)
+    {
+      z = xa > xa0 ? *--xa : 0;
+      d0 = Exp_1 | y << k - Ebits | z >> Ebits + 16 - k;
+      w = xa > xa0 ? *--xa : 0;
+      y = xa > xa0 ? *--xa : 0;
+      d1 = z << k + 16 - Ebits | w << k - Ebits | y >> 16 + Ebits - k;
+      goto ret_d;
+    }
+  z = xa > xa0 ? *--xa : 0;
+  w = xa > xa0 ? *--xa : 0;
+  k -= Ebits + 16;
+  d0 = Exp_1 | y << k + 16 | z << k | w >> 16 - k;
+  y = xa > xa0 ? *--xa : 0;
+  d1 = w << k + 16 | y << k;
+#endif
+ret_d:
+#ifdef VAX
+  word0 (d) = d0 >> 16 | d0 << 16;
+  word1 (d) = d1 >> 16 | d1 << 16;
+#else
+#undef d0
+#undef d1
+#endif
+  return d.d;
+}
+
+_Bigint *
+_DEFUN (d2b,
+	(ptr, _d, e, bits),
+	struct _reent * ptr _AND
+	double _d _AND
+	int *e _AND
+	int *bits)
+
+{
+  union double_union d;
+  _Bigint *b;
+  int de, i, k;
+  __ULong *x, y, z;
+#ifdef VAX
+  __ULong d0, d1;
+#endif
+  d.d = _d;
+#ifdef VAX
+  d0 = word0 (d) >> 16 | word0 (d) << 16;
+  d1 = word1 (d) >> 16 | word1 (d) << 16;
+#else
+#define d0 word0(d)
+#define d1 word1(d)
+  d.d = _d;
+#endif
+
+#ifdef Pack_32
+  b = Balloc (ptr, 1);
+#else
+  b = Balloc (ptr, 2);
+#endif
+  x = b->_x;
+
+  z = d0 & Frac_mask;
+  d0 &= 0x7fffffff;		/* clear sign bit, which we ignore */
+#ifdef Sudden_Underflow
+  de = (int) (d0 >> Exp_shift);
+#ifndef IBM
+  z |= Exp_msk11;
+#endif
+#else
+  if ((de = (int) (d0 >> Exp_shift)) != 0)
+    z |= Exp_msk1;
+#endif
+#ifdef Pack_32
+#ifndef _DOUBLE_IS_32BITS
+  if (d1)
+    {
+      y = d1;
+      k = lo0bits (&y);
+      if (k)
+	{
+         x[0] = y | z << (32 - k);
+	  z >>= k;
+	}
+      else
+	x[0] = y;
+      i = b->_wds = (x[1] = z) ? 2 : 1;
+    }
+  else
+#endif
+    {
+#ifdef DEBUG
+      if (!z)
+	Bug ("Zero passed to d2b");
+#endif
+      k = lo0bits (&z);
+      x[0] = z;
+      i = b->_wds = 1;
+#ifndef _DOUBLE_IS_32BITS
+      k += 32;
+#endif
+    }
+#else
+  if (d1)
+    {
+      y = d1;
+      k = lo0bits (&y);
+      if (k)
+	if (k >= 16)
+	  {
+	    x[0] = y | z << 32 - k & 0xffff;
+	    x[1] = z >> k - 16 & 0xffff;
+	    x[2] = z >> k;
+	    i = 2;
+	  }
+	else
+	  {
+	    x[0] = y & 0xffff;
+	    x[1] = y >> 16 | z << 16 - k & 0xffff;
+	    x[2] = z >> k & 0xffff;
+	    x[3] = z >> k + 16;
+	    i = 3;
+	  }
+      else
+	{
+	  x[0] = y & 0xffff;
+	  x[1] = y >> 16;
+	  x[2] = z & 0xffff;
+	  x[3] = z >> 16;
+	  i = 3;
+	}
+    }
+  else
+    {
+#ifdef DEBUG
+      if (!z)
+	Bug ("Zero passed to d2b");
+#endif
+      k = lo0bits (&z);
+      if (k >= 16)
+	{
+	  x[0] = z;
+	  i = 0;
+	}
+      else
+	{
+	  x[0] = z & 0xffff;
+	  x[1] = z >> 16;
+	  i = 1;
+	}
+      k += 32;
+    }
+  while (!x[i])
+    --i;
+  b->_wds = i + 1;
+#endif
+#ifndef Sudden_Underflow
+  if (de)
+    {
+#endif
+#ifdef IBM
+      *e = (de - Bias - (P - 1) << 2) + k;
+      *bits = 4 * P + 8 - k - hi0bits (word0 (d) & Frac_mask);
+#else
+      *e = de - Bias - (P - 1) + k;
+      *bits = P - k;
+#endif
+#ifndef Sudden_Underflow
+    }
+  else
+    {
+      *e = de - Bias - (P - 1) + 1 + k;
+#ifdef Pack_32
+      *bits = 32 * i - hi0bits (x[i - 1]);
+#else
+      *bits = (i + 2) * 16 - hi0bits (x[i]);
+#endif
+    }
+#endif
+  return b;
+}
+#undef d0
+#undef d1
+
+double
+_DEFUN (ratio, (a, b), _Bigint * a _AND _Bigint * b)
+
+{
+  union double_union da, db;
+  int k, ka, kb;
+
+  da.d = b2d (a, &ka);
+  db.d = b2d (b, &kb);
+#ifdef Pack_32
+  k = ka - kb + 32 * (a->_wds - b->_wds);
+#else
+  k = ka - kb + 16 * (a->_wds - b->_wds);
+#endif
+#ifdef IBM
+  if (k > 0)
+    {
+      word0 (da) += (k >> 2) * Exp_msk1;
+      if (k &= 3)
+	da.d *= 1 << k;
+    }
+  else
+    {
+      k = -k;
+      word0 (db) += (k >> 2) * Exp_msk1;
+      if (k &= 3)
+	db.d *= 1 << k;
+    }
+#else
+  if (k > 0)
+    word0 (da) += k * Exp_msk1;
+  else
+    {
+      k = -k;
+      word0 (db) += k * Exp_msk1;
+    }
+#endif
+  return da.d / db.d;
+}
+
+
+_CONST double
+  tens[] =
+{
+  1e0, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9,
+  1e10, 1e11, 1e12, 1e13, 1e14, 1e15, 1e16, 1e17, 1e18, 1e19,
+  1e20, 1e21, 1e22, 1e23, 1e24
+
+};
+
+#if !defined(_DOUBLE_IS_32BITS) && !defined(__v800)
+_CONST double bigtens[] =
+{1e16, 1e32, 1e64, 1e128, 1e256};
+
+_CONST double tinytens[] =
+{1e-16, 1e-32, 1e-64, 1e-128, 1e-256};
+#else
+_CONST double bigtens[] =
+{1e16, 1e32};
+
+_CONST double tinytens[] =
+{1e-16, 1e-32};
+#endif
+
+
+double
+_DEFUN (_mprec_log10, (dig),
+	int dig)
+{
+  double v = 1.0;
+  if (dig < 24)
+    return tens[dig];
+  while (dig > 0)
+    {
+      v *= 10;
+      dig--;
+    }
+  return v;
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/mprec.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/mprec.h?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/mprec.h (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/mprec.h Thu Nov  8 16:56:19 2007
@@ -0,0 +1,385 @@
+/****************************************************************
+ *
+ * The author of this software is David M. Gay.
+ *
+ * Copyright (c) 1991, 2000 by AT&T.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose without fee is hereby granted, provided that this entire notice
+ * is included in all copies of any software which is or includes a copy
+ * or modification of this software and in all copies of the supporting
+ * documentation for such software.
+ *
+ * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED
+ * WARRANTY.  IN PARTICULAR, NEITHER THE AUTHOR NOR AT&T MAKES ANY
+ * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
+ * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
+ *
+ ***************************************************************/
+
+/* Please send bug reports to
+	David M. Gay
+	AT&T Bell Laboratories, Room 2C-463
+	600 Mountain Avenue
+	Murray Hill, NJ 07974-2070
+	U.S.A.
+	dmg at research.att.com or research!dmg
+ */
+
+#ifndef __CLASSPATH_MPREC_H__
+#define __CLASSPATH_MPREC_H__
+
+#include <config.h>
+#include "config-int.h"
+#include "ieeefp.h"
+/* CLASSPATH LOCAL */
+#include "namespace.h"
+
+#if defined HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+
+#if defined HAVE_SYS_CONFIG_H
+#include <sys/config.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+  /* These typedefs are true for the targets running Java. */
+
+#ifdef __IEEE_LITTLE_ENDIAN
+#define IEEE_8087
+#endif
+
+#ifdef __IEEE_BIG_ENDIAN
+#define IEEE_MC68k
+#endif
+
+#ifdef __Z8000__
+#define Just_16
+#endif
+
+#ifdef DEBUG
+#include "stdio.h"
+#include <stdlib.h>
+#define Bug(x) {fprintf(stderr, "%s\n", x); exit(1);}
+#endif
+
+
+#ifdef Unsigned_Shifts
+#define Sign_Extend(a,b) if (b < 0) a |= (uint32_t)0xffff0000;
+#else
+#define Sign_Extend(a,b) /*no-op*/
+#endif
+
+#if defined(IEEE_8087) + defined(IEEE_MC68k) + defined(VAX) + defined(IBM) != 1
+Exactly one of IEEE_8087, IEEE_MC68k, VAX, or IBM should be defined.
+#endif
+
+/* If we are going to examine or modify specific bits in a double using
+   the word0 and/or word1 macros, then we must wrap the double inside
+   a union.  This is necessary to avoid undefined behavior according to
+   the ANSI C spec.  */
+union double_union
+{
+  double d;
+  uint32_t i[2];
+};
+
+#ifdef IEEE_8087
+#define word0(x) (x.i[1])
+#define word1(x) (x.i[0])
+#else
+#define word0(x) (x.i[0])
+#define word1(x) (x.i[1])
+#endif
+
+/* The following definition of Storeinc is appropriate for MIPS processors.
+ * An alternative that might be better on some machines is
+ * #define Storeinc(a,b,c) (*a++ = b << 16 | c & 0xffff)
+ */
+#if defined(IEEE_8087) + defined(VAX)
+#define Storeinc(a,b,c) (((unsigned short *)a)[1] = (unsigned short)b, \
+((unsigned short *)a)[0] = (unsigned short)c, a++)
+#else
+#define Storeinc(a,b,c) (((unsigned short *)a)[0] = (unsigned short)b, \
+((unsigned short *)a)[1] = (unsigned short)c, a++)
+#endif
+
+/* #define P DBL_MANT_DIG */
+/* Ten_pmax = floor(P*log(2)/log(5)) */
+/* Bletch = (highest power of 2 < DBL_MAX_10_EXP) / 16 */
+/* Quick_max = floor((P-1)*log(FLT_RADIX)/log(10) - 1) */
+/* Int_max = floor(P*log(FLT_RADIX)/log(10) - 1) */
+
+#if defined(IEEE_8087) + defined(IEEE_MC68k)
+#if defined (_DOUBLE_IS_32BITS)
+#define Exp_shift   23
+#define Exp_shift1  23
+#define Exp_msk1    ((uint32_t)0x00800000L)
+#define Exp_msk11   ((uint32_t)0x00800000L)
+#define Exp_mask    ((uint32_t)0x7f800000L)
+#define P    	    24
+#define Bias 	    127
+#if 0
+#define IEEE_Arith  /* it is, but the code doesn't handle IEEE singles yet */
+#endif
+#define Emin        (-126)
+#define Exp_1       ((uint32_t)0x3f800000L)
+#define Exp_11      ((uint32_t)0x3f800000L)
+#define Ebits 	    8
+#define Frac_mask   ((uint32_t)0x007fffffL)
+#define Frac_mask1  ((uint32_t)0x007fffffL)
+#define Ten_pmax    10
+#define Sign_bit    ((uint32_t)0x80000000L)
+#define Ten_pmax    10
+#define Bletch	    2
+#define Bndry_mask  ((uint32_t)0x007fffffL)
+#define Bndry_mask1 ((uint32_t)0x007fffffL)
+#define LSB 1
+#define Sign_bit    ((uint32_t)0x80000000L)
+#define Log2P 	    1
+#define Tiny0 	    0
+#define Tiny1 	    1
+#define Quick_max   5
+#define Int_max     6
+#define Infinite(x) (word0(x) == ((uint32_t)0x7f800000L))
+#undef word0
+#undef word1
+
+#define word0(x) (x.i[0])
+#define word1(x) 0
+#else
+
+#define Exp_shift  20
+#define Exp_shift1 20
+#define Exp_msk1    ((uint32_t)0x100000L)
+#define Exp_msk11   ((uint32_t)0x100000L)
+#define Exp_mask  ((uint32_t)0x7ff00000L)
+#define P 53
+#define Bias 1023
+#define IEEE_Arith
+#define Emin (-1022)
+#define Exp_1  ((uint32_t)0x3ff00000L)
+#define Exp_11 ((uint32_t)0x3ff00000L)
+#define Ebits 11
+#define Frac_mask  ((uint32_t)0xfffffL)
+#define Frac_mask1 ((uint32_t)0xfffffL)
+#define Ten_pmax 22
+#define Bletch 0x10
+#define Bndry_mask  ((uint32_t)0xfffffL)
+#define Bndry_mask1 ((uint32_t)0xfffffL)
+#define LSB 1
+#define Sign_bit ((uint32_t)0x80000000L)
+#define Log2P 1
+#define Tiny0 0
+#define Tiny1 1
+#define Quick_max 14
+#define Int_max 14
+#define Infinite(x) (word0(x) == ((uint32_t)0x7ff00000L)) /* sufficient test for here */
+#endif
+
+#else
+#undef  Sudden_Underflow
+#define Sudden_Underflow
+#ifdef IBM
+#define Exp_shift  24
+#define Exp_shift1 24
+#define Exp_msk1   ((uint32_t)0x1000000L)
+#define Exp_msk11  ((uint32_t)0x1000000L)
+#define Exp_mask  ((uint32_t)0x7f000000L)
+#define P 14
+#define Bias 65
+#define Exp_1  ((uint32_t)0x41000000L)
+#define Exp_11 ((uint32_t)0x41000000L)
+#define Ebits 8	/* exponent has 7 bits, but 8 is the right value in b2d */
+#define Frac_mask  ((uint32_t)0xffffffL)
+#define Frac_mask1 ((uint32_t)0xffffffL)
+#define Bletch 4
+#define Ten_pmax 22
+#define Bndry_mask  ((uint32_t)0xefffffL)
+#define Bndry_mask1 ((uint32_t)0xffffffL)
+#define LSB 1
+#define Sign_bit ((uint32_t)0x80000000L)
+#define Log2P 4
+#define Tiny0 ((uint32_t)0x100000L)
+#define Tiny1 0
+#define Quick_max 14
+#define Int_max 15
+#else /* VAX */
+#define Exp_shift  23
+#define Exp_shift1 7
+#define Exp_msk1    0x80
+#define Exp_msk11   ((uint32_t)0x800000L)
+#define Exp_mask  ((uint32_t)0x7f80L)
+#define P 56
+#define Bias 129
+#define Exp_1  ((uint32_t)0x40800000L)
+#define Exp_11 ((uint32_t)0x4080L)
+#define Ebits 8
+#define Frac_mask  ((uint32_t)0x7fffffL)
+#define Frac_mask1 ((uint32_t)0xffff007fL)
+#define Ten_pmax 24
+#define Bletch 2
+#define Bndry_mask  ((uint32_t)0xffff007fL)
+#define Bndry_mask1 ((uint32_t)0xffff007fL)
+#define LSB ((uint32_t)0x10000L)
+#define Sign_bit ((uint32_t)0x8000L)
+#define Log2P 1
+#define Tiny0 0x80
+#define Tiny1 0
+#define Quick_max 15
+#define Int_max 15
+#endif
+#endif
+
+#ifndef IEEE_Arith
+#define ROUND_BIASED
+#endif
+
+#ifdef RND_PRODQUOT
+#define rounded_product(a,b) a = rnd_prod(a, b)
+#define rounded_quotient(a,b) a = rnd_quot(a, b)
+#ifdef KR_headers
+extern double rnd_prod(), rnd_quot();
+#else
+extern double rnd_prod(double, double), rnd_quot(double, double);
+#endif
+#else
+#define rounded_product(a,b) a *= b
+#define rounded_quotient(a,b) a /= b
+#endif
+
+#define Big0 (Frac_mask1 | Exp_msk1*(DBL_MAX_EXP+Bias-1))
+#define Big1 ((uint32_t)0xffffffffL)
+
+#ifndef Just_16
+/* When Pack_32 is not defined, we store 16 bits per 32-bit long.
+ * This makes some inner loops simpler and sometimes saves work
+ * during multiplications, but it often seems to make things slightly
+ * slower.  Hence the default is now to store 32 bits per long.
+ */
+
+#ifndef Pack_32
+#if SIZEOF_VOID_P != 8
+#define Pack_32
+#endif
+#endif
+#endif
+
+
+#define MAX_BIGNUMS 16
+#ifdef Pack_32
+#define MAX_BIGNUM_WDS 32
+#else
+  /* Note that this is a workaround for */
+#define MAX_BIGNUM_WDS 128
+#endif
+
+struct _Jv_Bigint
+{
+  struct _Jv_Bigint *_next;
+  int _k, _maxwds, _sign, _wds;
+  unsigned long _x[1];
+};
+
+
+#define	_PTR		void *
+#define	_AND		,
+#define	_NOARGS		void
+#define	_CONST		const
+#define	_VOLATILE	volatile
+#define	_SIGNED		signed
+#define	_DOTS		, ...
+#define _VOID void
+#define	_EXFUN(name, proto)		name proto
+#define	_DEFUN(name, arglist, args)	name(args)
+#define	_DEFUN_VOID(name)		name(_NOARGS)
+#define _CAST_VOID (void)
+
+
+struct _Jv_reent
+{
+  /* local copy of errno */
+  int _errno;
+
+  /* used by mprec routines */
+  struct _Jv_Bigint *_result;
+  int _result_k;
+  struct _Jv_Bigint *_p5s;
+
+  struct _Jv_Bigint **_freelist;
+  int _max_k;
+};
+
+
+typedef struct _Jv_Bigint _Jv_Bigint;
+
+#define Balloc  _Jv_Balloc
+#define Bfree   _Jv_Bfree
+#define multadd _Jv_multadd
+#define s2b     _Jv_s2b
+#define lo0bits _Jv_lo0bits
+#define hi0bits _Jv_hi0bits
+#define i2b     _Jv_i2b
+#define mult    _Jv_mult
+#define pow5mult        _Jv_pow5mult
+#define lshift  _Jv_lshift
+#define cmp     _Jv__mcmp
+#define diff    _Jv__mdiff
+#define ulp     _Jv_ulp
+#define b2d     _Jv_b2d
+#define d2b     _Jv_d2b
+#define ratio   _Jv_ratio
+
+#define tens _Jv__mprec_tens
+#define bigtens _Jv__mprec_bigtens
+#define tinytens _Jv__mprec_tinytens
+
+#define _dtoa _Jv_dtoa
+#define _dtoa_r _Jv_dtoa_r
+#define _strtod_r _Jv_strtod_r
+
+extern double _EXFUN(_strtod_r, (struct _Jv_reent *ptr, const char *s00, char **se));
+extern char* _EXFUN(_dtoa_r, (struct _Jv_reent *ptr, double d,
+			      int mode, int ndigits, int *decpt, int *sign,
+			      char **rve, int float_type));
+void _EXFUN(_dtoa, (double d, int mode, int ndigits, int *decpt, int *sign,
+		    char **rve, char *buf, int float_type));
+
+double 		_EXFUN(ulp,(double x));
+double		_EXFUN(b2d,(_Jv_Bigint *a , int *e));
+_Jv_Bigint *	_EXFUN(Balloc,(struct _Jv_reent *p, int k));
+void 		_EXFUN(Bfree,(struct _Jv_reent *p, _Jv_Bigint *v));
+_Jv_Bigint *	_EXFUN(multadd,(struct _Jv_reent *p, _Jv_Bigint *, int, int));
+_Jv_Bigint *	_EXFUN(s2b,(struct _Jv_reent *, const char*, int, int, unsigned long));
+_Jv_Bigint *	_EXFUN(i2b,(struct _Jv_reent *,int));
+_Jv_Bigint *	_EXFUN(mult, (struct _Jv_reent *, _Jv_Bigint *, _Jv_Bigint *));
+_Jv_Bigint *	_EXFUN(pow5mult, (struct _Jv_reent *, _Jv_Bigint *, int k));
+int 		_EXFUN(hi0bits,(unsigned long));
+int 		_EXFUN(lo0bits,(unsigned long *));
+_Jv_Bigint *    _EXFUN(d2b,(struct _Jv_reent *p, double d, int *e, int *bits));
+_Jv_Bigint *    _EXFUN(lshift,(struct _Jv_reent *p, _Jv_Bigint *b, int k));
+_Jv_Bigint *    _EXFUN(diff,(struct _Jv_reent *p, _Jv_Bigint *a, _Jv_Bigint *b));
+int             _EXFUN(cmp,(_Jv_Bigint *a, _Jv_Bigint *b));
+
+double		_EXFUN(ratio,(_Jv_Bigint *a, _Jv_Bigint *b));
+#define Bcopy(x,y) memcpy((char *)&x->_sign, (char *)&y->_sign, y->_wds*sizeof(long) + 2*sizeof(int))
+
+#if defined(_DOUBLE_IS_32BITS) && defined(__v800)
+#define n_bigtens 2
+#else
+#define n_bigtens 5
+#endif
+
+extern _CONST double tinytens[];
+extern _CONST double bigtens[];
+extern _CONST double tens[];
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __CLASSPATH_MPREC_H__ */

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/namespace.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/namespace.h?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/namespace.h (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/namespace.h Thu Nov  8 16:56:19 2007
@@ -0,0 +1,3 @@
+/* GCJ LOCAL We don't use the renaming here, so this file is empty for us.
+ * Warning ! This is a generated file. Use build_mathnamespace to regenerate it
+ */

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/s_atan.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/s_atan.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/s_atan.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/s_atan.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,140 @@
+
+/* @(#)s_atan.c 1.3 95/01/18 */
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunSoft, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice 
+ * is preserved.
+ * ====================================================
+ *
+ */
+
+/* atan(x)
+ * Method
+ *   1. Reduce x to positive by atan(x) = -atan(-x).
+ *   2. According to the integer k=4t+0.25 chopped, t=x, the argument
+ *      is further reduced to one of the following intervals and the
+ *      arctangent of t is evaluated by the corresponding formula:
+ *
+ *      [0,7/16]      atan(x) = t-t^3*(a1+t^2*(a2+...(a10+t^2*a11)...)
+ *      [7/16,11/16]  atan(x) = atan(1/2) + atan( (t-0.5)/(1+t/2) )
+ *      [11/16.19/16] atan(x) = atan( 1 ) + atan( (t-1)/(1+t) )
+ *      [19/16,39/16] atan(x) = atan(3/2) + atan( (t-1.5)/(1+1.5t) )
+ *      [39/16,INF]   atan(x) = atan(INF) + atan( -1/t )
+ *
+ * Constants:
+ * The hexadecimal values are the intended ones for the following 
+ * constants. The decimal values may be used, provided that the 
+ * compiler will convert from decimal to binary accurately enough 
+ * to produce the hexadecimal values shown.
+ */
+
+#include "fdlibm.h"
+
+#ifndef _DOUBLE_IS_32BITS
+
+#ifdef __STDC__
+static const double atanhi[] = {
+#else
+static double atanhi[] = {
+#endif
+  4.63647609000806093515e-01, /* atan(0.5)hi 0x3FDDAC67, 0x0561BB4F */
+  7.85398163397448278999e-01, /* atan(1.0)hi 0x3FE921FB, 0x54442D18 */
+  9.82793723247329054082e-01, /* atan(1.5)hi 0x3FEF730B, 0xD281F69B */
+  1.57079632679489655800e+00, /* atan(inf)hi 0x3FF921FB, 0x54442D18 */
+};
+
+#ifdef __STDC__
+static const double atanlo[] = {
+#else
+static double atanlo[] = {
+#endif
+  2.26987774529616870924e-17, /* atan(0.5)lo 0x3C7A2B7F, 0x222F65E2 */
+  3.06161699786838301793e-17, /* atan(1.0)lo 0x3C81A626, 0x33145C07 */
+  1.39033110312309984516e-17, /* atan(1.5)lo 0x3C700788, 0x7AF0CBBD */
+  6.12323399573676603587e-17, /* atan(inf)lo 0x3C91A626, 0x33145C07 */
+};
+
+#ifdef __STDC__
+static const double aT[] = {
+#else
+static double aT[] = {
+#endif
+  3.33333333333329318027e-01, /* 0x3FD55555, 0x5555550D */
+ -1.99999999998764832476e-01, /* 0xBFC99999, 0x9998EBC4 */
+  1.42857142725034663711e-01, /* 0x3FC24924, 0x920083FF */
+ -1.11111104054623557880e-01, /* 0xBFBC71C6, 0xFE231671 */
+  9.09088713343650656196e-02, /* 0x3FB745CD, 0xC54C206E */
+ -7.69187620504482999495e-02, /* 0xBFB3B0F2, 0xAF749A6D */
+  6.66107313738753120669e-02, /* 0x3FB10D66, 0xA0D03D51 */
+ -5.83357013379057348645e-02, /* 0xBFADDE2D, 0x52DEFD9A */
+  4.97687799461593236017e-02, /* 0x3FA97B4B, 0x24760DEB */
+ -3.65315727442169155270e-02, /* 0xBFA2B444, 0x2C6A6C2F */
+  1.62858201153657823623e-02, /* 0x3F90AD3A, 0xE322DA11 */
+};
+
+#ifdef __STDC__
+	static const double 
+#else
+	static double 
+#endif
+one   = 1.0,
+huge   = 1.0e300;
+
+#ifdef __STDC__
+	double atan(double x)
+#else
+	double atan(x)
+	double x;
+#endif
+{
+	double w,s1,s2,z;
+	int32_t ix,hx,id;
+
+	GET_HIGH_WORD(hx,x);
+	ix = hx&0x7fffffff;
+	if(ix>=0x44100000) {	/* if |x| >= 2^66 */
+   	    uint32_t low;
+
+	    GET_LOW_WORD(low,x);
+	    if(ix>0x7ff00000||
+		(ix==0x7ff00000&&(low!=0)))
+		return x+x;		/* NaN */
+	    if(hx>0) return  atanhi[3]+atanlo[3];
+	    else     return -atanhi[3]-atanlo[3];
+	} if (ix < 0x3fdc0000) {	/* |x| < 0.4375 */
+	    if (ix < 0x3e200000) {	/* |x| < 2^-29 */
+		if(huge+x>one) return x;	/* raise inexact */
+	    }
+	    id = -1;
+	} else {
+	x = fabs(x);
+	if (ix < 0x3ff30000) {		/* |x| < 1.1875 */
+	    if (ix < 0x3fe60000) {	/* 7/16 <=|x|<11/16 */
+		id = 0; x = (2.0*x-one)/(2.0+x); 
+	    } else {			/* 11/16<=|x|< 19/16 */
+		id = 1; x  = (x-one)/(x+one); 
+	    }
+	} else {
+	    if (ix < 0x40038000) {	/* |x| < 2.4375 */
+		id = 2; x  = (x-1.5)/(one+1.5*x);
+	    } else {			/* 2.4375 <= |x| < 2^66 */
+		id = 3; x  = -1.0/x;
+	    }
+	}}
+    /* end of argument reduction */
+	z = x*x;
+	w = z*z;
+    /* break sum from i=0 to 10 aT[i]z**(i+1) into odd and even poly */
+	s1 = z*(aT[0]+w*(aT[2]+w*(aT[4]+w*(aT[6]+w*(aT[8]+w*aT[10])))));
+	s2 = w*(aT[1]+w*(aT[3]+w*(aT[5]+w*(aT[7]+w*aT[9]))));
+	if (id<0) return x - x*(s1+s2);
+	else {
+	    z = atanhi[id] - ((x*(s1+s2) - atanlo[id]) - x);
+	    return (hx<0)? -z:z;
+	}
+}
+#endif /* _DOUBLE_IS_32BITS */

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/s_cbrt.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/s_cbrt.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/s_cbrt.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/s_cbrt.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,96 @@
+
+/* @(#)s_cbrt.c 1.3 95/01/18 */
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunSoft, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice 
+ * is preserved.
+ * ====================================================
+ *
+ */
+
+#include "fdlibm.h"
+
+#ifndef _DOUBLE_IS_32BITS
+
+/* cbrt(x)
+ * Return cube root of x
+ */
+#ifdef __STDC__
+static const uint32_t 
+#else
+static uint32_t
+#endif
+	B1 = 715094163, /* B1 = (682-0.03306235651)*2**20 */
+	B2 = 696219795; /* B2 = (664-0.03306235651)*2**20 */
+
+#ifdef __STDC__
+static const double
+#else
+static double
+#endif
+C =  5.42857142857142815906e-01, /* 19/35     = 0x3FE15F15, 0xF15F15F1 */
+D = -7.05306122448979611050e-01, /* -864/1225 = 0xBFE691DE, 0x2532C834 */
+E =  1.41428571428571436819e+00, /* 99/70     = 0x3FF6A0EA, 0x0EA0EA0F */
+F =  1.60714285714285720630e+00, /* 45/28     = 0x3FF9B6DB, 0x6DB6DB6E */
+G =  3.57142857142857150787e-01; /* 5/14      = 0x3FD6DB6D, 0xB6DB6DB7 */
+
+#ifdef __STDC__
+	double cbrt(double x) 
+#else
+	double cbrt(x) 
+	double x;
+#endif
+{
+	int32_t	hx, lx, ht;
+	double r,s,t=0.0,w;
+	uint32_t sign;
+
+
+	GET_HIGH_WORD(hx,x); /* high word of x */
+	sign=hx&0x80000000; 		/* sign= sign(x) */
+	hx  ^=sign;
+	if(hx>=0x7ff00000) return(x+x); /* cbrt(NaN,INF) is itself */
+	GET_LOW_WORD(lx, x);
+	if((hx|lx)==0) 
+	    return(x);		/* cbrt(0) is itself */
+
+	SET_HIGH_WORD(x,hx); /* x <- |x| */
+    /* rough cbrt to 5 bits */
+	if(hx<0x00100000) 		/* subnormal number */
+	  {
+	    SET_HIGH_WORD(t,0x43500000); 		/* set t= 2**54 */
+	    t*=x; 
+	    GET_HIGH_WORD(ht,t);
+	    SET_HIGH_WORD(t,ht/3+B2);
+	  }
+	else
+	  SET_HIGH_WORD(t,hx/3+B1);	
+
+
+    /* new cbrt to 23 bits, may be implemented in single precision */
+	r=t*t/x;
+	s=C+r*t;
+	t*=G+F/(s+E+D/s);	
+
+    /* chopped to 20 bits and make it larger than cbrt(x) */ 
+	SET_LOW_WORD(t,0);
+	GET_HIGH_WORD(ht,t);
+	SET_HIGH_WORD(t,ht + 0x00000001);
+
+    /* one step newton iteration to 53 bits with error less than 0.667 ulps */
+	s=t*t;		/* t*t is exact */
+	r=x/s;
+	w=t+t;
+	r=(r-t)/(w+r);	/* r-s is exact */
+	t=t+t*r;
+
+    /* retore the sign bit */
+	GET_HIGH_WORD(ht,t);
+	SET_HIGH_WORD(t,ht|sign);
+	return(t);
+}
+#endif /* _DOUBLE_IS_32BITS */

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/s_ceil.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/s_ceil.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/s_ceil.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/s_ceil.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,80 @@
+
+/* @(#)s_ceil.c 1.3 95/01/18 */
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunSoft, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice 
+ * is preserved.
+ * ====================================================
+ */
+
+/*
+ * ceil(x)
+ * Return x rounded toward -inf to integral value
+ * Method:
+ *	Bit twiddling.
+ * Exception:
+ *	Inexact flag raised if x not equal to ceil(x).
+ */
+
+#include "fdlibm.h"
+
+#ifndef _DOUBLE_IS_32BITS
+
+#ifdef __STDC__
+static const double huge = 1.0e300;
+#else
+static double huge = 1.0e300;
+#endif
+
+#ifdef __STDC__
+	double ceil(double x)
+#else
+	double ceil(x)
+	double x;
+#endif
+{
+	int32_t i0,i1,j0;
+	uint32_t i,j;
+	EXTRACT_WORDS(i0,i1,x);
+	j0 = ((i0>>20)&0x7ff)-0x3ff;
+	if(j0<20) {
+	    if(j0<0) { 	/* raise inexact if x != 0 */
+		if(huge+x>0.0) {/* return 0*sign(x) if |x|<1 */
+		    if(i0<0) {i0=0x80000000;i1=0;} 
+		    else if((i0|i1)!=0) { i0=0x3ff00000;i1=0;}
+		}
+	    } else {
+		i = (0x000fffff)>>j0;
+		if(((i0&i)|i1)==0) return x; /* x is integral */
+		if(huge+x>0.0) {	/* raise inexact flag */
+		    if(i0>0) i0 += (0x00100000)>>j0;
+		    i0 &= (~i); i1=0;
+		}
+	    }
+	} else if (j0>51) {
+	    if(j0==0x400) return x+x;	/* inf or NaN */
+	    else return x;		/* x is integral */
+	} else {
+	    i = ((uint32_t)(0xffffffff))>>(j0-20);
+	    if((i1&i)==0) return x;	/* x is integral */
+	    if(huge+x>0.0) { 		/* raise inexact flag */
+		if(i0>0) {
+		    if(j0==20) i0+=1; 
+		    else {
+			j = i1 + (1<<(52-j0));
+			if(j<i1) i0+=1;	/* got a carry */
+			i1 = j;
+		    }
+		}
+		i1 &= (~i);
+	    }
+	}
+	INSERT_WORDS(x,i0,i1);
+	return x;
+}
+
+#endif

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/s_copysign.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/s_copysign.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/s_copysign.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/s_copysign.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,37 @@
+
+/* @(#)s_copysign.c 1.3 95/01/18 */
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunSoft, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice 
+ * is preserved.
+ * ====================================================
+ */
+
+/*
+ * copysign(double x, double y)
+ * copysign(x,y) returns a value with the magnitude of x and
+ * with the sign bit of y.
+ */
+
+#include "fdlibm.h"
+
+#ifndef _DOUBLE_IS_32BITS
+
+#ifdef __STDC__
+	double copysign(double x, double y)
+#else
+	double copysign(x,y)
+	double x,y;
+#endif
+{
+        uint32_t hx, hy;
+	GET_HIGH_WORD(hx, x);
+	GET_HIGH_WORD(hy, y);
+	SET_HIGH_WORD(x, (hx&0x7fffffff)|(hy&0x80000000));
+        return x;
+}
+#endif /* _DOUBLE_IS_32BITS */

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/s_cos.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/s_cos.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/s_cos.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/s_cos.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,81 @@
+
+/* @(#)s_cos.c 1.3 95/01/18 */
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunSoft, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice 
+ * is preserved.
+ * ====================================================
+ */
+
+/* cos(x)
+ * Return cosine function of x.
+ *
+ * kernel function:
+ *	__kernel_sin		... sine function on [-pi/4,pi/4]
+ *	__kernel_cos		... cosine function on [-pi/4,pi/4]
+ *	__ieee754_rem_pio2	... argument reduction routine
+ *
+ * Method.
+ *      Let S,C and T denote the sin, cos and tan respectively on 
+ *	[-PI/4, +PI/4]. Reduce the argument x to y1+y2 = x-k*pi/2 
+ *	in [-pi/4 , +pi/4], and let n = k mod 4.
+ *	We have
+ *
+ *          n        sin(x)      cos(x)        tan(x)
+ *     ----------------------------------------------------------
+ *	    0	       S	   C		 T
+ *	    1	       C	  -S		-1/T
+ *	    2	      -S	  -C		 T
+ *	    3	      -C	   S		-1/T
+ *     ----------------------------------------------------------
+ *
+ * Special cases:
+ *      Let trig be any of sin, cos, or tan.
+ *      trig(+-INF)  is NaN, with signals;
+ *      trig(NaN)    is that NaN;
+ *
+ * Accuracy:
+ *	TRIG(x) returns trig(x) nearly rounded 
+ */
+
+#include "fdlibm.h"
+
+#ifndef _DOUBLE_IS_32BITS
+
+#ifdef __STDC__
+	double cos(double x)
+#else
+	double cos(x)
+	double x;
+#endif
+{
+	double y[2],z=0.0;
+	int32_t n, ix;
+
+    /* High word of x. */
+	GET_HIGH_WORD(ix,x);
+
+    /* |x| ~< pi/4 */
+	ix &= 0x7fffffff;
+	if(ix <= 0x3fe921fb) return __kernel_cos(x,z);
+
+    /* cos(Inf or NaN) is NaN */
+	else if (ix>=0x7ff00000) return x-x;
+
+    /* argument reduction needed */
+	else {
+	    n = __ieee754_rem_pio2(x,y);
+	    switch(n&3) {
+		case 0: return  __kernel_cos(y[0],y[1]);
+		case 1: return -__kernel_sin(y[0],y[1],1);
+		case 2: return -__kernel_cos(y[0],y[1]);
+		default:
+		        return  __kernel_sin(y[0],y[1],1);
+	    }
+	}
+}
+#endif /* _DOUBLE_IS_32BITS */

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/s_expm1.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/s_expm1.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/s_expm1.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/s_expm1.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,229 @@
+
+/* @(#)s_expm1.c 1.5 04/04/22 */
+/*
+ * ====================================================
+ * Copyright (C) 2004 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice 
+ * is preserved.
+ * ====================================================
+ */
+
+/* expm1(x)
+ * Returns exp(x)-1, the exponential of x minus 1.
+ *
+ * Method
+ *   1. Argument reduction:
+ *	Given x, find r and integer k such that
+ *
+ *               x = k*ln2 + r,  |r| <= 0.5*ln2 ~ 0.34658  
+ *
+ *      Here a correction term c will be computed to compensate 
+ *	the error in r when rounded to a floating-point number.
+ *
+ *   2. Approximating expm1(r) by a special rational function on
+ *	the interval [0,0.34658]:
+ *	Since
+ *	    r*(exp(r)+1)/(exp(r)-1) = 2+ r^2/6 - r^4/360 + ...
+ *	we define R1(r*r) by
+ *	    r*(exp(r)+1)/(exp(r)-1) = 2+ r^2/6 * R1(r*r)
+ *	That is,
+ *	    R1(r**2) = 6/r *((exp(r)+1)/(exp(r)-1) - 2/r)
+ *		     = 6/r * ( 1 + 2.0*(1/(exp(r)-1) - 1/r))
+ *		     = 1 - r^2/60 + r^4/2520 - r^6/100800 + ...
+ *      We use a special Remes algorithm on [0,0.347] to generate 
+ * 	a polynomial of degree 5 in r*r to approximate R1. The 
+ *	maximum error of this polynomial approximation is bounded 
+ *	by 2**-61. In other words,
+ *	    R1(z) ~ 1.0 + Q1*z + Q2*z**2 + Q3*z**3 + Q4*z**4 + Q5*z**5
+ *	where 	Q1  =  -1.6666666666666567384E-2,
+ * 		Q2  =   3.9682539681370365873E-4,
+ * 		Q3  =  -9.9206344733435987357E-6,
+ * 		Q4  =   2.5051361420808517002E-7,
+ * 		Q5  =  -6.2843505682382617102E-9;
+ *  	(where z=r*r, and the values of Q1 to Q5 are listed below)
+ *	with error bounded by
+ *	    |                  5           |     -61
+ *	    | 1.0+Q1*z+...+Q5*z   -  R1(z) | <= 2 
+ *	    |                              |
+ *	
+ *	expm1(r) = exp(r)-1 is then computed by the following 
+ * 	specific way which minimize the accumulation rounding error: 
+ *			       2     3
+ *			      r     r    [ 3 - (R1 + R1*r/2)  ]
+ *	      expm1(r) = r + --- + --- * [--------------------]
+ *		              2     2    [ 6 - r*(3 - R1*r/2) ]
+ *	
+ *	To compensate the error in the argument reduction, we use
+ *		expm1(r+c) = expm1(r) + c + expm1(r)*c 
+ *			   ~ expm1(r) + c + r*c 
+ *	Thus c+r*c will be added in as the correction terms for
+ *	expm1(r+c). Now rearrange the term to avoid optimization 
+ * 	screw up:
+ *		        (      2                                    2 )
+ *		        ({  ( r    [ R1 -  (3 - R1*r/2) ]  )  }    r  )
+ *	 expm1(r+c)~r - ({r*(--- * [--------------------]-c)-c} - --- )
+ *	                ({  ( 2    [ 6 - r*(3 - R1*r/2) ]  )  }    2  )
+ *                      (                                             )
+ *    	
+ *		   = r - E
+ *   3. Scale back to obtain expm1(x):
+ *	From step 1, we have
+ *	   expm1(x) = either 2^k*[expm1(r)+1] - 1
+ *		    = or     2^k*[expm1(r) + (1-2^-k)]
+ *   4. Implementation notes:
+ *	(A). To save one multiplication, we scale the coefficient Qi
+ *	     to Qi*2^i, and replace z by (x^2)/2.
+ *	(B). To achieve maximum accuracy, we compute expm1(x) by
+ *	  (i)   if x < -56*ln2, return -1.0, (raise inexact if x!=inf)
+ *	  (ii)  if k=0, return r-E
+ *	  (iii) if k=-1, return 0.5*(r-E)-0.5
+ *        (iv)	if k=1 if r < -0.25, return 2*((r+0.5)- E)
+ *	       	       else	     return  1.0+2.0*(r-E);
+ *	  (v)   if (k<-2||k>56) return 2^k(1-(E-r)) - 1 (or exp(x)-1)
+ *	  (vi)  if k <= 20, return 2^k((1-2^-k)-(E-r)), else
+ *	  (vii) return 2^k(1-((E+2^-k)-r)) 
+ *
+ * Special cases:
+ *	expm1(INF) is INF, expm1(NaN) is NaN;
+ *	expm1(-INF) is -1, and
+ *	for finite argument, only expm1(0)=0 is exact.
+ *
+ * Accuracy:
+ *	according to an error analysis, the error is always less than
+ *	1 ulp (unit in the last place).
+ *
+ * Misc. info.
+ *	For IEEE double 
+ *	    if x >  7.09782712893383973096e+02 then expm1(x) overflow
+ *
+ * Constants:
+ * The hexadecimal values are the intended ones for the following 
+ * constants. The decimal values may be used, provided that the 
+ * compiler will convert from decimal to binary accurately enough
+ * to produce the hexadecimal values shown.
+ */
+
+#include "fdlibm.h"
+
+#ifndef _DOUBLE_IS_32BITS
+
+#ifdef __STDC__
+static const double
+#else
+static double
+#endif
+one		= 1.0,
+huge		= 1.0e+300,
+tiny		= 1.0e-300,
+o_threshold	= 7.09782712893383973096e+02,/* 0x40862E42, 0xFEFA39EF */
+ln2_hi		= 6.93147180369123816490e-01,/* 0x3fe62e42, 0xfee00000 */
+ln2_lo		= 1.90821492927058770002e-10,/* 0x3dea39ef, 0x35793c76 */
+invln2		= 1.44269504088896338700e+00,/* 0x3ff71547, 0x652b82fe */
+	/* scaled coefficients related to expm1 */
+Q1  =  -3.33333333333331316428e-02, /* BFA11111 111110F4 */
+Q2  =   1.58730158725481460165e-03, /* 3F5A01A0 19FE5585 */
+Q3  =  -7.93650757867487942473e-05, /* BF14CE19 9EAADBB7 */
+Q4  =   4.00821782732936239552e-06, /* 3ED0CFCA 86E65239 */
+Q5  =  -2.01099218183624371326e-07; /* BE8AFDB7 6E09C32D */
+
+#ifdef __STDC__
+	double expm1(double x)
+#else
+	double expm1(x)
+	double x;
+#endif
+{
+	double y,hi,lo,c,t,e,hxs,hfx,r1;
+	int32_t k,xsb;
+	uint32_t hx;
+
+	GET_HIGH_WORD(hx,x); /* high word of x */
+	xsb = hx&0x80000000;		/* sign bit of x */
+	if(xsb==0) y=x; else y= -x;	/* y = |x| */
+	hx &= 0x7fffffff;		/* high word of |x| */
+
+    /* filter out huge and non-finite argument */
+	if(hx >= 0x4043687A) {			/* if |x|>=56*ln2 */
+	    if(hx >= 0x40862E42) {		/* if |x|>=709.78... */
+                if(hx>=0x7ff00000) {
+  		    uint32_t low;
+		    GET_LOW_WORD(low,x);
+		    if(((hx&0xfffff)|low)!=0) 
+		         return x+x; 	 /* NaN */
+		    else return (xsb==0)? x:-1.0;/* exp(+-inf)={inf,-1} */
+	        }
+	        if(x > o_threshold) return huge*huge; /* overflow */
+	    }
+	    if(xsb!=0) { /* x < -56*ln2, return -1.0 with inexact */
+		if(x+tiny<0.0)		/* raise inexact */
+		return tiny-one;	/* return -1 */
+	    }
+	}
+
+    /* argument reduction */
+	if(hx > 0x3fd62e42) {		/* if  |x| > 0.5 ln2 */ 
+	    if(hx < 0x3FF0A2B2) {	/* and |x| < 1.5 ln2 */
+		if(xsb==0)
+		    {hi = x - ln2_hi; lo =  ln2_lo;  k =  1;}
+		else
+		    {hi = x + ln2_hi; lo = -ln2_lo;  k = -1;}
+	    } else {
+		k  = invln2*x+((xsb==0)?0.5:-0.5);
+		t  = k;
+		hi = x - t*ln2_hi;	/* t*ln2_hi is exact here */
+		lo = t*ln2_lo;
+	    }
+	    x  = hi - lo;
+	    c  = (hi-x)-lo;
+	} 
+	else if(hx < 0x3c900000) {  	/* when |x|<2**-54, return x */
+	    t = huge+x;	/* return x with inexact flags when x!=0 */
+	    return x - (t-(huge+x));	
+	}
+	else k = 0;
+
+    /* x is now in primary range */
+	hfx = 0.5*x;
+	hxs = x*hfx;
+	r1 = one+hxs*(Q1+hxs*(Q2+hxs*(Q3+hxs*(Q4+hxs*Q5))));
+	t  = 3.0-r1*hfx;
+	e  = hxs*((r1-t)/(6.0 - x*t));
+	if(k==0) return x - (x*e-hxs);		/* c is 0 */
+	else {
+	    e  = (x*(e-c)-c);
+	    e -= hxs;
+	    if(k== -1) return 0.5*(x-e)-0.5;
+	    if(k==1) 
+	       	if(x < -0.25) return -2.0*(e-(x+0.5));
+	       	else 	      return  one+2.0*(x-e);
+	    if (k <= -2 || k>56) {   /* suffice to return exp(x)-1 */
+  	        uint32_t hy;
+		
+	        y = one-(e-x);
+		GET_HIGH_WORD(hy,y);	
+	        SET_HIGH_WORD(y, hy + (k<<20));	/* add k to y's exponent */
+	        return y-one;
+	    }
+	    t = one;
+	    if(k<20) {
+  	        uint32_t hy;
+
+ 	        SET_HIGH_WORD(t, 0x3ff00000 - (0x200000>>k));  /* t=1-2^-k */
+	       	y = t-(e-x);
+		GET_HIGH_WORD(hy, y);
+		SET_HIGH_WORD(y, hy + (k<<20));	/* add k to y's exponent */
+	   } else {
+  	        uint32_t hy;
+
+	       	SET_HIGH_WORD(t, (0x3ff-k)<<20);	/* 2^-k */
+	       	y = x-(e+t);
+	       	y += one;
+		GET_HIGH_WORD(hy, y);
+		SET_HIGH_WORD(y, hy + (k<<20));	/* add k to y's exponent */
+	    }
+	}
+	return y;
+}
+#endif /* _DOUBLE_IS_32BITS */

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/s_fabs.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/s_fabs.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/s_fabs.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/s_fabs.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,36 @@
+
+/* @(#)s_fabs.c 1.3 95/01/18 */
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunSoft, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice 
+ * is preserved.
+ * ====================================================
+ */
+
+/*
+ * fabs(x) returns the absolute value of x.
+ */
+
+#include "fdlibm.h"
+
+#ifndef _DOUBLE_IS_32BITS
+
+#ifdef __STDC__
+	double fabs(double x)
+#else
+	double fabs(x)
+	double x;
+#endif
+{
+        uint32_t hx;
+
+	GET_HIGH_WORD(hx,x);
+	SET_HIGH_WORD(x, hx & 0x7fffffff);
+        return x;
+}
+
+#endif /* _DOUBLE_IS_32BITS */

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/s_finite.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/s_finite.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/s_finite.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/s_finite.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,31 @@
+
+/* @(#)s_finite.c 1.3 95/01/18 */
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunSoft, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice 
+ * is preserved.
+ * ====================================================
+ */
+
+/*
+ * finite(x) returns 1 is x is finite, else 0;
+ * no branching!
+ */
+
+#include "fdlibm.h"
+
+#ifdef __STDC__
+	int finite(double x)
+#else
+	int finite(x)
+	double x;
+#endif
+{
+	uint32_t hx;
+	GET_HIGH_WORD(hx,x);
+	return  (unsigned)((hx&0x7fffffff)-0x7ff00000)>>31;
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/s_floor.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/s_floor.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/s_floor.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/s_floor.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,80 @@
+
+/* @(#)s_floor.c 1.3 95/01/18 */
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunSoft, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice 
+ * is preserved.
+ * ====================================================
+ */
+
+/*
+ * floor(x)
+ * Return x rounded toward -inf to integral value
+ * Method:
+ *	Bit twiddling.
+ * Exception:
+ *	Inexact flag raised if x not equal to floor(x).
+ */
+
+#include "fdlibm.h"
+
+#ifndef _DOUBLE_IS_32BITS
+
+#ifdef __STDC__
+static const double huge = 1.0e300;
+#else
+static double huge = 1.0e300;
+#endif
+
+#ifdef __STDC__
+	double floor(double x)
+#else
+	double floor(x)
+	double x;
+#endif
+{
+	int32_t i0,i1,j0;
+	uint32_t i,j;
+	EXTRACT_WORDS(i0,i1,x);
+	j0 = ((i0>>20)&0x7ff)-0x3ff;
+	if(j0<20) {
+	    if(j0<0) { 	/* raise inexact if x != 0 */
+		if(huge+x>0.0) {/* return 0*sign(x) if |x|<1 */
+		    if(i0>=0) {i0=i1=0;} 
+		    else if(((i0&0x7fffffff)|i1)!=0)
+			{ i0=0xbff00000;i1=0;}
+		}
+	    } else {
+		i = (0x000fffff)>>j0;
+		if(((i0&i)|i1)==0) return x; /* x is integral */
+		if(huge+x>0.0) {	/* raise inexact flag */
+		    if(i0<0) i0 += (0x00100000)>>j0;
+		    i0 &= (~i); i1=0;
+		}
+	    }
+	} else if (j0>51) {
+	    if(j0==0x400) return x+x;	/* inf or NaN */
+	    else return x;		/* x is integral */
+	} else {
+	    i = ((uint32_t)(0xffffffff))>>(j0-20);
+	    if((i1&i)==0) return x;	/* x is integral */
+	    if(huge+x>0.0) { 		/* raise inexact flag */
+		if(i0<0) {
+		    if(j0==20) i0+=1; 
+		    else {
+			j = i1+(1<<(52-j0));
+			if(j<(uint32_t)i1) i0 +=1 ; 	/* got a carry */
+			i1=j;
+		    }
+		}
+		i1 &= (~i);
+	    }
+	}
+	INSERT_WORDS(x,i0,i1);
+	return x;
+}
+#endif /* _DOUBLE_IS_32BITS */

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/s_log1p.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/s_log1p.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/s_log1p.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/s_log1p.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,168 @@
+
+/* @(#)s_log1p.c 1.4 96/03/07 */
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunSoft, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice 
+ * is preserved.
+ * ====================================================
+ */
+
+/* double log1p(double x)
+ *
+ * Method :                  
+ *   1. Argument Reduction: find k and f such that 
+ *			1+x = 2^k * (1+f), 
+ *	   where  sqrt(2)/2 < 1+f < sqrt(2) .
+ *
+ *      Note. If k=0, then f=x is exact. However, if k!=0, then f
+ *	may not be representable exactly. In that case, a correction
+ *	term is need. Let u=1+x rounded. Let c = (1+x)-u, then
+ *	log(1+x) - log(u) ~ c/u. Thus, we proceed to compute log(u),
+ *	and add back the correction term c/u.
+ *	(Note: when x > 2**53, one can simply return log(x))
+ *
+ *   2. Approximation of log1p(f).
+ *	Let s = f/(2+f) ; based on log(1+f) = log(1+s) - log(1-s)
+ *		 = 2s + 2/3 s**3 + 2/5 s**5 + .....,
+ *	     	 = 2s + s*R
+ *      We use a special Remes algorithm on [0,0.1716] to generate 
+ * 	a polynomial of degree 14 to approximate R The maximum error 
+ *	of this polynomial approximation is bounded by 2**-58.45. In
+ *	other words,
+ *		        2      4      6      8      10      12      14
+ *	    R(z) ~ Lp1*s +Lp2*s +Lp3*s +Lp4*s +Lp5*s  +Lp6*s  +Lp7*s
+ *  	(the values of Lp1 to Lp7 are listed in the program)
+ *	and
+ *	    |      2          14          |     -58.45
+ *	    | Lp1*s +...+Lp7*s    -  R(z) | <= 2 
+ *	    |                             |
+ *	Note that 2s = f - s*f = f - hfsq + s*hfsq, where hfsq = f*f/2.
+ *	In order to guarantee error in log below 1ulp, we compute log
+ *	by
+ *		log1p(f) = f - (hfsq - s*(hfsq+R)).
+ *	
+ *	3. Finally, log1p(x) = k*ln2 + log1p(f).  
+ *		 	     = k*ln2_hi+(f-(hfsq-(s*(hfsq+R)+k*ln2_lo)))
+ *	   Here ln2 is split into two floating point number: 
+ *			ln2_hi + ln2_lo,
+ *	   where n*ln2_hi is always exact for |n| < 2000.
+ *
+ * Special cases:
+ *	log1p(x) is NaN with signal if x < -1 (including -INF) ; 
+ *	log1p(+INF) is +INF; log1p(-1) is -INF with signal;
+ *	log1p(NaN) is that NaN with no signal.
+ *
+ * Accuracy:
+ *	according to an error analysis, the error is always less than
+ *	1 ulp (unit in the last place).
+ *
+ * Constants:
+ * The hexadecimal values are the intended ones for the following 
+ * constants. The decimal values may be used, provided that the 
+ * compiler will convert from decimal to binary accurately enough 
+ * to produce the hexadecimal values shown.
+ *
+ * Note: Assuming log() return accurate answer, the following
+ * 	 algorithm can be used to compute log1p(x) to within a few ULP:
+ *	
+ *		u = 1+x;
+ *		if(u==1.0) return x ; else
+ *			   return log(u)*(x/(u-1.0));
+ *
+ *	 See HP-15C Advanced Functions Handbook, p.193.
+ */
+
+#include "fdlibm.h"
+
+#ifndef _DOUBLE_IS_32BITS
+
+#ifdef __STDC__
+static const double
+#else
+static double
+#endif
+ln2_hi  =  6.93147180369123816490e-01,	/* 3fe62e42 fee00000 */
+ln2_lo  =  1.90821492927058770002e-10,	/* 3dea39ef 35793c76 */
+two54   =  1.80143985094819840000e+16,  /* 43500000 00000000 */
+Lp1 = 6.666666666666735130e-01,  /* 3FE55555 55555593 */
+Lp2 = 3.999999999940941908e-01,  /* 3FD99999 9997FA04 */
+Lp3 = 2.857142874366239149e-01,  /* 3FD24924 94229359 */
+Lp4 = 2.222219843214978396e-01,  /* 3FCC71C5 1D8E78AF */
+Lp5 = 1.818357216161805012e-01,  /* 3FC74664 96CB03DE */
+Lp6 = 1.531383769920937332e-01,  /* 3FC39A09 D078C69F */
+Lp7 = 1.479819860511658591e-01;  /* 3FC2F112 DF3E5244 */
+
+static double zero = 0.0;
+
+#ifdef __STDC__
+	double log1p(double x)
+#else
+	double log1p(x)
+	double x;
+#endif
+{
+	double hfsq,f,c,s,z,R,u;
+	int32_t k,hx,hu,ax;
+
+	GET_HIGH_WORD(hx,x); /* high word of x */
+	ax = hx&0x7fffffff;
+
+	k = 1;
+	if (hx < 0x3FDA827A) {			/* x < 0.41422  */
+	    if(ax>=0x3ff00000) {		/* x <= -1.0 */
+		if(x==-1.0) return -two54/zero; /* log1p(-1)=+inf */
+		else return (x-x)/(x-x);	/* log1p(x<-1)=NaN */
+	    }
+	    if(ax<0x3e200000) {			/* |x| < 2**-29 */
+		if(two54+x>zero			/* raise inexact */
+	            &&ax<0x3c900000) 		/* |x| < 2**-54 */
+		    return x;
+		else
+		    return x - x*x*0.5;
+	    }
+	    if(hx>0||hx<=((int)0xbfd2bec3)) {
+		k=0;f=x;hu=1;}	/* -0.2929<x<0.41422 */
+	} 
+	if (hx >= 0x7ff00000) return x+x;
+	if(k!=0) {
+	    if(hx<0x43400000) {
+		u  = 1.0+x; 
+		GET_HIGH_WORD(hu,u); /* high word of u */
+	        k  = (hu>>20)-1023;
+	        c  = (k>0)? 1.0-(u-x):x-(u-1.0);/* correction term */
+		c /= u;
+	    } else {
+		u  = x;
+		GET_HIGH_WORD(hu,u); /* high word of u */
+	        k  = (hu>>20)-1023;
+		c  = 0;
+	    }
+	    hu &= 0x000fffff;
+	    if(hu<0x6a09e) {
+	        SET_HIGH_WORD(u, hu|0x3ff00000);	/* normalize u */
+	    } else {
+	        k += 1; 
+		SET_HIGH_WORD(u, hu|0x3fe00000);	/* normalize u/2 */
+	        hu = (0x00100000-hu)>>2;
+	    }
+	    f = u-1.0;
+	}
+	hfsq=0.5*f*f;
+	if(hu==0) {	/* |f| < 2**-20 */
+	    if(f==zero) if(k==0) return zero;  
+			else {c += k*ln2_lo; return k*ln2_hi+c;}
+	    R = hfsq*(1.0-0.66666666666666666*f);
+	    if(k==0) return f-R; else
+	    	     return k*ln2_hi-((R-(k*ln2_lo+c))-f);
+	}
+ 	s = f/(2.0+f); 
+	z = s*s;
+	R = z*(Lp1+z*(Lp2+z*(Lp3+z*(Lp4+z*(Lp5+z*(Lp6+z*Lp7))))));
+	if(k==0) return f-(hfsq-s*(hfsq+R)); else
+		 return k*ln2_hi-((hfsq-(s*(hfsq+R)+(k*ln2_lo+c)))-f);
+}
+#endif /* _DOUBLE_IS_32BITS */  

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/s_rint.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/s_rint.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/s_rint.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/s_rint.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,86 @@
+
+/* @(#)s_rint.c 1.3 95/01/18 */
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunSoft, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice 
+ * is preserved.
+ * ====================================================
+ */
+
+/*
+ * rint(x)
+ * Return x rounded to integral value according to the prevailing
+ * rounding mode.
+ * Method:
+ *	Using floating addition.
+ * Exception:
+ *	Inexact flag raised if x not equal to rint(x).
+ */
+
+#include "fdlibm.h"
+
+#ifndef _DOUBLE_IS_32BITS
+
+#ifdef __STDC__
+static const double
+#else
+static double 
+#endif
+TWO52[2]={
+  4.50359962737049600000e+15, /* 0x43300000, 0x00000000 */
+ -4.50359962737049600000e+15, /* 0xC3300000, 0x00000000 */
+};
+
+#ifdef __STDC__
+	double rint(double x)
+#else
+	double rint(x)
+	double x;
+#endif
+{
+	int32_t i0,j0,sx;
+	uint32_t i,i1;
+	double t;
+	volatile double w;
+	EXTRACT_WORDS(i0,i1,x);
+	sx = (i0>>31)&1;
+	j0 = ((i0>>20)&0x7ff)-0x3ff;
+	if(j0<20) {
+	    if(j0<0) { 	
+		if(((i0&0x7fffffff)|i1)==0) return x;
+		i1 |= (i0&0x0fffff);
+		i0 &= 0xfffe0000;
+		i0 |= ((i1|-i1)>>12)&0x80000;
+		SET_HIGH_WORD(x,i0);
+	        w = TWO52[sx]+x;
+	        t =  w-TWO52[sx];
+		GET_HIGH_WORD(i0,t);
+		SET_HIGH_WORD(t,(i0&0x7fffffff)|(sx<<31));
+	        return t;
+	    } else {
+		i = (0x000fffff)>>j0;
+		if(((i0&i)|i1)==0) return x; /* x is integral */
+		i>>=1;
+		if(((i0&i)|i1)!=0) {
+		    if(j0==19) i1 = 0x40000000; else
+		    i0 = (i0&(~i))|((0x20000)>>j0);
+		}
+	    }
+	} else if (j0>51) {
+	    if(j0==0x400) return x+x;	/* inf or NaN */
+	    else return x;		/* x is integral */
+	} else {
+	    i = ((uint32_t)(0xffffffff))>>(j0-20);
+	    if((i1&i)==0) return x;	/* x is integral */
+	    i>>=1;
+	    if((i1&i)!=0) i1 = (i1&(~i))|((0x40000000)>>(j0-20));
+	}
+	INSERT_WORDS(x,i0,i1);
+	w = TWO52[sx]+x;
+	return w-TWO52[sx];
+}
+#endif /* _DOUBLE_IS_32BITS */

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/s_scalbn.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/s_scalbn.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/s_scalbn.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/s_scalbn.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,65 @@
+
+/* @(#)s_scalbn.c 1.3 95/01/18 */
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunSoft, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice 
+ * is preserved.
+ * ====================================================
+ */
+
+/* 
+ * scalbn (double x, int n)
+ * scalbn(x,n) returns x* 2**n  computed by  exponent  
+ * manipulation rather than by actually performing an 
+ * exponentiation or a multiplication.
+ */
+
+#include "fdlibm.h"
+
+#ifndef _DOUBLE_IS_32BITS
+
+#ifdef __STDC__
+static const double
+#else
+static double
+#endif
+two54   =  1.80143985094819840000e+16, /* 0x43500000, 0x00000000 */
+twom54  =  5.55111512312578270212e-17, /* 0x3C900000, 0x00000000 */
+huge   = 1.0e+300,
+tiny   = 1.0e-300;
+
+#ifdef __STDC__
+	double scalbn (double x, int n)
+#else
+	double scalbn (x,n)
+	double x; int n;
+#endif
+{
+	int32_t  k,hx,lx;
+	EXTRACT_WORDS(hx,lx,x);
+        k = (hx&0x7ff00000)>>20;		/* extract exponent */
+        if (k==0) {				/* 0 or subnormal x */
+            if ((lx|(hx&0x7fffffff))==0) return x; /* +-0 */
+	    x *= two54; 
+	    GET_HIGH_WORD(hx,x);
+	    k = ((hx&0x7ff00000)>>20) - 54; 
+            if (n< -50000) return tiny*x; 	/*underflow*/
+	    }
+        if (k==0x7ff) return x+x;		/* NaN or Inf */
+        k = k+n; 
+        if (k >  0x7fe) return huge*copysign(huge,x); /* overflow  */
+        if (k > 0) 				/* normal result */
+	    {SET_HIGH_WORD(x,(hx&0x800fffff)|(k<<20)); return x;}
+        if (k <= -54)
+            if (n > 50000) 	/* in case integer overflow in n+k */
+		return huge*copysign(huge,x);	/*overflow*/
+	    else return tiny*copysign(tiny,x); 	/*underflow*/
+        k += 54;				/* subnormal result */
+        SET_HIGH_WORD(x,(hx&0x800fffff)|(k<<20));
+        return x*twom54;
+}
+#endif /* _DOUBLE_IS_32BITS */

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/s_sin.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/s_sin.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/s_sin.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/s_sin.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,81 @@
+
+/* @(#)s_sin.c 1.3 95/01/18 */
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunSoft, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice 
+ * is preserved.
+ * ====================================================
+ */
+
+/* sin(x)
+ * Return sine function of x.
+ *
+ * kernel function:
+ *	__kernel_sin		... sine function on [-pi/4,pi/4]
+ *	__kernel_cos		... cose function on [-pi/4,pi/4]
+ *	__ieee754_rem_pio2	... argument reduction routine
+ *
+ * Method.
+ *      Let S,C and T denote the sin, cos and tan respectively on 
+ *	[-PI/4, +PI/4]. Reduce the argument x to y1+y2 = x-k*pi/2 
+ *	in [-pi/4 , +pi/4], and let n = k mod 4.
+ *	We have
+ *
+ *          n        sin(x)      cos(x)        tan(x)
+ *     ----------------------------------------------------------
+ *	    0	       S	   C		 T
+ *	    1	       C	  -S		-1/T
+ *	    2	      -S	  -C		 T
+ *	    3	      -C	   S		-1/T
+ *     ----------------------------------------------------------
+ *
+ * Special cases:
+ *      Let trig be any of sin, cos, or tan.
+ *      trig(+-INF)  is NaN, with signals;
+ *      trig(NaN)    is that NaN;
+ *
+ * Accuracy:
+ *	TRIG(x) returns trig(x) nearly rounded 
+ */
+
+#include "fdlibm.h"
+
+#ifndef _DOUBLE_IS_32BITS
+
+#ifdef __STDC__
+	double sin(double x)
+#else
+	double sin(x)
+	double x;
+#endif
+{
+	double y[2],z=0.0;
+	int32_t n, ix;
+
+    /* High word of x. */
+	GET_HIGH_WORD(ix,x);
+
+    /* |x| ~< pi/4 */
+	ix &= 0x7fffffff;
+	if(ix <= 0x3fe921fb) return __kernel_sin(x,z,0);
+
+    /* sin(Inf or NaN) is NaN */
+	else if (ix>=0x7ff00000) return x-x;
+
+    /* argument reduction needed */
+	else {
+	    n = __ieee754_rem_pio2(x,y);
+	    switch(n&3) {
+		case 0: return  __kernel_sin(y[0],y[1],1);
+		case 1: return  __kernel_cos(y[0],y[1]);
+		case 2: return -__kernel_sin(y[0],y[1],1);
+		default:
+			return -__kernel_cos(y[0],y[1]);
+	    }
+	}
+}
+#endif /* _DOUBLE_IS_32BITS */

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/s_tan.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/s_tan.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/s_tan.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/s_tan.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,75 @@
+
+/* @(#)s_tan.c 1.3 95/01/18 */
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunSoft, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice 
+ * is preserved.
+ * ====================================================
+ */
+
+/* tan(x)
+ * Return tangent function of x.
+ *
+ * kernel function:
+ *	__kernel_tan		... tangent function on [-pi/4,pi/4]
+ *	__ieee754_rem_pio2	... argument reduction routine
+ *
+ * Method.
+ *      Let S,C and T denote the sin, cos and tan respectively on 
+ *	[-PI/4, +PI/4]. Reduce the argument x to y1+y2 = x-k*pi/2 
+ *	in [-pi/4 , +pi/4], and let n = k mod 4.
+ *	We have
+ *
+ *          n        sin(x)      cos(x)        tan(x)
+ *     ----------------------------------------------------------
+ *	    0	       S	   C		 T
+ *	    1	       C	  -S		-1/T
+ *	    2	      -S	  -C		 T
+ *	    3	      -C	   S		-1/T
+ *     ----------------------------------------------------------
+ *
+ * Special cases:
+ *      Let trig be any of sin, cos, or tan.
+ *      trig(+-INF)  is NaN, with signals;
+ *      trig(NaN)    is that NaN;
+ *
+ * Accuracy:
+ *	TRIG(x) returns trig(x) nearly rounded 
+ */
+
+#include "fdlibm.h"
+
+#ifndef _DOUBLE_IS_32BITS
+
+#ifdef __STDC__
+	double tan(double x)
+#else
+	double tan(x)
+	double x;
+#endif
+{
+	double y[2],z=0.0;
+	int32_t n, ix;
+
+    /* High word of x. */
+	GET_HIGH_WORD(ix,x);
+
+    /* |x| ~< pi/4 */
+	ix &= 0x7fffffff;
+	if(ix <= 0x3fe921fb) return __kernel_tan(x,z,1);
+
+    /* tan(Inf or NaN) is NaN */
+	else if (ix>=0x7ff00000) return x-x;		/* NaN */
+
+    /* argument reduction needed */
+	else {
+	    n = __ieee754_rem_pio2(x,y);
+	    return __kernel_tan(y[0],y[1],1-((n&1)<<1)); /*   1 -- n even
+							-1 -- n odd */
+	}
+}
+#endif /* _DOUBLE_IS_32BITS */

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/s_tanh.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/s_tanh.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/s_tanh.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/s_tanh.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,85 @@
+
+/* @(#)s_tanh.c 1.3 95/01/18 */
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunSoft, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice 
+ * is preserved.
+ * ====================================================
+ */
+
+/* Tanh(x)
+ * Return the Hyperbolic Tangent of x
+ *
+ * Method :
+ *				       x    -x
+ *				      e  - e
+ *	0. tanh(x) is defined to be -----------
+ *				       x    -x
+ *				      e  + e
+ *	1. reduce x to non-negative by tanh(-x) = -tanh(x).
+ *	2.  0      <= x <= 2**-55 : tanh(x) := x*(one+x)
+ *					        -t
+ *	    2**-55 <  x <=  1     : tanh(x) := -----; t = expm1(-2x)
+ *					       t + 2
+ *						     2
+ *	    1      <= x <=  22.0  : tanh(x) := 1-  ----- ; t=expm1(2x)
+ *						   t + 2
+ *	    22.0   <  x <= INF    : tanh(x) := 1.
+ *
+ * Special cases:
+ *	tanh(NaN) is NaN;
+ *	only tanh(0)=0 is exact for finite argument.
+ */
+
+#include "fdlibm.h"
+
+#ifndef _DOUBLE_IS_32BITS
+
+#ifdef __STDC__
+static const double one=1.0, two=2.0, tiny = 1.0e-300;
+#else
+static double one=1.0, two=2.0, tiny = 1.0e-300;
+#endif
+
+#ifdef __STDC__
+	double tanh(double x)
+#else
+	double tanh(x)
+	double x;
+#endif
+{
+	double t,z;
+	int32_t jx,ix;
+
+    /* High word of |x|. */
+	GET_HIGH_WORD(jx,x);
+	ix = jx&0x7fffffff;
+
+    /* x is INF or NaN */
+	if(ix>=0x7ff00000) { 
+	    if (jx>=0) return one/x+one;    /* tanh(+-inf)=+-1 */
+	    else       return one/x-one;    /* tanh(NaN) = NaN */
+	}
+
+    /* |x| < 22 */
+	if (ix < 0x40360000) {		/* |x|<22 */
+	    if (ix<0x3c800000) 		/* |x|<2**-55 */
+		return x*(one+x);    	/* tanh(small) = small */
+	    if (ix>=0x3ff00000) {	/* |x|>=1  */
+		t = expm1(two*fabs(x));
+		z = one - two/(t+two);
+	    } else {
+	        t = expm1(-two*fabs(x));
+	        z= -t/(t+two);
+	    }
+    /* |x| > 22, return +-1 */
+	} else {
+	    z = one - tiny;		/* raised inexact flag */
+	}
+	return (jx>=0)? z: -z;
+}
+#endif /* _DOUBLE_IS_32BITS */  

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/sf_fabs.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/sf_fabs.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/sf_fabs.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/sf_fabs.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,47 @@
+/* sf_fabs.c -- float version of s_fabs.c.
+ * Conversion to float by Ian Lance Taylor, Cygnus Support, ian at cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice 
+ * is preserved.
+ * ====================================================
+ */
+
+/*
+ * fabsf(x) returns the absolute value of x.
+ */
+
+#include "fdlibm.h"
+
+#ifdef __STDC__
+	float fabsf(float x)
+#else
+	float fabsf(x)
+	float x;
+#endif
+{
+	uint32_t ix;
+	GET_FLOAT_WORD(ix,x);
+	SET_FLOAT_WORD(x,ix&0x7fffffff);
+        return x;
+}
+
+#ifdef _DOUBLE_IS_32BITS
+
+#ifdef __STDC__
+	double fabs(double x)
+#else
+	double fabs(x)
+	double x;
+#endif
+{
+	return (double) fabsf((float) x);
+}
+
+#endif /* defined(_DOUBLE_IS_32BITS) */

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/sf_rint.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/sf_rint.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/sf_rint.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/sf_rint.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,80 @@
+/* sf_rint.c -- float version of s_rint.c.
+ * Conversion to float by Ian Lance Taylor, Cygnus Support, ian at cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#include "fdlibm.h"
+
+#ifdef __STDC__
+static const float
+#else
+static float
+#endif
+TWO23[2]={
+  8.3886080000e+06, /* 0x4b000000 */
+ -8.3886080000e+06, /* 0xcb000000 */
+};
+
+#ifdef __STDC__
+	float rintf(float x)
+#else
+	float rintf(x)
+	float x;
+#endif
+{
+	int32_t i0,j0,sx;
+	uint32_t i,i1;
+	float w,t;
+	GET_FLOAT_WORD(i0,x);
+	sx = (i0>>31)&1;
+	j0 = ((i0>>23)&0xff)-0x7f;
+	if(j0<23) {
+	    if(j0<0) {
+		if((i0&0x7fffffff)==0) return x;
+		i1 = (i0&0x07fffff);
+		i0 &= 0xfff00000;
+		i0 |= ((i1|-i1)>>9)&0x400000;
+		SET_FLOAT_WORD(x,i0);
+	        w = TWO23[sx]+x;
+	        t =  w-TWO23[sx];
+		GET_FLOAT_WORD(i0,t);
+		SET_FLOAT_WORD(t,(i0&0x7fffffff)|(sx<<31));
+	        return t;
+	    } else {
+		i = (0x007fffff)>>j0;
+		if((i0&i)==0) return x; /* x is integral */
+		i>>=1;
+		if((i0&i)!=0) i0 = (i0&(~i))|((0x100000)>>j0);
+	    }
+	} else {
+	    if(j0==0x80) return x+x;	/* inf or NaN */
+	    else return x;		/* x is integral */
+	}
+	SET_FLOAT_WORD(x,i0);
+	w = TWO23[sx]+x;
+	return w-TWO23[sx];
+}
+
+#ifdef _DOUBLE_IS_32BITS
+
+#ifdef __STDC__
+	double rint(double x)
+#else
+	double rint(x)
+	double x;
+#endif
+{
+	return (double) rintf((float) x);
+}
+
+#endif /* defined(_DOUBLE_IS_32BITS) */

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/strtod.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/strtod.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/strtod.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/strtod.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,719 @@
+/*
+FUNCTION
+        <<strtod>>, <<strtodf>>---string to double or float
+
+INDEX
+	strtod
+INDEX
+	_strtod_r
+INDEX
+	strtodf
+
+ANSI_SYNOPSIS
+        #include <stdlib.h>
+        double strtod(const char *<[str]>, char **<[tail]>);
+        float strtodf(const char *<[str]>, char **<[tail]>);
+
+        double _strtod_r(void *<[reent]>, 
+                         const char *<[str]>, char **<[tail]>);
+
+TRAD_SYNOPSIS
+        #include <stdlib.h>
+        double strtod(<[str]>,<[tail]>)
+        char *<[str]>;
+        char **<[tail]>;
+
+        float strtodf(<[str]>,<[tail]>)
+        char *<[str]>;
+        char **<[tail]>;
+
+        double _strtod_r(<[reent]>,<[str]>,<[tail]>)
+	char *<[reent]>;
+        char *<[str]>;
+        char **<[tail]>;
+
+DESCRIPTION
+	The function <<strtod>> parses the character string <[str]>,
+	producing a substring which can be converted to a double
+	value.  The substring converted is the longest initial
+	subsequence of <[str]>, beginning with the first
+	non-whitespace character, that has the format:
+	.[+|-]<[digits]>[.][<[digits]>][(e|E)[+|-]<[digits]>] 
+	The substring contains no characters if <[str]> is empty, consists
+	entirely of whitespace, or if the first non-whitespace
+	character is something other than <<+>>, <<->>, <<.>>, or a
+	digit. If the substring is empty, no conversion is done, and
+	the value of <[str]> is stored in <<*<[tail]>>>.  Otherwise,
+	the substring is converted, and a pointer to the final string
+	(which will contain at least the terminating null character of
+	<[str]>) is stored in <<*<[tail]>>>.  If you want no
+	assignment to <<*<[tail]>>>, pass a null pointer as <[tail]>.
+	<<strtodf>> is identical to <<strtod>> except for its return type.
+
+	This implementation returns the nearest machine number to the
+	input decimal string.  Ties are broken by using the IEEE
+	round-even rule.
+
+	The alternate function <<_strtod_r>> is a reentrant version.
+	The extra argument <[reent]> is a pointer to a reentrancy structure.
+
+RETURNS
+	<<strtod>> returns the converted substring value, if any.  If
+	no conversion could be performed, 0 is returned.  If the
+	correct value is out of the range of representable values,
+	plus or minus <<HUGE_VAL>> is returned, and <<ERANGE>> is
+	stored in errno. If the correct value would cause underflow, 0
+	is returned and <<ERANGE>> is stored in errno.
+
+Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
+<<lseek>>, <<read>>, <<sbrk>>, <<write>>.
+*/
+
+/****************************************************************
+ *
+ * The author of this software is David M. Gay.
+ *
+ * Copyright (c) 1991 by AT&T.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose without fee is hereby granted, provided that this entire notice
+ * is included in all copies of any software which is or includes a copy
+ * or modification of this software and in all copies of the supporting
+ * documentation for such software.
+ *
+ * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED
+ * WARRANTY.  IN PARTICULAR, NEITHER THE AUTHOR NOR AT&T MAKES ANY
+ * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
+ * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
+ *
+ ***************************************************************/
+
+/* Please send bug reports to
+	David M. Gay
+	AT&T Bell Laboratories, Room 2C-463
+	600 Mountain Avenue
+	Murray Hill, NJ 07974-2070
+	U.S.A.
+	dmg at research.att.com or research!dmg
+ */
+
+#include <string.h>
+#include <float.h>
+#include <errno.h>
+#include "mprec.h"
+
+double
+_DEFUN (_strtod_r, (ptr, s00, se),
+	struct _Jv_reent *ptr _AND
+	_CONST char *s00 _AND
+	char **se)
+{
+  int bb2, bb5, bbe, bd2, bd5, bbbits, bs2, c, dsign, e1, esign, i, j,
+    k, nd, nd0, nf, nz, nz0, sign;
+  int digits = 0;  /* Number of digits found in fraction part. */
+  long e;
+  _CONST char *s, *s0, *s1;
+  double aadj, aadj1, adj;
+  long L;
+  unsigned long y, z;
+  union double_union rv, rv0;
+
+  _Jv_Bigint *bb = NULL, *bb1, *bd = NULL, *bd0, *bs = NULL, *delta = NULL;
+  sign = nz0 = nz = 0;
+  rv.d = 0.;
+  for (s = s00;; s++)
+    switch (*s)
+      {
+      case '-':
+	sign = 1;
+	/* no break */
+      case '+':
+	if (*++s)
+	  goto break2;
+	/* no break */
+      case 0:
+	s = s00;
+	goto ret;
+      case '\t':
+      case '\n':
+      case '\v':
+      case '\f':
+      case '\r':
+      case ' ':
+	continue;
+      default:
+	goto break2;
+      }
+break2:
+  if (*s == '0')
+    {
+      digits++;
+      nz0 = 1;
+      while (*++s == '0')
+	digits++;
+      if (!*s)
+	goto ret;
+    }
+  s0 = s;
+  y = z = 0;
+  for (nd = nf = 0; (c = *s) >= '0' && c <= '9'; nd++, s++)
+    {
+      digits++;
+      if (nd < 9)
+	y = 10 * y + c - '0';
+      else if (nd < 16)
+	z = 10 * z + c - '0';
+    }
+  nd0 = nd;
+  if (c == '.')
+    {
+      c = *++s;
+      if (!nd)
+	{
+	  for (; c == '0'; c = *++s)
+	    {
+	      digits++;
+	      nz++;
+	    }
+	  if (c > '0' && c <= '9')
+	    {
+	      digits++;
+	      s0 = s;
+	      nf += nz;
+	      nz = 0;
+	      goto have_dig;
+	    }
+	  goto dig_done;
+	}
+      for (; c >= '0' && c <= '9'; c = *++s)
+	{
+	  digits++;
+	have_dig:
+	  nz++;
+	  if (c -= '0')
+	    {
+	      nf += nz;
+	      for (i = 1; i < nz; i++)
+		if (nd++ < 9)
+		  y *= 10;
+		else if (nd <= DBL_DIG + 1)
+		  z *= 10;
+	      if (nd++ < 9)
+		y = 10 * y + c;
+	      else if (nd <= DBL_DIG + 1)
+		z = 10 * z + c;
+	      nz = 0;
+	    }
+	}
+    }
+dig_done:
+  e = 0;
+  if (c == 'e' || c == 'E')
+    {
+      if (!nd && !nz && !nz0)
+	{
+	  s = s00;
+	  goto ret;
+	}
+      s00 = s;
+      esign = 0;
+      switch (c = *++s)
+	{
+	case '-':
+	  esign = 1;
+	case '+':
+	  c = *++s;
+	}
+      if (c >= '0' && c <= '9')
+	{
+	  while (c == '0')
+	    c = *++s;
+	  if (c > '0' && c <= '9')
+	    {
+	      e = c - '0';
+	      s1 = s;
+	      while ((c = *++s) >= '0' && c <= '9')
+		e = 10 * e + c - '0';
+	      if (s - s1 > 8)
+		/* Avoid confusion from exponents
+		 * so large that e might overflow.
+		 */
+		e = 9999999L;
+	      if (esign)
+		e = -e;
+	    }
+	}
+      else
+	{
+	  /* No exponent after an 'E' : that's an error. */
+	  ptr->_errno = EINVAL;
+	  e = 0;
+	  s = s00;
+	  goto ret;
+	}
+    }
+  if (!nd)
+    {
+      if (!nz && !nz0)
+	s = s00;
+      goto ret;
+    }
+  e1 = e -= nf;
+
+  /* Now we have nd0 digits, starting at s0, followed by a
+   * decimal point, followed by nd-nd0 digits.  The number we're
+   * after is the integer represented by those digits times
+   * 10**e */
+
+  if (!nd0)
+    nd0 = nd;
+  k = nd < DBL_DIG + 1 ? nd : DBL_DIG + 1;
+  rv.d = y;
+  if (k > 9)
+    rv.d = tens[k - 9] * rv.d + z;
+  bd0 = 0;
+  if (nd <= DBL_DIG
+#ifndef RND_PRODQUOT
+      && FLT_ROUNDS == 1
+#endif
+    )
+    {
+      if (!e)
+	goto ret;
+      if (e > 0)
+	{
+	  if (e <= Ten_pmax)
+	    {
+#ifdef VAX
+	      goto vax_ovfl_check;
+#else
+	      /* rv.d = */ rounded_product (rv.d, tens[e]);
+	      goto ret;
+#endif
+	    }
+	  i = DBL_DIG - nd;
+	  if (e <= Ten_pmax + i)
+	    {
+	      /* A fancier test would sometimes let us do
+				 * this for larger i values.
+				 */
+	      e -= i;
+	      rv.d *= tens[i];
+#ifdef VAX
+	      /* VAX exponent range is so narrow we must
+	       * worry about overflow here...
+	       */
+	    vax_ovfl_check:
+	      word0 (rv) -= P * Exp_msk1;
+	      /* rv.d = */ rounded_product (rv.d, tens[e]);
+	      if ((word0 (rv) & Exp_mask)
+		  > Exp_msk1 * (DBL_MAX_EXP + Bias - 1 - P))
+		goto ovfl;
+	      word0 (rv) += P * Exp_msk1;
+#else
+	      /* rv.d = */ rounded_product (rv.d, tens[e]);
+#endif
+	      goto ret;
+	    }
+	}
+#ifndef Inaccurate_Divide
+      else if (e >= -Ten_pmax)
+	{
+	  /* rv.d = */ rounded_quotient (rv.d, tens[-e]);
+	  goto ret;
+	}
+#endif
+    }
+  e1 += nd - k;
+
+  /* Get starting approximation = rv.d * 10**e1 */
+
+  if (e1 > 0)
+    {
+      if ((i = e1 & 15))
+	rv.d *= tens[i];
+
+      if (e1 &= ~15)
+	{
+	  if (e1 > DBL_MAX_10_EXP)
+	    {
+	    ovfl:
+	      ptr->_errno = ERANGE;
+
+	      /* Force result to IEEE infinity. */
+	      word0 (rv) = Exp_mask;
+	      word1 (rv) = 0;
+
+	      if (bd0)
+		goto retfree;
+	      goto ret;
+	    }
+	  if (e1 >>= 4)
+	    {
+	      for (j = 0; e1 > 1; j++, e1 >>= 1)
+		if (e1 & 1)
+		  rv.d *= bigtens[j];
+	      /* The last multiplication could overflow. */
+	      word0 (rv) -= P * Exp_msk1;
+	      rv.d *= bigtens[j];
+	      if ((z = word0 (rv) & Exp_mask)
+		  > Exp_msk1 * (DBL_MAX_EXP + Bias - P))
+		goto ovfl;
+	      if (z > Exp_msk1 * (DBL_MAX_EXP + Bias - 1 - P))
+		{
+		  /* set to largest number */
+		  /* (Can't trust DBL_MAX) */
+		  word0 (rv) = Big0;
+#ifndef _DOUBLE_IS_32BITS
+		  word1 (rv) = Big1;
+#endif
+		}
+	      else
+		word0 (rv) += P * Exp_msk1;
+	    }
+
+	}
+    }
+  else if (e1 < 0)
+    {
+      e1 = -e1;
+      if ((i = e1 & 15))
+	rv.d /= tens[i];
+      if (e1 &= ~15)
+	{
+	  e1 >>= 4;
+	  if (e1 >= 1 << n_bigtens)
+            goto undfl;
+	  for (j = 0; e1 > 1; j++, e1 >>= 1)
+	    if (e1 & 1)
+	      rv.d *= tinytens[j];
+	  /* The last multiplication could underflow. */
+	  rv0.d = rv.d;
+	  rv.d *= tinytens[j];
+	  if (!rv.d)
+	    {
+	      rv.d = 2. * rv0.d;
+	      rv.d *= tinytens[j];
+	      if (!rv.d)
+		{
+		undfl:
+		  rv.d = 0.;
+		  ptr->_errno = ERANGE;
+		  if (bd0)
+		    goto retfree;
+		  goto ret;
+		}
+#ifndef _DOUBLE_IS_32BITS
+	      word0 (rv) = Tiny0;
+	      word1 (rv) = Tiny1;
+#else
+	      word0 (rv) = Tiny1;
+#endif
+	      /* The refinement below will clean
+	       * this approximation up.
+	       */
+	    }
+	}
+    }
+
+  /* Now the hard part -- adjusting rv to the correct value.*/
+
+  /* Put digits into bd: true value = bd * 10^e */
+
+  bd0 = s2b (ptr, s0, nd0, nd, y);
+
+  for (;;)
+    {
+      bd = Balloc (ptr, bd0->_k);
+      Bcopy (bd, bd0);
+      bb = d2b (ptr, rv.d, &bbe, &bbbits);	/* rv.d = bb * 2^bbe */
+      bs = i2b (ptr, 1);
+
+      if (e >= 0)
+	{
+	  bb2 = bb5 = 0;
+	  bd2 = bd5 = e;
+	}
+      else
+	{
+	  bb2 = bb5 = -e;
+	  bd2 = bd5 = 0;
+	}
+      if (bbe >= 0)
+	bb2 += bbe;
+      else
+	bd2 -= bbe;
+      bs2 = bb2;
+#ifdef Sudden_Underflow
+#ifdef IBM
+      j = 1 + 4 * P - 3 - bbbits + ((bbe + bbbits - 1) & 3);
+#else
+      j = P + 1 - bbbits;
+#endif
+#else
+      i = bbe + bbbits - 1;	/* logb(rv.d) */
+      if (i < Emin)		/* denormal */
+	j = bbe + (P - Emin);
+      else
+	j = P + 1 - bbbits;
+#endif
+      bb2 += j;
+      bd2 += j;
+      i = bb2 < bd2 ? bb2 : bd2;
+      if (i > bs2)
+	i = bs2;
+      if (i > 0)
+	{
+	  bb2 -= i;
+	  bd2 -= i;
+	  bs2 -= i;
+	}
+      if (bb5 > 0)
+	{
+	  bs = pow5mult (ptr, bs, bb5);
+	  bb1 = mult (ptr, bs, bb);
+	  Bfree (ptr, bb);
+	  bb = bb1;
+	}
+      if (bb2 > 0)
+	bb = lshift (ptr, bb, bb2);
+      if (bd5 > 0)
+	bd = pow5mult (ptr, bd, bd5);
+      if (bd2 > 0)
+	bd = lshift (ptr, bd, bd2);
+      if (bs2 > 0)
+	bs = lshift (ptr, bs, bs2);
+      delta = diff (ptr, bb, bd);
+      dsign = delta->_sign;
+      delta->_sign = 0;
+      i = cmp (delta, bs);
+      if (i < 0)
+	{
+	  /* Error is less than half an ulp -- check for
+	   * special case of mantissa a power of two.
+	   */
+	  if (dsign || word1 (rv) || word0 (rv) & Bndry_mask)
+	    break;
+	  delta = lshift (ptr, delta, Log2P);
+	  if (cmp (delta, bs) > 0)
+	    goto drop_down;
+	  break;
+	}
+      if (i == 0)
+	{
+	  /* exactly half-way between */
+	  if (dsign)
+	    {
+	      if ((word0 (rv) & Bndry_mask1) == Bndry_mask1
+		  && word1 (rv) == 0xffffffff)
+		{
+		  /*boundary case -- increment exponent*/
+		  word0 (rv) = (word0 (rv) & Exp_mask)
+		    + Exp_msk1
+#ifdef IBM
+		    | Exp_msk1 >> 4
+#endif
+		    ;
+#ifndef _DOUBLE_IS_32BITS
+		  word1 (rv) = 0;
+#endif
+		  break;
+		}
+	    }
+	  else if (!(word0 (rv) & Bndry_mask) && !word1 (rv))
+	    {
+	    drop_down:
+	      /* boundary case -- decrement exponent */
+#ifdef Sudden_Underflow
+	      L = word0 (rv) & Exp_mask;
+#ifdef IBM
+	      if (L < Exp_msk1)
+#else
+	      if (L <= Exp_msk1)
+#endif
+		goto undfl;
+	      L -= Exp_msk1;
+#else
+	      L = (word0 (rv) & Exp_mask) - Exp_msk1;
+#endif
+	      word0 (rv) = L | Bndry_mask1;
+#ifndef _DOUBLE_IS_32BITS
+	      word1 (rv) = 0xffffffff;
+#endif
+#ifdef IBM
+	      goto cont;
+#else
+	      break;
+#endif
+	    }
+#ifndef ROUND_BIASED
+	  if (!(word1 (rv) & LSB))
+	    break;
+#endif
+	  if (dsign)
+	    rv.d += ulp (rv.d);
+#ifndef ROUND_BIASED
+	  else
+	    {
+	      rv.d -= ulp (rv.d);
+#ifndef Sudden_Underflow
+	      if (!rv.d)
+		goto undfl;
+#endif
+	    }
+#endif
+	  break;
+	}
+      if ((aadj = ratio (delta, bs)) <= 2.)
+	{
+	  if (dsign)
+	    aadj = aadj1 = 1.;
+	  else if (word1 (rv) || word0 (rv) & Bndry_mask)
+	    {
+#ifndef Sudden_Underflow
+	      if (word1 (rv) == Tiny1 && !word0 (rv))
+		goto undfl;
+#endif
+	      aadj = 1.;
+	      aadj1 = -1.;
+	    }
+	  else
+	    {
+	      /* special case -- power of FLT_RADIX to be */
+	      /* rounded down... */
+
+	      if (aadj < 2. / FLT_RADIX)
+		aadj = 1. / FLT_RADIX;
+	      else
+		aadj *= 0.5;
+	      aadj1 = -aadj;
+	    }
+	}
+      else
+	{
+	  aadj *= 0.5;
+	  aadj1 = dsign ? aadj : -aadj;
+#ifdef Check_FLT_ROUNDS
+	  switch (FLT_ROUNDS)
+	    {
+	    case 2:		/* towards +infinity */
+	      aadj1 -= 0.5;
+	      break;
+	    case 0:		/* towards 0 */
+	    case 3:		/* towards -infinity */
+	      aadj1 += 0.5;
+	    }
+#else
+	  if (FLT_ROUNDS == 0)
+	    aadj1 += 0.5;
+#endif
+	}
+      y = word0 (rv) & Exp_mask;
+
+      /* Check for overflow */
+
+      if (y == Exp_msk1 * (DBL_MAX_EXP + Bias - 1))
+	{
+	  rv0.d = rv.d;
+	  word0 (rv) -= P * Exp_msk1;
+	  adj = aadj1 * ulp (rv.d);
+	  rv.d += adj;
+	  if ((word0 (rv) & Exp_mask) >=
+	      Exp_msk1 * (DBL_MAX_EXP + Bias - P))
+	    {
+	      if (word0 (rv0) == Big0 && word1 (rv0) == Big1)
+		goto ovfl;
+#ifdef _DOUBLE_IS_32BITS
+	      word0 (rv) = Big1;
+#else
+	      word0 (rv) = Big0;
+	      word1 (rv) = Big1;
+#endif
+	      goto cont;
+	    }
+	  else
+	    word0 (rv) += P * Exp_msk1;
+	}
+      else
+	{
+#ifdef Sudden_Underflow
+	  if ((word0 (rv) & Exp_mask) <= P * Exp_msk1)
+	    {
+	      rv0.d = rv.d;
+	      word0 (rv) += P * Exp_msk1;
+	      adj = aadj1 * ulp (rv.d);
+	      rv.d += adj;
+#ifdef IBM
+	      if ((word0 (rv) & Exp_mask) < P * Exp_msk1)
+#else
+	      if ((word0 (rv) & Exp_mask) <= P * Exp_msk1)
+#endif
+		{
+		  if (word0 (rv0) == Tiny0
+		      && word1 (rv0) == Tiny1)
+		    goto undfl;
+		  word0 (rv) = Tiny0;
+		  word1 (rv) = Tiny1;
+		  goto cont;
+		}
+	      else
+		word0 (rv) -= P * Exp_msk1;
+	    }
+	  else
+	    {
+	      adj = aadj1 * ulp (rv.d);
+	      rv.d += adj;
+	    }
+#else
+	  /* Compute adj so that the IEEE rounding rules will
+	   * correctly round rv.d + adj in some half-way cases.
+	   * If rv.d * ulp(rv.d) is denormalized (i.e.,
+	   * y <= (P-1)*Exp_msk1), we must adjust aadj to avoid
+	   * trouble from bits lost to denormalization;
+	   * example: 1.2e-307 .
+	   */
+	  if (y <= (P - 1) * Exp_msk1 && aadj >= 1.)
+	    {
+	      aadj1 = (double) (int) (aadj + 0.5);
+	      if (!dsign)
+		aadj1 = -aadj1;
+	    }
+	  adj = aadj1 * ulp (rv.d);
+	  rv.d += adj;
+#endif
+	}
+      z = word0 (rv) & Exp_mask;
+      if (y == z)
+	{
+	  /* Can we stop now? */
+	  L = aadj;
+	  aadj -= L;
+	  /* The tolerances below are conservative. */
+	  if (dsign || word1 (rv) || word0 (rv) & Bndry_mask)
+	    {
+	      if (aadj < .4999999 || aadj > .5000001)
+		break;
+	    }
+	  else if (aadj < .4999999 / FLT_RADIX)
+	    break;
+	}
+    cont:
+      Bfree (ptr, bb);
+      Bfree (ptr, bd);
+      Bfree (ptr, bs);
+      Bfree (ptr, delta);
+    }
+retfree:
+  Bfree (ptr, bb);
+  Bfree (ptr, bd);
+  Bfree (ptr, bs);
+  Bfree (ptr, bd0);
+  Bfree (ptr, delta);
+ret:
+  if (se)
+    *se = (char *) s;
+  if (digits == 0)
+    ptr->_errno = EINVAL;
+  return sign ? -rv.d : rv.d;
+}
+

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/w_acos.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/w_acos.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/w_acos.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/w_acos.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,39 @@
+
+/* @(#)w_acos.c 1.3 95/01/18 */
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunSoft, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice 
+ * is preserved.
+ * ====================================================
+ */
+
+/*
+ * wrap_acos(x)
+ */
+
+#include "fdlibm.h"
+
+
+#ifdef __STDC__
+	double acos(double x)		/* wrapper acos */
+#else
+	double acos(x)			/* wrapper acos */
+	double x;
+#endif
+{
+#ifdef _IEEE_LIBM
+	return __ieee754_acos(x);
+#else
+	double z;
+	z = __ieee754_acos(x);
+	if(_LIB_VERSION == _IEEE_ || isnan(x)) return z;
+	if(fabs(x)>1.0) {
+	        return __kernel_standard(x,x,1); /* acos(|x|>1) */
+	} else
+	    return z;
+#endif
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/w_asin.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/w_asin.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/w_asin.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/w_asin.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,41 @@
+
+/* @(#)w_asin.c 1.3 95/01/18 */
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunSoft, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice 
+ * is preserved.
+ * ====================================================
+ *
+ */
+
+/* 
+ * wrapper asin(x)
+ */
+
+
+#include "fdlibm.h"
+
+
+#ifdef __STDC__
+	double asin(double x)		/* wrapper asin */
+#else
+	double asin(x)			/* wrapper asin */
+	double x;
+#endif
+{
+#ifdef _IEEE_LIBM
+	return __ieee754_asin(x);
+#else
+	double z;
+	z = __ieee754_asin(x);
+	if(_LIB_VERSION == _IEEE_ || isnan(x)) return z;
+	if(fabs(x)>1.0) {
+	        return __kernel_standard(x,x,2); /* asin(|x|>1) */
+	} else
+	    return z;
+#endif
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/w_atan2.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/w_atan2.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/w_atan2.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/w_atan2.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,40 @@
+
+/* @(#)w_atan2.c 1.3 95/01/18 */
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunSoft, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice 
+ * is preserved.
+ * ====================================================
+ *
+ */
+
+/* 
+ * wrapper atan2(y,x)
+ */
+
+#include "fdlibm.h"
+
+
+#ifdef __STDC__
+	double atan2(double y, double x)	/* wrapper atan2 */
+#else
+	double atan2(y,x)			/* wrapper atan2 */
+	double y,x;
+#endif
+{
+#ifdef _IEEE_LIBM
+	return __ieee754_atan2(y,x);
+#else
+	double z;
+	z = __ieee754_atan2(y,x);
+	if(_LIB_VERSION == _IEEE_||isnan(x)||isnan(y)) return z;
+	if(x==0.0&&y==0.0) {
+	        return __kernel_standard(y,x,3); /* atan2(+-0,+-0) */
+	} else
+	    return z;
+#endif
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/w_cosh.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/w_cosh.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/w_cosh.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/w_cosh.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,38 @@
+
+/* @(#)w_cosh.c 1.3 95/01/18 */
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunSoft, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice 
+ * is preserved.
+ * ====================================================
+ */
+
+/* 
+ * wrapper cosh(x)
+ */
+
+#include "fdlibm.h"
+
+#ifdef __STDC__
+	double cosh(double x)		/* wrapper cosh */
+#else
+	double cosh(x)			/* wrapper cosh */
+	double x;
+#endif
+{
+#ifdef _IEEE_LIBM
+	return __ieee754_cosh(x);
+#else
+	double z;
+	z = __ieee754_cosh(x);
+	if(_LIB_VERSION == _IEEE_ || isnan(x)) return z;
+	if(fabs(x)>7.10475860073943863426e+02) {	
+	        return __kernel_standard(x,x,5); /* cosh overflow */
+	} else
+	    return z;
+#endif
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/w_exp.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/w_exp.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/w_exp.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/w_exp.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,48 @@
+
+/* @(#)w_exp.c 1.4 04/04/22 */
+/*
+ * ====================================================
+ * Copyright (C) 2004 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice 
+ * is preserved.
+ * ====================================================
+ */
+
+/* 
+ * wrapper exp(x)
+ */
+
+#include "fdlibm.h"
+
+#ifdef __STDC__
+static const double
+#else
+static double
+#endif
+o_threshold=  7.09782712893383973096e+02,  /* 0x40862E42, 0xFEFA39EF */
+u_threshold= -7.45133219101941108420e+02;  /* 0xc0874910, 0xD52D3051 */
+
+#ifdef __STDC__
+	double exp(double x)		/* wrapper exp */
+#else
+	double exp(x)			/* wrapper exp */
+	double x;
+#endif
+{
+#ifdef _IEEE_LIBM
+	return __ieee754_exp(x);
+#else
+	double z;
+	z = __ieee754_exp(x);
+	if(_LIB_VERSION == _IEEE_) return z;
+	if(finite(x)) {
+	    if(x>o_threshold)
+	        return __kernel_standard(x,x,6); /* exp overflow */
+	    else if(x<u_threshold)
+	        return __kernel_standard(x,x,7); /* exp underflow */
+	} 
+	return z;
+#endif
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/w_fmod.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/w_fmod.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/w_fmod.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/w_fmod.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,39 @@
+
+/* @(#)w_fmod.c 1.3 95/01/18 */
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunSoft, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice 
+ * is preserved.
+ * ====================================================
+ */
+
+/* 
+ * wrapper fmod(x,y)
+ */
+
+#include "fdlibm.h"
+
+
+#ifdef __STDC__
+	double fmod(double x, double y)	/* wrapper fmod */
+#else
+	double fmod(x,y)		/* wrapper fmod */
+	double x,y;
+#endif
+{
+#ifdef _IEEE_LIBM
+	return __ieee754_fmod(x,y);
+#else
+	double z;
+	z = __ieee754_fmod(x,y);
+	if(_LIB_VERSION == _IEEE_ ||isnan(y)||isnan(x)) return z;
+	if(y==0.0) {
+	        return __kernel_standard(x,y,27); /* fmod(x,0) */
+	} else
+	    return z;
+#endif
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/w_hypot.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/w_hypot.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/w_hypot.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/w_hypot.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,39 @@
+
+/* @(#)w_hypot.c 1.3 95/01/18 */
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunSoft, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice 
+ * is preserved.
+ * ====================================================
+ */
+
+/*
+ * wrapper hypot(x,y)
+ */
+
+#include "fdlibm.h"
+
+
+#ifdef __STDC__
+	double hypot(double x, double y)/* wrapper hypot */
+#else
+	double hypot(x,y)		/* wrapper hypot */
+	double x,y;
+#endif
+{
+#ifdef _IEEE_LIBM
+	return __ieee754_hypot(x,y);
+#else
+	double z;
+	z = __ieee754_hypot(x,y);
+	if(_LIB_VERSION == _IEEE_) return z;
+	if((!finite(z))&&finite(x)&&finite(y))
+	    return __kernel_standard(x,y,4); /* hypot overflow */
+	else
+	    return z;
+#endif
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/w_log.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/w_log.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/w_log.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/w_log.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,39 @@
+
+/* @(#)w_log.c 1.3 95/01/18 */
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunSoft, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice 
+ * is preserved.
+ * ====================================================
+ */
+
+/*
+ * wrapper log(x)
+ */
+
+#include "fdlibm.h"
+
+
+#ifdef __STDC__
+	double log(double x)		/* wrapper log */
+#else
+	double log(x)			/* wrapper log */
+	double x;
+#endif
+{
+#ifdef _IEEE_LIBM
+	return __ieee754_log(x);
+#else
+	double z;
+	z = __ieee754_log(x);
+	if(_LIB_VERSION == _IEEE_ || isnan(x) || x > 0.0) return z;
+	if(x==0.0)
+	    return __kernel_standard(x,x,16); /* log(0) */
+	else 
+	    return __kernel_standard(x,x,17); /* log(x<0) */
+#endif
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/w_log10.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/w_log10.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/w_log10.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/w_log10.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,42 @@
+
+/* @(#)w_log10.c 1.3 95/01/18 */
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunSoft, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice 
+ * is preserved.
+ * ====================================================
+ */
+
+/* 
+ * wrapper log10(X)
+ */
+
+#include "fdlibm.h"
+
+
+#ifdef __STDC__
+	double log10(double x)		/* wrapper log10 */
+#else
+	double log10(x)			/* wrapper log10 */
+	double x;
+#endif
+{
+#ifdef _IEEE_LIBM
+	return __ieee754_log10(x);
+#else
+	double z;
+	z = __ieee754_log10(x);
+	if(_LIB_VERSION == _IEEE_ || isnan(x)) return z;
+	if(x<=0.0) {
+	    if(x==0.0)
+	        return __kernel_standard(x,x,18); /* log10(0) */
+	    else 
+	        return __kernel_standard(x,x,19); /* log10(x<0) */
+	} else
+	    return z;
+#endif
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/w_pow.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/w_pow.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/w_pow.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/w_pow.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,60 @@
+
+
+/* @(#)w_pow.c 1.3 95/01/18 */
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunSoft, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice 
+ * is preserved.
+ * ====================================================
+ */
+
+/* 
+ * wrapper pow(x,y) return x**y
+ */
+
+#include "fdlibm.h"
+
+
+#ifdef __STDC__
+	double pow(double x, double y)	/* wrapper pow */
+#else
+	double pow(x,y)			/* wrapper pow */
+	double x,y;
+#endif
+{
+#ifdef _IEEE_LIBM
+	return  __ieee754_pow(x,y);
+#else
+	double z;
+	z=__ieee754_pow(x,y);
+	if(_LIB_VERSION == _IEEE_|| isnan(y)) return z;
+	if(isnan(x)) {
+	    if(y==0.0) 
+	        return __kernel_standard(x,y,42); /* pow(NaN,0.0) */
+	    else 
+		return z;
+	}
+	if(x==0.0){ 
+	    if(y==0.0)
+	        return __kernel_standard(x,y,20); /* pow(0.0,0.0) */
+	    if(finite(y)&&y<0.0)
+	        return __kernel_standard(x,y,23); /* pow(0.0,negative) */
+	    return z;
+	}
+	if(!finite(z)) {
+	    if(finite(x)&&finite(y)) {
+	        if(isnan(z))
+	            return __kernel_standard(x,y,24); /* pow neg**non-int */
+	        else 
+	            return __kernel_standard(x,y,21); /* pow overflow */
+	    }
+	} 
+	if(z==0.0&&finite(x)&&finite(y))
+	    return __kernel_standard(x,y,22); /* pow underflow */
+	return z;
+#endif
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/w_remainder.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/w_remainder.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/w_remainder.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/w_remainder.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,38 @@
+
+/* @(#)w_remainder.c 1.3 95/01/18 */
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunSoft, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice 
+ * is preserved.
+ * ====================================================
+ */
+
+/* 
+ * wrapper remainder(x,p)
+ */
+
+#include "fdlibm.h"
+
+#ifdef __STDC__
+	double remainder(double x, double y)	/* wrapper remainder */
+#else
+	double remainder(x,y)			/* wrapper remainder */
+	double x,y;
+#endif
+{
+#ifdef _IEEE_LIBM
+	return __ieee754_remainder(x,y);
+#else
+	double z;
+	z = __ieee754_remainder(x,y);
+	if(_LIB_VERSION == _IEEE_ || isnan(y)) return z;
+	if(y==0.0) 
+	    return __kernel_standard(x,y,28); /* remainder(x,0) */
+	else
+	    return z;
+#endif
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/w_sinh.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/w_sinh.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/w_sinh.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/w_sinh.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,38 @@
+
+/* @(#)w_sinh.c 1.3 95/01/18 */
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunSoft, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice 
+ * is preserved.
+ * ====================================================
+ */
+
+/* 
+ * wrapper sinh(x)
+ */
+
+#include "fdlibm.h"
+
+#ifdef __STDC__
+	double sinh(double x)		/* wrapper sinh */
+#else
+	double sinh(x)			/* wrapper sinh */
+	double x;
+#endif
+{
+#ifdef _IEEE_LIBM
+	return __ieee754_sinh(x);
+#else
+	double z; 
+	z = __ieee754_sinh(x);
+	if(_LIB_VERSION == _IEEE_) return z;
+	if(!finite(z)&&finite(x)) {
+	    return __kernel_standard(x,x,25); /* sinh overflow */
+	} else
+	    return z;
+#endif
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/w_sqrt.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/w_sqrt.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/w_sqrt.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/fdlibm/w_sqrt.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,38 @@
+
+/* @(#)w_sqrt.c 1.3 95/01/18 */
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunSoft, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice 
+ * is preserved.
+ * ====================================================
+ */
+
+/* 
+ * wrapper sqrt(x)
+ */
+
+#include "fdlibm.h"
+
+#ifdef __STDC__
+	double sqrt(double x)		/* wrapper sqrt */
+#else
+	double sqrt(x)			/* wrapper sqrt */
+	double x;
+#endif
+{
+#ifdef _IEEE_LIBM
+	return __ieee754_sqrt(x);
+#else
+	double z;
+	z = __ieee754_sqrt(x);
+	if(_LIB_VERSION == _IEEE_ || isnan(x)) return z;
+	if(x<0.0) {
+	    return __kernel_standard(x,x,26); /* sqrt(negative) */
+	} else
+	    return z;
+#endif
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jawt/.cvsignore
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jawt/.cvsignore?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jawt/.cvsignore (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jawt/.cvsignore Thu Nov  8 16:56:19 2007
@@ -0,0 +1,8 @@
+*.o
+*.a
+*.lo
+*.la
+.libs
+.deps
+Makefile
+Makefile.in

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jawt/Makefile.am
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jawt/Makefile.am?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jawt/Makefile.am (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jawt/Makefile.am Thu Nov  8 16:56:19 2007
@@ -0,0 +1,13 @@
+nativeexeclib_LTLIBRARIES = libjawt.la
+
+libjawt_la_SOURCES = jawt.c
+libjawt_la_LIBADD = $(top_builddir)/native/jni/gtk-peer/libgtkpeer.la
+libjawt_la_LDFLAGS = -avoid-version
+
+AM_LDFLAGS = @CLASSPATH_MODULE@ @GTK_LIBS@ @PANGOFT2_LIBS@ @X_LIBS@ @XTEST_LIBS@
+AM_CPPFLAGS = @CLASSPATH_INCLUDES@
+
+# Just the WARNING_CFLAGS. We cannot use the strict flags since the gtk
+# headers contain broken prototypes (by design, see gtkitemfactory.h).
+AM_CFLAGS = @WARNING_CFLAGS@ @ERROR_CFLAGS@ \
+            @GTK_CFLAGS@ @PANGOFT2_CFLAGS@

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jawt/Makefile.in
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jawt/Makefile.in?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jawt/Makefile.in (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jawt/Makefile.in Thu Nov  8 16:56:19 2007
@@ -0,0 +1,598 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = native/jawt
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/../../config/depstand.m4 \
+	$(top_srcdir)/../../config/lead-dot.m4 \
+	$(top_srcdir)/../../config/multi.m4 \
+	$(top_srcdir)/../../libtool.m4 $(top_srcdir)/m4/acattribute.m4 \
+	$(top_srcdir)/m4/accross.m4 $(top_srcdir)/m4/acinclude.m4 \
+	$(top_srcdir)/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \
+	$(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
+	$(top_srcdir)/m4/pkg.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/include/config.h
+CONFIG_CLEAN_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+    *) f=$$p;; \
+  esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(nativeexeclibdir)"
+nativeexeclibLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(nativeexeclib_LTLIBRARIES)
+libjawt_la_DEPENDENCIES =  \
+	$(top_builddir)/native/jni/gtk-peer/libgtkpeer.la
+am_libjawt_la_OBJECTS = jawt.lo
+libjawt_la_OBJECTS = $(am_libjawt_la_OBJECTS)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \
+	$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+	$(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(libjawt_la_SOURCES)
+DIST_SOURCES = $(libjawt_la_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BUILD_CLASS_FILES_FALSE = @BUILD_CLASS_FILES_FALSE@
+BUILD_CLASS_FILES_TRUE = @BUILD_CLASS_FILES_TRUE@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CLASSPATH_CONVENIENCE = @CLASSPATH_CONVENIENCE@
+CLASSPATH_INCLUDES = @CLASSPATH_INCLUDES@
+CLASSPATH_MODULE = @CLASSPATH_MODULE@
+COLLECTIONS_PREFIX = @COLLECTIONS_PREFIX@
+CP = @CP@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CREATE_ALSA_LIBRARIES_FALSE = @CREATE_ALSA_LIBRARIES_FALSE@
+CREATE_ALSA_LIBRARIES_TRUE = @CREATE_ALSA_LIBRARIES_TRUE@
+CREATE_API_DOCS_FALSE = @CREATE_API_DOCS_FALSE@
+CREATE_API_DOCS_TRUE = @CREATE_API_DOCS_TRUE@
+CREATE_COLLECTIONS_FALSE = @CREATE_COLLECTIONS_FALSE@
+CREATE_COLLECTIONS_TRUE = @CREATE_COLLECTIONS_TRUE@
+CREATE_CORE_JNI_LIBRARIES_FALSE = @CREATE_CORE_JNI_LIBRARIES_FALSE@
+CREATE_CORE_JNI_LIBRARIES_TRUE = @CREATE_CORE_JNI_LIBRARIES_TRUE@
+CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
+CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
+CREATE_GCONF_PEER_LIBRARIES_FALSE = @CREATE_GCONF_PEER_LIBRARIES_FALSE@
+CREATE_GCONF_PEER_LIBRARIES_TRUE = @CREATE_GCONF_PEER_LIBRARIES_TRUE@
+CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
+CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
+CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
+CREATE_JNI_HEADERS_TRUE = @CREATE_JNI_HEADERS_TRUE@
+CREATE_JNI_LIBRARIES_FALSE = @CREATE_JNI_LIBRARIES_FALSE@
+CREATE_JNI_LIBRARIES_TRUE = @CREATE_JNI_LIBRARIES_TRUE@
+CREATE_PLUGIN_FALSE = @CREATE_PLUGIN_FALSE@
+CREATE_PLUGIN_TRUE = @CREATE_PLUGIN_TRUE@
+CREATE_QT_PEER_LIBRARIES_FALSE = @CREATE_QT_PEER_LIBRARIES_FALSE@
+CREATE_QT_PEER_LIBRARIES_TRUE = @CREATE_QT_PEER_LIBRARIES_TRUE@
+CREATE_WRAPPERS_FALSE = @CREATE_WRAPPERS_FALSE@
+CREATE_WRAPPERS_TRUE = @CREATE_WRAPPERS_TRUE@
+CREATE_XMLJ_LIBRARY_FALSE = @CREATE_XMLJ_LIBRARY_FALSE@
+CREATE_XMLJ_LIBRARY_TRUE = @CREATE_XMLJ_LIBRARY_TRUE@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DATE = @DATE@
+DEFAULT_PREFS_PEER = @DEFAULT_PREFS_PEER@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+ECJ = @ECJ@
+EGREP = @EGREP@
+ENABLE_LOCAL_SOCKETS_FALSE = @ENABLE_LOCAL_SOCKETS_FALSE@
+ENABLE_LOCAL_SOCKETS_TRUE = @ENABLE_LOCAL_SOCKETS_TRUE@
+ERROR_CFLAGS = @ERROR_CFLAGS@
+EXAMPLESDIR = @EXAMPLESDIR@
+EXEEXT = @EXEEXT@
+FASTJAR = @FASTJAR@
+FIND = @FIND@
+FOUND_CACAO_FALSE = @FOUND_CACAO_FALSE@
+FOUND_CACAO_TRUE = @FOUND_CACAO_TRUE@
+FOUND_ECJ_FALSE = @FOUND_ECJ_FALSE@
+FOUND_ECJ_TRUE = @FOUND_ECJ_TRUE@
+FOUND_GCJX_FALSE = @FOUND_GCJX_FALSE@
+FOUND_GCJX_TRUE = @FOUND_GCJX_TRUE@
+FOUND_GCJ_FALSE = @FOUND_GCJ_FALSE@
+FOUND_GCJ_TRUE = @FOUND_GCJ_TRUE@
+FOUND_JIKES_FALSE = @FOUND_JIKES_FALSE@
+FOUND_JIKES_TRUE = @FOUND_JIKES_TRUE@
+FOUND_KJC_FALSE = @FOUND_KJC_FALSE@
+FOUND_KJC_TRUE = @FOUND_KJC_TRUE@
+FREETYPE2_CFLAGS = @FREETYPE2_CFLAGS@
+FREETYPE2_LIBS = @FREETYPE2_LIBS@
+GCJ = @GCJ@
+GCJX = @GCJX@
+GCONF_CFLAGS = @GCONF_CFLAGS@
+GCONF_LIBS = @GCONF_LIBS@
+GDK_CFLAGS = @GDK_CFLAGS@
+GDK_LIBS = @GDK_LIBS@
+GJDOC = @GJDOC@
+GLIB_CFLAGS = @GLIB_CFLAGS@
+GLIB_LIBS = @GLIB_LIBS@
+GTK_CFLAGS = @GTK_CFLAGS@
+GTK_LIBS = @GTK_LIBS@
+INIT_LOAD_LIBRARY = @INIT_LOAD_LIBRARY@
+INSTALL_CLASS_FILES_FALSE = @INSTALL_CLASS_FILES_FALSE@
+INSTALL_CLASS_FILES_TRUE = @INSTALL_CLASS_FILES_TRUE@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_GLIBJ_ZIP_FALSE = @INSTALL_GLIBJ_ZIP_FALSE@
+INSTALL_GLIBJ_ZIP_TRUE = @INSTALL_GLIBJ_ZIP_TRUE@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION = @JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION@
+JAY = @JAY@
+JAY_SKELETON = @JAY_SKELETON@
+JIKES = @JIKES@
+JIKESENCODING = @JIKESENCODING@
+JIKESWARNINGS = @JIKESWARNINGS@
+KJC = @KJC@
+LDFLAGS = @LDFLAGS@
+LIBDEBUG = @LIBDEBUG@
+LIBICONV = @LIBICONV@
+LIBMAGIC = @LIBMAGIC@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBVERSION = @LIBVERSION@
+LN_S = @LN_S@
+LTLIBICONV = @LTLIBICONV@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
+MAKEINFO = @MAKEINFO@
+MKDIR = @MKDIR@
+MOC = @MOC@
+MOZILLA_CFLAGS = @MOZILLA_CFLAGS@
+MOZILLA_LIBS = @MOZILLA_LIBS@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PANGOFT2_CFLAGS = @PANGOFT2_CFLAGS@
+PANGOFT2_LIBS = @PANGOFT2_LIBS@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PATH_TO_ESCHER = @PATH_TO_ESCHER@
+PATH_TO_GLIBJ_ZIP = @PATH_TO_GLIBJ_ZIP@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PLUGIN_DIR = @PLUGIN_DIR@
+QT_CFLAGS = @QT_CFLAGS@
+QT_LIBS = @QT_LIBS@
+RANLIB = @RANLIB@
+REGEN_PARSERS_FALSE = @REGEN_PARSERS_FALSE@
+REGEN_PARSERS_TRUE = @REGEN_PARSERS_TRUE@
+REMOVE = @REMOVE@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRICT_WARNING_CFLAGS = @STRICT_WARNING_CFLAGS@
+STRIP = @STRIP@
+USER_CLASSLIB = @USER_CLASSLIB@
+USER_JAVAH = @USER_JAVAH@
+USER_SPECIFIED_CLASSLIB_FALSE = @USER_SPECIFIED_CLASSLIB_FALSE@
+USER_SPECIFIED_CLASSLIB_TRUE = @USER_SPECIFIED_CLASSLIB_TRUE@
+USER_SPECIFIED_JAVAH_FALSE = @USER_SPECIFIED_JAVAH_FALSE@
+USER_SPECIFIED_JAVAH_TRUE = @USER_SPECIFIED_JAVAH_TRUE@
+USE_ESCHER_FALSE = @USE_ESCHER_FALSE@
+USE_ESCHER_TRUE = @USE_ESCHER_TRUE@
+USE_PREBUILT_GLIBJ_ZIP_FALSE = @USE_PREBUILT_GLIBJ_ZIP_FALSE@
+USE_PREBUILT_GLIBJ_ZIP_TRUE = @USE_PREBUILT_GLIBJ_ZIP_TRUE@
+VERSION = @VERSION@
+VM_BINARY = @VM_BINARY@
+WARNING_CFLAGS = @WARNING_CFLAGS@
+XML_CFLAGS = @XML_CFLAGS@
+XML_LIBS = @XML_LIBS@
+XSLT_CFLAGS = @XSLT_CFLAGS@
+XSLT_LIBS = @XSLT_LIBS@
+XTEST_LIBS = @XTEST_LIBS@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+ZIP = @ZIP@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+default_toolkit = @default_toolkit@
+exec_prefix = @exec_prefix@
+glibjdir = @glibjdir@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+multi_basedir = @multi_basedir@
+nativeexeclibdir = @nativeexeclibdir@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+toolexeclibdir = @toolexeclibdir@
+vm_classes = @vm_classes@
+nativeexeclib_LTLIBRARIES = libjawt.la
+libjawt_la_SOURCES = jawt.c
+libjawt_la_LIBADD = $(top_builddir)/native/jni/gtk-peer/libgtkpeer.la
+libjawt_la_LDFLAGS = -avoid-version
+AM_LDFLAGS = @CLASSPATH_MODULE@ @GTK_LIBS@ @PANGOFT2_LIBS@ @X_LIBS@ @XTEST_LIBS@
+AM_CPPFLAGS = @CLASSPATH_INCLUDES@
+
+# Just the WARNING_CFLAGS. We cannot use the strict flags since the gtk
+# headers contain broken prototypes (by design, see gtkitemfactory.h).
+AM_CFLAGS = @WARNING_CFLAGS@ @ERROR_CFLAGS@ \
+            @GTK_CFLAGS@ @PANGOFT2_CFLAGS@
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  native/jawt/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  native/jawt/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-nativeexeclibLTLIBRARIES: $(nativeexeclib_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(nativeexeclibdir)" || $(mkdir_p) "$(DESTDIR)$(nativeexeclibdir)"
+	@list='$(nativeexeclib_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) --mode=install $(nativeexeclibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(nativeexeclibdir)/$$f'"; \
+	    $(LIBTOOL) --mode=install $(nativeexeclibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(nativeexeclibdir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-nativeexeclibLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@set -x; list='$(nativeexeclib_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(nativeexeclibdir)/$$p'"; \
+	  $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(nativeexeclibdir)/$$p"; \
+	done
+
+clean-nativeexeclibLTLIBRARIES:
+	-test -z "$(nativeexeclib_LTLIBRARIES)" || rm -f $(nativeexeclib_LTLIBRARIES)
+	@list='$(nativeexeclib_LTLIBRARIES)'; for p in $$list; do \
+	  dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+	  test "$$dir" != "$$p" || dir=.; \
+	  echo "rm -f \"$${dir}/so_locations\""; \
+	  rm -f "$${dir}/so_locations"; \
+	done
+libjawt.la: $(libjawt_la_OBJECTS) $(libjawt_la_DEPENDENCIES) 
+	$(LINK) -rpath $(nativeexeclibdir) $(libjawt_la_LDFLAGS) $(libjawt_la_OBJECTS) $(libjawt_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/jawt.Plo at am__quote@
+
+.c.o:
+ at am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+ at am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(COMPILE) -c $<
+
+.c.obj:
+ at am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+ at am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+ at am__fastdepCC_TRUE@	if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+ at am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+distclean-libtool:
+	-rm -f libtool
+uninstall-info-am:
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	    $$tags $$unique; \
+	fi
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$tags $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && cd $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+	list='$(DISTFILES)'; for file in $$list; do \
+	  case $$file in \
+	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+	  esac; \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+	    dir="/$$dir"; \
+	    $(mkdir_p) "$(distdir)$$dir"; \
+	  else \
+	    dir=''; \
+	  fi; \
+	  if test -d $$d/$$file; then \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES)
+installdirs:
+	for dir in "$(DESTDIR)$(nativeexeclibdir)"; do \
+	  test -z "$$dir" || $(mkdir_p) "$$dir"; \
+	done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-nativeexeclibLTLIBRARIES \
+	mostlyclean-am
+
+distclean: distclean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+	distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am: install-nativeexeclibLTLIBRARIES
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+	mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am uninstall-nativeexeclibLTLIBRARIES
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+	clean-libtool clean-nativeexeclibLTLIBRARIES ctags distclean \
+	distclean-compile distclean-generic distclean-libtool \
+	distclean-tags distdir dvi dvi-am html html-am info info-am \
+	install install-am install-data install-data-am install-exec \
+	install-exec-am install-info install-info-am install-man \
+	install-nativeexeclibLTLIBRARIES install-strip installcheck \
+	installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-compile \
+	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+	tags uninstall uninstall-am uninstall-info-am \
+	uninstall-nativeexeclibLTLIBRARIES
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jawt/jawt.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jawt/jawt.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jawt/jawt.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jawt/jawt.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,186 @@
+/* jawt.c -- X11 implementation of the AWT Native Interface
+   Copyright (C) 2005 Free Software Foundation, Inc.
+
+   This file is part of GNU Classpath.
+
+   GNU Classpath is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   GNU Classpath is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with GNU Classpath; see the file COPYING.  If not, write to the
+   Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+   02110-1301 USA.
+
+   Linking this library statically or dynamically with other modules is
+   making a combined work based on this library.  Thus, the terms and
+   conditions of the GNU General Public License cover the whole
+   combination.
+
+   As a special exception, the copyright holders of this library give you
+   permission to link this library with independent modules to produce an
+   executable, regardless of the license terms of these independent
+   modules, and to copy and distribute the resulting executable under
+   terms of your choice, provided that you also meet, for each linked
+   independent module, the terms and conditions of the license of that
+   module.  An independent module is a module which is not derived from
+   or based on this library.  If you modify this library, you may extend
+   this exception to your version of the library, but you are not
+   obligated to do so.  If you do not wish to do so, delete this
+   exception statement from your version. */
+
+#include <stdlib.h>
+#include <jni.h>
+#include <jawt.h>
+#include <jawt_md.h>
+#include "classpath_jawt.h"
+
+#ifndef __GNUC__
+#define __attribute__(x) /* nothing */
+#endif
+
+static jint (JNICALL _Jv_Lock) (JAWT_DrawingSurface* surface);
+static void (JNICALL _Jv_Unlock) (JAWT_DrawingSurface* surface);
+static JAWT_DrawingSurfaceInfo* (JNICALL _Jv_GetDrawingSurfaceInfo)
+     (JAWT_DrawingSurface* surface);
+static void (JNICALL _Jv_FreeDrawingSurfaceInfo)
+     (JAWT_DrawingSurfaceInfo* surface_info);
+static JAWT_DrawingSurface* (JNICALL _Jv_GetDrawingSurface) (JNIEnv* env,
+							     jobject canvas);
+static void (JNICALL _Jv_FreeDrawingSurface) (JAWT_DrawingSurface* surface);
+static void (JNICALL _Jv_AWTLock) (JNIEnv*);
+static void (JNICALL _Jv_AWTUnlock) (JNIEnv*);
+
+JNIEXPORT jboolean JNICALL
+JAWT_GetAWT (JNIEnv* env __attribute__((unused)), JAWT* awt)
+{
+  jint retrieved_version;
+
+  retrieved_version = classpath_jawt_get_awt_version ();
+
+  if (awt->version > retrieved_version)
+    return JNI_FALSE;
+
+  awt->GetDrawingSurface = _Jv_GetDrawingSurface;
+  awt->FreeDrawingSurface = _Jv_FreeDrawingSurface;
+  awt->Lock = _Jv_AWTLock;
+  awt->Unlock = _Jv_AWTUnlock;
+
+  return JNI_TRUE;
+}
+
+/* JAWT_DrawingSurface functions */
+
+static jint
+(JNICALL _Jv_Lock) (JAWT_DrawingSurface* surface __attribute__((unused)))
+{
+  return classpath_jawt_lock ();
+}
+
+static void
+(JNICALL _Jv_Unlock) (JAWT_DrawingSurface* surface __attribute__((unused)))
+{
+  classpath_jawt_unlock ();
+}
+
+static JAWT_DrawingSurfaceInfo*
+(JNICALL _Jv_GetDrawingSurfaceInfo) (JAWT_DrawingSurface* surface)
+{
+  JAWT_DrawingSurfaceInfo* surface_info;
+  JAWT_X11DrawingSurfaceInfo* surface_info_x11;
+
+  if (surface == NULL || surface->target == NULL)
+    return NULL;
+
+  surface_info = (JAWT_DrawingSurfaceInfo*) malloc (sizeof (JAWT_DrawingSurfaceInfo));
+
+  if (surface_info == NULL)
+    return NULL;
+
+  surface_info->platformInfo = malloc (sizeof (JAWT_X11DrawingSurfaceInfo));
+
+  if (surface_info->platformInfo == NULL)
+    return NULL;
+
+  surface_info_x11 = (JAWT_X11DrawingSurfaceInfo*) surface_info->platformInfo;
+
+  surface_info_x11->display = classpath_jawt_get_default_display (surface->env,
+                                                                  surface->target);
+  surface_info_x11->drawable = classpath_jawt_get_drawable (surface->env,
+                                                            surface->target);
+  surface_info_x11->visualID = classpath_jawt_get_visualID (surface->env,
+                                                            surface->target);
+
+  /* FIXME: also include bounding rectangle of drawing surface */
+  /* FIXME: also include current clipping region */
+
+  return surface_info;
+}
+
+static void
+(JNICALL _Jv_FreeDrawingSurfaceInfo) (JAWT_DrawingSurfaceInfo* surface_info)
+{
+  JAWT_X11DrawingSurfaceInfo* surface_info_x11;
+
+  if (surface_info == NULL)
+    return;
+
+  surface_info_x11 = (JAWT_X11DrawingSurfaceInfo*) surface_info->platformInfo;
+
+  surface_info_x11->display = NULL;
+  surface_info_x11->drawable = 0;
+  surface_info_x11->visualID = 0;
+
+  free (surface_info->platformInfo);
+  free (surface_info);
+  surface_info = NULL;
+}
+
+/* JAWT functions */
+
+static JAWT_DrawingSurface*
+(JNICALL _Jv_GetDrawingSurface) (JNIEnv* env, jobject canvas)
+{
+  JAWT_DrawingSurface* surface;
+
+  surface = (JAWT_DrawingSurface*) malloc (sizeof (JAWT_DrawingSurface));
+
+  if (surface == NULL)
+    return NULL;
+
+  surface->env = env;
+  surface->target = canvas;
+
+  /* initialize function pointers */
+  surface->GetDrawingSurfaceInfo = _Jv_GetDrawingSurfaceInfo;
+  surface->FreeDrawingSurfaceInfo = _Jv_FreeDrawingSurfaceInfo;
+
+  surface->Lock = _Jv_Lock;
+  surface->Unlock = _Jv_Unlock;
+
+  return surface;
+}
+
+static void
+(JNICALL _Jv_FreeDrawingSurface) (JAWT_DrawingSurface* surface)
+{
+  free (surface);
+}
+
+static void
+(JNICALL _Jv_AWTLock) (JNIEnv* env __attribute__((unused)))
+{
+  /* FIXME: what is this supposed to do? */
+}
+
+static void
+(JNICALL _Jv_AWTUnlock) (JNIEnv* env __attribute__((unused)))
+{
+  /* FIXME: what is this supposed to do? */
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/Makefile.am
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/Makefile.am?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/Makefile.am (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/Makefile.am Thu Nov  8 16:56:19 2007
@@ -0,0 +1,38 @@
+## Input file for automake to generate the Makefile.in used by configure
+
+if CREATE_CORE_JNI_LIBRARIES
+  JNIDIRS = java-io java-lang java-net java-nio java-util
+endif
+
+if CREATE_ALSA_LIBRARIES
+  ALSADIR = midi-alsa
+endif
+
+if CREATE_DSSI_LIBRARIES
+  DSSIDIR = midi-dssi
+endif
+
+if CREATE_GTK_PEER_LIBRARIES
+  GTKDIR = gtk-peer
+endif
+
+if CREATE_QT_PEER_LIBRARIES
+  CLASSPATH_QT_PEER_DIR = qt-peer
+endif
+
+if CREATE_GCONF_PEER_LIBRARIES
+  CLASSPATH_GCONF_PEER_DIR = gconf-peer
+endif
+
+if CREATE_XMLJ_LIBRARY
+  XMLJDIR = xmlj
+endif
+
+SUBDIRS = classpath $(JNIDIRS) \
+  $(ALSADIR) $(DSSIDIR) $(GTKDIR) $(CLASSPATH_QT_PEER_DIR) $(XMLJDIR) \
+  $(CLASSPATH_GCONF_PEER_DIR)
+DIST_SUBDIRS = classpath java-io java-lang java-net java-nio java-util \
+               gtk-peer gconf-peer qt-peer xmlj midi-alsa midi-dssi
+
+all-local:
+	cd $(top_srcdir) && $(SHELL) ./scripts/check_jni_methods.sh

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/Makefile.in
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/Makefile.in?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/Makefile.in (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/Makefile.in Thu Nov  8 16:56:19 2007
@@ -0,0 +1,620 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = native/jni
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/../../config/depstand.m4 \
+	$(top_srcdir)/../../config/lead-dot.m4 \
+	$(top_srcdir)/../../config/multi.m4 \
+	$(top_srcdir)/../../libtool.m4 $(top_srcdir)/m4/acattribute.m4 \
+	$(top_srcdir)/m4/accross.m4 $(top_srcdir)/m4/acinclude.m4 \
+	$(top_srcdir)/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \
+	$(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
+	$(top_srcdir)/m4/pkg.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/include/config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+	html-recursive info-recursive install-data-recursive \
+	install-exec-recursive install-info-recursive \
+	install-recursive installcheck-recursive installdirs-recursive \
+	pdf-recursive ps-recursive uninstall-info-recursive \
+	uninstall-recursive
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BUILD_CLASS_FILES_FALSE = @BUILD_CLASS_FILES_FALSE@
+BUILD_CLASS_FILES_TRUE = @BUILD_CLASS_FILES_TRUE@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CLASSPATH_CONVENIENCE = @CLASSPATH_CONVENIENCE@
+CLASSPATH_INCLUDES = @CLASSPATH_INCLUDES@
+CLASSPATH_MODULE = @CLASSPATH_MODULE@
+COLLECTIONS_PREFIX = @COLLECTIONS_PREFIX@
+CP = @CP@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CREATE_ALSA_LIBRARIES_FALSE = @CREATE_ALSA_LIBRARIES_FALSE@
+CREATE_ALSA_LIBRARIES_TRUE = @CREATE_ALSA_LIBRARIES_TRUE@
+CREATE_API_DOCS_FALSE = @CREATE_API_DOCS_FALSE@
+CREATE_API_DOCS_TRUE = @CREATE_API_DOCS_TRUE@
+CREATE_COLLECTIONS_FALSE = @CREATE_COLLECTIONS_FALSE@
+CREATE_COLLECTIONS_TRUE = @CREATE_COLLECTIONS_TRUE@
+CREATE_CORE_JNI_LIBRARIES_FALSE = @CREATE_CORE_JNI_LIBRARIES_FALSE@
+CREATE_CORE_JNI_LIBRARIES_TRUE = @CREATE_CORE_JNI_LIBRARIES_TRUE@
+CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
+CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
+CREATE_GCONF_PEER_LIBRARIES_FALSE = @CREATE_GCONF_PEER_LIBRARIES_FALSE@
+CREATE_GCONF_PEER_LIBRARIES_TRUE = @CREATE_GCONF_PEER_LIBRARIES_TRUE@
+CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
+CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
+CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
+CREATE_JNI_HEADERS_TRUE = @CREATE_JNI_HEADERS_TRUE@
+CREATE_JNI_LIBRARIES_FALSE = @CREATE_JNI_LIBRARIES_FALSE@
+CREATE_JNI_LIBRARIES_TRUE = @CREATE_JNI_LIBRARIES_TRUE@
+CREATE_PLUGIN_FALSE = @CREATE_PLUGIN_FALSE@
+CREATE_PLUGIN_TRUE = @CREATE_PLUGIN_TRUE@
+CREATE_QT_PEER_LIBRARIES_FALSE = @CREATE_QT_PEER_LIBRARIES_FALSE@
+CREATE_QT_PEER_LIBRARIES_TRUE = @CREATE_QT_PEER_LIBRARIES_TRUE@
+CREATE_WRAPPERS_FALSE = @CREATE_WRAPPERS_FALSE@
+CREATE_WRAPPERS_TRUE = @CREATE_WRAPPERS_TRUE@
+CREATE_XMLJ_LIBRARY_FALSE = @CREATE_XMLJ_LIBRARY_FALSE@
+CREATE_XMLJ_LIBRARY_TRUE = @CREATE_XMLJ_LIBRARY_TRUE@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DATE = @DATE@
+DEFAULT_PREFS_PEER = @DEFAULT_PREFS_PEER@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+ECJ = @ECJ@
+EGREP = @EGREP@
+ENABLE_LOCAL_SOCKETS_FALSE = @ENABLE_LOCAL_SOCKETS_FALSE@
+ENABLE_LOCAL_SOCKETS_TRUE = @ENABLE_LOCAL_SOCKETS_TRUE@
+ERROR_CFLAGS = @ERROR_CFLAGS@
+EXAMPLESDIR = @EXAMPLESDIR@
+EXEEXT = @EXEEXT@
+FASTJAR = @FASTJAR@
+FIND = @FIND@
+FOUND_CACAO_FALSE = @FOUND_CACAO_FALSE@
+FOUND_CACAO_TRUE = @FOUND_CACAO_TRUE@
+FOUND_ECJ_FALSE = @FOUND_ECJ_FALSE@
+FOUND_ECJ_TRUE = @FOUND_ECJ_TRUE@
+FOUND_GCJX_FALSE = @FOUND_GCJX_FALSE@
+FOUND_GCJX_TRUE = @FOUND_GCJX_TRUE@
+FOUND_GCJ_FALSE = @FOUND_GCJ_FALSE@
+FOUND_GCJ_TRUE = @FOUND_GCJ_TRUE@
+FOUND_JIKES_FALSE = @FOUND_JIKES_FALSE@
+FOUND_JIKES_TRUE = @FOUND_JIKES_TRUE@
+FOUND_KJC_FALSE = @FOUND_KJC_FALSE@
+FOUND_KJC_TRUE = @FOUND_KJC_TRUE@
+FREETYPE2_CFLAGS = @FREETYPE2_CFLAGS@
+FREETYPE2_LIBS = @FREETYPE2_LIBS@
+GCJ = @GCJ@
+GCJX = @GCJX@
+GCONF_CFLAGS = @GCONF_CFLAGS@
+GCONF_LIBS = @GCONF_LIBS@
+GDK_CFLAGS = @GDK_CFLAGS@
+GDK_LIBS = @GDK_LIBS@
+GJDOC = @GJDOC@
+GLIB_CFLAGS = @GLIB_CFLAGS@
+GLIB_LIBS = @GLIB_LIBS@
+GTK_CFLAGS = @GTK_CFLAGS@
+GTK_LIBS = @GTK_LIBS@
+INIT_LOAD_LIBRARY = @INIT_LOAD_LIBRARY@
+INSTALL_CLASS_FILES_FALSE = @INSTALL_CLASS_FILES_FALSE@
+INSTALL_CLASS_FILES_TRUE = @INSTALL_CLASS_FILES_TRUE@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_GLIBJ_ZIP_FALSE = @INSTALL_GLIBJ_ZIP_FALSE@
+INSTALL_GLIBJ_ZIP_TRUE = @INSTALL_GLIBJ_ZIP_TRUE@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION = @JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION@
+JAY = @JAY@
+JAY_SKELETON = @JAY_SKELETON@
+JIKES = @JIKES@
+JIKESENCODING = @JIKESENCODING@
+JIKESWARNINGS = @JIKESWARNINGS@
+KJC = @KJC@
+LDFLAGS = @LDFLAGS@
+LIBDEBUG = @LIBDEBUG@
+LIBICONV = @LIBICONV@
+LIBMAGIC = @LIBMAGIC@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBVERSION = @LIBVERSION@
+LN_S = @LN_S@
+LTLIBICONV = @LTLIBICONV@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
+MAKEINFO = @MAKEINFO@
+MKDIR = @MKDIR@
+MOC = @MOC@
+MOZILLA_CFLAGS = @MOZILLA_CFLAGS@
+MOZILLA_LIBS = @MOZILLA_LIBS@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PANGOFT2_CFLAGS = @PANGOFT2_CFLAGS@
+PANGOFT2_LIBS = @PANGOFT2_LIBS@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PATH_TO_ESCHER = @PATH_TO_ESCHER@
+PATH_TO_GLIBJ_ZIP = @PATH_TO_GLIBJ_ZIP@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PLUGIN_DIR = @PLUGIN_DIR@
+QT_CFLAGS = @QT_CFLAGS@
+QT_LIBS = @QT_LIBS@
+RANLIB = @RANLIB@
+REGEN_PARSERS_FALSE = @REGEN_PARSERS_FALSE@
+REGEN_PARSERS_TRUE = @REGEN_PARSERS_TRUE@
+REMOVE = @REMOVE@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRICT_WARNING_CFLAGS = @STRICT_WARNING_CFLAGS@
+STRIP = @STRIP@
+USER_CLASSLIB = @USER_CLASSLIB@
+USER_JAVAH = @USER_JAVAH@
+USER_SPECIFIED_CLASSLIB_FALSE = @USER_SPECIFIED_CLASSLIB_FALSE@
+USER_SPECIFIED_CLASSLIB_TRUE = @USER_SPECIFIED_CLASSLIB_TRUE@
+USER_SPECIFIED_JAVAH_FALSE = @USER_SPECIFIED_JAVAH_FALSE@
+USER_SPECIFIED_JAVAH_TRUE = @USER_SPECIFIED_JAVAH_TRUE@
+USE_ESCHER_FALSE = @USE_ESCHER_FALSE@
+USE_ESCHER_TRUE = @USE_ESCHER_TRUE@
+USE_PREBUILT_GLIBJ_ZIP_FALSE = @USE_PREBUILT_GLIBJ_ZIP_FALSE@
+USE_PREBUILT_GLIBJ_ZIP_TRUE = @USE_PREBUILT_GLIBJ_ZIP_TRUE@
+VERSION = @VERSION@
+VM_BINARY = @VM_BINARY@
+WARNING_CFLAGS = @WARNING_CFLAGS@
+XML_CFLAGS = @XML_CFLAGS@
+XML_LIBS = @XML_LIBS@
+XSLT_CFLAGS = @XSLT_CFLAGS@
+XSLT_LIBS = @XSLT_LIBS@
+XTEST_LIBS = @XTEST_LIBS@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+ZIP = @ZIP@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+default_toolkit = @default_toolkit@
+exec_prefix = @exec_prefix@
+glibjdir = @glibjdir@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+multi_basedir = @multi_basedir@
+nativeexeclibdir = @nativeexeclibdir@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+toolexeclibdir = @toolexeclibdir@
+vm_classes = @vm_classes@
+ at CREATE_CORE_JNI_LIBRARIES_TRUE@JNIDIRS = java-io java-lang java-net java-nio java-util
+ at CREATE_ALSA_LIBRARIES_TRUE@ALSADIR = midi-alsa
+ at CREATE_DSSI_LIBRARIES_TRUE@DSSIDIR = midi-dssi
+ at CREATE_GTK_PEER_LIBRARIES_TRUE@GTKDIR = gtk-peer
+ at CREATE_QT_PEER_LIBRARIES_TRUE@CLASSPATH_QT_PEER_DIR = qt-peer
+ at CREATE_GCONF_PEER_LIBRARIES_TRUE@CLASSPATH_GCONF_PEER_DIR = gconf-peer
+ at CREATE_XMLJ_LIBRARY_TRUE@XMLJDIR = xmlj
+SUBDIRS = classpath $(JNIDIRS) \
+  $(ALSADIR) $(DSSIDIR) $(GTKDIR) $(CLASSPATH_QT_PEER_DIR) $(XMLJDIR) \
+  $(CLASSPATH_GCONF_PEER_DIR)
+
+DIST_SUBDIRS = classpath java-io java-lang java-net java-nio java-util \
+               gtk-peer gconf-peer qt-peer xmlj midi-alsa midi-dssi
+
+all: all-recursive
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  native/jni/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  native/jni/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+distclean-libtool:
+	-rm -f libtool
+uninstall-info-am:
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+#     (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+	@failcom='exit 1'; \
+	for f in x $$MAKEFLAGS; do \
+	  case $$f in \
+	    *=* | --[!k]*);; \
+	    *k*) failcom='fail=yes';; \
+	  esac; \
+	done; \
+	dot_seen=no; \
+	target=`echo $@ | sed s/-recursive//`; \
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  echo "Making $$target in $$subdir"; \
+	  if test "$$subdir" = "."; then \
+	    dot_seen=yes; \
+	    local_target="$$target-am"; \
+	  else \
+	    local_target="$$target"; \
+	  fi; \
+	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	  || eval $$failcom; \
+	done; \
+	if test "$$dot_seen" = "no"; then \
+	  $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+	fi; test -z "$$fail"
+
+mostlyclean-recursive clean-recursive distclean-recursive \
+maintainer-clean-recursive:
+	@failcom='exit 1'; \
+	for f in x $$MAKEFLAGS; do \
+	  case $$f in \
+	    *=* | --[!k]*);; \
+	    *k*) failcom='fail=yes';; \
+	  esac; \
+	done; \
+	dot_seen=no; \
+	case "$@" in \
+	  distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+	  *) list='$(SUBDIRS)' ;; \
+	esac; \
+	rev=''; for subdir in $$list; do \
+	  if test "$$subdir" = "."; then :; else \
+	    rev="$$subdir $$rev"; \
+	  fi; \
+	done; \
+	rev="$$rev ."; \
+	target=`echo $@ | sed s/-recursive//`; \
+	for subdir in $$rev; do \
+	  echo "Making $$target in $$subdir"; \
+	  if test "$$subdir" = "."; then \
+	    local_target="$$target-am"; \
+	  else \
+	    local_target="$$target"; \
+	  fi; \
+	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	  || eval $$failcom; \
+	done && test -z "$$fail"
+tags-recursive:
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+	done
+ctags-recursive:
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+	done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+	  include_option=--etags-include; \
+	  empty_fix=.; \
+	else \
+	  include_option=--include; \
+	  empty_fix=; \
+	fi; \
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  if test "$$subdir" = .; then :; else \
+	    test ! -f $$subdir/TAGS || \
+	      tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+	  fi; \
+	done; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	    $$tags $$unique; \
+	fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$tags $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && cd $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+	list='$(DISTFILES)'; for file in $$list; do \
+	  case $$file in \
+	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+	  esac; \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+	    dir="/$$dir"; \
+	    $(mkdir_p) "$(distdir)$$dir"; \
+	  else \
+	    dir=''; \
+	  fi; \
+	  if test -d $$d/$$file; then \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+	list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+	  if test "$$subdir" = .; then :; else \
+	    test -d "$(distdir)/$$subdir" \
+	    || $(mkdir_p) "$(distdir)/$$subdir" \
+	    || exit 1; \
+	    distdir=`$(am__cd) $(distdir) && pwd`; \
+	    top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+	    (cd $$subdir && \
+	      $(MAKE) $(AM_MAKEFLAGS) \
+	        top_distdir="$$top_distdir" \
+	        distdir="$$distdir/$$subdir" \
+	        distdir) \
+	      || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-recursive
+all-am: Makefile all-local
+installdirs: installdirs-recursive
+installdirs-am:
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-recursive
+	-rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-libtool \
+	distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-recursive
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+uninstall-info: uninstall-info-recursive
+
+.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am all-local check \
+	check-am clean clean-generic clean-libtool clean-recursive \
+	ctags ctags-recursive distclean distclean-generic \
+	distclean-libtool distclean-recursive distclean-tags distdir \
+	dvi dvi-am html html-am info info-am install install-am \
+	install-data install-data-am install-exec install-exec-am \
+	install-info install-info-am install-man install-strip \
+	installcheck installcheck-am installdirs installdirs-am \
+	maintainer-clean maintainer-clean-generic \
+	maintainer-clean-recursive mostlyclean mostlyclean-generic \
+	mostlyclean-libtool mostlyclean-recursive pdf pdf-am ps ps-am \
+	tags tags-recursive uninstall uninstall-am uninstall-info-am
+
+
+all-local:
+	cd $(top_srcdir) && $(SHELL) ./scripts/check_jni_methods.sh
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/classpath/Makefile.am
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/classpath/Makefile.am?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/classpath/Makefile.am (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/classpath/Makefile.am Thu Nov  8 16:56:19 2007
@@ -0,0 +1,12 @@
+# Header needed for jawt implementations such as the one found in ../gtk-peer.
+EXTRA_DIST = classpath_jawt.h
+
+noinst_LTLIBRARIES = libclasspath.la
+
+libclasspath_la_SOURCES = jcl.c jcl.h \
+			  jnilink.c jnilink.h \
+			  native_state.c native_state.h
+
+AM_LDFLAGS = @CLASSPATH_CONVENIENCE@
+AM_CPPFLAGS = @CLASSPATH_INCLUDES@
+AM_CFLAGS = @WARNING_CFLAGS@ @STRICT_WARNING_CFLAGS@ @ERROR_CFLAGS@

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/classpath/Makefile.in
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/classpath/Makefile.in?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/classpath/Makefile.in (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/classpath/Makefile.in Thu Nov  8 16:56:19 2007
@@ -0,0 +1,568 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = native/jni/classpath
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/../../config/depstand.m4 \
+	$(top_srcdir)/../../config/lead-dot.m4 \
+	$(top_srcdir)/../../config/multi.m4 \
+	$(top_srcdir)/../../libtool.m4 $(top_srcdir)/m4/acattribute.m4 \
+	$(top_srcdir)/m4/accross.m4 $(top_srcdir)/m4/acinclude.m4 \
+	$(top_srcdir)/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \
+	$(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
+	$(top_srcdir)/m4/pkg.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/include/config.h
+CONFIG_CLEAN_FILES =
+LTLIBRARIES = $(noinst_LTLIBRARIES)
+libclasspath_la_LIBADD =
+am_libclasspath_la_OBJECTS = jcl.lo jnilink.lo native_state.lo
+libclasspath_la_OBJECTS = $(am_libclasspath_la_OBJECTS)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \
+	$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+	$(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(libclasspath_la_SOURCES)
+DIST_SOURCES = $(libclasspath_la_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BUILD_CLASS_FILES_FALSE = @BUILD_CLASS_FILES_FALSE@
+BUILD_CLASS_FILES_TRUE = @BUILD_CLASS_FILES_TRUE@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CLASSPATH_CONVENIENCE = @CLASSPATH_CONVENIENCE@
+CLASSPATH_INCLUDES = @CLASSPATH_INCLUDES@
+CLASSPATH_MODULE = @CLASSPATH_MODULE@
+COLLECTIONS_PREFIX = @COLLECTIONS_PREFIX@
+CP = @CP@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CREATE_ALSA_LIBRARIES_FALSE = @CREATE_ALSA_LIBRARIES_FALSE@
+CREATE_ALSA_LIBRARIES_TRUE = @CREATE_ALSA_LIBRARIES_TRUE@
+CREATE_API_DOCS_FALSE = @CREATE_API_DOCS_FALSE@
+CREATE_API_DOCS_TRUE = @CREATE_API_DOCS_TRUE@
+CREATE_COLLECTIONS_FALSE = @CREATE_COLLECTIONS_FALSE@
+CREATE_COLLECTIONS_TRUE = @CREATE_COLLECTIONS_TRUE@
+CREATE_CORE_JNI_LIBRARIES_FALSE = @CREATE_CORE_JNI_LIBRARIES_FALSE@
+CREATE_CORE_JNI_LIBRARIES_TRUE = @CREATE_CORE_JNI_LIBRARIES_TRUE@
+CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
+CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
+CREATE_GCONF_PEER_LIBRARIES_FALSE = @CREATE_GCONF_PEER_LIBRARIES_FALSE@
+CREATE_GCONF_PEER_LIBRARIES_TRUE = @CREATE_GCONF_PEER_LIBRARIES_TRUE@
+CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
+CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
+CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
+CREATE_JNI_HEADERS_TRUE = @CREATE_JNI_HEADERS_TRUE@
+CREATE_JNI_LIBRARIES_FALSE = @CREATE_JNI_LIBRARIES_FALSE@
+CREATE_JNI_LIBRARIES_TRUE = @CREATE_JNI_LIBRARIES_TRUE@
+CREATE_PLUGIN_FALSE = @CREATE_PLUGIN_FALSE@
+CREATE_PLUGIN_TRUE = @CREATE_PLUGIN_TRUE@
+CREATE_QT_PEER_LIBRARIES_FALSE = @CREATE_QT_PEER_LIBRARIES_FALSE@
+CREATE_QT_PEER_LIBRARIES_TRUE = @CREATE_QT_PEER_LIBRARIES_TRUE@
+CREATE_WRAPPERS_FALSE = @CREATE_WRAPPERS_FALSE@
+CREATE_WRAPPERS_TRUE = @CREATE_WRAPPERS_TRUE@
+CREATE_XMLJ_LIBRARY_FALSE = @CREATE_XMLJ_LIBRARY_FALSE@
+CREATE_XMLJ_LIBRARY_TRUE = @CREATE_XMLJ_LIBRARY_TRUE@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DATE = @DATE@
+DEFAULT_PREFS_PEER = @DEFAULT_PREFS_PEER@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+ECJ = @ECJ@
+EGREP = @EGREP@
+ENABLE_LOCAL_SOCKETS_FALSE = @ENABLE_LOCAL_SOCKETS_FALSE@
+ENABLE_LOCAL_SOCKETS_TRUE = @ENABLE_LOCAL_SOCKETS_TRUE@
+ERROR_CFLAGS = @ERROR_CFLAGS@
+EXAMPLESDIR = @EXAMPLESDIR@
+EXEEXT = @EXEEXT@
+FASTJAR = @FASTJAR@
+FIND = @FIND@
+FOUND_CACAO_FALSE = @FOUND_CACAO_FALSE@
+FOUND_CACAO_TRUE = @FOUND_CACAO_TRUE@
+FOUND_ECJ_FALSE = @FOUND_ECJ_FALSE@
+FOUND_ECJ_TRUE = @FOUND_ECJ_TRUE@
+FOUND_GCJX_FALSE = @FOUND_GCJX_FALSE@
+FOUND_GCJX_TRUE = @FOUND_GCJX_TRUE@
+FOUND_GCJ_FALSE = @FOUND_GCJ_FALSE@
+FOUND_GCJ_TRUE = @FOUND_GCJ_TRUE@
+FOUND_JIKES_FALSE = @FOUND_JIKES_FALSE@
+FOUND_JIKES_TRUE = @FOUND_JIKES_TRUE@
+FOUND_KJC_FALSE = @FOUND_KJC_FALSE@
+FOUND_KJC_TRUE = @FOUND_KJC_TRUE@
+FREETYPE2_CFLAGS = @FREETYPE2_CFLAGS@
+FREETYPE2_LIBS = @FREETYPE2_LIBS@
+GCJ = @GCJ@
+GCJX = @GCJX@
+GCONF_CFLAGS = @GCONF_CFLAGS@
+GCONF_LIBS = @GCONF_LIBS@
+GDK_CFLAGS = @GDK_CFLAGS@
+GDK_LIBS = @GDK_LIBS@
+GJDOC = @GJDOC@
+GLIB_CFLAGS = @GLIB_CFLAGS@
+GLIB_LIBS = @GLIB_LIBS@
+GTK_CFLAGS = @GTK_CFLAGS@
+GTK_LIBS = @GTK_LIBS@
+INIT_LOAD_LIBRARY = @INIT_LOAD_LIBRARY@
+INSTALL_CLASS_FILES_FALSE = @INSTALL_CLASS_FILES_FALSE@
+INSTALL_CLASS_FILES_TRUE = @INSTALL_CLASS_FILES_TRUE@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_GLIBJ_ZIP_FALSE = @INSTALL_GLIBJ_ZIP_FALSE@
+INSTALL_GLIBJ_ZIP_TRUE = @INSTALL_GLIBJ_ZIP_TRUE@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION = @JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION@
+JAY = @JAY@
+JAY_SKELETON = @JAY_SKELETON@
+JIKES = @JIKES@
+JIKESENCODING = @JIKESENCODING@
+JIKESWARNINGS = @JIKESWARNINGS@
+KJC = @KJC@
+LDFLAGS = @LDFLAGS@
+LIBDEBUG = @LIBDEBUG@
+LIBICONV = @LIBICONV@
+LIBMAGIC = @LIBMAGIC@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBVERSION = @LIBVERSION@
+LN_S = @LN_S@
+LTLIBICONV = @LTLIBICONV@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
+MAKEINFO = @MAKEINFO@
+MKDIR = @MKDIR@
+MOC = @MOC@
+MOZILLA_CFLAGS = @MOZILLA_CFLAGS@
+MOZILLA_LIBS = @MOZILLA_LIBS@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PANGOFT2_CFLAGS = @PANGOFT2_CFLAGS@
+PANGOFT2_LIBS = @PANGOFT2_LIBS@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PATH_TO_ESCHER = @PATH_TO_ESCHER@
+PATH_TO_GLIBJ_ZIP = @PATH_TO_GLIBJ_ZIP@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PLUGIN_DIR = @PLUGIN_DIR@
+QT_CFLAGS = @QT_CFLAGS@
+QT_LIBS = @QT_LIBS@
+RANLIB = @RANLIB@
+REGEN_PARSERS_FALSE = @REGEN_PARSERS_FALSE@
+REGEN_PARSERS_TRUE = @REGEN_PARSERS_TRUE@
+REMOVE = @REMOVE@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRICT_WARNING_CFLAGS = @STRICT_WARNING_CFLAGS@
+STRIP = @STRIP@
+USER_CLASSLIB = @USER_CLASSLIB@
+USER_JAVAH = @USER_JAVAH@
+USER_SPECIFIED_CLASSLIB_FALSE = @USER_SPECIFIED_CLASSLIB_FALSE@
+USER_SPECIFIED_CLASSLIB_TRUE = @USER_SPECIFIED_CLASSLIB_TRUE@
+USER_SPECIFIED_JAVAH_FALSE = @USER_SPECIFIED_JAVAH_FALSE@
+USER_SPECIFIED_JAVAH_TRUE = @USER_SPECIFIED_JAVAH_TRUE@
+USE_ESCHER_FALSE = @USE_ESCHER_FALSE@
+USE_ESCHER_TRUE = @USE_ESCHER_TRUE@
+USE_PREBUILT_GLIBJ_ZIP_FALSE = @USE_PREBUILT_GLIBJ_ZIP_FALSE@
+USE_PREBUILT_GLIBJ_ZIP_TRUE = @USE_PREBUILT_GLIBJ_ZIP_TRUE@
+VERSION = @VERSION@
+VM_BINARY = @VM_BINARY@
+WARNING_CFLAGS = @WARNING_CFLAGS@
+XML_CFLAGS = @XML_CFLAGS@
+XML_LIBS = @XML_LIBS@
+XSLT_CFLAGS = @XSLT_CFLAGS@
+XSLT_LIBS = @XSLT_LIBS@
+XTEST_LIBS = @XTEST_LIBS@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+ZIP = @ZIP@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+default_toolkit = @default_toolkit@
+exec_prefix = @exec_prefix@
+glibjdir = @glibjdir@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+multi_basedir = @multi_basedir@
+nativeexeclibdir = @nativeexeclibdir@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+toolexeclibdir = @toolexeclibdir@
+vm_classes = @vm_classes@
+
+# Header needed for jawt implementations such as the one found in ../gtk-peer.
+EXTRA_DIST = classpath_jawt.h
+noinst_LTLIBRARIES = libclasspath.la
+libclasspath_la_SOURCES = jcl.c jcl.h \
+			  jnilink.c jnilink.h \
+			  native_state.c native_state.h
+
+AM_LDFLAGS = @CLASSPATH_CONVENIENCE@
+AM_CPPFLAGS = @CLASSPATH_INCLUDES@
+AM_CFLAGS = @WARNING_CFLAGS@ @STRICT_WARNING_CFLAGS@ @ERROR_CFLAGS@
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  native/jni/classpath/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  native/jni/classpath/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-noinstLTLIBRARIES:
+	-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
+	@list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
+	  dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+	  test "$$dir" != "$$p" || dir=.; \
+	  echo "rm -f \"$${dir}/so_locations\""; \
+	  rm -f "$${dir}/so_locations"; \
+	done
+libclasspath.la: $(libclasspath_la_OBJECTS) $(libclasspath_la_DEPENDENCIES) 
+	$(LINK)  $(libclasspath_la_LDFLAGS) $(libclasspath_la_OBJECTS) $(libclasspath_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/jcl.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/jnilink.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/native_state.Plo at am__quote@
+
+.c.o:
+ at am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+ at am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(COMPILE) -c $<
+
+.c.obj:
+ at am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+ at am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+ at am__fastdepCC_TRUE@	if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+ at am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+distclean-libtool:
+	-rm -f libtool
+uninstall-info-am:
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	    $$tags $$unique; \
+	fi
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$tags $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && cd $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+	list='$(DISTFILES)'; for file in $$list; do \
+	  case $$file in \
+	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+	  esac; \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+	    dir="/$$dir"; \
+	    $(mkdir_p) "$(distdir)$$dir"; \
+	  else \
+	    dir=''; \
+	  fi; \
+	  if test -d $$d/$$file; then \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES)
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
+	mostlyclean-am
+
+distclean: distclean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+	distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+	mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+	clean-libtool clean-noinstLTLIBRARIES ctags distclean \
+	distclean-compile distclean-generic distclean-libtool \
+	distclean-tags distdir dvi dvi-am html html-am info info-am \
+	install install-am install-data install-data-am install-exec \
+	install-exec-am install-info install-info-am install-man \
+	install-strip installcheck installcheck-am installdirs \
+	maintainer-clean maintainer-clean-generic mostlyclean \
+	mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+	pdf pdf-am ps ps-am tags uninstall uninstall-am \
+	uninstall-info-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/classpath/classpath_jawt.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/classpath/classpath_jawt.h?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/classpath/classpath_jawt.h (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/classpath/classpath_jawt.h Thu Nov  8 16:56:19 2007
@@ -0,0 +1,60 @@
+/* classpath_awt.h -- libjawt's interface to the peer library
+   Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+ 
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+/*
+ * libjawt.so is linked directly to the peer library with -l.  This
+ * header declares all the functions that libjawt.so needs -- X-based
+ * peer libraries wanting to support libjawt.so must implement these
+ * functions.
+ */
+
+#ifndef __classpath_jawt_h__
+#define __classpath_jawt_h__
+
+#include <jni.h>
+#include <X11/Xlib.h>
+
+#define CLASSPATH_JAWT_VERSION 0x10004
+
+jint     classpath_jawt_get_awt_version (void);
+Display* classpath_jawt_get_default_display (JNIEnv* env, jobject canvas);
+Drawable classpath_jawt_get_drawable (JNIEnv* env, jobject canvas);
+VisualID classpath_jawt_get_visualID (JNIEnv* env, jobject canvas);
+jint     classpath_jawt_lock (void);
+void     classpath_jawt_unlock (void);
+
+#endif /* __classpath_jawt_h__ */

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/classpath/jcl.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/classpath/jcl.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/classpath/jcl.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/classpath/jcl.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,275 @@
+/* jcl.c
+   Copyright (C) 1998, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+ 
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+/* do not move; needed here because of some macro definitions */
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <jcl.h>
+
+#ifndef __GNUC__
+  #ifndef __attribute__
+    #define __attribute__(x)	/* nothing */
+  #endif
+#endif
+
+JNIEXPORT void JNICALL
+JCL_ThrowException (JNIEnv * env, const char *className, const char *errMsg)
+{
+  jclass excClass;
+  if ((*env)->ExceptionOccurred (env))
+    {
+      (*env)->ExceptionClear (env);
+    }
+  excClass = (*env)->FindClass (env, className);
+  if (excClass == NULL)
+    {
+      jclass errExcClass;
+      errExcClass =
+	(*env)->FindClass (env, "java/lang/ClassNotFoundException");
+      if (errExcClass == NULL)
+	{
+	  errExcClass = (*env)->FindClass (env, "java/lang/InternalError");
+	  if (errExcClass == NULL)
+	    {
+	      fprintf (stderr, "JCL: Utterly failed to throw exeption ");
+	      fprintf (stderr, "%s", className);
+	      fprintf (stderr, " with message ");
+	      fprintf (stderr, "%s", errMsg);
+	      return;
+	    }
+	}
+      /* Removed this (more comprehensive) error string to avoid the need for
+       * a static variable or allocation of a buffer for this message in this
+       * (unlikely) error case. --Fridi. 
+       *
+       * sprintf(errstr,"JCL: Failed to throw exception %s with message %s: could not find exception class.", className, errMsg); 
+       */
+      (*env)->ThrowNew (env, errExcClass, className);
+    }
+  (*env)->ThrowNew (env, excClass, errMsg);
+}
+
+JNIEXPORT void *JNICALL
+JCL_malloc (JNIEnv * env, size_t size)
+{
+  void *mem = malloc (size);
+  if (mem == NULL)
+    {
+      JCL_ThrowException (env, "java/lang/OutOfMemoryError",
+			  "malloc() failed.");
+      return NULL;
+    }
+  return mem;
+}
+
+JNIEXPORT void *JNICALL
+JCL_realloc (JNIEnv * env, void *ptr, size_t size)
+{
+  ptr = realloc (ptr, size);
+  if (ptr == 0)
+    {
+      JCL_ThrowException (env, "java/lang/OutOfMemoryError",
+			  "malloc() failed.");
+      return NULL;
+    }
+  return (ptr);
+}
+
+JNIEXPORT void JNICALL
+JCL_free (JNIEnv * env __attribute__ ((unused)), void *p)
+{
+  if (p != NULL)
+    {
+      free (p);
+    }
+}
+
+JNIEXPORT const char *JNICALL
+JCL_jstring_to_cstring (JNIEnv * env, jstring s)
+{
+  const char *cstr;
+  if (s == NULL)
+    {
+      JCL_ThrowException (env, "java/lang/NullPointerException",
+			  "Null string");
+      return NULL;
+    }
+  cstr = (const char *) (*env)->GetStringUTFChars (env, s, NULL);
+  if (cstr == NULL)
+    {
+      JCL_ThrowException (env, "java/lang/InternalError",
+			  "GetStringUTFChars() failed.");
+      return NULL;
+    }
+  return cstr;
+}
+
+JNIEXPORT void JNICALL
+JCL_free_cstring (JNIEnv * env, jstring s, const char *cstr)
+{
+  (*env)->ReleaseStringUTFChars (env, s, cstr);
+}
+
+JNIEXPORT jint JNICALL
+JCL_MonitorEnter (JNIEnv * env, jobject o)
+{
+  jint retval = (*env)->MonitorEnter (env, o);
+  if (retval != 0)
+    {
+      JCL_ThrowException (env, "java/lang/InternalError",
+			  "MonitorEnter() failed.");
+    }
+  return retval;
+}
+
+JNIEXPORT jint JNICALL
+JCL_MonitorExit (JNIEnv * env, jobject o)
+{
+  jint retval = (*env)->MonitorExit (env, o);
+  if (retval != 0)
+    {
+      JCL_ThrowException (env, "java/lang/InternalError",
+			  "MonitorExit() failed.");
+    }
+  return retval;
+}
+
+JNIEXPORT jclass JNICALL
+JCL_FindClass (JNIEnv * env, const char *className)
+{
+  jclass retval = (*env)->FindClass (env, className);
+  if (retval == NULL)
+    {
+      JCL_ThrowException (env, "java/lang/ClassNotFoundException", className);
+    }
+  return retval;
+}
+
+
+/*
+ * Build a Pointer object. The function caches the class type 
+ */
+
+static jclass rawDataClass;
+static jfieldID rawData_fid;
+static jmethodID rawData_mid;
+
+JNIEXPORT jobject JNICALL
+JCL_NewRawDataObject (JNIEnv * env, void *data)
+{
+  if (rawDataClass == NULL)
+    {
+      jclass tmp;
+#if SIZEOF_VOID_P == 8
+      rawDataClass = (*env)->FindClass (env, "gnu/classpath/Pointer64");
+      if (rawDataClass == NULL)
+	{
+	  JCL_ThrowException (env, "java/lang/InternalError",
+			      "unable to find internal class");
+	  return NULL;
+	}
+
+      rawData_mid = (*env)->GetMethodID (env, rawDataClass, "<init>", "(J)V");
+      if (rawData_mid == NULL)
+	{
+	  JCL_ThrowException (env, "java/lang/InternalError",
+			      "unable to find internal constructor");
+	  return NULL;
+	}
+
+      rawData_fid = (*env)->GetFieldID (env, rawDataClass, "data", "J");
+      if (rawData_fid == NULL)
+	{
+	  JCL_ThrowException (env, "java/lang/InternalError",
+			      "unable to find internal field");
+	  return NULL;
+	}
+#else
+      rawDataClass = (*env)->FindClass (env, "gnu/classpath/Pointer32");
+      if (rawDataClass == NULL)
+	{
+	  JCL_ThrowException (env, "java/lang/InternalError",
+			      "unable to find internal class");
+	  return NULL;
+	}
+
+      rawData_mid = (*env)->GetMethodID (env, rawDataClass, "<init>", "(I)V");
+      if (rawData_mid == NULL)
+	{
+	  JCL_ThrowException (env, "java/lang/InternalError",
+			      "unable to find internal constructor");
+	  return NULL;
+	}
+
+      rawData_fid = (*env)->GetFieldID (env, rawDataClass, "data", "I");
+      if (rawData_fid == NULL)
+	{
+	  JCL_ThrowException (env, "java/lang/InternalError",
+			      "unable to find internal field");
+	  return NULL;
+	}
+
+#endif
+      tmp = (*env)->NewGlobalRef (env, rawDataClass);
+      if (tmp == NULL)
+	{
+	  JCL_ThrowException (env, "java/lang/InternalError",
+			      "unable to create an internal global ref");
+	  return NULL;
+	}
+      (*env)->DeleteLocalRef(env, rawDataClass);
+      rawDataClass = tmp;
+    }
+
+#if SIZEOF_VOID_P == 8
+  return (*env)->NewObject (env, rawDataClass, rawData_mid, (jlong) data);
+#else
+  return (*env)->NewObject (env, rawDataClass, rawData_mid, (jint) data);
+#endif
+}
+
+JNIEXPORT void * JNICALL
+JCL_GetRawData (JNIEnv * env, jobject rawdata)
+{
+#if SIZEOF_VOID_P == 8
+  return (void *) (*env)->GetLongField (env, rawdata, rawData_fid);
+#else
+  return (void *) (*env)->GetIntField (env, rawdata, rawData_fid);
+#endif  
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/classpath/jcl.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/classpath/jcl.h?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/classpath/jcl.h (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/classpath/jcl.h Thu Nov  8 16:56:19 2007
@@ -0,0 +1,94 @@
+/* jcl.h
+   Copyright (C) 1998, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+ 
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#ifndef __JCL_H__
+#define __JCL_H__
+
+#include <stddef.h>
+#include <jni.h>
+#include <config.h>
+
+#if SIZEOF_VOID_P == 4
+typedef jint jpointer;
+#elif SIZEOF_VOID_P == 8
+typedef jlong jpointer;
+#else
+#error "Unknown pointer size"
+#endif
+
+/* Helper macros for going between pointers and jlongs.  */
+#define JLONG_TO_PTR(T,P) ((T *)(long)P)
+#define PTR_TO_JLONG(P) ((jlong)(long)P)
+
+JNIEXPORT jclass JNICALL JCL_FindClass (JNIEnv * env, const char *className);
+JNIEXPORT void JNICALL JCL_ThrowException (JNIEnv * env,
+					   const char *className,
+					   const char *errMsg);
+JNIEXPORT void *JNICALL JCL_malloc (JNIEnv * env, size_t size);
+JNIEXPORT void *JNICALL JCL_realloc (JNIEnv * env, void *ptr, size_t size);
+JNIEXPORT void JNICALL JCL_free (JNIEnv * env, void *p);
+JNIEXPORT const char *JNICALL JCL_jstring_to_cstring (JNIEnv * env,
+						      jstring s);
+JNIEXPORT void JNICALL JCL_free_cstring (JNIEnv * env, jstring s,
+					 const char *cstr);
+JNIEXPORT jint JNICALL JCL_MonitorEnter (JNIEnv * env, jobject o);
+JNIEXPORT jint JNICALL JCL_MonitorExit (JNIEnv * env, jobject o);
+
+JNIEXPORT jobject JNICALL JCL_NewRawDataObject (JNIEnv * env, void *data);
+JNIEXPORT void * JNICALL JCL_GetRawData (JNIEnv * env, jobject rawdata);
+
+#define JCL_RETHROW_EXCEPTION(env) if((*(env))->ExceptionOccurred((env)) != NULL) return NULL;
+
+/* Simple debug macro */
+#ifdef DEBUG
+#define DBG(x) fprintf(stderr, "%s", (x));
+#else
+#define DBG(x)
+#endif
+
+/* Some O/S's don't declare 'environ' */
+#if HAVE_CRT_EXTERNS_H
+/* Darwin does not have a variable named environ
+   but has a function which you can get the environ
+   variable with.  */
+#include <crt_externs.h>
+#define environ (*_NSGetEnviron())
+#else
+extern char **environ;
+#endif /* HAVE_CRT_EXTERNS_H */
+
+#endif

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/classpath/jnilink.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/classpath/jnilink.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/classpath/jnilink.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/classpath/jnilink.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,125 @@
+/* JNILINK 1.1: JNI version.
+   Copyright (C) 1998 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+ 
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+#include <stdlib.h>
+#include <string.h>
+#include <jcl.h>
+
+#include "jnilink.h"
+
+#define GETCLASS(c) *(jclass*)(c)
+
+JNIEXPORT jclass JNICALL
+LINK_RelinkClass (JNIEnv * env, linkedClass * c, const char *name)
+{
+  jclass found;
+  LINK_UnlinkClass (env, *c);
+
+  found = (*env)->FindClass (env, name);
+  if (found == NULL)
+    return NULL;
+
+  *c = JCL_malloc (env, sizeof (jclass));
+  if (*c == NULL)
+    return NULL;
+
+  GETCLASS (*c) = (*env)->NewGlobalRef (env, found);
+  return GETCLASS (*c);
+}
+
+JNIEXPORT jclass JNICALL
+LINK_RelinkKnownClass (JNIEnv * env, linkedClass * c, jclass newClass)
+{
+  LINK_UnlinkClass (env, *c);
+
+  *c = JCL_malloc (env, sizeof (jclass));
+  if (*c == NULL)
+    return NULL;
+
+  GETCLASS (*c) = (*env)->NewGlobalRef (env, newClass);
+  return newClass;
+}
+
+JNIEXPORT jmethodID JNICALL
+LINK_RelinkMethod (JNIEnv * env, jmethodID * m, linkedClass c,
+		   const char *name, const char *sig)
+{
+  *m = (*env)->GetMethodID (env, GETCLASS (c), name, sig);
+  return *m;
+}
+
+JNIEXPORT jmethodID JNICALL
+LINK_RelinkStaticMethod (JNIEnv * env, jmethodID * m, linkedClass c,
+			 const char *name, const char *sig)
+{
+  *m = (*env)->GetStaticMethodID (env, GETCLASS (c), name, sig);
+  return *m;
+}
+
+JNIEXPORT jfieldID JNICALL
+LINK_RelinkField (JNIEnv * env, jfieldID * f, linkedClass c,
+		  const char *name, const char *sig)
+{
+  *f = (*env)->GetFieldID (env, GETCLASS (c), name, sig);
+  return *f;
+}
+
+JNIEXPORT jfieldID JNICALL
+LINK_RelinkStaticField (JNIEnv * env, jfieldID * f, linkedClass c,
+			const char *name, const char *sig)
+{
+  *f = (*env)->GetStaticFieldID (env, GETCLASS (c), name, sig);
+  return *f;
+}
+
+
+/* These are for when the class referencing the symbols is unloaded; it
+destroys any object references
+ * the linker might have kept around.
+ */
+JNIEXPORT void JNICALL
+LINK_UnlinkClass (JNIEnv * env, linkedClass * c)
+{
+  if (*c != NULL)
+    {
+      if (GETCLASS (*c) != NULL)
+	(*env)->DeleteGlobalRef (env, GETCLASS (*c));
+      JCL_free (env, *c);
+      *c = NULL;
+    }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/classpath/jnilink.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/classpath/jnilink.h?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/classpath/jnilink.h (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/classpath/jnilink.h Thu Nov  8 16:56:19 2007
@@ -0,0 +1,82 @@
+/* JNILINK 1.1: JNI version.
+   Copyright (C) 1998 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+ 
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+#ifndef __JNILINK_H__
+#define __JNILINK_H__
+
+#include <jni.h>
+
+typedef void *linkedClass;
+
+#define LINK_LinkClass(env,c,name)              ((c)==NULL ? LINK_ReallyLinkClass((env),&(c),(name)) : (c))
+#define LINK_LinkKnownClass(env,c,newClass)     ((c)==NULL ? LINK_ReallyLinkKnownClass((env),&(c),(newClass)) : (c))
+#define LINK_LinkMethod(env,m,c,name,sig)       ((m)==NULL ? LINK_RelinkMethod((env),&(m),(c),(name),(sig)) : (m))
+#define LINK_LinkStaticMethod(env,m,c,name,sig) ((m)==NULL ? LINK_RelinkStaticMethod((env),&(m),(c),(name),(sig)) : (m))
+#define LINK_LinkField(env,f,c,name,sig)        ((m)==NULL ? LINK_RelinkField((env),&(f),(c),(name),(sig)) : (f))
+#define LINK_LinkStaticField(env,f,c,name,sig)  ((m)==NULL ? LINK_RelinkStaticField((env),&(f),(c),(name),(sig)) : (f))
+
+#define LINK_LinkConstructor(env,m,c,sig)       ((m)==NULL ? LINK_RelinkMethod((env),&(m),(c),"<init>",(sig)) : (m))
+
+JNIEXPORT jclass JNICALL
+LINK_ReallyLinkClass (JNIEnv * env, linkedClass * c, const char *name);
+JNIEXPORT jclass JNICALL
+LINK_ReallyLinkKnownClass (JNIEnv * env, linkedClass * c, jclass newClass);
+JNIEXPORT jclass JNICALL
+LINK_RelinkClass (JNIEnv * env, linkedClass * c, const char *name);
+JNIEXPORT jclass JNICALL
+LINK_RelinkKnownClass (JNIEnv * env, linkedClass * c, jclass newClass);
+JNIEXPORT jmethodID JNICALL
+LINK_RelinkMethod (JNIEnv * env, jmethodID * m, linkedClass c,
+		   const char *name, const char *sig);
+JNIEXPORT jmethodID JNICALL
+LINK_RelinkStaticMethod (JNIEnv * env, jmethodID * m, linkedClass c,
+			 const char *name, const char *sig);
+JNIEXPORT jfieldID JNICALL
+LINK_RelinkField (JNIEnv * env, jfieldID * f, linkedClass c,
+		  const char *name, const char *sig);
+JNIEXPORT jfieldID JNICALL
+LINK_RelinkStaticField (JNIEnv * env, jfieldID * f, linkedClass c,
+			const char *name, const char *sig);
+
+/* These are for when the class referencing the symbols is unloaded; it
+destroys any object references
+ * the linker might have kept around.
+ */
+JNIEXPORT void JNICALL LINK_UnlinkClass (JNIEnv * env, linkedClass * c);
+
+#endif

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/classpath/native_state.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/classpath/native_state.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/classpath/native_state.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/classpath/native_state.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,276 @@
+/* Magical NSA API -- Associate a C ptr with an instance of an object
+   Copyright (C) 1998, 2002 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+ 
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#include <stdlib.h>
+#include <assert.h>
+#include <jni.h>
+#include "native_state.h"
+
+#define DEFAULT_TABLE_SIZE 97
+
+struct state_table *
+cp_gtk_init_state_table_with_size (JNIEnv * env, jclass clazz, jint size)
+{
+  struct state_table *table;
+  jfieldID hash;
+  jclass clazz_g;
+
+  hash = (*env)->GetFieldID (env, clazz, "native_state", "I");
+  if (hash == NULL)
+    return NULL;
+
+  clazz_g = (*env)->NewGlobalRef (env, clazz);
+  if (clazz_g == NULL)
+    return NULL;
+
+  table = (struct state_table *) malloc (sizeof (struct state_table));
+  table->size = size;
+  table->head = (struct state_node **) calloc (sizeof (struct state_node *),
+					       table->size);
+  table->hash = hash;
+  table->clazz = clazz_g;
+
+  return table;
+}
+
+struct state_table *
+cp_gtk_init_state_table (JNIEnv * env, jclass clazz)
+{
+  return cp_gtk_init_state_table_with_size (env, clazz, DEFAULT_TABLE_SIZE);
+}
+
+static void *
+remove_node (struct state_node **head, jint obj_id)
+{
+  struct state_node *back_ptr = NULL;
+  struct state_node *node = *head;
+
+  while (node != NULL)
+    {
+      if (node->key == obj_id)
+	{
+	  void *return_value;
+	  if (back_ptr == NULL)
+	    *head = node->next;
+	  else
+	    back_ptr->next = node->next;
+	  return_value = node->c_state;
+	  free (node);
+	  return return_value;
+	}
+      back_ptr = node;
+      node = node->next;
+    }
+
+  return NULL;
+}
+
+static void *
+get_node (struct state_node **head, jint obj_id)
+{
+  struct state_node *back_ptr = NULL;
+  struct state_node *node = *head;
+
+  while (node != NULL)
+    {
+      if (node->key == obj_id)
+	{
+	  /* Move the node we found to the front of the list.  */
+	  if (back_ptr != NULL)
+	    {
+	      back_ptr->next = node->next;
+	      node->next = *head;
+	      *head = node;
+	    }
+
+	  /* Return the match.  */
+	  return node->c_state;
+	}
+
+      back_ptr = node;
+      node = node->next;
+    }
+
+  return NULL;
+}
+
+static void
+add_node (struct state_node **head, jint obj_id, void *state)
+{
+  struct state_node *node = *head;
+  struct state_node *back_ptr = NULL;
+
+  struct state_node *new_node;
+
+  if (node != NULL)
+    {
+      while (node->next != NULL && obj_id != node->key)
+	{
+	  back_ptr = node;
+	  node = node->next;
+	}
+
+      if (node->key == obj_id)
+	{
+	  /* If we're updating a node, move it to the front of the
+	     list.  */
+	  if (back_ptr != NULL)
+	    {
+	      back_ptr->next = node->next;
+	      node->next = *head;
+	      *head = node;
+	    }
+	  node->c_state = state;
+	  return;
+	}
+    }
+
+  new_node = (struct state_node *) malloc (sizeof (struct state_node));
+  new_node->key = obj_id;
+  new_node->c_state = state;
+  new_node->next = *head;
+  *head = new_node;
+}
+
+#ifndef NDEBUG
+static void
+cp_gtk_check_compat (JNIEnv * env, jobject obj, struct state_table *table)
+{
+  jclass objclazz;
+
+  objclazz = (*env)->GetObjectClass(env, obj);
+  assert ((*env)->IsAssignableFrom(env, objclazz, table->clazz));
+  (*env)->DeleteLocalRef(env, objclazz);
+}
+#endif
+
+void
+cp_gtk_set_state_oid (JNIEnv * env, jobject lock, struct state_table *table,
+	       jint obj_id, void *state)
+{
+  jint hash;
+
+  hash = obj_id % table->size;
+
+  (*env)->MonitorEnter (env, lock);
+  add_node (&table->head[hash], obj_id, state);
+  (*env)->MonitorExit (env, lock);
+}
+
+void *
+cp_gtk_get_state_oid (JNIEnv * env, jobject lock, struct state_table *table,
+	       jint obj_id)
+{
+  jint hash;
+  void *return_value;
+
+  hash = obj_id % table->size;
+
+  (*env)->MonitorEnter (env, lock);
+  return_value = get_node (&table->head[hash], obj_id);
+  (*env)->MonitorExit (env, lock);
+
+  return return_value;
+}
+
+void *
+cp_gtk_remove_state_oid (JNIEnv * env, jobject lock, struct state_table *table,
+		  jint obj_id)
+{
+  jint hash;
+  void *return_value;
+
+  hash = obj_id % table->size;
+
+  (*env)->MonitorEnter (env, lock);
+  return_value = remove_node (&table->head[hash], obj_id);
+  (*env)->MonitorExit (env, lock);
+
+  return return_value;
+}
+
+int
+cp_gtk_set_state (JNIEnv * env, jobject obj, struct state_table *table, void *state)
+{
+  jint obj_id;
+
+#ifndef NDEBUG
+  cp_gtk_check_compat(env, obj, table);
+#endif
+
+  obj_id = (*env)->GetIntField (env, obj, table->hash);
+
+  if ((*env)->ExceptionOccurred (env) != NULL)
+    return -1;
+
+  cp_gtk_set_state_oid (env, table->clazz, table, obj_id, state);
+  return 0;
+}
+
+void *
+cp_gtk_get_state (JNIEnv * env, jobject obj, struct state_table *table)
+{
+  jint obj_id;
+
+#ifndef NDEBUG
+  cp_gtk_check_compat(env, obj, table);
+#endif
+
+  obj_id = (*env)->GetIntField (env, obj, table->hash);
+
+  if ((*env)->ExceptionOccurred (env) != NULL)
+    return NULL;
+
+  return cp_gtk_get_state_oid (env, table->clazz, table, obj_id);
+}
+
+void *
+cp_gtk_remove_state_slot (JNIEnv * env, jobject obj, struct state_table *table)
+{
+  jint obj_id;
+
+#ifndef NDEBUG
+  cp_gtk_check_compat(env, obj, table);
+#endif
+
+  obj_id = (*env)->GetIntField (env, obj, table->hash);
+
+  if ((*env)->ExceptionOccurred (env) != NULL)
+    return NULL;
+
+  return cp_gtk_remove_state_oid (env, table->clazz, table, obj_id);
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/classpath/native_state.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/classpath/native_state.h?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/classpath/native_state.h (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/classpath/native_state.h Thu Nov  8 16:56:19 2007
@@ -0,0 +1,71 @@
+/* Magical NSA API -- Associate a C ptr with an instance of an object
+   Copyright (C) 1998 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+ 
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#ifndef JCL_NATIVE_STATE
+#define JCL_NATIVE_STATE
+
+#include <jni.h>
+
+struct state_table
+{
+  jint size;			/* number of slots, should be prime */
+  jfieldID hash;		/* field containing System.identityHashCode(this) */
+  jclass clazz;			/* lock aquired for reading/writing nodes */
+  struct state_node **head;
+};
+
+struct state_node
+{
+  jint key;
+  void *c_state;
+  struct state_node *next;
+};
+
+struct state_table *cp_gtk_init_state_table_with_size (JNIEnv *, jclass, jint);
+struct state_table *cp_gtk_init_state_table (JNIEnv *, jclass);
+
+/* lowlevel api */
+void cp_gtk_set_state_oid (JNIEnv *, jobject, struct state_table *, jint, void *);
+void *cp_gtk_get_state_oid (JNIEnv *, jobject, struct state_table *, jint);
+void *cp_gtk_remove_state_oid (JNIEnv *, jobject, struct state_table *, jint);
+
+/* highlevel api */
+int cp_gtk_set_state (JNIEnv *, jobject, struct state_table *, void *);
+void *cp_gtk_get_state (JNIEnv *, jobject, struct state_table *);
+void *cp_gtk_remove_state_slot (JNIEnv *, jobject, struct state_table *);
+
+#endif

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gconf-peer/GConfNativePeer.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gconf-peer/GConfNativePeer.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gconf-peer/GConfNativePeer.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gconf-peer/GConfNativePeer.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,598 @@
+/* GConfNativePeer.c -- Implements native methods for class GConfNativePeer
+   Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+   
+   This file is part of GNU Classpath.
+   
+   GNU Classpath is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+   
+   GNU Classpath is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+   
+   You should have received a copy of the GNU General Public License
+   along with GNU Classpath; see the file COPYING.  If not, write to the
+   Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+   02110-1301 USA.
+   
+   Linking this library statically or dynamically with other modules is
+   making a combined work based on this library.  Thus, the terms and
+   conditions of the GNU General Public License cover the whole
+   combination.
+   
+   As a special exception, the copyright holders of this library give you
+   permission to link this library with independent modules to produce an
+   executable, regardless of the license terms of these independent
+   modules, and to copy and distribute the resulting executable under
+   terms of your choice, provided that you also meet, for each linked
+   independent module, the terms and conditions of the license of that
+   module.  An independent module is a module which is not derived from
+   or based on this library.  If you modify this library, you may extend
+   this exception to your version of the library, but you are not
+   obligated to do so.  If you do not wish to do so, delete this
+   exception statement from your version. */
+
+#include <stdio.h>
+#include <string.h>
+
+#include <jni.h>
+
+#include <glib.h>
+#include <gdk/gdk.h>
+#include <gconf/gconf-client.h>
+
+#include "jcl.h"
+
+#include "gnu_java_util_prefs_gconf_GConfNativePeer.h"
+
+/*
+ * Cached id, methods and objects
+ */
+
+/** Reference count */
+static int reference_count = 0;
+
+/** GConfClient backend */
+static GConfClient *client = NULL;
+
+/** java.util.ArrayList class */
+static jclass jlist_class = NULL;
+
+/** java.util.ArrayList constructor id */
+static jmethodID jlist_init_id = NULL;
+
+/** ava.util.ArrayList add id */
+static jmethodID jlist_add_id = NULL;
+
+/* ***** PRIVATE FUNCTIONS DELCARATION ***** */
+
+/**
+ * Gets the reference of the default GConfClient and initialize the
+ * the type system.
+ * The client reference should be released with g_object_unref after use.
+ * This functions must be called with gdk lock held.
+ */
+static void init_gconf_client (void);
+
+/**
+ * Throws a new runtime exception after a failure, with the given message.
+ */
+static void throw_exception (JNIEnv * env, const char *msg);
+
+/**
+ * Throws the given exception after a failure, with the given message.
+ */
+static void
+throw_exception_by_name (JNIEnv * env, const char *name, const char *msg);
+
+/**
+ * Return a reference to a java.util.ArrayList class.
+ */
+static gboolean set_jlist_class (JNIEnv * env);
+
+/**
+ * Builds a new reference to a new java.util.ArrayList instace.
+ * The instance should be freed by the caller after use.
+ */
+static jclass get_jlist_reference (JNIEnv * env, jclass jlist_class);
+
+/* ***** END: PRIVATE FUNCTIONS DELCARATION ***** */
+
+/* ***** NATIVE FUNCTIONS ***** */
+
+/*
+ * Class:     gnu_java_util_prefs_gconf_GConfNativePeer
+ * Method:    init_class
+ * Signature: ()V
+ */
+JNIEXPORT void
+JNICALL Java_gnu_java_util_prefs_gconf_GConfNativePeer_init_1class
+  (JNIEnv *env, jclass clazz)
+{
+  if (reference_count == 0)
+    {
+      Java_gnu_java_util_prefs_gconf_GConfNativePeer_init_1id_1cache
+		(env, clazz);
+      return;
+    }
+
+  reference_count++;
+}
+
+/*
+ * Class:     gnu_java_util_prefs_gconf_GConfNativePeer
+ * Method:    init_id_chache
+ * Signature: ()V
+ */
+JNIEXPORT void
+JNICALL Java_gnu_java_util_prefs_gconf_GConfNativePeer_init_1id_1cache
+  (JNIEnv *env, jclass clazz __attribute__ ((unused)))
+{
+  reference_count++;
+
+  gdk_threads_enter ();
+  init_gconf_client ();
+  gdk_threads_leave ();
+
+  /* if client is null, there is probably an out of memory */
+  if (client == NULL)
+    {
+      /* release the string and throw a runtime exception */
+      throw_exception (env,
+      		"Unable to initialize GConfClient in native code\n");
+      return;
+    }
+
+  /* ***** java.util.ArrayList ***** */
+  if (set_jlist_class (env) == FALSE)
+    {
+      throw_exception (env,
+      		"Unable to get valid reference to java.util.List in native code\n");
+      return;
+    }
+}
+
+/*
+ * Class:     gnu_java_util_prefs_gconf_GConfNativePeer
+ * Method:    gconf_client_gconf_client_all_keys
+ * Signature: (Ljava/lang/String;)Ljava/util/List;
+ */
+JNIEXPORT jobject JNICALL
+Java_gnu_java_util_prefs_gconf_GConfNativePeer_gconf_1client_1gconf_1client_1all_1keys
+  (JNIEnv *env, jclass clazz __attribute__ ((unused)), jstring node)
+{
+  /* TODO: check all the calls to gdk_threads_enter/leave */
+  
+  const char *dir = NULL;
+  GError *err = NULL;
+  GSList *entries = NULL;
+  GSList *tmp;
+
+  /* java.util.ArrayList */
+  jobject jlist = NULL;
+
+  dir = JCL_jstring_to_cstring (env, node);
+  if (dir == NULL)
+    {
+      return NULL;
+    }
+
+  gdk_threads_enter ();
+  entries = gconf_client_all_entries (client, dir, &err);
+  gdk_threads_leave ();
+  if (err != NULL)
+    {
+      throw_exception_by_name (env, "java/util/prefs/BackingStoreException",
+                               err->message);
+      g_error_free (err);
+      err = NULL;
+
+      JCL_free_cstring (env, node, dir);
+      return NULL;
+    }
+
+  jlist = get_jlist_reference (env, jlist_class);
+  if (jlist == NULL)
+    {
+      throw_exception_by_name (env, "java/util/prefs/BackingStoreException",
+			       "Unable to get java.util.List reference in native code\n");
+      JCL_free_cstring (env, node, dir);
+      g_slist_foreach (entries, (GFunc) gconf_entry_free, NULL);
+      g_slist_free (entries);
+      return NULL;
+    }
+
+  tmp = entries;
+  while (tmp != NULL)
+    {
+      const char *_val = gconf_entry_get_key (tmp->data);
+      _val = strrchr (_val, '/');
+      ++_val;
+      (*env)->CallBooleanMethod (env, jlist, jlist_add_id,
+				 (*env)->NewStringUTF (env, _val));
+      tmp = g_slist_next (tmp);
+    }
+
+  /* clean up things */
+  JCL_free_cstring (env, node, dir);
+  g_slist_foreach (entries, (GFunc) gconf_entry_free, NULL);
+  g_slist_free (entries);
+  
+  return jlist;
+}
+
+/*
+ * Class:     gnu_java_util_prefs_gconf_GConfNativePeer
+ * Method:    gconf_client_gconf_client_all_nodes
+ * Signature: (Ljava/lang/String;)Ljava/util/List;
+ */
+JNIEXPORT jobject JNICALL
+Java_gnu_java_util_prefs_gconf_GConfNativePeer_gconf_1client_1gconf_1client_1all_1nodes
+  (JNIEnv *env, jclass clazz __attribute__ ((unused)), jstring node)
+{
+  const char *dir = NULL;
+  GError *err = NULL;
+  GSList *entries = NULL;
+  GSList *tmp;
+
+  /* java.util.ArrayList */
+  jobject jlist = NULL;
+
+  dir = JCL_jstring_to_cstring (env, node);
+  if (dir == NULL)
+    {
+      return NULL;
+    }
+
+  gdk_threads_enter ();
+  entries = gconf_client_all_dirs (client, dir, &err);
+  gdk_threads_leave ();
+  if (err != NULL)
+    {
+      throw_exception_by_name (env, "java/util/prefs/BackingStoreException",
+                               err->message);
+      g_error_free (err);
+      err = NULL;
+      JCL_free_cstring (env, node, dir);
+      return NULL;
+    }
+
+  jlist = get_jlist_reference (env, jlist_class);
+  if (jlist == NULL)
+    {
+      throw_exception_by_name (env, "java/util/prefs/BackingStoreException",
+			       "Unable to get java.util.List reference in native code\n");
+      JCL_free_cstring (env, node, dir);
+      g_slist_foreach (entries, (GFunc) gconf_entry_free, NULL);
+      g_slist_free (entries);
+      return NULL;
+    }
+
+  tmp = entries;
+  while (tmp != NULL)
+    {
+      const char *_val = tmp->data;
+      _val = strrchr (_val, '/');
+      ++_val;
+      (*env)->CallBooleanMethod (env, jlist, jlist_add_id,
+				 (*env)->NewStringUTF (env, _val));
+      tmp = g_slist_next (tmp);
+    }
+
+  /* clean up things */
+  JCL_free_cstring (env, node, dir);
+  g_slist_foreach (entries, (GFunc) gconf_entry_free, NULL);
+  g_slist_free (entries);
+
+  return jlist;
+}
+
+/*
+ * Class:     gnu_java_util_prefs_gconf_GConfNativePeer
+ * Method:    gconf_client_suggest_sync
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL
+Java_gnu_java_util_prefs_gconf_GConfNativePeer_gconf_1client_1suggest_1sync
+  (JNIEnv *env, jclass clazz __attribute__ ((unused)))
+{
+  GError *err = NULL;
+
+  gdk_threads_enter ();
+  gconf_client_suggest_sync (client, &err);
+  gdk_threads_leave ();
+  if (err != NULL)
+    {
+      throw_exception_by_name (env, "java/util/prefs/BackingStoreException",
+			       			   err->message);
+      g_error_free (err);
+      err = NULL;
+    }
+}
+
+/*
+ * Class:     gnu_java_util_prefs_gconf_GConfNativePeer
+ * Method:    gconf_client_unset
+ * Signature: (Ljava/lang/String;)Z
+ */
+JNIEXPORT jboolean JNICALL
+Java_gnu_java_util_prefs_gconf_GConfNativePeer_gconf_1client_1unset
+  (JNIEnv *env, jclass clazz __attribute__ ((unused)), jstring key)
+{
+  const char *_key = NULL;
+  gboolean result = JNI_FALSE;
+  GError *err = NULL;
+
+  _key = JCL_jstring_to_cstring (env, key);
+  if (_key == NULL)
+    {
+      return JNI_FALSE;
+    }
+
+  gdk_threads_enter ();
+  result = gconf_client_unset (client, _key, &err);
+  gdk_threads_leave ();
+  if (err != NULL)
+    {
+      result = JNI_FALSE;
+      g_error_free (err);
+      err = NULL;
+    }
+    
+  JCL_free_cstring (env, key, _key);
+
+  return result;
+}
+
+/*
+ * Class:     gnu_java_util_prefs_gconf_GConfNativePeer
+ * Method:    gconf_client_get_string
+ * Signature: (Ljava/lang/String;)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL
+Java_gnu_java_util_prefs_gconf_GConfNativePeer_gconf_1client_1get_1string
+  (JNIEnv *env, jclass clazz __attribute__ ((unused)), jstring key)
+{
+  const char *_key = NULL;
+  const char *_value = NULL;
+  GError *err = NULL;
+  jstring result = NULL;
+
+  _key = JCL_jstring_to_cstring (env, key);
+  if (_key == NULL)
+    {
+      return NULL;
+    }
+
+  gdk_threads_enter ();
+  _value = gconf_client_get_string (client, _key, &err);
+  gdk_threads_leave ();
+  JCL_free_cstring (env, key, _key);
+  if (err != NULL)
+    {
+      /* just in case */
+      if (_value != NULL) g_free ((gpointer) _value);
+      g_error_free (err);
+      err = NULL;
+      
+      return NULL;
+    }
+
+  /* Even if Gconf reported no error it is possible that NULL was returned */
+  /* and it should be prevented to create a Java string from that value. */
+  if (_value != NULL)
+    {
+      result = (*env)->NewStringUTF (env, _value);
+      g_free ((gpointer) _value);
+    }
+
+  return result;
+}
+
+/*
+ * Class:     gnu_java_util_prefs_gconf_GConfNativePeer
+ * Method:    gconf_client_set_string
+ * Signature: (Ljava/lang/String;Ljava/lang/String;)Z
+ */
+JNIEXPORT jboolean JNICALL
+Java_gnu_java_util_prefs_gconf_GConfNativePeer_gconf_1client_1set_1string
+  (JNIEnv *env, jclass clazz __attribute__ ((unused)),
+   jstring key, jstring value)
+{
+  const char *_key = NULL;
+  const char *_value = NULL;
+  GError *err = NULL;
+
+  gboolean result = JNI_FALSE;
+
+  /* load an UTF string from the virtual machine. */
+  _key = JCL_jstring_to_cstring (env, key);
+  _value = JCL_jstring_to_cstring (env, value);
+  if (_key == NULL || _value == NULL)
+    {
+      return JNI_FALSE;
+    }
+
+  gdk_threads_enter ();
+  result = gconf_client_set_string (client, _key, _value, &err);
+  gdk_threads_leave ();
+  if (err != NULL)
+  	{
+	  g_error_free (err);
+      err = NULL;
+      result = JNI_FALSE;
+  	}
+	
+  JCL_free_cstring (env, key, _key);
+  JCL_free_cstring (env, value, _value);
+
+  return (jboolean) result;
+}
+
+/*
+ * Class:     gnu_java_util_prefs_gconf_GConfNativePeer
+ * Method:    gconf_client_remove_dir
+ * Signature: (Ljava/lang/String;)V
+ */
+JNIEXPORT void JNICALL
+Java_gnu_java_util_prefs_gconf_GConfNativePeer_gconf_1client_1remove_1dir
+  (JNIEnv *env, jclass clazz __attribute__ ((unused)), jstring node)
+{
+  const char *dir = NULL;
+
+  dir = JCL_jstring_to_cstring (env, node);
+  if (dir == NULL)
+    return;
+
+  gdk_threads_enter ();
+  gconf_client_remove_dir (client, dir, NULL);
+  gdk_threads_leave ();
+
+  JCL_free_cstring (env, node, dir);
+}
+
+/*
+ * Class:     gnu_java_util_prefs_gconf_GConfNativePeer
+ * Method:    gconf_client_add_dir
+ * Signature: (Ljava/lang/String;)V
+ */
+JNIEXPORT void JNICALL
+Java_gnu_java_util_prefs_gconf_GConfNativePeer_gconf_1client_1add_1dir
+  (JNIEnv *env, jclass clazz __attribute__ ((unused)), jstring node)
+{
+  const char *dir = NULL;
+
+  dir = JCL_jstring_to_cstring (env, node);
+  if (dir == NULL)
+    return;
+
+  /* ignore errors */
+  gdk_threads_enter ();
+  gconf_client_add_dir (client, dir, GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
+  gdk_threads_leave ();
+
+  JCL_free_cstring (env, node, dir);
+}
+
+/*
+ * Class:     gnu_java_util_prefs_gconf_GConfNativePeer
+ * Method:    gconf_client_dir_exists
+ * Signature: (Ljava/lang/String;)Z
+ */
+JNIEXPORT jboolean JNICALL
+Java_gnu_java_util_prefs_gconf_GConfNativePeer_gconf_1client_1dir_1exists
+  (JNIEnv *env, jclass clazz __attribute__ ((unused)), jstring node)
+{
+  const char *dir = NULL;
+  GError *err = NULL;
+  jboolean value = JNI_FALSE;
+
+  dir = JCL_jstring_to_cstring (env, node);
+  if (dir == NULL)
+    return value;
+
+  /* on error return false */
+  gdk_threads_enter ();
+  value = gconf_client_dir_exists (client, dir, &err);
+  gdk_threads_leave ();
+  if (err != NULL)
+    value = JNI_FALSE;
+
+  JCL_free_cstring (env, node, dir);
+
+  return value;
+}
+
+/*
+ * Class:     gnu_java_util_prefs_gconf_GConfNativePeer
+ * Method:    finalize_class
+ * Signature: ()V
+ */
+JNIEXPORT void
+JNICALL Java_gnu_java_util_prefs_gconf_GConfNativePeer_finalize_1class
+  (JNIEnv *env, jclass clazz __attribute__ ((unused)))
+{
+  if (reference_count == 0)
+    {
+      /* last reference, free all resources and return */
+      gdk_threads_enter ();
+      g_object_unref (G_OBJECT (client));
+      gdk_threads_leave ();
+
+      (*env)->DeleteGlobalRef (env, jlist_class);
+
+      jlist_class = NULL;
+      jlist_init_id = NULL;
+      jlist_add_id = NULL;
+
+      return;
+    }
+
+  reference_count--;
+}
+
+/* ***** END: NATIVE FUNCTIONS ***** */
+
+/* ***** PRIVATE FUNCTIONS IMPLEMENTATION ***** */
+
+static void throw_exception (JNIEnv *env, const char *msg)
+{
+  throw_exception_by_name (env, "java/lang/RuntimeException", msg);
+}
+
+static void
+throw_exception_by_name (JNIEnv *env, const char *name, const char *msg)
+{
+  JCL_ThrowException (env, name, msg);
+}
+
+static void init_gconf_client (void)
+{
+  g_type_init ();
+  client = gconf_client_get_default ();
+}
+
+static gboolean set_jlist_class (JNIEnv *env)
+{
+  jclass local_jlist_class = NULL;
+
+  /* gets a reference to the ArrayList class */
+  local_jlist_class = JCL_FindClass (env, "java/util/ArrayList");
+  if (local_jlist_class == NULL)
+    {
+      return FALSE;
+    }
+
+  jlist_class = (*env)->NewGlobalRef (env, local_jlist_class);
+  (*env)->DeleteLocalRef (env, local_jlist_class);
+  if (jlist_class == NULL)
+    {
+      return FALSE;
+    }
+
+  /* and initialize it */
+  jlist_init_id = (*env)->GetMethodID (env, jlist_class, "<init>", "()V");
+  if (jlist_init_id == NULL)
+    {
+      return FALSE;
+    }
+
+  jlist_add_id = (*env)->GetMethodID (env, jlist_class, "add",
+				      				  "(Ljava/lang/Object;)Z");
+  if (jlist_add_id == NULL)
+    {
+      return FALSE;
+    }
+
+  return TRUE;
+}
+
+static jobject get_jlist_reference (JNIEnv *env, jclass jlist_class)
+{
+  return (*env)->NewObject (env, jlist_class, jlist_init_id);
+}
+
+/* ***** END: PRIVATE FUNCTIONS IMPLEMENTATION ***** */

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gconf-peer/Makefile.am
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gconf-peer/Makefile.am?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gconf-peer/Makefile.am (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gconf-peer/Makefile.am Thu Nov  8 16:56:19 2007
@@ -0,0 +1,14 @@
+nativeexeclib_LTLIBRARIES = libgconfpeer.la
+
+libgconfpeer_la_SOURCES = GConfNativePeer.c
+
+libgconfpeer_la_LIBADD = $(top_builddir)/native/jni/classpath/native_state.lo \
+                       $(top_builddir)/native/jni/classpath/jcl.lo
+
+libgconfpeer_la_LDFLAGS = -avoid-version
+
+AM_LDFLAGS = @CLASSPATH_MODULE@ @GCONF_LIBS@ @GDK_LIBS@
+
+AM_CPPFLAGS = @CLASSPATH_INCLUDES@
+
+AM_CFLAGS = @WARNING_CFLAGS@ @ERROR_CFLAGS@ @GCONF_CFLAGS@ @GDK_CFLAGS@

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gconf-peer/Makefile.in
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gconf-peer/Makefile.in?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gconf-peer/Makefile.in (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gconf-peer/Makefile.in Thu Nov  8 16:56:19 2007
@@ -0,0 +1,596 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = native/jni/gconf-peer
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/../../config/depstand.m4 \
+	$(top_srcdir)/../../config/lead-dot.m4 \
+	$(top_srcdir)/../../config/multi.m4 \
+	$(top_srcdir)/../../libtool.m4 $(top_srcdir)/m4/acattribute.m4 \
+	$(top_srcdir)/m4/accross.m4 $(top_srcdir)/m4/acinclude.m4 \
+	$(top_srcdir)/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \
+	$(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
+	$(top_srcdir)/m4/pkg.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/include/config.h
+CONFIG_CLEAN_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+    *) f=$$p;; \
+  esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(nativeexeclibdir)"
+nativeexeclibLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(nativeexeclib_LTLIBRARIES)
+libgconfpeer_la_DEPENDENCIES =  \
+	$(top_builddir)/native/jni/classpath/native_state.lo \
+	$(top_builddir)/native/jni/classpath/jcl.lo
+am_libgconfpeer_la_OBJECTS = GConfNativePeer.lo
+libgconfpeer_la_OBJECTS = $(am_libgconfpeer_la_OBJECTS)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \
+	$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+	$(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(libgconfpeer_la_SOURCES)
+DIST_SOURCES = $(libgconfpeer_la_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BUILD_CLASS_FILES_FALSE = @BUILD_CLASS_FILES_FALSE@
+BUILD_CLASS_FILES_TRUE = @BUILD_CLASS_FILES_TRUE@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CLASSPATH_CONVENIENCE = @CLASSPATH_CONVENIENCE@
+CLASSPATH_INCLUDES = @CLASSPATH_INCLUDES@
+CLASSPATH_MODULE = @CLASSPATH_MODULE@
+COLLECTIONS_PREFIX = @COLLECTIONS_PREFIX@
+CP = @CP@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CREATE_ALSA_LIBRARIES_FALSE = @CREATE_ALSA_LIBRARIES_FALSE@
+CREATE_ALSA_LIBRARIES_TRUE = @CREATE_ALSA_LIBRARIES_TRUE@
+CREATE_API_DOCS_FALSE = @CREATE_API_DOCS_FALSE@
+CREATE_API_DOCS_TRUE = @CREATE_API_DOCS_TRUE@
+CREATE_COLLECTIONS_FALSE = @CREATE_COLLECTIONS_FALSE@
+CREATE_COLLECTIONS_TRUE = @CREATE_COLLECTIONS_TRUE@
+CREATE_CORE_JNI_LIBRARIES_FALSE = @CREATE_CORE_JNI_LIBRARIES_FALSE@
+CREATE_CORE_JNI_LIBRARIES_TRUE = @CREATE_CORE_JNI_LIBRARIES_TRUE@
+CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
+CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
+CREATE_GCONF_PEER_LIBRARIES_FALSE = @CREATE_GCONF_PEER_LIBRARIES_FALSE@
+CREATE_GCONF_PEER_LIBRARIES_TRUE = @CREATE_GCONF_PEER_LIBRARIES_TRUE@
+CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
+CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
+CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
+CREATE_JNI_HEADERS_TRUE = @CREATE_JNI_HEADERS_TRUE@
+CREATE_JNI_LIBRARIES_FALSE = @CREATE_JNI_LIBRARIES_FALSE@
+CREATE_JNI_LIBRARIES_TRUE = @CREATE_JNI_LIBRARIES_TRUE@
+CREATE_PLUGIN_FALSE = @CREATE_PLUGIN_FALSE@
+CREATE_PLUGIN_TRUE = @CREATE_PLUGIN_TRUE@
+CREATE_QT_PEER_LIBRARIES_FALSE = @CREATE_QT_PEER_LIBRARIES_FALSE@
+CREATE_QT_PEER_LIBRARIES_TRUE = @CREATE_QT_PEER_LIBRARIES_TRUE@
+CREATE_WRAPPERS_FALSE = @CREATE_WRAPPERS_FALSE@
+CREATE_WRAPPERS_TRUE = @CREATE_WRAPPERS_TRUE@
+CREATE_XMLJ_LIBRARY_FALSE = @CREATE_XMLJ_LIBRARY_FALSE@
+CREATE_XMLJ_LIBRARY_TRUE = @CREATE_XMLJ_LIBRARY_TRUE@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DATE = @DATE@
+DEFAULT_PREFS_PEER = @DEFAULT_PREFS_PEER@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+ECJ = @ECJ@
+EGREP = @EGREP@
+ENABLE_LOCAL_SOCKETS_FALSE = @ENABLE_LOCAL_SOCKETS_FALSE@
+ENABLE_LOCAL_SOCKETS_TRUE = @ENABLE_LOCAL_SOCKETS_TRUE@
+ERROR_CFLAGS = @ERROR_CFLAGS@
+EXAMPLESDIR = @EXAMPLESDIR@
+EXEEXT = @EXEEXT@
+FASTJAR = @FASTJAR@
+FIND = @FIND@
+FOUND_CACAO_FALSE = @FOUND_CACAO_FALSE@
+FOUND_CACAO_TRUE = @FOUND_CACAO_TRUE@
+FOUND_ECJ_FALSE = @FOUND_ECJ_FALSE@
+FOUND_ECJ_TRUE = @FOUND_ECJ_TRUE@
+FOUND_GCJX_FALSE = @FOUND_GCJX_FALSE@
+FOUND_GCJX_TRUE = @FOUND_GCJX_TRUE@
+FOUND_GCJ_FALSE = @FOUND_GCJ_FALSE@
+FOUND_GCJ_TRUE = @FOUND_GCJ_TRUE@
+FOUND_JIKES_FALSE = @FOUND_JIKES_FALSE@
+FOUND_JIKES_TRUE = @FOUND_JIKES_TRUE@
+FOUND_KJC_FALSE = @FOUND_KJC_FALSE@
+FOUND_KJC_TRUE = @FOUND_KJC_TRUE@
+FREETYPE2_CFLAGS = @FREETYPE2_CFLAGS@
+FREETYPE2_LIBS = @FREETYPE2_LIBS@
+GCJ = @GCJ@
+GCJX = @GCJX@
+GCONF_CFLAGS = @GCONF_CFLAGS@
+GCONF_LIBS = @GCONF_LIBS@
+GDK_CFLAGS = @GDK_CFLAGS@
+GDK_LIBS = @GDK_LIBS@
+GJDOC = @GJDOC@
+GLIB_CFLAGS = @GLIB_CFLAGS@
+GLIB_LIBS = @GLIB_LIBS@
+GTK_CFLAGS = @GTK_CFLAGS@
+GTK_LIBS = @GTK_LIBS@
+INIT_LOAD_LIBRARY = @INIT_LOAD_LIBRARY@
+INSTALL_CLASS_FILES_FALSE = @INSTALL_CLASS_FILES_FALSE@
+INSTALL_CLASS_FILES_TRUE = @INSTALL_CLASS_FILES_TRUE@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_GLIBJ_ZIP_FALSE = @INSTALL_GLIBJ_ZIP_FALSE@
+INSTALL_GLIBJ_ZIP_TRUE = @INSTALL_GLIBJ_ZIP_TRUE@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION = @JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION@
+JAY = @JAY@
+JAY_SKELETON = @JAY_SKELETON@
+JIKES = @JIKES@
+JIKESENCODING = @JIKESENCODING@
+JIKESWARNINGS = @JIKESWARNINGS@
+KJC = @KJC@
+LDFLAGS = @LDFLAGS@
+LIBDEBUG = @LIBDEBUG@
+LIBICONV = @LIBICONV@
+LIBMAGIC = @LIBMAGIC@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBVERSION = @LIBVERSION@
+LN_S = @LN_S@
+LTLIBICONV = @LTLIBICONV@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
+MAKEINFO = @MAKEINFO@
+MKDIR = @MKDIR@
+MOC = @MOC@
+MOZILLA_CFLAGS = @MOZILLA_CFLAGS@
+MOZILLA_LIBS = @MOZILLA_LIBS@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PANGOFT2_CFLAGS = @PANGOFT2_CFLAGS@
+PANGOFT2_LIBS = @PANGOFT2_LIBS@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PATH_TO_ESCHER = @PATH_TO_ESCHER@
+PATH_TO_GLIBJ_ZIP = @PATH_TO_GLIBJ_ZIP@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PLUGIN_DIR = @PLUGIN_DIR@
+QT_CFLAGS = @QT_CFLAGS@
+QT_LIBS = @QT_LIBS@
+RANLIB = @RANLIB@
+REGEN_PARSERS_FALSE = @REGEN_PARSERS_FALSE@
+REGEN_PARSERS_TRUE = @REGEN_PARSERS_TRUE@
+REMOVE = @REMOVE@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRICT_WARNING_CFLAGS = @STRICT_WARNING_CFLAGS@
+STRIP = @STRIP@
+USER_CLASSLIB = @USER_CLASSLIB@
+USER_JAVAH = @USER_JAVAH@
+USER_SPECIFIED_CLASSLIB_FALSE = @USER_SPECIFIED_CLASSLIB_FALSE@
+USER_SPECIFIED_CLASSLIB_TRUE = @USER_SPECIFIED_CLASSLIB_TRUE@
+USER_SPECIFIED_JAVAH_FALSE = @USER_SPECIFIED_JAVAH_FALSE@
+USER_SPECIFIED_JAVAH_TRUE = @USER_SPECIFIED_JAVAH_TRUE@
+USE_ESCHER_FALSE = @USE_ESCHER_FALSE@
+USE_ESCHER_TRUE = @USE_ESCHER_TRUE@
+USE_PREBUILT_GLIBJ_ZIP_FALSE = @USE_PREBUILT_GLIBJ_ZIP_FALSE@
+USE_PREBUILT_GLIBJ_ZIP_TRUE = @USE_PREBUILT_GLIBJ_ZIP_TRUE@
+VERSION = @VERSION@
+VM_BINARY = @VM_BINARY@
+WARNING_CFLAGS = @WARNING_CFLAGS@
+XML_CFLAGS = @XML_CFLAGS@
+XML_LIBS = @XML_LIBS@
+XSLT_CFLAGS = @XSLT_CFLAGS@
+XSLT_LIBS = @XSLT_LIBS@
+XTEST_LIBS = @XTEST_LIBS@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+ZIP = @ZIP@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+default_toolkit = @default_toolkit@
+exec_prefix = @exec_prefix@
+glibjdir = @glibjdir@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+multi_basedir = @multi_basedir@
+nativeexeclibdir = @nativeexeclibdir@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+toolexeclibdir = @toolexeclibdir@
+vm_classes = @vm_classes@
+nativeexeclib_LTLIBRARIES = libgconfpeer.la
+libgconfpeer_la_SOURCES = GConfNativePeer.c
+libgconfpeer_la_LIBADD = $(top_builddir)/native/jni/classpath/native_state.lo \
+                       $(top_builddir)/native/jni/classpath/jcl.lo
+
+libgconfpeer_la_LDFLAGS = -avoid-version
+AM_LDFLAGS = @CLASSPATH_MODULE@ @GCONF_LIBS@ @GDK_LIBS@
+AM_CPPFLAGS = @CLASSPATH_INCLUDES@
+AM_CFLAGS = @WARNING_CFLAGS@ @ERROR_CFLAGS@ @GCONF_CFLAGS@ @GDK_CFLAGS@
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  native/jni/gconf-peer/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  native/jni/gconf-peer/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-nativeexeclibLTLIBRARIES: $(nativeexeclib_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(nativeexeclibdir)" || $(mkdir_p) "$(DESTDIR)$(nativeexeclibdir)"
+	@list='$(nativeexeclib_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) --mode=install $(nativeexeclibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(nativeexeclibdir)/$$f'"; \
+	    $(LIBTOOL) --mode=install $(nativeexeclibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(nativeexeclibdir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-nativeexeclibLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@set -x; list='$(nativeexeclib_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(nativeexeclibdir)/$$p'"; \
+	  $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(nativeexeclibdir)/$$p"; \
+	done
+
+clean-nativeexeclibLTLIBRARIES:
+	-test -z "$(nativeexeclib_LTLIBRARIES)" || rm -f $(nativeexeclib_LTLIBRARIES)
+	@list='$(nativeexeclib_LTLIBRARIES)'; for p in $$list; do \
+	  dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+	  test "$$dir" != "$$p" || dir=.; \
+	  echo "rm -f \"$${dir}/so_locations\""; \
+	  rm -f "$${dir}/so_locations"; \
+	done
+libgconfpeer.la: $(libgconfpeer_la_OBJECTS) $(libgconfpeer_la_DEPENDENCIES) 
+	$(LINK) -rpath $(nativeexeclibdir) $(libgconfpeer_la_LDFLAGS) $(libgconfpeer_la_OBJECTS) $(libgconfpeer_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/GConfNativePeer.Plo at am__quote@
+
+.c.o:
+ at am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+ at am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(COMPILE) -c $<
+
+.c.obj:
+ at am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+ at am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+ at am__fastdepCC_TRUE@	if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+ at am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+distclean-libtool:
+	-rm -f libtool
+uninstall-info-am:
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	    $$tags $$unique; \
+	fi
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$tags $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && cd $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+	list='$(DISTFILES)'; for file in $$list; do \
+	  case $$file in \
+	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+	  esac; \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+	    dir="/$$dir"; \
+	    $(mkdir_p) "$(distdir)$$dir"; \
+	  else \
+	    dir=''; \
+	  fi; \
+	  if test -d $$d/$$file; then \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES)
+installdirs:
+	for dir in "$(DESTDIR)$(nativeexeclibdir)"; do \
+	  test -z "$$dir" || $(mkdir_p) "$$dir"; \
+	done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-nativeexeclibLTLIBRARIES \
+	mostlyclean-am
+
+distclean: distclean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+	distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am: install-nativeexeclibLTLIBRARIES
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+	mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am uninstall-nativeexeclibLTLIBRARIES
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+	clean-libtool clean-nativeexeclibLTLIBRARIES ctags distclean \
+	distclean-compile distclean-generic distclean-libtool \
+	distclean-tags distdir dvi dvi-am html html-am info info-am \
+	install install-am install-data install-data-am install-exec \
+	install-exec-am install-info install-info-am install-man \
+	install-nativeexeclibLTLIBRARIES install-strip installcheck \
+	installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-compile \
+	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+	tags uninstall uninstall-am uninstall-info-am \
+	uninstall-nativeexeclibLTLIBRARIES
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/.cvsignore
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/.cvsignore?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/.cvsignore (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/.cvsignore Thu Nov  8 16:56:19 2007
@@ -0,0 +1,8 @@
+*.o
+*.a
+*.lo
+*.la
+.libs
+.deps
+Makefile
+Makefile.in

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/GtkDragSourceContextPeer.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/GtkDragSourceContextPeer.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/GtkDragSourceContextPeer.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/GtkDragSourceContextPeer.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,256 @@
+/* gtkdragsourcecontextpeer.c -- Native implementation of GtkDragSourceContextPeer
+   Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#include "gtkpeer.h"
+#include "GtkDragSourceContextPeer.h"
+
+#include <jni.h>
+#include <gtk/gtk.h>
+
+static GtkWidget * get_widget (GtkWidget *widget);
+  
+#define ACTION_COPY 1
+#define ACTION_MOVE 2
+#define ACTION_COPY_OR_MOVE  3
+#define ACTION_LINK 1073741824
+
+#define AWT_DEFAULT_CURSOR 0
+#define AWT_CROSSHAIR_CURSOR 1
+#define AWT_TEXT_CURSOR 2
+#define AWT_WAIT_CURSOR 3
+#define AWT_SW_RESIZE_CURSOR 4
+#define AWT_SE_RESIZE_CURSOR 5
+#define AWT_NW_RESIZE_CURSOR 6
+#define AWT_NE_RESIZE_CURSOR 7
+#define AWT_N_RESIZE_CURSOR 8
+#define AWT_S_RESIZE_CURSOR 9
+#define AWT_W_RESIZE_CURSOR 10
+#define AWT_E_RESIZE_CURSOR 11
+#define AWT_HAND_CURSOR 12
+#define AWT_MOVE_CURSOR 13
+
+GtkWidget *widget;
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_dnd_peer_gtk_GtkDragSourceContextPeer_create 
+  (JNIEnv *env, jobject obj, jobject comp)
+{
+  void *ptr;
+  
+  gdk_threads_enter ();
+  
+  NSA_SET_GLOBAL_REF (env, obj);  
+  NSA_SET_GLOBAL_REF (env, comp);
+  
+  ptr = NSA_GET_PTR (env, comp);
+  widget = get_widget (GTK_WIDGET (ptr));
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_dnd_peer_gtk_GtkDragSourceContextPeer_nativeSetCursor
+  (JNIEnv *env, jobject obj, jint type)
+{
+  void *ptr;
+  GdkWindow *win;
+  GdkCursorType gdk_cursor_type;
+  GdkCursor *gdk_cursor;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_GLOBAL_REF (env, obj);
+  
+  switch (type)
+    {
+    case AWT_CROSSHAIR_CURSOR:
+      gdk_cursor_type = GDK_CROSSHAIR;
+      break;
+    case AWT_TEXT_CURSOR:
+      gdk_cursor_type = GDK_XTERM;
+      break;
+    case AWT_WAIT_CURSOR:
+      gdk_cursor_type = GDK_WATCH;
+      break;
+    case AWT_SW_RESIZE_CURSOR:
+      gdk_cursor_type = GDK_BOTTOM_LEFT_CORNER;
+      break;
+    case AWT_SE_RESIZE_CURSOR:
+      gdk_cursor_type = GDK_BOTTOM_RIGHT_CORNER;
+      break;
+    case AWT_NW_RESIZE_CURSOR:
+      gdk_cursor_type = GDK_TOP_LEFT_CORNER;
+      break;
+    case AWT_NE_RESIZE_CURSOR:
+      gdk_cursor_type = GDK_TOP_RIGHT_CORNER;
+      break;
+    case AWT_N_RESIZE_CURSOR:
+      gdk_cursor_type = GDK_TOP_SIDE;
+      break;
+    case AWT_S_RESIZE_CURSOR:
+      gdk_cursor_type = GDK_BOTTOM_SIDE;
+      break;
+    case AWT_W_RESIZE_CURSOR:
+      gdk_cursor_type = GDK_LEFT_SIDE;
+      break;
+    case AWT_E_RESIZE_CURSOR:
+      gdk_cursor_type = GDK_RIGHT_SIDE;
+      break;
+    case AWT_HAND_CURSOR:
+      gdk_cursor_type = GDK_HAND2;
+      break;
+    case AWT_MOVE_CURSOR:
+      gdk_cursor_type = GDK_FLEUR;
+      break;
+    default:
+      gdk_cursor_type = GDK_LEFT_PTR;
+    }
+  
+  win = widget->window;
+  if ((widget->window) == NULL)
+    win = widget->window;
+    
+  gdk_cursor = gdk_cursor_new (gdk_cursor_type);
+
+  gdk_window_set_cursor (win, gdk_cursor);
+  gdk_cursor_unref (gdk_cursor);
+
+  gdk_flush();
+  
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_dnd_peer_gtk_GtkDragSourceContextPeer_connectSignals 
+  (JNIEnv *env, jobject obj, jobject comp)
+{
+  jobject *gref;
+  void *ptr;
+  
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_GLOBAL_REF (env, obj);
+  gref = NSA_GET_GLOBAL_REF (env, comp);
+
+ /* Uncomment when needed:
+  g_signal_connect (G_OBJECT (widget), "drag_motion",
+                    G_CALLBACK (drag_motion_cb), *gref);
+  g_signal_connect (G_OBJECT (widget), "drag_begin",
+                    G_CALLBACK (drag_begin_cb), *gref);
+  g_signal_connect (G_OBJECT (widget), "drag_end",
+                    G_CALLBACK (drag_end_cb), *gref);
+  g_signal_connect (G_OBJECT (widget), "drag_data_get",
+                    G_CALLBACK (drag_data_get_cb), *gref);
+  g_signal_connect (G_OBJECT (widget), "drag_drop",
+                    G_CALLBACK (drag_drop_cb), *gref);
+  g_signal_connect (G_OBJECT (widget), "drag_data_delete",
+                    G_CALLBACK (drag_data_delete_cb), *gref);
+  g_signal_connect (G_OBJECT (widget), "drag_data_received",
+                    G_CALLBACK (drag_data_received_cb), *gref);
+  */
+                                 
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_dnd_peer_gtk_GtkDragSourceContextPeer_nativeStartDrag
+  (JNIEnv *env, jobject obj, jobject img, jint x, jint y, jint act,
+   jstring target)
+{
+  void *ptr;
+  const gchar *data;
+  GtkTargetEntry tar[1];
+  GdkEvent *event;
+  GdkPixbuf *image = NULL;
+  GdkDragContext *context = NULL;
+  GdkDragAction action = GDK_ACTION_DEFAULT;
+  
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_GLOBAL_REF (env, obj);
+
+  data = (*env)->GetStringUTFChars (env, target, NULL);
+  tar[0].target = (gchar *) data;  
+  event = gdk_event_new (GDK_ALL_EVENTS_MASK);
+  
+  switch (act)
+    {
+    case ACTION_COPY:
+      action = GDK_ACTION_COPY;
+      break;
+    case ACTION_MOVE:
+      action = GDK_ACTION_MOVE;
+      break;
+    case ACTION_COPY_OR_MOVE:
+      action = GDK_ACTION_COPY | GDK_ACTION_MOVE;
+      break;
+    case ACTION_LINK:
+      action = GDK_ACTION_LINK;
+      break;
+    default:
+      action = GDK_ACTION_DEFAULT;
+    }
+
+  gtk_drag_highlight (widget);
+  context = gtk_drag_begin (widget, 
+             gtk_target_list_new (tar, sizeof (tar) / sizeof (GtkTargetEntry)), 
+             action, GDK_BUTTON1_MASK | GDK_BUTTON2_MASK, event);
+
+  if (img != NULL)
+  {
+    image = cp_gtk_image_get_pixbuf (env, img);
+    gtk_drag_set_icon_pixbuf (context, image, x, y);
+  }
+
+  gdk_event_free (event);
+  (*env)->ReleaseStringUTFChars (env, target, data);  
+  
+  gdk_threads_leave ();
+}
+
+static GtkWidget *
+get_widget (GtkWidget *widget)
+{
+  GtkWidget *w;
+  
+  if (GTK_IS_EVENT_BOX (widget) || GTK_IS_CONTAINER (widget))
+    w = gtk_bin_get_child (GTK_BIN(widget));
+  else
+    w = widget;
+
+  return w;
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/Makefile.am
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/Makefile.am?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/Makefile.am (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/Makefile.am Thu Nov  8 16:56:19 2007
@@ -0,0 +1,64 @@
+nativeexeclib_LTLIBRARIES = libgtkpeer.la
+
+# GTK JNI sources.
+libgtkpeer_la_SOURCES = gnu_java_awt_peer_gtk_CairoSurface.c \
+			gnu_java_awt_peer_gtk_CairoGraphics2D.c \
+			gnu_java_awt_peer_gtk_ComponentGraphics.c \
+			gnu_java_awt_peer_gtk_ComponentGraphicsCopy.c \
+			gnu_java_awt_peer_gtk_FreetypeGlyphVector.c \
+			gnu_java_awt_peer_gtk_GThreadNativeMethodRunner.c \
+			gnu_java_awt_peer_gtk_GdkFontPeer.c \
+			gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.c \
+			gnu_java_awt_peer_gtk_GdkPixbufDecoder.c \
+			gnu_java_awt_peer_gtk_GdkRobotPeer.c \
+			gnu_java_awt_peer_gtk_GdkScreenGraphicsDevice.c \
+			gnu_java_awt_peer_gtk_GtkButtonPeer.c \
+			gnu_java_awt_peer_gtk_GtkCanvasPeer.c \
+			gnu_java_awt_peer_gtk_GtkCheckboxMenuItemPeer.c \
+			gnu_java_awt_peer_gtk_GtkCheckboxPeer.c \
+			gnu_java_awt_peer_gtk_GtkChoicePeer.c \
+			gnu_java_awt_peer_gtk_GtkClipboard.c \
+			gnu_java_awt_peer_gtk_GtkComponentPeer.c \
+			gnu_java_awt_peer_gtk_GtkEmbeddedWindowPeer.c \
+			gnu_java_awt_peer_gtk_GtkFileDialogPeer.c \
+			gnu_java_awt_peer_gtk_GtkFramePeer.c \
+			gnu_java_awt_peer_gtk_GtkGenericPeer.c \
+			gnu_java_awt_peer_gtk_GtkImage.c \
+			gnu_java_awt_peer_gtk_GtkLabelPeer.c \
+			gnu_java_awt_peer_gtk_GtkListPeer.c \
+			gnu_java_awt_peer_gtk_GtkMenuBarPeer.c \
+			gnu_java_awt_peer_gtk_GtkMenuComponentPeer.c \
+			gnu_java_awt_peer_gtk_GtkMenuItemPeer.c \
+			gnu_java_awt_peer_gtk_GtkMenuPeer.c \
+			gnu_java_awt_peer_gtk_GtkPanelPeer.c \
+			gnu_java_awt_peer_gtk_GtkPopupMenuPeer.c \
+			gnu_java_awt_peer_gtk_GtkScrollbarPeer.c \
+			gnu_java_awt_peer_gtk_GtkScrollPanePeer.c \
+			gnu_java_awt_peer_gtk_GtkSelection.c \
+			gnu_java_awt_peer_gtk_GtkTextAreaPeer.c \
+			gnu_java_awt_peer_gtk_GtkTextFieldPeer.c \
+			gnu_java_awt_peer_gtk_GtkToolkit.c \
+			gnu_java_awt_peer_gtk_GtkWindowPeer.c \
+			gnu_java_awt_peer_gtk_GtkVolatileImage.c \
+			GtkDragSourceContextPeer.c \
+			cairographics2d.h \
+			gthread-jni.c \
+			gdkdisplay.h \
+			gdkfont.h \
+			gthread-jni.h \
+			gtk_jawt.c \
+			gtkpeer.h
+
+libgtkpeer_la_LIBADD = $(top_builddir)/native/jni/classpath/native_state.lo \
+		       $(top_builddir)/native/jni/classpath/jcl.lo
+libgtkpeer_la_LDFLAGS = -avoid-version
+
+AM_LDFLAGS = @CLASSPATH_MODULE@ @GTK_LIBS@ @FREETYPE2_LIBS@ \
+             @PANGOFT2_LIBS@ @X_PRE_LIBS@ @X_LIBS@ @X_EXTRA_LIBS@ @XTEST_LIBS@
+AM_CPPFLAGS = @CLASSPATH_INCLUDES@
+
+# Just the WARNING_CFLAGS. We cannot use the strict flags since the gtk
+# headers contain broken prototypes (by design, see gtkitemfactory.h).
+AM_CFLAGS = @WARNING_CFLAGS@ @ERROR_CFLAGS@ \
+            @GTK_CFLAGS@ @FREETYPE2_CFLAGS@ @PANGOFT2_CFLAGS@ \
+            @X_CFLAGS@

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/Makefile.in
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/Makefile.in?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/Makefile.in (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/Makefile.in Thu Nov  8 16:56:19 2007
@@ -0,0 +1,733 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = native/jni/gtk-peer
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/../../config/depstand.m4 \
+	$(top_srcdir)/../../config/lead-dot.m4 \
+	$(top_srcdir)/../../config/multi.m4 \
+	$(top_srcdir)/../../libtool.m4 $(top_srcdir)/m4/acattribute.m4 \
+	$(top_srcdir)/m4/accross.m4 $(top_srcdir)/m4/acinclude.m4 \
+	$(top_srcdir)/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \
+	$(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
+	$(top_srcdir)/m4/pkg.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/include/config.h
+CONFIG_CLEAN_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+    *) f=$$p;; \
+  esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(nativeexeclibdir)"
+nativeexeclibLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(nativeexeclib_LTLIBRARIES)
+libgtkpeer_la_DEPENDENCIES =  \
+	$(top_builddir)/native/jni/classpath/native_state.lo \
+	$(top_builddir)/native/jni/classpath/jcl.lo
+am_libgtkpeer_la_OBJECTS = gnu_java_awt_peer_gtk_CairoSurface.lo \
+	gnu_java_awt_peer_gtk_CairoGraphics2D.lo \
+	gnu_java_awt_peer_gtk_ComponentGraphics.lo \
+	gnu_java_awt_peer_gtk_ComponentGraphicsCopy.lo \
+	gnu_java_awt_peer_gtk_FreetypeGlyphVector.lo \
+	gnu_java_awt_peer_gtk_GThreadNativeMethodRunner.lo \
+	gnu_java_awt_peer_gtk_GdkFontPeer.lo \
+	gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.lo \
+	gnu_java_awt_peer_gtk_GdkPixbufDecoder.lo \
+	gnu_java_awt_peer_gtk_GdkRobotPeer.lo \
+	gnu_java_awt_peer_gtk_GdkScreenGraphicsDevice.lo \
+	gnu_java_awt_peer_gtk_GtkButtonPeer.lo \
+	gnu_java_awt_peer_gtk_GtkCanvasPeer.lo \
+	gnu_java_awt_peer_gtk_GtkCheckboxMenuItemPeer.lo \
+	gnu_java_awt_peer_gtk_GtkCheckboxPeer.lo \
+	gnu_java_awt_peer_gtk_GtkChoicePeer.lo \
+	gnu_java_awt_peer_gtk_GtkClipboard.lo \
+	gnu_java_awt_peer_gtk_GtkComponentPeer.lo \
+	gnu_java_awt_peer_gtk_GtkEmbeddedWindowPeer.lo \
+	gnu_java_awt_peer_gtk_GtkFileDialogPeer.lo \
+	gnu_java_awt_peer_gtk_GtkFramePeer.lo \
+	gnu_java_awt_peer_gtk_GtkGenericPeer.lo \
+	gnu_java_awt_peer_gtk_GtkImage.lo \
+	gnu_java_awt_peer_gtk_GtkLabelPeer.lo \
+	gnu_java_awt_peer_gtk_GtkListPeer.lo \
+	gnu_java_awt_peer_gtk_GtkMenuBarPeer.lo \
+	gnu_java_awt_peer_gtk_GtkMenuComponentPeer.lo \
+	gnu_java_awt_peer_gtk_GtkMenuItemPeer.lo \
+	gnu_java_awt_peer_gtk_GtkMenuPeer.lo \
+	gnu_java_awt_peer_gtk_GtkPanelPeer.lo \
+	gnu_java_awt_peer_gtk_GtkPopupMenuPeer.lo \
+	gnu_java_awt_peer_gtk_GtkScrollbarPeer.lo \
+	gnu_java_awt_peer_gtk_GtkScrollPanePeer.lo \
+	gnu_java_awt_peer_gtk_GtkSelection.lo \
+	gnu_java_awt_peer_gtk_GtkTextAreaPeer.lo \
+	gnu_java_awt_peer_gtk_GtkTextFieldPeer.lo \
+	gnu_java_awt_peer_gtk_GtkToolkit.lo \
+	gnu_java_awt_peer_gtk_GtkWindowPeer.lo \
+	gnu_java_awt_peer_gtk_GtkVolatileImage.lo \
+	GtkDragSourceContextPeer.lo gthread-jni.lo gtk_jawt.lo
+libgtkpeer_la_OBJECTS = $(am_libgtkpeer_la_OBJECTS)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \
+	$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+	$(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(libgtkpeer_la_SOURCES)
+DIST_SOURCES = $(libgtkpeer_la_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BUILD_CLASS_FILES_FALSE = @BUILD_CLASS_FILES_FALSE@
+BUILD_CLASS_FILES_TRUE = @BUILD_CLASS_FILES_TRUE@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CLASSPATH_CONVENIENCE = @CLASSPATH_CONVENIENCE@
+CLASSPATH_INCLUDES = @CLASSPATH_INCLUDES@
+CLASSPATH_MODULE = @CLASSPATH_MODULE@
+COLLECTIONS_PREFIX = @COLLECTIONS_PREFIX@
+CP = @CP@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CREATE_ALSA_LIBRARIES_FALSE = @CREATE_ALSA_LIBRARIES_FALSE@
+CREATE_ALSA_LIBRARIES_TRUE = @CREATE_ALSA_LIBRARIES_TRUE@
+CREATE_API_DOCS_FALSE = @CREATE_API_DOCS_FALSE@
+CREATE_API_DOCS_TRUE = @CREATE_API_DOCS_TRUE@
+CREATE_COLLECTIONS_FALSE = @CREATE_COLLECTIONS_FALSE@
+CREATE_COLLECTIONS_TRUE = @CREATE_COLLECTIONS_TRUE@
+CREATE_CORE_JNI_LIBRARIES_FALSE = @CREATE_CORE_JNI_LIBRARIES_FALSE@
+CREATE_CORE_JNI_LIBRARIES_TRUE = @CREATE_CORE_JNI_LIBRARIES_TRUE@
+CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
+CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
+CREATE_GCONF_PEER_LIBRARIES_FALSE = @CREATE_GCONF_PEER_LIBRARIES_FALSE@
+CREATE_GCONF_PEER_LIBRARIES_TRUE = @CREATE_GCONF_PEER_LIBRARIES_TRUE@
+CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
+CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
+CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
+CREATE_JNI_HEADERS_TRUE = @CREATE_JNI_HEADERS_TRUE@
+CREATE_JNI_LIBRARIES_FALSE = @CREATE_JNI_LIBRARIES_FALSE@
+CREATE_JNI_LIBRARIES_TRUE = @CREATE_JNI_LIBRARIES_TRUE@
+CREATE_PLUGIN_FALSE = @CREATE_PLUGIN_FALSE@
+CREATE_PLUGIN_TRUE = @CREATE_PLUGIN_TRUE@
+CREATE_QT_PEER_LIBRARIES_FALSE = @CREATE_QT_PEER_LIBRARIES_FALSE@
+CREATE_QT_PEER_LIBRARIES_TRUE = @CREATE_QT_PEER_LIBRARIES_TRUE@
+CREATE_WRAPPERS_FALSE = @CREATE_WRAPPERS_FALSE@
+CREATE_WRAPPERS_TRUE = @CREATE_WRAPPERS_TRUE@
+CREATE_XMLJ_LIBRARY_FALSE = @CREATE_XMLJ_LIBRARY_FALSE@
+CREATE_XMLJ_LIBRARY_TRUE = @CREATE_XMLJ_LIBRARY_TRUE@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DATE = @DATE@
+DEFAULT_PREFS_PEER = @DEFAULT_PREFS_PEER@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+ECJ = @ECJ@
+EGREP = @EGREP@
+ENABLE_LOCAL_SOCKETS_FALSE = @ENABLE_LOCAL_SOCKETS_FALSE@
+ENABLE_LOCAL_SOCKETS_TRUE = @ENABLE_LOCAL_SOCKETS_TRUE@
+ERROR_CFLAGS = @ERROR_CFLAGS@
+EXAMPLESDIR = @EXAMPLESDIR@
+EXEEXT = @EXEEXT@
+FASTJAR = @FASTJAR@
+FIND = @FIND@
+FOUND_CACAO_FALSE = @FOUND_CACAO_FALSE@
+FOUND_CACAO_TRUE = @FOUND_CACAO_TRUE@
+FOUND_ECJ_FALSE = @FOUND_ECJ_FALSE@
+FOUND_ECJ_TRUE = @FOUND_ECJ_TRUE@
+FOUND_GCJX_FALSE = @FOUND_GCJX_FALSE@
+FOUND_GCJX_TRUE = @FOUND_GCJX_TRUE@
+FOUND_GCJ_FALSE = @FOUND_GCJ_FALSE@
+FOUND_GCJ_TRUE = @FOUND_GCJ_TRUE@
+FOUND_JIKES_FALSE = @FOUND_JIKES_FALSE@
+FOUND_JIKES_TRUE = @FOUND_JIKES_TRUE@
+FOUND_KJC_FALSE = @FOUND_KJC_FALSE@
+FOUND_KJC_TRUE = @FOUND_KJC_TRUE@
+FREETYPE2_CFLAGS = @FREETYPE2_CFLAGS@
+FREETYPE2_LIBS = @FREETYPE2_LIBS@
+GCJ = @GCJ@
+GCJX = @GCJX@
+GCONF_CFLAGS = @GCONF_CFLAGS@
+GCONF_LIBS = @GCONF_LIBS@
+GDK_CFLAGS = @GDK_CFLAGS@
+GDK_LIBS = @GDK_LIBS@
+GJDOC = @GJDOC@
+GLIB_CFLAGS = @GLIB_CFLAGS@
+GLIB_LIBS = @GLIB_LIBS@
+GTK_CFLAGS = @GTK_CFLAGS@
+GTK_LIBS = @GTK_LIBS@
+INIT_LOAD_LIBRARY = @INIT_LOAD_LIBRARY@
+INSTALL_CLASS_FILES_FALSE = @INSTALL_CLASS_FILES_FALSE@
+INSTALL_CLASS_FILES_TRUE = @INSTALL_CLASS_FILES_TRUE@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_GLIBJ_ZIP_FALSE = @INSTALL_GLIBJ_ZIP_FALSE@
+INSTALL_GLIBJ_ZIP_TRUE = @INSTALL_GLIBJ_ZIP_TRUE@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION = @JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION@
+JAY = @JAY@
+JAY_SKELETON = @JAY_SKELETON@
+JIKES = @JIKES@
+JIKESENCODING = @JIKESENCODING@
+JIKESWARNINGS = @JIKESWARNINGS@
+KJC = @KJC@
+LDFLAGS = @LDFLAGS@
+LIBDEBUG = @LIBDEBUG@
+LIBICONV = @LIBICONV@
+LIBMAGIC = @LIBMAGIC@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBVERSION = @LIBVERSION@
+LN_S = @LN_S@
+LTLIBICONV = @LTLIBICONV@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
+MAKEINFO = @MAKEINFO@
+MKDIR = @MKDIR@
+MOC = @MOC@
+MOZILLA_CFLAGS = @MOZILLA_CFLAGS@
+MOZILLA_LIBS = @MOZILLA_LIBS@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PANGOFT2_CFLAGS = @PANGOFT2_CFLAGS@
+PANGOFT2_LIBS = @PANGOFT2_LIBS@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PATH_TO_ESCHER = @PATH_TO_ESCHER@
+PATH_TO_GLIBJ_ZIP = @PATH_TO_GLIBJ_ZIP@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PLUGIN_DIR = @PLUGIN_DIR@
+QT_CFLAGS = @QT_CFLAGS@
+QT_LIBS = @QT_LIBS@
+RANLIB = @RANLIB@
+REGEN_PARSERS_FALSE = @REGEN_PARSERS_FALSE@
+REGEN_PARSERS_TRUE = @REGEN_PARSERS_TRUE@
+REMOVE = @REMOVE@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRICT_WARNING_CFLAGS = @STRICT_WARNING_CFLAGS@
+STRIP = @STRIP@
+USER_CLASSLIB = @USER_CLASSLIB@
+USER_JAVAH = @USER_JAVAH@
+USER_SPECIFIED_CLASSLIB_FALSE = @USER_SPECIFIED_CLASSLIB_FALSE@
+USER_SPECIFIED_CLASSLIB_TRUE = @USER_SPECIFIED_CLASSLIB_TRUE@
+USER_SPECIFIED_JAVAH_FALSE = @USER_SPECIFIED_JAVAH_FALSE@
+USER_SPECIFIED_JAVAH_TRUE = @USER_SPECIFIED_JAVAH_TRUE@
+USE_ESCHER_FALSE = @USE_ESCHER_FALSE@
+USE_ESCHER_TRUE = @USE_ESCHER_TRUE@
+USE_PREBUILT_GLIBJ_ZIP_FALSE = @USE_PREBUILT_GLIBJ_ZIP_FALSE@
+USE_PREBUILT_GLIBJ_ZIP_TRUE = @USE_PREBUILT_GLIBJ_ZIP_TRUE@
+VERSION = @VERSION@
+VM_BINARY = @VM_BINARY@
+WARNING_CFLAGS = @WARNING_CFLAGS@
+XML_CFLAGS = @XML_CFLAGS@
+XML_LIBS = @XML_LIBS@
+XSLT_CFLAGS = @XSLT_CFLAGS@
+XSLT_LIBS = @XSLT_LIBS@
+XTEST_LIBS = @XTEST_LIBS@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+ZIP = @ZIP@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+default_toolkit = @default_toolkit@
+exec_prefix = @exec_prefix@
+glibjdir = @glibjdir@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+multi_basedir = @multi_basedir@
+nativeexeclibdir = @nativeexeclibdir@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+toolexeclibdir = @toolexeclibdir@
+vm_classes = @vm_classes@
+nativeexeclib_LTLIBRARIES = libgtkpeer.la
+
+# GTK JNI sources.
+libgtkpeer_la_SOURCES = gnu_java_awt_peer_gtk_CairoSurface.c \
+			gnu_java_awt_peer_gtk_CairoGraphics2D.c \
+			gnu_java_awt_peer_gtk_ComponentGraphics.c \
+			gnu_java_awt_peer_gtk_ComponentGraphicsCopy.c \
+			gnu_java_awt_peer_gtk_FreetypeGlyphVector.c \
+			gnu_java_awt_peer_gtk_GThreadNativeMethodRunner.c \
+			gnu_java_awt_peer_gtk_GdkFontPeer.c \
+			gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.c \
+			gnu_java_awt_peer_gtk_GdkPixbufDecoder.c \
+			gnu_java_awt_peer_gtk_GdkRobotPeer.c \
+			gnu_java_awt_peer_gtk_GdkScreenGraphicsDevice.c \
+			gnu_java_awt_peer_gtk_GtkButtonPeer.c \
+			gnu_java_awt_peer_gtk_GtkCanvasPeer.c \
+			gnu_java_awt_peer_gtk_GtkCheckboxMenuItemPeer.c \
+			gnu_java_awt_peer_gtk_GtkCheckboxPeer.c \
+			gnu_java_awt_peer_gtk_GtkChoicePeer.c \
+			gnu_java_awt_peer_gtk_GtkClipboard.c \
+			gnu_java_awt_peer_gtk_GtkComponentPeer.c \
+			gnu_java_awt_peer_gtk_GtkEmbeddedWindowPeer.c \
+			gnu_java_awt_peer_gtk_GtkFileDialogPeer.c \
+			gnu_java_awt_peer_gtk_GtkFramePeer.c \
+			gnu_java_awt_peer_gtk_GtkGenericPeer.c \
+			gnu_java_awt_peer_gtk_GtkImage.c \
+			gnu_java_awt_peer_gtk_GtkLabelPeer.c \
+			gnu_java_awt_peer_gtk_GtkListPeer.c \
+			gnu_java_awt_peer_gtk_GtkMenuBarPeer.c \
+			gnu_java_awt_peer_gtk_GtkMenuComponentPeer.c \
+			gnu_java_awt_peer_gtk_GtkMenuItemPeer.c \
+			gnu_java_awt_peer_gtk_GtkMenuPeer.c \
+			gnu_java_awt_peer_gtk_GtkPanelPeer.c \
+			gnu_java_awt_peer_gtk_GtkPopupMenuPeer.c \
+			gnu_java_awt_peer_gtk_GtkScrollbarPeer.c \
+			gnu_java_awt_peer_gtk_GtkScrollPanePeer.c \
+			gnu_java_awt_peer_gtk_GtkSelection.c \
+			gnu_java_awt_peer_gtk_GtkTextAreaPeer.c \
+			gnu_java_awt_peer_gtk_GtkTextFieldPeer.c \
+			gnu_java_awt_peer_gtk_GtkToolkit.c \
+			gnu_java_awt_peer_gtk_GtkWindowPeer.c \
+			gnu_java_awt_peer_gtk_GtkVolatileImage.c \
+			GtkDragSourceContextPeer.c \
+			cairographics2d.h \
+			gthread-jni.c \
+			gdkdisplay.h \
+			gdkfont.h \
+			gthread-jni.h \
+			gtk_jawt.c \
+			gtkpeer.h
+
+libgtkpeer_la_LIBADD = $(top_builddir)/native/jni/classpath/native_state.lo \
+		       $(top_builddir)/native/jni/classpath/jcl.lo
+
+libgtkpeer_la_LDFLAGS = -avoid-version
+AM_LDFLAGS = @CLASSPATH_MODULE@ @GTK_LIBS@ @FREETYPE2_LIBS@ \
+             @PANGOFT2_LIBS@ @X_PRE_LIBS@ @X_LIBS@ @X_EXTRA_LIBS@ @XTEST_LIBS@
+
+AM_CPPFLAGS = @CLASSPATH_INCLUDES@
+
+# Just the WARNING_CFLAGS. We cannot use the strict flags since the gtk
+# headers contain broken prototypes (by design, see gtkitemfactory.h).
+AM_CFLAGS = @WARNING_CFLAGS@ @ERROR_CFLAGS@ \
+            @GTK_CFLAGS@ @FREETYPE2_CFLAGS@ @PANGOFT2_CFLAGS@ \
+            @X_CFLAGS@
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  native/jni/gtk-peer/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  native/jni/gtk-peer/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-nativeexeclibLTLIBRARIES: $(nativeexeclib_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(nativeexeclibdir)" || $(mkdir_p) "$(DESTDIR)$(nativeexeclibdir)"
+	@list='$(nativeexeclib_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) --mode=install $(nativeexeclibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(nativeexeclibdir)/$$f'"; \
+	    $(LIBTOOL) --mode=install $(nativeexeclibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(nativeexeclibdir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-nativeexeclibLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@set -x; list='$(nativeexeclib_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(nativeexeclibdir)/$$p'"; \
+	  $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(nativeexeclibdir)/$$p"; \
+	done
+
+clean-nativeexeclibLTLIBRARIES:
+	-test -z "$(nativeexeclib_LTLIBRARIES)" || rm -f $(nativeexeclib_LTLIBRARIES)
+	@list='$(nativeexeclib_LTLIBRARIES)'; for p in $$list; do \
+	  dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+	  test "$$dir" != "$$p" || dir=.; \
+	  echo "rm -f \"$${dir}/so_locations\""; \
+	  rm -f "$${dir}/so_locations"; \
+	done
+libgtkpeer.la: $(libgtkpeer_la_OBJECTS) $(libgtkpeer_la_DEPENDENCIES) 
+	$(LINK) -rpath $(nativeexeclibdir) $(libgtkpeer_la_LDFLAGS) $(libgtkpeer_la_OBJECTS) $(libgtkpeer_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/GtkDragSourceContextPeer.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gnu_java_awt_peer_gtk_CairoGraphics2D.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gnu_java_awt_peer_gtk_CairoSurface.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gnu_java_awt_peer_gtk_ComponentGraphics.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gnu_java_awt_peer_gtk_ComponentGraphicsCopy.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gnu_java_awt_peer_gtk_FreetypeGlyphVector.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gnu_java_awt_peer_gtk_GThreadNativeMethodRunner.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gnu_java_awt_peer_gtk_GdkFontPeer.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gnu_java_awt_peer_gtk_GdkPixbufDecoder.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gnu_java_awt_peer_gtk_GdkRobotPeer.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gnu_java_awt_peer_gtk_GdkScreenGraphicsDevice.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gnu_java_awt_peer_gtk_GtkButtonPeer.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gnu_java_awt_peer_gtk_GtkCanvasPeer.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gnu_java_awt_peer_gtk_GtkCheckboxMenuItemPeer.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gnu_java_awt_peer_gtk_GtkCheckboxPeer.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gnu_java_awt_peer_gtk_GtkChoicePeer.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gnu_java_awt_peer_gtk_GtkClipboard.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gnu_java_awt_peer_gtk_GtkComponentPeer.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gnu_java_awt_peer_gtk_GtkEmbeddedWindowPeer.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gnu_java_awt_peer_gtk_GtkFileDialogPeer.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gnu_java_awt_peer_gtk_GtkFramePeer.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gnu_java_awt_peer_gtk_GtkGenericPeer.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gnu_java_awt_peer_gtk_GtkImage.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gnu_java_awt_peer_gtk_GtkLabelPeer.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gnu_java_awt_peer_gtk_GtkListPeer.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gnu_java_awt_peer_gtk_GtkMenuBarPeer.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gnu_java_awt_peer_gtk_GtkMenuComponentPeer.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gnu_java_awt_peer_gtk_GtkMenuItemPeer.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gnu_java_awt_peer_gtk_GtkMenuPeer.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gnu_java_awt_peer_gtk_GtkPanelPeer.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gnu_java_awt_peer_gtk_GtkPopupMenuPeer.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gnu_java_awt_peer_gtk_GtkScrollPanePeer.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gnu_java_awt_peer_gtk_GtkScrollbarPeer.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gnu_java_awt_peer_gtk_GtkSelection.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gnu_java_awt_peer_gtk_GtkTextAreaPeer.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gnu_java_awt_peer_gtk_GtkTextFieldPeer.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gnu_java_awt_peer_gtk_GtkToolkit.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gnu_java_awt_peer_gtk_GtkVolatileImage.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gnu_java_awt_peer_gtk_GtkWindowPeer.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gthread-jni.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gtk_jawt.Plo at am__quote@
+
+.c.o:
+ at am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+ at am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(COMPILE) -c $<
+
+.c.obj:
+ at am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+ at am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+ at am__fastdepCC_TRUE@	if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+ at am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+distclean-libtool:
+	-rm -f libtool
+uninstall-info-am:
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	    $$tags $$unique; \
+	fi
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$tags $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && cd $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+	list='$(DISTFILES)'; for file in $$list; do \
+	  case $$file in \
+	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+	  esac; \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+	    dir="/$$dir"; \
+	    $(mkdir_p) "$(distdir)$$dir"; \
+	  else \
+	    dir=''; \
+	  fi; \
+	  if test -d $$d/$$file; then \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES)
+installdirs:
+	for dir in "$(DESTDIR)$(nativeexeclibdir)"; do \
+	  test -z "$$dir" || $(mkdir_p) "$$dir"; \
+	done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-nativeexeclibLTLIBRARIES \
+	mostlyclean-am
+
+distclean: distclean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+	distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am: install-nativeexeclibLTLIBRARIES
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+	mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am uninstall-nativeexeclibLTLIBRARIES
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+	clean-libtool clean-nativeexeclibLTLIBRARIES ctags distclean \
+	distclean-compile distclean-generic distclean-libtool \
+	distclean-tags distdir dvi dvi-am html html-am info info-am \
+	install install-am install-data install-data-am install-exec \
+	install-exec-am install-info install-info-am install-man \
+	install-nativeexeclibLTLIBRARIES install-strip installcheck \
+	installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-compile \
+	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+	tags uninstall uninstall-am uninstall-info-am \
+	uninstall-nativeexeclibLTLIBRARIES
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/cairographics2d.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/cairographics2d.h?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/cairographics2d.h (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/cairographics2d.h Thu Nov  8 16:56:19 2007
@@ -0,0 +1,116 @@
+/* cairographics2d.h -- 
+   Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#ifndef CAIROGRAPHICS2D_H
+#define CAIROGRAPHICS2D_H
+
+
+#include <cairo.h>
+#include <gtk/gtk.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <config.h>
+#include "native_state.h"
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+#include <jni.h>
+
+/*
+ * These public final constants are part of the java2d public API, so we
+ * write them explicitly here to save fetching them from the constant pool
+ * all the time. 
+ */
+enum java_awt_alpha_composite_rule
+  {
+    java_awt_alpha_composite_CLEAR = 1,
+    java_awt_alpha_composite_SRC = 2,
+    java_awt_alpha_composite_SRC_OVER = 3,
+    java_awt_alpha_composite_DST_OVER = 4,
+    java_awt_alpha_composite_SRC_IN = 5,
+    java_awt_alpha_composite_DST_IN = 6,
+    java_awt_alpha_composite_SRC_OUT = 7,
+    java_awt_alpha_composite_DST_OUT = 8,
+    java_awt_alpha_composite_DST = 9,
+    java_awt_alpha_composite_SRC_ATOP = 10,
+    java_awt_alpha_composite_DST_ATOP = 11,
+    java_awt_alpha_composite_XOR = 12
+  };
+
+enum java_awt_basic_stroke_join_rule
+  {
+    java_awt_basic_stroke_JOIN_MITER = 0,
+    java_awt_basic_stroke_JOIN_ROUND = 1,
+    java_awt_basic_stroke_JOIN_BEVEL = 2
+  };
+
+enum java_awt_basic_stroke_cap_rule
+  {
+    java_awt_basic_stroke_CAP_BUTT = 0,
+    java_awt_basic_stroke_CAP_ROUND = 1,
+    java_awt_basic_stroke_CAP_SQUARE = 2
+  };
+
+enum java_awt_geom_path_iterator_winding_rule
+  {
+    java_awt_geom_path_iterator_WIND_EVEN_ODD = 0,
+    java_awt_geom_path_iterator_WIND_NON_ZERO = 1
+  };
+
+enum java_awt_rendering_hints_filter
+  {
+    java_awt_rendering_hints_VALUE_INTERPOLATION_NEAREST_NEIGHBOR = 0,    
+    java_awt_rendering_hints_VALUE_INTERPOLATION_BILINEAR = 1,
+    java_awt_rendering_hints_VALUE_ALPHA_INTERPOLATION_SPEED = 2,
+    java_awt_rendering_hints_VALUE_ALPHA_INTERPOLATION_QUALITY = 3,
+    java_awt_rendering_hints_VALUE_ALPHA_INTERPOLATION_DEFAULT = 4
+ 
+  };
+
+/**
+ * A structure which basically contains the cairo_t pointer. 
+ * The rest is for gradient and texture fills.
+ */
+struct cairographics2d
+{
+  cairo_t *cr;
+  cairo_surface_t *pattern_surface;
+  cairo_pattern_t *pattern; 
+  char *pattern_pixels;
+};
+
+#endif

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gdkdisplay.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gdkdisplay.h?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gdkdisplay.h (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gdkdisplay.h Thu Nov  8 16:56:19 2007
@@ -0,0 +1,67 @@
+#ifndef __GDKDISPLAY_H__
+#define __GDKDISPLAY_H__
+
+/* gdkdisplay.h -- Some global stuff related to displays & screens 
+   Copyright (C) 2006 Free Software Foundation, Inc.
+   
+   This file is part of GNU Classpath.
+   
+   GNU Classpath is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+   
+   GNU Classpath is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+   
+   You should have received a copy of the GNU General Public License
+   along with GNU Classpath; see the file COPYING.  If not, write to the
+   Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+   02110-1301 USA.
+   
+   Linking this library statically or dynamically with other modules is
+   making a combined work based on this library.  Thus, the terms and
+   conditions of the GNU General Public License cover the whole
+   combination.
+   
+   As a special exception, the copyright holders of this library give you
+   permission to link this library with independent modules to produce an
+   executable, regardless of the license terms of these independent
+   modules, and to copy and distribute the resulting executable under
+   terms of your choice, provided that you also meet, for each linked
+   independent module, the terms and conditions of the license of that
+   module.  An independent module is a module which is not derived from
+   or based on this library.  If you modify this library, you may extend
+   this exception to your version of the library, but you are not
+   obligated to do so.  If you do not wish to do so, delete this
+   exception statement from your version. */
+
+#include "gtkpeer.h"
+
+/* Allows storing GdkDisplay pointers in GdkGraphicsEnvironment instances. */
+extern struct state_table *cp_gtk_native_display_state_table;
+
+/* Allows storing GdkScreen pointers in GdkScreenGraphicsDevice instances. */
+extern struct state_table *cp_gtk_native_screen_state_table;
+
+#define NSA_DISPLAY_INIT(env, clazz) \
+  cp_gtk_native_display_state_table = cp_gtk_init_state_table (env, clazz)
+
+#define NSA_GET_DISPLAY_PTR(env, obj) \
+  cp_gtk_get_state (env, obj, cp_gtk_native_display_state_table)
+
+#define NSA_SET_DISPLAY_PTR(env, obj, ptr) \
+  cp_gtk_set_state (env, obj, cp_gtk_native_display_state_table, (void *)ptr)
+
+#define NSA_SCREEN_INIT(env, clazz) \
+  cp_gtk_native_screen_state_table = cp_gtk_init_state_table (env, clazz)
+
+#define NSA_GET_SCREEN_PTR(env, obj) \
+  cp_gtk_get_state (env, obj, cp_gtk_native_screen_state_table)
+
+#define NSA_SET_SCREEN_PTR(env, obj, ptr) \
+  cp_gtk_set_state (env, obj, cp_gtk_native_screen_state_table, (void *)ptr)
+
+#endif /* __GDKDISPLAY_H__ */

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gdkfont.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gdkfont.h?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gdkfont.h (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gdkfont.h Thu Nov  8 16:56:19 2007
@@ -0,0 +1,142 @@
+#ifndef __GDKFONT_H__
+#define __GDKFONT_H__
+
+/* gdkfont.h -- Some global stuff related to fonts and glyphs 
+   Copyright (C) 2003 Free Software Foundation, Inc.
+   
+   This file is part of GNU Classpath.
+   
+   GNU Classpath is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+   
+   GNU Classpath is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+   
+   You should have received a copy of the GNU General Public License
+   along with GNU Classpath; see the file COPYING.  If not, write to the
+   Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+   02110-1301 USA.
+   
+   Linking this library statically or dynamically with other modules is
+   making a combined work based on this library.  Thus, the terms and
+   conditions of the GNU General Public License cover the whole
+   combination.
+   
+   As a special exception, the copyright holders of this library give you
+   permission to link this library with independent modules to produce an
+   executable, regardless of the license terms of these independent
+   modules, and to copy and distribute the resulting executable under
+   terms of your choice, provided that you also meet, for each linked
+   independent module, the terms and conditions of the license of that
+   module.  An independent module is a module which is not derived from
+   or based on this library.  If you modify this library, you may extend
+   this exception to your version of the library, but you are not
+   obligated to do so.  If you do not wish to do so, delete this
+   exception statement from your version. */
+
+#include "gtkpeer.h"
+
+#include <pango/pango.h>
+#include <pango/pango-context.h>
+#include <pango/pango-fontmap.h>
+#include <pango/pangoft2.h>
+
+extern struct state_table *cp_gtk_native_font_state_table;
+extern struct state_table *native_glyphvector_state_table;
+extern struct state_table *cp_gtk_native_text_layout_state_table;
+
+#define NSA_FONT_INIT(env, clazz) \
+  cp_gtk_native_font_state_table = cp_gtk_init_state_table (env, clazz)
+
+#define NSA_GET_FONT_PTR(env, obj) \
+  cp_gtk_get_state (env, obj, cp_gtk_native_font_state_table)
+
+#define NSA_SET_FONT_PTR(env, obj, ptr) \
+  cp_gtk_set_state (env, obj, cp_gtk_native_font_state_table, (void *)ptr)
+
+#define NSA_DEL_FONT_PTR(env, obj) \
+  cp_gtk_remove_state_slot (env, obj, cp_gtk_native_font_state_table)
+
+
+#define NSA_GV_INIT(env, clazz) \
+  native_glyphvector_state_table = cp_gtk_init_state_table (env, clazz)
+
+#define NSA_GET_GV_PTR(env, obj) \
+  cp_gtk_get_state (env, obj, native_glyphvector_state_table)
+
+#define NSA_SET_GV_PTR(env, obj, ptr) \
+  cp_gtk_set_state (env, obj, native_glyphvector_state_table, (void *)ptr)
+
+#define NSA_DEL_GV_PTR(env, obj) \
+  cp_gtk_remove_state_slot (env, obj, native_glyphvector_state_table)
+
+
+#define NSA_TEXT_LAYOUT_INIT(env, clazz) \
+  cp_gtk_native_text_layout_state_table = cp_gtk_init_state_table (env, clazz)
+
+#define NSA_GET_TEXT_LAYOUT_PTR(env, obj) \
+  cp_gtk_get_state (env, obj, cp_gtk_native_text_layout_state_table)
+
+#define NSA_SET_TEXT_LAYOUT_PTR(env, obj, ptr) \
+  cp_gtk_set_state (env, obj, cp_gtk_native_text_layout_state_table, (void *)ptr)
+
+#define NSA_DEL_TEXT_LAYOUT_PTR(env, obj) \
+  cp_gtk_remove_state_slot (env, obj, cp_gtk_native_text_layout_state_table)
+
+#define FONT_METRICS_ASCENT      0
+#define FONT_METRICS_MAX_ASCENT  1
+#define FONT_METRICS_DESCENT     2
+#define FONT_METRICS_MAX_DESCENT 3
+#define FONT_METRICS_MAX_ADVANCE 4
+#define NUM_FONT_METRICS 5
+
+#define TEXT_METRICS_X_BEARING 0
+#define TEXT_METRICS_Y_BEARING 1
+#define TEXT_METRICS_WIDTH     2
+#define TEXT_METRICS_HEIGHT    3
+#define TEXT_METRICS_X_ADVANCE 4
+#define TEXT_METRICS_Y_ADVANCE 5
+#define NUM_TEXT_METRICS 6
+
+#define NUM_GLYPH_METRICS 10
+
+#define GLYPH_LOG_X(i)      (NUM_GLYPH_METRICS * (i)    )
+#define GLYPH_LOG_Y(i)      (NUM_GLYPH_METRICS * (i) + 1)
+#define GLYPH_LOG_WIDTH(i)  (NUM_GLYPH_METRICS * (i) + 2)
+#define GLYPH_LOG_HEIGHT(i) (NUM_GLYPH_METRICS * (i) + 3)
+
+#define GLYPH_INK_X(i)      (NUM_GLYPH_METRICS * (i) + 4)
+#define GLYPH_INK_Y(i)      (NUM_GLYPH_METRICS * (i) + 5)
+#define GLYPH_INK_WIDTH(i)  (NUM_GLYPH_METRICS * (i) + 6)
+#define GLYPH_INK_HEIGHT(i) (NUM_GLYPH_METRICS * (i) + 7)
+
+#define GLYPH_POS_X(i)      (NUM_GLYPH_METRICS * (i) + 8)
+#define GLYPH_POS_Y(i)      (NUM_GLYPH_METRICS * (i) + 9)
+
+struct peerfont
+{
+  PangoFont *font;
+  PangoFontDescription *desc;
+  PangoContext *ctx;
+  PangoLayout *layout;
+  /* 
+   * The GdkGraphics2D (using cairo) may store a pointer to a
+   * cairo_font_t here; since we want to work equally well with
+   * the GdkGraphics class (using GDK) we do not explicitly mention
+   * cairo types here; it is up to the higher level driver routine
+   * in GdkClasspathFontPeer.java to decide which backend functions
+   * to invoke. 
+   */
+  void *graphics_resource;
+};
+
+struct textlayout
+{
+  PangoLayout *pango_layout;
+};
+
+#endif /* __GDKFONT_H__ */

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_CairoGraphics2D.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_CairoGraphics2D.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_CairoGraphics2D.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_CairoGraphics2D.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,803 @@
+/* gnu_java_awt_peer_gtk_CairoGraphics2d.c
+   Copyright (C) 2006  Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+   
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+   
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+   
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+   
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+   
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#include "jcl.h"
+#include "gdkfont.h"
+#include "cairographics2d.h"
+#include "gnu_java_awt_peer_gtk_CairoGraphics2D.h"
+#include <gdk/gdktypes.h>
+#include <gdk/gdkprivate.h>
+#include <gdk/gdkx.h>
+
+#include <cairo-ft.h>
+#include <cairo-xlib.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+
+static void install_font_peer(cairo_t *cr, struct peerfont *pfont);
+static void update_pattern_transform (struct cairographics2d *gr);
+
+/**
+ * Allocates the cairographics2d structure.
+ */
+JNIEXPORT jlong JNICALL
+Java_gnu_java_awt_peer_gtk_CairoGraphics2D_init
+  (JNIEnv *env __attribute__ ((unused)),
+   jobject obj __attribute__ ((unused)),
+   jlong cairo_t_pointer)
+{
+  struct cairographics2d *g = NULL;
+  cairo_t *cr = JLONG_TO_PTR(cairo_t, cairo_t_pointer);
+  g_assert(cr != NULL);
+
+  g = (struct cairographics2d *) g_malloc (sizeof (struct cairographics2d));
+
+  g_assert (g != NULL);
+  memset (g, 0, sizeof(struct cairographics2d));
+  g->cr = cr;
+  
+  return PTR_TO_JLONG(g);
+}
+
+/**
+ * Disposes of the cairographics2d structure.
+ */
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_CairoGraphics2D_disposeNative
+  (JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
+  jlong pointer)
+{
+  struct cairographics2d *gr = JLONG_TO_PTR(struct cairographics2d, pointer);
+
+  if (gr == NULL)
+    return;
+
+  if (gr->cr)
+    cairo_destroy (gr->cr);
+
+  if (gr->pattern)
+    cairo_pattern_destroy (gr->pattern);
+  gr->pattern = NULL;
+  
+  if (gr->pattern_surface)
+    cairo_surface_destroy (gr->pattern_surface);
+  gr->pattern_surface = NULL;
+
+  if (gr->pattern_pixels)
+    g_free(gr->pattern_pixels);
+  gr->pattern_pixels = NULL;
+
+  g_free( gr );
+}
+
+/**
+ * Set the gradient.
+ */
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_CairoGraphics2D_setGradient
+  (JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
+   jlong pointer,
+   jdouble x1, jdouble y1, 
+   jdouble x2, jdouble y2,
+   jint r1, jint g1, jint b1, jint a1,
+   jint r2, jint g2, jint b2, jint a2,
+   jboolean cyclic)
+{
+  struct cairographics2d *gr = NULL;
+  cairo_pattern_t* pattern;
+  cairo_extend_t extend;
+
+  gr = JLONG_TO_PTR(struct cairographics2d, pointer);
+  g_assert( gr != NULL );
+
+  pattern = cairo_pattern_create_linear(x1, y1, x2, y2);
+  g_assert( pattern != NULL );
+
+  cairo_pattern_add_color_stop_rgba(pattern, 0.0, r1 / 255.0, g1 / 255.0, 
+				    b1 / 255.0, a1 / 255.0);
+
+  cairo_pattern_add_color_stop_rgba(pattern, 1.0, r2 / 255.0, g2 / 255.0, 
+				    b2 / 255.0, a2 / 255.0);
+
+  extend = (cyclic == JNI_TRUE) ? CAIRO_EXTEND_REFLECT : CAIRO_EXTEND_NONE;
+
+  cairo_pattern_set_extend( pattern, extend );
+
+  gr->pattern = pattern;
+  cairo_set_source(gr->cr, gr->pattern);
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_CairoGraphics2D_setTexturePixels
+ (JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
+  jlong pointer, jintArray jarr, jint w, jint h, jint stride)
+{
+  struct cairographics2d *gr = NULL;
+  jint *jpixels = NULL;
+
+  gr = JLONG_TO_PTR(struct cairographics2d, pointer);
+  g_assert (gr != NULL);
+
+  if (gr->pattern)
+    cairo_pattern_destroy (gr->pattern);
+
+  if (gr->pattern_surface)
+    cairo_surface_destroy (gr->pattern_surface);
+
+  if (gr->pattern_pixels)
+    g_free (gr->pattern_pixels);
+
+  gr->pattern = NULL;
+  gr->pattern_surface = NULL;
+  gr->pattern_pixels = NULL;
+
+  gr->pattern_pixels = (char *) g_malloc (h * stride * 4);
+  g_assert (gr->pattern_pixels != NULL);
+
+  jpixels = (*env)->GetIntArrayElements (env, jarr, NULL);
+  g_assert (jpixels != NULL);
+  memcpy (gr->pattern_pixels, jpixels, h * stride * 4);
+  (*env)->ReleaseIntArrayElements (env, jarr, jpixels, 0);
+
+  gr->pattern_surface = cairo_image_surface_create_for_data ((unsigned char *)gr->pattern_pixels, 
+							CAIRO_FORMAT_ARGB32, 
+							w, h, stride * 4);
+  g_assert (gr->pattern_surface != NULL);
+  gr->pattern = cairo_pattern_create_for_surface (gr->pattern_surface);
+  g_assert (gr->pattern != NULL);
+  cairo_pattern_set_extend (gr->pattern, CAIRO_EXTEND_REPEAT);
+  cairo_set_source (gr->cr, gr->pattern);
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_CairoGraphics2D_drawPixels 
+(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
+ jlong pointer, jintArray java_pixels, 
+ jint w, jint h, jint stride, jdoubleArray java_matrix, jdouble alpha)
+{
+  jint *native_pixels = NULL;
+  jdouble *native_matrix = NULL;
+  struct cairographics2d *gr = JLONG_TO_PTR(struct cairographics2d, pointer);
+  g_assert (gr != NULL);
+
+  native_pixels = (*env)->GetIntArrayElements (env, java_pixels, NULL);
+  native_matrix = (*env)->GetDoubleArrayElements (env, java_matrix, NULL);
+  g_assert (native_pixels != NULL);
+  g_assert (native_matrix != NULL);
+  g_assert ((*env)->GetArrayLength (env, java_matrix) == 6);
+
+ {
+   cairo_matrix_t mat;
+   cairo_pattern_t *p;
+   cairo_surface_t *surf = cairo_image_surface_create_for_data ((unsigned char *)native_pixels, 
+							   CAIRO_FORMAT_ARGB32, 
+							   w, h, stride * 4);   
+   cairo_matrix_init_identity (&mat);
+   cairo_matrix_init (&mat, 
+                      native_matrix[0], native_matrix[1],
+                      native_matrix[2], native_matrix[3],
+                      native_matrix[4], native_matrix[5]);
+
+   p = cairo_pattern_create_for_surface (surf);
+   cairo_pattern_set_matrix (p, &mat);
+   if (gr->pattern)
+     cairo_pattern_set_filter (p, cairo_pattern_get_filter (gr->pattern));
+   cairo_set_source (gr->cr, p);
+   if (alpha == 1.)
+     cairo_paint (gr->cr);
+   else
+     cairo_paint_with_alpha(gr->cr, alpha);
+
+   cairo_pattern_destroy (p);
+   cairo_surface_destroy (surf);
+ }
+  
+ (*env)->ReleaseIntArrayElements (env, java_pixels, native_pixels, 0);
+ (*env)->ReleaseDoubleArrayElements (env, java_matrix, native_matrix, 0);
+}
+
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoSetMatrix
+(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
+ jlong pointer, jdoubleArray java_matrix)
+{
+  jdouble *native_matrix = NULL;
+  struct cairographics2d *gr = JLONG_TO_PTR(struct cairographics2d, pointer);
+  g_assert (gr != NULL);
+
+  native_matrix = (*env)->GetDoubleArrayElements (env, java_matrix, NULL);  
+  g_assert (native_matrix != NULL);
+  g_assert ((*env)->GetArrayLength (env, java_matrix) == 6);
+
+  {
+    cairo_matrix_t mat;
+
+    cairo_matrix_init_identity (&mat);
+    cairo_matrix_init (&mat, 
+                       native_matrix[0], native_matrix[1],
+                       native_matrix[2], native_matrix[3],
+                       native_matrix[4], native_matrix[5]);
+    g_assert (gr != NULL);
+    cairo_set_matrix (gr->cr, &mat);
+  }
+
+  (*env)->ReleaseDoubleArrayElements (env, java_matrix, native_matrix, 0);
+  update_pattern_transform (gr);
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoScale
+(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
+ jlong pointer, jdouble x, jdouble y)
+{
+  struct cairographics2d *gr = JLONG_TO_PTR(struct cairographics2d, pointer);
+  g_assert (gr != NULL);
+
+  cairo_scale (gr->cr, x, y);
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoDrawGlyphVector
+(JNIEnv *env, jobject obj __attribute__((unused)), jlong pointer,
+ jobject font,
+ jfloat x, jfloat y, jint n,
+ jintArray java_codes,
+ jfloatArray java_positions)
+{
+  
+  struct cairographics2d *gr = NULL;
+  struct peerfont *pfont = NULL;
+  cairo_glyph_t *glyphs = NULL;
+  int *native_codes;
+  float *native_positions;
+  jint i = 0;
+
+  g_assert (java_codes != NULL);
+  g_assert (java_positions != NULL);
+
+  gr = JLONG_TO_PTR(struct cairographics2d, pointer);
+  g_assert (gr != NULL);
+
+  pfont = (struct peerfont *)NSA_GET_FONT_PTR (env, font);
+  g_assert (pfont != NULL);
+
+  install_font_peer(gr->cr, pfont);
+
+  glyphs = g_malloc( sizeof(cairo_glyph_t) * n);
+  g_assert (glyphs != NULL);
+
+  native_codes = (*env)->GetIntArrayElements (env, java_codes, NULL);
+  native_positions = (*env)->GetFloatArrayElements (env, java_positions, NULL);
+  
+  for (i = 0; i < n; ++i)
+    {
+      glyphs[i].index = native_codes[i];
+      glyphs[i].x = x + native_positions[ 2*i ];
+      glyphs[i].y = y + native_positions[ 2*i + 1];
+    }
+
+  (*env)->ReleaseFloatArrayElements (env, java_positions, native_positions, 0);
+  (*env)->ReleaseIntArrayElements (env, java_codes, native_codes, 0);
+
+  pango_fc_font_lock_face( (PangoFcFont *)pfont->font );
+  cairo_show_glyphs (gr->cr, glyphs, n);
+  pango_fc_font_unlock_face( (PangoFcFont *)pfont->font );
+
+  g_free(glyphs);
+}
+
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoSetOperator 
+(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
+ jlong pointer, jint op)
+{
+  struct cairographics2d *gr = JLONG_TO_PTR(struct cairographics2d, pointer);
+  g_assert (gr != NULL);
+
+  switch ((enum java_awt_alpha_composite_rule) op)
+    {
+    case java_awt_alpha_composite_CLEAR: 
+      cairo_set_operator (gr->cr, CAIRO_OPERATOR_CLEAR);
+      break;
+      
+    case java_awt_alpha_composite_SRC: 
+      cairo_set_operator (gr->cr, CAIRO_OPERATOR_SOURCE);
+      break;
+      
+    case java_awt_alpha_composite_SRC_OVER: 
+      cairo_set_operator (gr->cr, CAIRO_OPERATOR_OVER);
+      break;
+
+    case java_awt_alpha_composite_DST_OVER: 
+      cairo_set_operator (gr->cr, CAIRO_OPERATOR_DEST_OVER);
+      break;
+
+    case java_awt_alpha_composite_SRC_IN: 
+      cairo_set_operator (gr->cr, CAIRO_OPERATOR_IN);
+      break;
+
+    case java_awt_alpha_composite_DST_IN: 
+      cairo_set_operator (gr->cr, CAIRO_OPERATOR_DEST_IN);
+      break;
+
+    case java_awt_alpha_composite_SRC_OUT: 
+      cairo_set_operator (gr->cr, CAIRO_OPERATOR_OUT);
+      break;
+
+    case java_awt_alpha_composite_DST_OUT: 
+      cairo_set_operator (gr->cr, CAIRO_OPERATOR_DEST_OUT);
+      break;
+
+    case java_awt_alpha_composite_DST: 
+      cairo_set_operator (gr->cr, CAIRO_OPERATOR_DEST);
+      break;
+
+    case java_awt_alpha_composite_SRC_ATOP: 
+      cairo_set_operator (gr->cr, CAIRO_OPERATOR_ATOP);
+      break;
+
+    case java_awt_alpha_composite_DST_ATOP: 
+      cairo_set_operator (gr->cr, CAIRO_OPERATOR_DEST_ATOP);
+      break;
+
+    case java_awt_alpha_composite_XOR: 
+      cairo_set_operator (gr->cr, CAIRO_OPERATOR_XOR);
+      break;
+    }
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoSetRGBAColor
+(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
+ jlong pointer, jdouble r, jdouble g, jdouble b, jdouble a)
+{
+  struct cairographics2d *gr = JLONG_TO_PTR(struct cairographics2d, pointer);
+  g_assert (gr != NULL);
+
+  cairo_set_source_rgba (gr->cr, r, g, b, a);
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoSetFillRule 
+(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
+ jlong pointer, jint rule)
+{
+  struct cairographics2d *gr = JLONG_TO_PTR(struct cairographics2d, pointer);
+  g_assert (gr != NULL);
+
+  switch ((enum java_awt_geom_path_iterator_winding_rule) rule)
+    {
+    case java_awt_geom_path_iterator_WIND_NON_ZERO:
+      cairo_set_fill_rule (gr->cr, CAIRO_FILL_RULE_WINDING);
+      break;
+    case java_awt_geom_path_iterator_WIND_EVEN_ODD:
+      cairo_set_fill_rule (gr->cr, CAIRO_FILL_RULE_EVEN_ODD);
+      break;
+    }
+}
+
+/**
+ * Set the line style, except for dashes.
+ */
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoSetLine
+(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
+ jlong pointer, jdouble width, int cap, int join, double miterLimit)
+{
+  struct cairographics2d *gr = JLONG_TO_PTR(struct cairographics2d, pointer);
+  g_assert (gr != NULL);
+
+  /* set width */
+  cairo_set_line_width (gr->cr, width);
+
+  /* set cap */
+  switch ((enum java_awt_basic_stroke_cap_rule) cap)
+    {
+    case java_awt_basic_stroke_CAP_BUTT: 
+      cairo_set_line_cap (gr->cr, CAIRO_LINE_CAP_BUTT);
+      break;
+
+    case java_awt_basic_stroke_CAP_ROUND: 
+      cairo_set_line_cap (gr->cr, CAIRO_LINE_CAP_ROUND);
+      break;
+
+    case java_awt_basic_stroke_CAP_SQUARE: 
+      cairo_set_line_cap (gr->cr, CAIRO_LINE_CAP_SQUARE);
+      break;
+    }
+
+  /* set join */
+  switch ((enum java_awt_basic_stroke_join_rule) join)
+    {
+    case java_awt_basic_stroke_JOIN_MITER:
+      cairo_set_line_join (gr->cr, CAIRO_LINE_JOIN_MITER);
+      break;
+
+    case java_awt_basic_stroke_JOIN_ROUND:
+      cairo_set_line_join (gr->cr, CAIRO_LINE_JOIN_ROUND);
+      break;
+
+    case java_awt_basic_stroke_JOIN_BEVEL:
+      cairo_set_line_join (gr->cr, CAIRO_LINE_JOIN_BEVEL);
+      break;
+    }
+
+  /* set miter */
+  cairo_set_miter_limit (gr->cr, miterLimit);
+}
+
+/**
+ * Set the line dashes
+ */ 
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoSetDash
+(JNIEnv *env, jobject obj __attribute__((unused)),
+ jlong pointer, jdoubleArray dashes, jint ndash, jdouble offset)
+{
+  jdouble *dasharr = NULL;
+  struct cairographics2d *gr = JLONG_TO_PTR(struct cairographics2d, pointer);
+  g_assert (gr != NULL);
+
+  dasharr = (*env)->GetDoubleArrayElements (env, dashes, NULL);  
+  g_assert (dasharr != NULL);
+
+  cairo_set_dash (gr->cr, dasharr, ndash, offset);
+
+  (*env)->ReleaseDoubleArrayElements (env, dashes, dasharr, 0);
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoSave
+(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
+ jlong pointer)
+{
+  struct cairographics2d *gr = JLONG_TO_PTR(struct cairographics2d, pointer);
+  g_assert (gr != NULL);
+
+  cairo_save (gr->cr);
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoRestore
+(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
+ jlong pointer)
+{
+  struct cairographics2d *gr = JLONG_TO_PTR(struct cairographics2d, pointer);
+  g_assert (gr != NULL);
+
+  cairo_restore (gr->cr);
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoNewPath 
+(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
+ jlong pointer)
+{
+  struct cairographics2d *gr = JLONG_TO_PTR(struct cairographics2d, pointer);
+  g_assert (gr != NULL);
+
+  cairo_new_path (gr->cr);
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoMoveTo 
+(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
+ jlong pointer, jdouble x, jdouble y)
+{
+  struct cairographics2d *gr = JLONG_TO_PTR(struct cairographics2d, pointer);
+  g_assert (gr != NULL);
+
+  cairo_move_to (gr->cr, x, y);
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoLineTo 
+(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
+ jlong pointer, jdouble x, jdouble y)
+{
+  struct cairographics2d *gr = JLONG_TO_PTR(struct cairographics2d, pointer);
+  g_assert (gr != NULL);
+
+  cairo_line_to (gr->cr, x, y);
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoCurveTo 
+(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
+ jlong pointer, jdouble x1, jdouble y1,
+ jdouble x2, jdouble y2, jdouble x3, jdouble y3)
+{
+  struct cairographics2d *gr = JLONG_TO_PTR(struct cairographics2d, pointer);
+  g_assert (gr != NULL);
+  cairo_curve_to (gr->cr, x1, y1, x2, y2, x3, y3);
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoRelMoveTo 
+(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
+ jlong pointer, jdouble dx, jdouble dy)
+{
+  struct cairographics2d *gr = JLONG_TO_PTR(struct cairographics2d, pointer);
+  g_assert (gr != NULL);
+
+  cairo_rel_move_to (gr->cr, dx, dy);
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoRelLineTo 
+(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
+ jlong pointer, jdouble dx, jdouble dy)
+{
+  struct cairographics2d *gr = JLONG_TO_PTR(struct cairographics2d, pointer);
+  g_assert (gr != NULL);
+
+  cairo_rel_line_to (gr->cr, dx, dy);
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoRelCurveTo 
+(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
+ jlong pointer, jdouble dx1, jdouble dy1,
+ jdouble dx2, jdouble dy2, jdouble dx3, jdouble dy3)
+{
+  struct cairographics2d *gr = JLONG_TO_PTR(struct cairographics2d, pointer);
+  g_assert (gr != NULL);
+
+  cairo_rel_curve_to (gr->cr, dx1, dy1, dx2, dy2, dx3, dy3);
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoRectangle 
+(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
+ jlong pointer, jdouble x, jdouble y, jdouble width, jdouble height)
+{
+  struct cairographics2d *gr = JLONG_TO_PTR(struct cairographics2d, pointer);
+
+  cairo_rectangle (gr->cr, x, y, width, height);
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoArc 
+(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
+ jlong pointer, jdouble x, jdouble y, jdouble radius, jdouble angle1,
+ jdouble angle2)
+{
+  struct cairographics2d *gr = JLONG_TO_PTR(struct cairographics2d, pointer);
+
+  cairo_arc (gr->cr, x, y, radius, angle1, angle2);
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoClosePath 
+(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
+ jlong pointer)
+{
+  struct cairographics2d *gr = JLONG_TO_PTR(struct cairographics2d, pointer);
+  g_assert (gr != NULL);
+
+  cairo_close_path (gr->cr);
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoStroke 
+(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
+ jlong pointer)
+{
+  struct cairographics2d *gr = JLONG_TO_PTR(struct cairographics2d, pointer);
+  g_assert (gr != NULL);
+
+  cairo_stroke (gr->cr);
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoFill 
+(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
+ jlong pointer, jdouble alpha)
+{
+  struct cairographics2d *gr = JLONG_TO_PTR(struct cairographics2d, pointer);
+  g_assert (gr != NULL);
+
+  if (alpha == 1.0)
+    cairo_fill (gr->cr);
+  else
+    {
+      cairo_save(gr->cr);
+      cairo_clip(gr->cr);
+      cairo_paint_with_alpha(gr->cr, alpha);
+      cairo_restore(gr->cr);
+    }
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoClip 
+(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
+ jlong pointer)
+{
+  struct cairographics2d *gr = JLONG_TO_PTR(struct cairographics2d, pointer);
+  g_assert( gr != NULL );
+
+  cairo_clip( gr->cr );
+}
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoResetClip 
+(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
+ jlong pointer)
+{
+  struct cairographics2d *gr = JLONG_TO_PTR(struct cairographics2d, pointer);
+  g_assert (gr != NULL);
+
+  cairo_reset_clip( gr->cr );
+}
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoPreserveClip 
+(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
+ jlong pointer)
+{
+  struct cairographics2d *gr = JLONG_TO_PTR(struct cairographics2d, pointer);
+  g_assert (gr != NULL);
+
+  cairo_clip_preserve( gr->cr );
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoSurfaceSetFilter
+(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
+ jlong pointer, jint filter)
+{
+  struct cairographics2d *gr = JLONG_TO_PTR(struct cairographics2d, pointer);
+  g_assert (gr != NULL);
+  
+  if (gr->pattern == NULL)
+    return;
+  
+  switch ((enum java_awt_rendering_hints_filter) filter)
+    {
+    case java_awt_rendering_hints_VALUE_INTERPOLATION_NEAREST_NEIGHBOR:
+      cairo_pattern_set_filter (gr->pattern, CAIRO_FILTER_NEAREST);
+      break;
+    case java_awt_rendering_hints_VALUE_INTERPOLATION_BILINEAR:
+      cairo_pattern_set_filter (gr->pattern, CAIRO_FILTER_BILINEAR);
+      break; 
+    case java_awt_rendering_hints_VALUE_ALPHA_INTERPOLATION_SPEED:
+      cairo_pattern_set_filter (gr->pattern, CAIRO_FILTER_FAST);
+      break;
+    case java_awt_rendering_hints_VALUE_ALPHA_INTERPOLATION_DEFAULT:
+      cairo_pattern_set_filter (gr->pattern, CAIRO_FILTER_NEAREST);
+      break;
+    case java_awt_rendering_hints_VALUE_ALPHA_INTERPOLATION_QUALITY:
+      cairo_pattern_set_filter (gr->pattern, CAIRO_FILTER_BEST);
+      break;
+    }
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoDrawLine
+(JNIEnv *env __attribute__ ((unused)), jobject obj __attribute__ ((unused)),
+ jlong pointer, jdouble x1, jdouble y1, jdouble x2, jdouble y2)
+{
+  struct cairographics2d *gr = JLONG_TO_PTR(struct cairographics2d, pointer);
+  g_assert (gr != NULL);
+
+  cairo_new_path(gr->cr);
+  cairo_move_to(gr->cr, x1, y1);
+  cairo_line_to(gr->cr, x2, y2);
+  cairo_stroke(gr->cr);
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoDrawRect
+(JNIEnv *env __attribute__ ((unused)), jobject obj __attribute__ ((unused)),
+ jlong pointer, jdouble x, jdouble y, jdouble w, jdouble h)
+{
+  struct cairographics2d *gr = JLONG_TO_PTR(struct cairographics2d, pointer);
+  g_assert (gr != NULL);
+
+  cairo_new_path(gr->cr);
+  cairo_rectangle(gr->cr, x, y, w, h);
+  cairo_stroke(gr->cr);
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoFillRect
+(JNIEnv *env __attribute__ ((unused)), jobject obj __attribute__ ((unused)),
+ jlong pointer, jdouble x, jdouble y, jdouble w, jdouble h)
+{
+  struct cairographics2d *gr = JLONG_TO_PTR(struct cairographics2d, pointer);
+  g_assert (gr != NULL);
+
+  cairo_new_path(gr->cr);
+  cairo_rectangle(gr->cr, x, y, w, h);
+  cairo_fill(gr->cr);
+}
+
+
+/************************** FONT STUFF ****************************/
+static void
+install_font_peer(cairo_t *cr,
+		  struct peerfont *pfont)
+{
+  cairo_font_face_t *ft;
+  FT_Face face = NULL;
+
+  g_assert(cr != NULL);
+  g_assert(pfont != NULL);
+
+  if (pfont->graphics_resource == NULL)
+    {
+      face = pango_fc_font_lock_face( (PangoFcFont *)pfont->font );
+      g_assert (face != NULL);
+
+      ft = cairo_ft_font_face_create_for_ft_face (face, 0);
+      g_assert (ft != NULL);
+
+      cairo_set_font_face (cr, ft);
+      /*      cairo_font_face_destroy (ft);*/
+      cairo_set_font_size (cr,
+                           (pango_font_description_get_size (pfont->desc) /
+                            (double)PANGO_SCALE));
+      ft = cairo_get_font_face (cr);
+      pango_fc_font_unlock_face( (PangoFcFont *)pfont->font );
+      pfont->graphics_resource = ft;
+    }
+  else
+    {
+      ft = (cairo_font_face_t *) pfont->graphics_resource;
+      cairo_set_font_face (cr, ft);
+      cairo_set_font_size (cr,
+                           (pango_font_description_get_size (pfont->desc) /
+                            (double)PANGO_SCALE));
+    }
+}
+
+static void 
+update_pattern_transform (struct cairographics2d *gr)
+{
+  cairo_matrix_t mat;
+
+  g_assert (gr != NULL);
+  if (gr->pattern == NULL)
+    return;
+
+  cairo_get_matrix (gr->cr, &mat);
+  cairo_pattern_set_matrix (gr->pattern, &mat);
+}
+

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_CairoSurface.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_CairoSurface.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_CairoSurface.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_CairoSurface.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,306 @@
+/* gnu_java_awt_peer_gtk_CairoSurface.c
+   Copyright (C)  2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#include "jcl.h"
+#include "gtkpeer.h"
+#include <cairo-xlib.h>
+#include <gdk/gdkx.h>
+
+#include "gnu_java_awt_peer_gtk_CairoSurface.h"
+#include "cairographics2d.h"
+
+/**
+ * Field names in CairoSurface.java
+ */
+#define SURFACE "surfacePointer"
+#define BUFFER "bufferPointer"
+
+/* prototypes */
+static void setNativeObject( JNIEnv *env, jobject obj, void *ptr, const char *pointer );
+
+/**
+ * Creates a cairo surface, ARGB32, native ordering, premultiplied alpha.
+ */
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_CairoSurface_create (JNIEnv *env, jobject obj, jint width, jint height, jint stride)
+{
+  cairo_surface_t* surface;
+  void *data = g_malloc(stride * height * 4);
+  memset(data, 0, stride * height * 4);
+  setNativeObject(env, obj, data, BUFFER);
+
+  surface = cairo_image_surface_create_for_data
+    (data, CAIRO_FORMAT_ARGB32, width, height, stride * 4);
+
+  setNativeObject(env, obj, surface, SURFACE);
+}
+
+/**
+ * Destroy the surface
+ */
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_CairoSurface_destroy
+(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
+ jlong surfacePointer, jlong bufferPointer)
+{
+  void *buffer;
+  cairo_surface_t* surface = JLONG_TO_PTR(void, surfacePointer);
+  if( surface != NULL )
+    cairo_surface_destroy(surface);
+
+  buffer = JLONG_TO_PTR(void, bufferPointer);
+  if( buffer != NULL )
+    g_free(buffer);
+}
+
+/**
+ * Gets a pixel
+ */
+JNIEXPORT jint JNICALL 
+Java_gnu_java_awt_peer_gtk_CairoSurface_nativeGetElem
+(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
+ jlong bufferPointer, jint i)
+{
+  jint *pixeldata = JLONG_TO_PTR(void, bufferPointer);
+
+  if( pixeldata == NULL )
+    return 0;
+
+  return pixeldata[i];
+}
+
+/**
+ * Sets a pixel
+ */
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_CairoSurface_nativeSetElem 
+(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
+ jlong bufferPointer, jint i, jint val)
+{
+  jint *pixeldata = JLONG_TO_PTR(void, bufferPointer);
+
+  if( pixeldata == NULL )
+    return;
+
+  pixeldata[i] = val;
+}
+
+/**
+ * Gets all pixels in an array
+ */
+JNIEXPORT jintArray JNICALL 
+Java_gnu_java_awt_peer_gtk_CairoSurface_nativeGetPixels
+(JNIEnv *env __attribute((unused)), jobject obj __attribute((unused)),
+ jlong bufferPointer, int size)
+{
+  jint *pixeldata, *jpixdata;
+  jintArray jpixels;
+
+  pixeldata = JLONG_TO_PTR(void, bufferPointer);
+  g_assert(pixeldata != NULL);
+
+  jpixels = (*env)->NewIntArray (env, size);
+  jpixdata = (*env)->GetIntArrayElements (env, jpixels, NULL);
+  memcpy (jpixdata, pixeldata, size * sizeof( jint ));
+
+  (*env)->ReleaseIntArrayElements (env, jpixels, jpixdata, 0);
+  return jpixels;
+}
+
+/**
+ * Sets all pixels by an array.
+ */
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_CairoSurface_nativeSetPixels
+(JNIEnv *env, jobject obj, jlong bufferPointer, jintArray jpixels)
+{
+  jint *pixeldata, *jpixdata;
+  int size;
+  int width, height;
+  jclass cls;
+  jfieldID field;
+
+  if( jpixels == NULL )
+    return;
+
+  cls = (*env)->GetObjectClass (env, obj);
+  field = (*env)->GetFieldID (env, cls, "width", "I");
+  g_assert (field != 0);
+  width = (*env)->GetIntField (env, obj, field);
+
+  field = (*env)->GetFieldID (env, cls, "height", "I");
+  g_assert (field != 0);
+  height = (*env)->GetIntField (env, obj, field);
+
+  pixeldata = JLONG_TO_PTR(void, bufferPointer);
+  g_assert(pixeldata != NULL);
+  
+  jpixdata = (*env)->GetIntArrayElements (env, jpixels, NULL);
+  size = (*env)->GetArrayLength( env, jpixels );
+  if( size > width * height ) size = width * height; /* stop overflows. */
+  
+  memcpy (pixeldata, jpixdata, size * sizeof( jint ));
+
+  (*env)->ReleaseIntArrayElements (env, jpixels, jpixdata, 0);
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_CairoSurface_nativeDrawSurface 
+(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
+ jlong surfacePointer, jlong context, jdoubleArray java_matrix, double alpha)
+{
+  struct cairographics2d *gr = JLONG_TO_PTR(struct cairographics2d, context);
+  cairo_t *cr = gr->cr;
+  jdouble *native_matrix = NULL;
+  cairo_surface_t* surface = JLONG_TO_PTR(void, surfacePointer);
+  g_assert(surface != NULL);
+  g_assert(cr != NULL);
+
+  native_matrix = (*env)->GetDoubleArrayElements (env, java_matrix, NULL);
+  g_assert (native_matrix != NULL);
+  g_assert ((*env)->GetArrayLength (env, java_matrix) == 6);
+
+ {
+   cairo_matrix_t mat;
+   cairo_pattern_t *p;
+   cairo_matrix_init_identity (&mat);
+   cairo_matrix_init (&mat, 
+                      native_matrix[0], native_matrix[1],
+                      native_matrix[2], native_matrix[3],
+                      native_matrix[4], native_matrix[5]);
+
+   p = cairo_pattern_create_for_surface (surface);
+   cairo_pattern_set_matrix (p, &mat);
+
+   cairo_set_source(cr, p);
+   if (alpha == 1.0)
+     cairo_paint(cr);
+   else
+     cairo_paint_with_alpha(cr, alpha);
+
+   cairo_pattern_destroy(p);
+ }
+  
+ (*env)->ReleaseDoubleArrayElements (env, java_matrix, native_matrix, 0);
+}
+
+JNIEXPORT jlong JNICALL 
+Java_gnu_java_awt_peer_gtk_CairoSurface_getFlippedBuffer 
+(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
+ jlong bufferPointer, jint size)
+{
+  jint *dst;
+  jint *src = JLONG_TO_PTR(void, bufferPointer);
+  int i;
+  int t;
+
+  g_assert( src != NULL );
+  dst = g_malloc( size * sizeof( jint ) );
+
+  for(i = 0; i < size; i++ )
+    {
+      t = (src[i] & 0x0000FF) << 16;
+      dst[i] = (src[i] & 0x00FF0000) >> 16;
+      dst[i] |= (src[i] & 0xFF00FF00);
+      dst[i] |= t;
+    }
+
+  return PTR_TO_JLONG(dst);
+}
+
+/**
+ * Create and return a cairo context for drawing to the surface.
+ */
+JNIEXPORT jlong JNICALL 
+Java_gnu_java_awt_peer_gtk_CairoSurface_nativeNewCairoContext
+(JNIEnv *env __attribute((unused)), jobject obj __attribute((unused)),
+ jlong surfacePointer)
+{
+  cairo_surface_t* surface = JLONG_TO_PTR(cairo_surface_t, surfacePointer);
+  cairo_t *ptr;
+  g_assert(surface != NULL);
+  ptr = cairo_create(surface);
+  g_assert(ptr != NULL);
+
+  return PTR_TO_JLONG(ptr);
+}
+
+/**
+ * copyArea.
+ */
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_CairoSurface_copyAreaNative2
+(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
+ jlong bufferPointer,
+ jint x, jint y, jint w, jint h, jint dx, jint dy, jint stride)
+{
+  int row;
+  int srcOffset, dstOffset;
+  jint *temp;
+  jint *pixeldata = JLONG_TO_PTR(jint, bufferPointer);
+  g_assert( pixeldata != NULL );
+
+  temp = g_malloc( h * w * 4 );
+  g_assert( temp != NULL );
+
+  srcOffset = x + (y * stride);
+  dstOffset = (x + dx) + ((y + dy) * stride);
+
+  for( row = 0; row < h; row++ )
+    memcpy( temp + (w * row), pixeldata + srcOffset + (stride * row), w * 4 );
+
+  for( row = 0; row < h; row++ )
+    memcpy( pixeldata + dstOffset + (stride * row), temp + (w * row), w * 4 );
+
+  g_free( temp );
+}
+
+/*
+ * Sets the native object field.
+ */
+static void 
+setNativeObject( JNIEnv *env, jobject obj, void *ptr, const char *pointer )
+{   
+  jclass cls;
+  jlong value;
+  jfieldID nofid;
+  cls = (*env)->GetObjectClass( env, obj );
+  value = PTR_TO_JLONG(ptr); 
+  nofid = (*env)->GetFieldID( env, cls, pointer, "J" );
+  (*env)->SetLongField( env, obj, nofid, value );
+  (*env)->DeleteLocalRef( env, cls );
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_ComponentGraphics.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_ComponentGraphics.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_ComponentGraphics.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_ComponentGraphics.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,355 @@
+/* gnu_java_awt_peer_gtk_ComponentGraphics.c
+   Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#include "jcl.h"
+#include "gtkpeer.h"
+#include <cairo-xlib.h>
+#include <gdk/gdktypes.h>
+#include <gdk/gdkprivate.h>
+#include <gdk/gdkx.h>
+#include <X11/extensions/Xrender.h>
+
+#include <gdk-pixbuf/gdk-pixbuf.h>
+#include <gdk-pixbuf/gdk-pixdata.h>
+
+#include <cairo-ft.h>
+#include <cairo-xlib.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "gnu_java_awt_peer_gtk_ComponentGraphics.h"
+
+#include "cairographics2d.h"
+
+static short flush_scheduled = 0;
+
+static gboolean flush (gpointer data __attribute__((unused)))
+{
+  gdk_threads_enter ();
+
+  XFlush (GDK_DISPLAY ());
+  flush_scheduled = 0;
+
+  gdk_threads_leave ();
+
+  return FALSE;
+}
+
+/* The minimum time period between calls to XFlush, in
+   milliseconds. */
+#define MINIMUM_FLUSH_PERIOD 20
+
+/* schedule_flush must be called with the GDK lock held. */
+static void
+schedule_flush ()
+{
+  if (!flush_scheduled)
+    {
+      g_timeout_add (MINIMUM_FLUSH_PERIOD, flush, NULL);
+      flush_scheduled = 1;
+    }
+}
+
+void cp_gtk_grab_current_drawable(GtkWidget *widget, GdkDrawable **draw,
+				  GdkWindow **win)
+{
+  g_assert (widget != NULL);
+  g_assert (draw != NULL);
+  g_assert (win != NULL);
+
+  *win = widget->window;
+
+  *draw = *win;
+  gdk_window_get_internal_paint_info (*win, draw, 0, 0); 
+}
+
+/**
+ * Returns whether the XRender extension is supported
+ */
+JNIEXPORT jboolean JNICALL 
+Java_gnu_java_awt_peer_gtk_ComponentGraphics_hasXRender
+  (JNIEnv *env __attribute__ ((unused)), jclass cls __attribute__ ((unused)))
+{
+#if HAVE_XRENDER
+  int ev = 0, err = 0; 
+  if( XRenderQueryExtension (GDK_DISPLAY (), &ev, &err) )
+    return JNI_TRUE;
+#endif
+  return JNI_FALSE;
+}
+
+
+JNIEXPORT jlong JNICALL 
+Java_gnu_java_awt_peer_gtk_ComponentGraphics_initState
+  (JNIEnv *env, jobject obj __attribute__ ((unused)), jobject peer)
+{
+  Drawable draw;
+  Display * dpy;
+  Visual * vis;
+  GdkDrawable *drawable;
+  cairo_surface_t *surface;
+  GdkWindow *win;
+  GtkWidget *widget = NULL;
+  void *ptr = NULL;
+  int width, height;
+  cairo_t *cr;
+
+  gdk_threads_enter();
+
+  ptr = NSA_GET_PTR (env, peer);
+  g_assert (ptr != NULL);
+
+  widget = GTK_WIDGET (ptr);
+  g_assert (widget != NULL);
+
+  cp_gtk_grab_current_drawable (widget, &drawable, &win);
+  g_assert (drawable != NULL);
+
+  width = widget->allocation.width;
+  height = widget->allocation.height;
+
+  g_assert (drawable != NULL);
+
+  draw = gdk_x11_drawable_get_xid(drawable);
+  g_assert (draw != (XID) 0);
+  
+  dpy = gdk_x11_drawable_get_xdisplay(drawable);
+  g_assert (dpy != NULL);
+  
+  vis = gdk_x11_visual_get_xvisual(gdk_drawable_get_visual(drawable));
+  g_assert (vis != NULL);
+  
+  surface = cairo_xlib_surface_create (dpy, draw, vis, width, height);
+  g_assert (surface != NULL);
+
+  cr = cairo_create (surface);
+  g_assert(cr != NULL);
+
+  gdk_threads_leave();
+
+  return PTR_TO_JLONG(cr);
+}
+
+/**
+ * Disposes of the surface
+ */
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_ComponentGraphics_disposeSurface
+  (JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
+   jlong value)
+{
+  struct cairographics2d *gr;
+  cairo_surface_t *surface;
+
+  gr = JLONG_TO_PTR(struct cairographics2d, value);
+
+  if (gr == NULL)
+    return;
+
+  if (gr->cr == NULL)
+    return;
+
+  surface = cairo_get_target (gr->cr);
+  if (surface != NULL)
+    {
+      gdk_threads_enter();
+      cairo_surface_destroy (surface);
+      gdk_threads_leave();
+    }
+}
+
+JNIEXPORT jlong JNICALL 
+Java_gnu_java_awt_peer_gtk_ComponentGraphics_initFromVolatile
+  (JNIEnv *env  __attribute__ ((unused)), jobject obj __attribute__ ((unused)),
+   jlong ptr, jint width, jint height)
+{
+  Drawable draw;
+  Display * dpy;
+  Visual * vis;
+  GdkDrawable *drawable;
+  cairo_surface_t *surface;
+  cairo_t *cr;
+
+  gdk_threads_enter();
+
+  drawable = JLONG_TO_PTR(GdkDrawable, ptr);
+  g_assert (drawable != NULL);
+
+  draw = gdk_x11_drawable_get_xid(drawable);
+  g_assert (draw != (XID) 0);
+  
+  dpy = gdk_x11_drawable_get_xdisplay(drawable);
+  g_assert (dpy != NULL);
+  
+  vis = gdk_x11_visual_get_xvisual(gdk_drawable_get_visual(drawable));
+  g_assert (vis != NULL);
+  
+  surface = cairo_xlib_surface_create (dpy, draw, vis, width, height);
+  g_assert (surface != NULL);
+
+  cr = cairo_create (surface);
+  g_assert(cr != NULL);
+
+  gdk_threads_leave();
+
+  return PTR_TO_JLONG(cr);
+}
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_ComponentGraphics_start_1gdk_1drawing
+  (JNIEnv *env __attribute__ ((unused)), jobject obj __attribute__ ((unused)))
+{
+  gdk_threads_enter();
+}
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_ComponentGraphics_end_1gdk_1drawing
+  (JNIEnv *env __attribute__ ((unused)), jobject obj __attribute__ ((unused)))
+{
+  schedule_flush ();
+  gdk_threads_leave();
+}
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_ComponentGraphics_copyAreaNative
+  (JNIEnv *env, jobject obj __attribute__((unused)), jobject peer,
+   jint x, jint y, jint w, jint h, jint dx, jint dy)
+{
+  GdkPixbuf *pixbuf;
+  GdkDrawable *drawable;
+  GdkWindow *win;
+  GtkWidget *widget = NULL;
+  void *ptr = NULL;
+
+  gdk_threads_enter();
+
+  ptr = NSA_GET_PTR (env, peer);
+  g_assert (ptr != NULL);
+
+  widget = GTK_WIDGET (ptr);
+  g_assert (widget != NULL);
+
+  cp_gtk_grab_current_drawable (widget, &drawable, &win);
+  g_assert (drawable != NULL);
+
+  pixbuf = gdk_pixbuf_new( GDK_COLORSPACE_RGB, TRUE, 8, w, h );
+  gdk_pixbuf_get_from_drawable( pixbuf, drawable, NULL, x, y, 0, 0, w, h );
+  gdk_draw_pixbuf (drawable, NULL, pixbuf,
+		   0, 0, x + dx, y + dy, 
+		   w, h, 
+		   GDK_RGB_DITHER_NORMAL, 0, 0);
+  gdk_threads_leave();
+}
+
+JNIEXPORT jobject JNICALL 
+Java_gnu_java_awt_peer_gtk_ComponentGraphics_nativeGrab
+(JNIEnv *env, jclass cls __attribute__((unused)), jobject peer )
+{
+  GdkPixbuf *pixbuf;
+  GdkDrawable *drawable;
+  GdkWindow *win;
+  gint w,h;
+  GtkWidget *widget = NULL;
+  void *ptr = NULL;
+  
+  gdk_threads_enter();
+
+  ptr = NSA_GET_PTR (env, peer);
+  g_assert (ptr != NULL);
+
+  widget = GTK_WIDGET (ptr);
+  g_assert (widget != NULL);
+
+  cp_gtk_grab_current_drawable (widget, &drawable, &win);
+  g_assert (drawable != NULL);
+
+  gdk_drawable_get_size ( drawable, &w, &h );
+
+  pixbuf = gdk_pixbuf_new( GDK_COLORSPACE_RGB, TRUE, 8, w, h );
+  gdk_pixbuf_get_from_drawable( pixbuf, drawable, NULL, 0, 0, 0, 0, w, h );
+  g_object_ref( pixbuf );
+  gdk_draw_pixbuf (drawable, NULL, pixbuf,
+		   0, 0, 0, 0, 
+		   w, h, 
+		   GDK_RGB_DITHER_NORMAL, 0, 0);
+  gdk_threads_leave();
+
+  return JCL_NewRawDataObject (env, pixbuf);
+}
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_ComponentGraphics_drawVolatile
+(JNIEnv *env, jobject obj __attribute__ ((unused)), jobject peer, 
+ jlong img, jint x, jint y, jint w, jint h, jint cx, jint cy, jint cw, jint ch)
+{
+  GdkPixmap *pixmap;
+  GtkWidget *widget = NULL;
+  void *ptr = NULL;
+  GdkGC *gc;
+  GdkRectangle clip;
+
+  gdk_threads_enter();
+  ptr = NSA_GET_PTR (env, peer);
+  g_assert (ptr != NULL);
+
+  widget = GTK_WIDGET (ptr);
+  g_assert (widget != NULL);
+
+  pixmap = JLONG_TO_PTR(GdkPixmap, img);
+ 
+  gc = gdk_gc_new(widget->window);
+
+  clip.x = cx;
+  clip.y = cy;
+  clip.width = cw;
+  clip.height = ch;
+  gdk_gc_set_clip_rectangle(gc, &clip);
+
+  gdk_draw_drawable(widget->window,
+		    gc,
+		    pixmap,
+		    0, 0,
+		    x, y,
+		    w, h);
+
+  g_object_unref( gc );
+
+  schedule_flush ();
+
+  gdk_threads_leave();
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_ComponentGraphicsCopy.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_ComponentGraphicsCopy.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_ComponentGraphicsCopy.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_ComponentGraphicsCopy.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,132 @@
+/* gnu_java_awt_peer_gtk_ComponentGraphicsCopy.c
+   Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#include "jcl.h"
+#include "gtkpeer.h"
+#include <cairo-xlib.h>
+#include <gdk/gdktypes.h>
+#include <gdk/gdkprivate.h>
+#include <gdk/gdkx.h>
+
+#include <gdk-pixbuf/gdk-pixbuf.h>
+#include <gdk-pixbuf/gdk-pixdata.h>
+
+#include <cairo-ft.h>
+#include <cairo-xlib.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "gnu_java_awt_peer_gtk_ComponentGraphicsCopy.h"
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_ComponentGraphicsCopy_getPixbuf
+   (JNIEnv *env, jobject obj __attribute__((unused)),
+    jobject peer, jobject image)
+{
+  gint width, height;
+  GdkPixbuf *pixbuf;
+  GdkDrawable *drawable;
+  GdkWindow *win;
+  GtkWidget *widget = NULL;
+  void *ptr = NULL;
+
+  gdk_threads_enter();
+
+  ptr = NSA_GET_PTR (env, peer);
+  g_assert (ptr != NULL);
+
+  widget = GTK_WIDGET (ptr);
+  g_assert (widget != NULL);
+
+  cp_gtk_grab_current_drawable (widget, &drawable, &win);
+  g_assert (drawable != NULL);
+
+  pixbuf = cp_gtk_image_get_pixbuf( env, image );
+  g_assert( pixbuf != NULL);
+
+  width = gdk_pixbuf_get_width( pixbuf );
+  height = gdk_pixbuf_get_height( pixbuf );
+
+  gdk_pixbuf_get_from_drawable( pixbuf, /* destination pixbuf */
+				drawable, 
+				NULL, /* colormap */
+				0, 0, 0, 0,
+				width, height );
+  gdk_threads_leave();
+}
+
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_ComponentGraphicsCopy_copyPixbuf
+  (JNIEnv *env, jobject obj __attribute__((unused)),
+   jobject peer, jobject image,
+   int x __attribute__((unused)), int y __attribute__((unused)),
+   int width __attribute__((unused)), int height __attribute__((unused)))
+{
+  gint pwidth, pheight;
+  GdkPixbuf *pixbuf;
+  GdkDrawable *drawable;
+  GdkWindow *win;
+  GtkWidget *widget = NULL;
+  void *ptr = NULL;
+
+  gdk_threads_enter();
+
+  ptr = NSA_GET_PTR (env, peer);
+  g_assert (ptr != NULL);
+
+  widget = GTK_WIDGET (ptr);
+  g_assert (widget != NULL);
+
+  cp_gtk_grab_current_drawable (widget, &drawable, &win);
+  g_assert (drawable != NULL);
+
+  pixbuf = cp_gtk_image_get_pixbuf( env, image );
+  g_assert( pixbuf != NULL);
+
+  pwidth = gdk_pixbuf_get_width( pixbuf );
+  pheight = gdk_pixbuf_get_height( pixbuf );
+
+  gdk_draw_pixbuf (drawable, NULL, pixbuf,
+		   0, 0, 0, 0, 
+		   pwidth, pheight, 
+		   GDK_RGB_DITHER_NORMAL, 0, 0);
+
+  gdk_threads_leave();
+}
+

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_FreetypeGlyphVector.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_FreetypeGlyphVector.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_FreetypeGlyphVector.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_FreetypeGlyphVector.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,348 @@
+/* gnu_java_awt_FreetypeGlyphVector.c
+   Copyright (C) 2006  Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#include <jni.h>
+#include <gtk/gtk.h>
+#include <string.h>
+#include <pango/pango.h>
+#include <pango/pangoft2.h>
+#include <pango/pangofc-font.h>
+#include <freetype/ftglyph.h>
+#include <freetype/ftoutln.h>
+#include "native_state.h"
+#include "gdkfont.h"
+#include "gnu_java_awt_peer_gtk_FreetypeGlyphVector.h"
+#include "cairographics2d.h"
+
+typedef struct gp
+{
+  JNIEnv *env;
+  jobject obj;
+  double px;
+  double py;
+  double sx;
+  double sy;
+} generalpath ;
+
+static PangoFcFont *
+getFont(JNIEnv *env, jobject obj)
+{
+  jfieldID fid;
+  jobject data;
+  jclass cls;
+  struct peerfont *pfont;
+
+  cls = (*env)->GetObjectClass (env, obj);
+  fid = (*env)->GetFieldID (env, cls, "peer", 
+				 "Lgnu/java/awt/peer/gtk/GdkFontPeer;");
+  g_assert (fid != 0);
+
+  data = (*env)->GetObjectField (env, obj, fid);
+  g_assert (data != NULL);
+
+  pfont = (struct peerfont *)NSA_GET_FONT_PTR (env, data);
+  g_assert (pfont != NULL);
+  g_assert (pfont->font != NULL);
+
+  return (PangoFcFont *)pfont->font;
+}
+
+JNIEXPORT jintArray JNICALL 
+Java_gnu_java_awt_peer_gtk_FreetypeGlyphVector_getGlyphs
+  (JNIEnv *env, jobject obj, jintArray codepoints)
+{
+  FT_Face ft_face;
+  jintArray retArray;
+  PangoFcFont *font;
+  jint *values, *cpvals;
+  jint length;
+  int i;
+
+  font = getFont(env, obj);
+
+  ft_face = pango_fc_font_lock_face( font );
+  g_assert (ft_face != NULL);
+
+  length = (*env)->GetArrayLength (env, codepoints);
+  cpvals = (*env)->GetIntArrayElements (env, codepoints, NULL);
+
+  retArray = (*env)->NewIntArray (env, length);
+  values = (*env)->GetIntArrayElements (env, retArray, NULL);
+
+  for( i = 0; i < length; i++ )
+    values[i] = FT_Get_Char_Index( ft_face, cpvals[i] );
+
+  (*env)->ReleaseIntArrayElements (env, retArray, values, 0);
+  (*env)->ReleaseIntArrayElements (env, codepoints, cpvals, 0);
+
+  pango_fc_font_unlock_face (font);
+
+  return retArray;
+}
+
+JNIEXPORT jobject JNICALL 
+Java_gnu_java_awt_peer_gtk_FreetypeGlyphVector_getKerning
+(JNIEnv *env, jobject obj, jint rightGlyph, jint leftGlyph)
+{
+  FT_Face ft_face;
+  FT_Vector kern;
+  jclass cls;
+  jmethodID method;
+  jvalue values[2];
+  PangoFcFont *font;
+
+  font = getFont(env, obj);
+  ft_face = pango_fc_font_lock_face( font );
+  g_assert (ft_face != NULL);
+  FT_Get_Kerning( ft_face, rightGlyph, leftGlyph, FT_KERNING_DEFAULT, &kern );
+
+  pango_fc_font_unlock_face( font );
+
+  values[0].d = (jdouble)kern.x/64.0;
+  values[1].d = (jdouble)kern.y/64.0;
+
+  cls = (*env)->FindClass (env, "java/awt/geom/Point2D$Double");
+  method = (*env)->GetMethodID (env, cls, "<init>", "(DD)V");
+  return (*env)->NewObjectA(env, cls, method, values);
+}
+
+JNIEXPORT jdoubleArray JNICALL 
+Java_gnu_java_awt_peer_gtk_FreetypeGlyphVector_getMetricsNative
+(JNIEnv *env, jobject obj, jint glyphIndex )
+{
+  FT_Face ft_face;
+  jdouble *values;
+  jdoubleArray retArray = NULL;
+  PangoFcFont *font;
+
+  font = getFont(env, obj);
+  ft_face = pango_fc_font_lock_face( font );
+
+  g_assert (ft_face != NULL);
+
+  FT_Set_Transform( ft_face, NULL, NULL );
+
+  if( FT_Load_Glyph( ft_face, glyphIndex, FT_LOAD_NO_BITMAP ) != 0 )
+    {
+      pango_fc_font_unlock_face( font );
+      printf("Couldn't load glyph %i\n", glyphIndex);
+      return NULL;
+    }
+
+  retArray = (*env)->NewDoubleArray (env, 8);
+  values = (*env)->GetDoubleArrayElements (env, retArray, NULL);
+
+  values[0] = 0;
+  values[1] = (jdouble)ft_face->glyph->advance.x/64.0;
+  values[2] = (jdouble)ft_face->glyph->advance.y/64.0;
+  values[3] = (jdouble)ft_face->glyph->metrics.horiBearingX/64.0;
+  values[4] = -(jdouble)ft_face->glyph->metrics.horiBearingY/64.0;
+  values[5] = (jdouble)ft_face->glyph->metrics.width/64.0;
+  values[6] = (jdouble)ft_face->glyph->metrics.height/64.0;
+  values[7] = 0;
+
+  (*env)->ReleaseDoubleArrayElements (env, retArray, values, 0);
+  pango_fc_font_unlock_face( font );
+
+  return retArray;
+}
+
+/* GetOutline code follows ****************************/
+/********* Freetype callback functions *****************************/
+
+static int _moveTo( const FT_Vector* to,
+		    void *p)
+{
+  JNIEnv *env;
+  jobject obj;
+  jclass cls;
+  jmethodID method;
+  jvalue values[2];
+  generalpath *path = (generalpath *) p;
+
+  env = path->env;
+  obj = path->obj;
+
+  values[0].f = (jfloat)(to->x * path->sx + path->px);
+  values[1].f = (jfloat)(to->y * path->sy + path->py);
+
+  cls = (*env)->FindClass (env, "java/awt/geom/GeneralPath");
+  method = (*env)->GetMethodID (env, cls, "moveTo", "(FF)V");
+  (*env)->CallVoidMethodA(env, obj, method, values );
+
+  return 0;
+}
+
+static int _lineTo( const FT_Vector*  to,
+		    void *p)
+{
+  JNIEnv *env;
+  jobject obj;
+  jclass cls;
+  jmethodID method;
+  jvalue values[2];
+  generalpath *path = (generalpath *) p;
+
+  env = path->env;
+  obj = path->obj; 
+  values[0].f = (jfloat)(to->x * path->sx + path->px);
+  values[1].f = (jfloat)(to->y * path->sy + path->py);
+
+  cls = (*env)->FindClass (env, "java/awt/geom/GeneralPath");
+  method = (*env)->GetMethodID (env, cls, "lineTo", "(FF)V");
+  (*env)->CallVoidMethodA(env, obj, method, values );
+
+  return 0;
+}
+
+static int _quadTo( const FT_Vector*  cp,
+		    const FT_Vector*  to,
+		    void *p)
+{
+  JNIEnv *env;
+  jobject obj;
+  jclass cls;
+  jmethodID method;
+  jvalue values[4];
+  generalpath *path = (generalpath *) p;
+
+  env = path->env;
+  obj = path->obj;
+  values[0].f = (jfloat)(cp->x * path->sx + path->px);
+  values[1].f = (jfloat)(cp->y * path->sy + path->py);
+  values[2].f = (jfloat)(to->x * path->sx + path->px);
+  values[3].f = (jfloat)(to->y * path->sy + path->py);
+
+  cls = (*env)->FindClass (env, "java/awt/geom/GeneralPath");
+  method = (*env)->GetMethodID (env, cls, "quadTo", "(FFFF)V");
+  (*env)->CallVoidMethodA(env, obj, method, values );
+
+  return 0;
+}
+
+static int _curveTo( const FT_Vector*  cp1,
+		     const FT_Vector*  cp2,
+		     const FT_Vector*  to,
+		     void *p)
+{
+  JNIEnv *env;
+  jobject obj;
+  jclass cls;
+  jmethodID method;
+  jvalue values[6];
+  generalpath *path = (generalpath *) p;
+
+  env = path->env;
+  obj = path->obj;
+  values[0].f = (jfloat)(cp1->x * path->sx + path->px);
+  values[1].f = (jfloat)(cp1->y * path->sy + path->py);
+  values[2].f = (jfloat)(cp2->x * path->sx + path->px);
+  values[3].f = (jfloat)(cp2->y * path->sy + path->py);
+  values[4].f = (jfloat)(to->x * path->sx + path->px);
+  values[5].f = (jfloat)(to->y * path->sy + path->py);
+
+  cls = (*env)->FindClass (env, "java/awt/geom/GeneralPath");
+  method = (*env)->GetMethodID (env, cls, "curveTo", "(FFFFFF)V");
+  (*env)->CallVoidMethodA(env, obj, method, values );
+
+  return 0;
+}
+
+
+JNIEXPORT jobject JNICALL 
+Java_gnu_java_awt_peer_gtk_FreetypeGlyphVector_getGlyphOutlineNative
+ (JNIEnv *env, jobject obj, jint glyphIndex)
+{
+  generalpath *path;
+  jobject gp;
+  FT_Outline_Funcs ftCallbacks =
+    {
+      (FT_Outline_MoveToFunc) _moveTo,
+      (FT_Outline_LineToFunc) _lineTo,
+      (FT_Outline_ConicToFunc) _quadTo,
+      (FT_Outline_CubicToFunc) _curveTo,
+      0,
+      0
+    };
+  PangoFcFont *font;
+  FT_Face ft_face;
+  FT_Glyph glyph;
+
+  font = getFont(env, obj);
+  ft_face = pango_fc_font_lock_face( font );
+
+  g_assert (ft_face != NULL);
+
+  path = g_malloc0 (sizeof (generalpath));
+  g_assert(path != NULL);
+  path->env = env;
+
+  path->px = path->py = 0.0;
+  path->sx = 1.0/64.0;
+  path->sy = -1.0/64.0;
+
+  {  /* create a GeneralPath instance */
+    jclass cls;
+    jmethodID method;
+    
+    cls = (*env)->FindClass (env, "java/awt/geom/GeneralPath");
+    method = (*env)->GetMethodID (env, cls, "<init>", "()V");
+    gp = path->obj = (*env)->NewObject (env, cls, method);
+  }
+	      
+  if(FT_Load_Glyph(ft_face,
+		   (FT_UInt)(glyphIndex),
+		   FT_LOAD_DEFAULT | FT_LOAD_NO_BITMAP) != 0)
+    {
+      pango_fc_font_unlock_face( font );
+      g_free(path); 
+      return NULL;
+    }
+
+  FT_Get_Glyph( ft_face->glyph, &glyph );
+  FT_Outline_Decompose (&(((FT_OutlineGlyph)glyph)->outline),
+			&ftCallbacks, path);
+  FT_Done_Glyph( glyph );
+  
+  pango_fc_font_unlock_face( font );
+
+  g_free(path); 
+
+  return gp; 
+}
+
+

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GThreadNativeMethodRunner.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GThreadNativeMethodRunner.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GThreadNativeMethodRunner.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GThreadNativeMethodRunner.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,70 @@
+/* Native implementation of functions in GThreadNativeMethodRunner
+   Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+#include "gnu_java_awt_peer_gtk_GThreadNativeMethodRunner.h"
+#include "gthread-jni.h"
+
+/*
+ * Class:     GThreadNativeMethodRunner
+ * Method:    nativeRun
+ * Signature: (J)V
+ *
+ * Purpose: Run the C function whose function pointer is
+ *
+ */
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GThreadNativeMethodRunner_nativeRun
+  (JNIEnv *env __attribute__((unused)),
+   jobject lcl_obj __attribute__((unused)),
+   jlong funcAddr, jlong funcArg)
+{
+  /* Convert the function's address back into a pointer to a C function. */
+  void *(*funcPtr)(void *) = (void *(*)(void *)) (size_t)funcAddr;
+
+  /* We do not need to worry about the return value from funcPtr(); it's
+     just thrown away.  That is part of the g_threads spec, so no reason
+     to worry about returning it.  */
+  (void) funcPtr((void *) (size_t)funcArg);
+  /* Fall off the end and terminate the thread of control. */
+}
+
+/* Local Variables: */
+/* c-file-style: "gnu" */
+/* End: */
+
+

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,412 @@
+/* gnu_java_awt_GdkFont.c
+   Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+   
+   This file is part of GNU Classpath.
+   
+   GNU Classpath is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+   
+   GNU Classpath is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+   
+   You should have received a copy of the GNU General Public License
+   along with GNU Classpath; see the file COPYING.  If not, write to the
+   Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+   02110-1301 USA.
+   
+   Linking this library statically or dynamically with other modules is
+   making a combined work based on this library.  Thus, the terms and
+   conditions of the GNU General Public License cover the whole
+   combination.
+   
+   As a special exception, the copyright holders of this library give you
+   permission to link this library with independent modules to produce an
+   executable, regardless of the license terms of these independent
+   modules, and to copy and distribute the resulting executable under
+   terms of your choice, provided that you also meet, for each linked
+   independent module, the terms and conditions of the license of that
+   module.  An independent module is a module which is not derived from
+   or based on this library.  If you modify this library, you may extend
+   this exception to your version of the library, but you are not
+   obligated to do so.  If you do not wish to do so, delete this
+   exception statement from your version. */
+
+#include <pango/pango.h>
+#include <pango/pangoft2.h>
+#include <pango/pangofc-font.h>
+#include <freetype/ftglyph.h>
+#include <freetype/ftoutln.h>
+#include <freetype/fttypes.h>
+#include <freetype/tttables.h>
+#include "gdkfont.h"
+#include "gnu_java_awt_peer_gtk_GdkFontPeer.h"
+
+struct state_table *cp_gtk_native_font_state_table;
+
+enum java_awt_font_style {
+  java_awt_font_PLAIN = 0,
+  java_awt_font_BOLD = 1,
+  java_awt_font_ITALIC = 2
+};
+
+enum java_awt_font_baseline {
+  java_awt_font_ROMAN_BASELINE = 0,
+  java_awt_font_CENTER_BASELINE = 1,
+  java_awt_font_HANGING_BASELINE = 2
+};
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkFontPeer_initStaticState 
+  (JNIEnv *env, jclass clazz)
+{
+  NSA_FONT_INIT (env, clazz);
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkFontPeer_initState
+  (JNIEnv *env, jobject self)
+{
+  struct peerfont *pfont = NULL;
+
+  gdk_threads_enter ();
+
+  g_assert (self != NULL);
+  pfont = (struct peerfont *) g_malloc0 (sizeof (struct peerfont));
+  g_assert (pfont != NULL);
+  NSA_SET_FONT_PTR (env, self, pfont);
+
+  gdk_threads_leave ();
+}
+
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkFontPeer_dispose
+  (JNIEnv *env, jobject self)
+{
+  struct peerfont *pfont = NULL;
+
+  gdk_threads_enter ();
+
+  pfont = (struct peerfont *)NSA_DEL_FONT_PTR (env, self);
+  g_assert (pfont != NULL);
+  if (pfont->layout != NULL)
+    g_object_unref (pfont->layout);
+  if (pfont->font != NULL)
+    g_object_unref (pfont->font);
+  if (pfont->ctx != NULL)
+    g_object_unref (pfont->ctx);
+  if (pfont->desc != NULL)
+    pango_font_description_free (pfont->desc);
+  g_free (pfont);
+
+  gdk_threads_leave ();
+}
+
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkFontPeer_releasePeerGraphicsResource
+   (JNIEnv *env, jobject java_font)
+{
+  struct peerfont *pfont = NULL;
+
+  gdk_threads_enter();
+
+  pfont = (struct peerfont *) NSA_GET_FONT_PTR (env, java_font);
+  g_assert (pfont != NULL);
+  if (pfont->graphics_resource != NULL)
+    {
+      cairo_font_face_destroy ((cairo_font_face_t *) pfont->graphics_resource);
+      pfont->graphics_resource = NULL;
+    }
+
+  gdk_threads_leave();
+}
+
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkFontPeer_getFontMetrics
+   (JNIEnv *env, jobject java_font, jdoubleArray java_metrics)
+{
+  struct peerfont *pfont = NULL;
+  jdouble *native_metrics = NULL;
+  PangoFontMetrics *pango_metrics = NULL;
+  PangoLayout* layout = NULL;
+  PangoRectangle ink_rect;
+  PangoRectangle logical_rect;
+  PangoLayoutIter* iter = NULL;
+  int pango_ascent = 0;
+  int pango_descent = 0;
+  int pango_ink_ascent = 0;
+  int pango_ink_descent = 0;
+  int baseline = 0;
+  int java_ascent = 0;
+  int java_descent = 0;
+
+  gdk_threads_enter();
+
+  pfont = (struct peerfont *) NSA_GET_FONT_PTR (env, java_font);
+  g_assert (pfont != NULL);
+
+  pango_metrics 
+    = pango_context_get_metrics (pfont->ctx, pfont->desc,
+				 gtk_get_default_language ());
+
+  native_metrics 
+    = (*env)->GetDoubleArrayElements (env, java_metrics, NULL);
+
+  g_assert (native_metrics != NULL);
+
+  pango_ascent = PANGO_PIXELS (pango_font_metrics_get_ascent (pango_metrics));
+  pango_descent = PANGO_PIXELS (pango_font_metrics_get_descent (pango_metrics));
+
+  layout = pango_layout_new (pfont->ctx);
+
+  /* Pango seems to produce ascent and descent values larger than
+     those that Sun produces for the same-sized font.  It turns out
+     that an average of the "ink ascent" and "logical ascent" closely
+     approximates Sun's ascent values.  Likewise for descent values.
+     This is expensive but we cache GdkFontMetrics so this should only
+     run once per Font instance. */
+  pango_layout_set_text (layout, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKL"
+                         "MNOPQRSTUVWXYZ0123456789", -1);
+  pango_layout_set_font_description (layout, pfont->desc);
+
+  pango_layout_get_pixel_extents (layout, &ink_rect, &logical_rect);
+
+  iter = pango_layout_get_iter (layout);
+
+  baseline = PANGO_PIXELS (pango_layout_iter_get_baseline (iter));
+
+  pango_ink_ascent = baseline - ink_rect.y;
+  pango_ink_descent = ink_rect.y + ink_rect.height - baseline;
+
+  java_ascent = (pango_ascent + pango_ink_ascent) >> 1;
+  java_descent = (pango_descent + pango_ink_descent) >> 1;
+
+  java_ascent = MAX(0, java_ascent);
+  java_descent = MAX(0, java_descent);
+
+  pango_ascent = MAX(0, pango_ascent);
+  pango_descent = MAX(0, pango_descent);
+
+  /* Pango monospaced fonts have smaller ascent metrics than Sun's so
+     we return the logical ascent for monospaced fonts. */
+  if (!strcmp (pango_font_description_get_family (pfont->desc),
+               "Courier"))
+    native_metrics[FONT_METRICS_ASCENT] = pango_ascent;
+  else
+    native_metrics[FONT_METRICS_ASCENT] = java_ascent;
+
+  native_metrics[FONT_METRICS_MAX_ASCENT] = pango_ascent;
+
+  native_metrics[FONT_METRICS_DESCENT] = java_descent;
+
+  native_metrics[FONT_METRICS_MAX_DESCENT] = pango_descent;
+
+  native_metrics[FONT_METRICS_MAX_ADVANCE] 
+    = PANGO_PIXELS (pango_font_metrics_get_approximate_char_width 
+		    (pango_metrics));
+	 
+  (*env)->ReleaseDoubleArrayElements (env, 
+				      java_metrics, 
+				      native_metrics, 0);
+
+  pango_font_metrics_unref (pango_metrics);
+
+  gdk_threads_leave();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkFontPeer_getTextMetrics
+   (JNIEnv *env, jobject java_font, jstring str, jdoubleArray java_metrics)
+{
+  struct peerfont *pfont = NULL;
+  const char *cstr = NULL;
+  jdouble *native_metrics = NULL;  
+  PangoRectangle log;
+  PangoRectangle log2;
+  int line_count = 0;
+  int i = 0;
+  int width = 0;
+
+  gdk_threads_enter();
+
+  pfont = (struct peerfont *)NSA_GET_FONT_PTR (env, java_font);
+  g_assert (pfont != NULL);
+
+  cstr = (*env)->GetStringUTFChars (env, str, NULL);
+  g_assert(cstr != NULL);
+  
+  pango_layout_set_text (pfont->layout, cstr, -1);
+  pango_layout_get_extents (pfont->layout, NULL, &log);
+  
+  line_count = pango_layout_get_line_count (pfont->layout);
+  for (i = 0; i < line_count; i++)
+   {
+     pango_layout_line_get_extents (pango_layout_get_line (pfont->layout, i), 
+       NULL, &log2);
+     width += log2.width;
+   }
+
+  (*env)->ReleaseStringUTFChars (env, str, cstr);  
+  pango_layout_set_text (pfont->layout, "", -1);
+
+  native_metrics = (*env)->GetDoubleArrayElements (env, java_metrics, NULL);
+  g_assert (native_metrics != NULL);
+
+  native_metrics[TEXT_METRICS_X_BEARING] 
+    = PANGO_PIXELS( ((double)log.x) );
+
+  native_metrics[TEXT_METRICS_Y_BEARING] 
+    = PANGO_PIXELS( ((double)log.y) );
+
+  native_metrics[TEXT_METRICS_HEIGHT] 
+    = PANGO_PIXELS( ((double)log.height) );
+
+  native_metrics[TEXT_METRICS_WIDTH]
+    = PANGO_PIXELS( ((double)width) );
+
+  native_metrics[TEXT_METRICS_X_ADVANCE] 
+    = PANGO_PIXELS( ((double) (log.x + log.width)) );
+
+  native_metrics[TEXT_METRICS_Y_ADVANCE] 
+    = PANGO_PIXELS( ((double) (log.y + log.height)) );
+	 
+  (*env)->ReleaseDoubleArrayElements (env, java_metrics, native_metrics, 0);
+
+  gdk_threads_leave();
+}
+
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkFontPeer_setFont
+  (JNIEnv *env, jobject self, jstring family_name_str, jint style_int, jint size)
+{
+  struct peerfont *pfont = NULL;
+  char const *family_name = NULL;
+  enum java_awt_font_style style;
+  PangoFT2FontMap *ft2_map = NULL;
+
+  gdk_threads_enter ();
+
+  style = (enum java_awt_font_style) style_int;
+
+  g_assert (self != NULL);
+  pfont = (struct peerfont *)NSA_GET_FONT_PTR (env, self);
+  g_assert (pfont != NULL);
+
+  if (pfont->ctx != NULL)
+    g_object_unref (pfont->ctx);
+  if (pfont->font != NULL)
+    g_object_unref (pfont->font);
+  if (pfont->desc != NULL)
+    pango_font_description_free (pfont->desc);
+
+  pfont->desc = pango_font_description_new ();
+  g_assert (pfont->desc != NULL);
+
+  family_name = (*env)->GetStringUTFChars(env, family_name_str, 0);
+  g_assert (family_name != NULL);
+  pango_font_description_set_family (pfont->desc, family_name);
+  (*env)->ReleaseStringUTFChars(env, family_name_str, family_name);
+
+
+  if (style & java_awt_font_BOLD)
+    pango_font_description_set_weight (pfont->desc, PANGO_WEIGHT_BOLD);
+
+  if (style & java_awt_font_ITALIC)
+    pango_font_description_set_style (pfont->desc, PANGO_STYLE_ITALIC);
+
+  pango_font_description_set_size (pfont->desc, size * PANGO_SCALE);
+  if (pfont->ctx == NULL)
+    {
+      ft2_map = PANGO_FT2_FONT_MAP(pango_ft2_font_map_for_display ());
+      pfont->ctx = pango_ft2_font_map_create_context (ft2_map);
+    }
+
+  g_assert (pfont->ctx != NULL);
+  
+  if (pfont->font != NULL)
+    {
+      g_object_unref (pfont->font);
+      pfont->font = NULL;
+    }
+  
+  pango_context_set_font_description (pfont->ctx, pfont->desc);
+  pango_context_set_language (pfont->ctx, gtk_get_default_language());
+  pfont->font = pango_context_load_font (pfont->ctx, pfont->desc);
+  g_assert (pfont->font != NULL);
+
+  if (pfont->layout == NULL)
+    pfont->layout = pango_layout_new (pfont->ctx);
+  g_assert (pfont->layout != NULL);
+
+  gdk_threads_leave ();
+}
+
+
+JNIEXPORT jbyteArray JNICALL 
+Java_gnu_java_awt_peer_gtk_GdkFontPeer_getTrueTypeTable 
+  (JNIEnv *env, jobject self, jbyte n, jbyte a, jbyte m, jbyte e)
+{
+  struct peerfont *pfont = NULL;
+  FT_Face face;
+  FT_ULong length = 0;
+  FT_ULong tag;
+  int error;
+  FT_Byte *buffer;
+  jbyteArray result_array;
+  jbyte *rbuf;
+
+  pfont = (struct peerfont *)NSA_GET_FONT_PTR (env, self);
+  if(pfont == NULL)
+    return NULL;
+
+  gdk_threads_enter ();
+  face = pango_fc_font_lock_face ((PangoFcFont *)pfont->font);
+  tag = FT_MAKE_TAG( n, a, m, e );
+
+  /* Get the length of the table requested */
+  error = FT_Load_Sfnt_Table( face, tag, 0, NULL, &length );
+  if ( error ) 
+    {
+      pango_fc_font_unlock_face ((PangoFcFont *)pfont->font);
+      gdk_threads_leave ();
+      return NULL;
+    }
+
+  buffer = (FT_Byte *)g_malloc0( length );
+  if ( buffer == NULL ) 
+    {
+      pango_fc_font_unlock_face ((PangoFcFont *)pfont->font);
+      gdk_threads_leave ();
+      return NULL;
+    }
+  /* get the table data */
+  error = FT_Load_Sfnt_Table( face, tag, 0, buffer, &length );
+  if ( error ) 
+    {
+      pango_fc_font_unlock_face ((PangoFcFont *)pfont->font);
+      g_free(buffer);
+      gdk_threads_leave ();
+      return NULL;
+    }
+
+  /* copy to a jbytearray */
+  result_array = (*env)->NewByteArray (env, length);
+
+  rbuf = (*env)->GetByteArrayElements (env, result_array, NULL);
+  memcpy(rbuf, buffer, length);
+  (*env)->ReleaseByteArrayElements (env, result_array, rbuf, 0);
+
+  g_free(buffer);
+  pango_fc_font_unlock_face ((PangoFcFont *)pfont->font);
+  gdk_threads_leave ();
+
+  /* done */
+  return result_array;
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,275 @@
+/* gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.c
+   Copyright (C) 2004, 2006 Free Software Foundation, Inc.
+
+   This file is part of GNU Classpath.
+
+   GNU Classpath is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   GNU Classpath is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with GNU Classpath; see the file COPYING.  If not, write to the
+   Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+   02110-1301 USA.
+
+   Linking this library statically or dynamically with other modules is
+   making a combined work based on this library.  Thus, the terms and
+   conditions of the GNU General Public License cover the whole
+   combination.
+
+   As a special exception, the copyright holders of this library give you
+   permission to link this library with independent modules to produce an
+   executable, regardless of the license terms of these independent
+   modules, and to copy and distribute the resulting executable under
+   terms of your choice, provided that you also meet, for each linked
+   independent module, the terms and conditions of the license of that
+   module.  An independent module is a module which is not derived from
+   or based on this library.  If you modify this library, you may extend
+   this exception to your version of the library, but you are not
+   obligated to do so.  If you do not wish to do so, delete this
+   exception statement from your version. */
+
+#include <glib.h>
+#include <gdk/gdk.h>
+
+#include "gdkfont.h"
+#include "gdkdisplay.h"
+#include "gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.h"
+
+struct state_table *cp_gtk_native_display_state_table;
+
+jclass gdkGraphicsEnvironment_class;
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGraphicsEnvironment_initStaticState
+(JNIEnv *env, jclass klazz __attribute__((unused)))
+{
+    gdkGraphicsEnvironment_class = (*env)->NewGlobalRef
+    (env, klazz);
+
+	NSA_DISPLAY_INIT(env, gdkGraphicsEnvironment_class);
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGraphicsEnvironment_nativeInitState
+(JNIEnv *env, jobject obj)
+{
+	GdkDisplay *defaultDisplay;
+	
+    gdk_threads_enter();
+    
+    /* Retrieve the default display. */
+    defaultDisplay = gdk_display_get_default();
+    
+    gdk_threads_leave();
+    
+    /* Store display pointer in GdkGraphicsEnvironment instance. */
+    NSA_SET_DISPLAY_PTR(env, obj, (void *) defaultDisplay);
+}
+
+static gint
+cmp_families (const void *a, const void *b)
+{
+  const char *a_name = pango_font_family_get_name (*(PangoFontFamily **)a);
+  const char *b_name = pango_font_family_get_name (*(PangoFontFamily **)b);
+
+  return g_utf8_collate (a_name, b_name);
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGraphicsEnvironment_nativeGetFontFamilies
+(JNIEnv *env, jobject  self __attribute__((unused)), jobjectArray family_name)
+{
+  PangoContext *context = NULL;
+  PangoFontFamily **families = NULL;
+  int n_families = 0;
+  int idx = 0;
+
+  gdk_threads_enter ();
+
+  context = gdk_pango_context_get();
+  g_assert (context != NULL);
+
+  pango_context_list_families (context, &families, &n_families);
+
+  qsort (families, n_families, sizeof (PangoFontFamily *), cmp_families);
+
+  for (idx = 0;  idx < n_families;  idx++)
+    {
+      const char *name_tmp =  pango_font_family_get_name (families[idx]);
+      jstring name = (*env)->NewStringUTF (env, name_tmp);
+      (*env)->SetObjectArrayElement (env, family_name, idx, name);
+      (*env)->DeleteLocalRef(env, name);
+    }
+  g_free (families);
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT jint JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGraphicsEnvironment_nativeGetNumFontFamilies
+(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)))
+{
+  PangoContext *context = NULL;
+  PangoFontFamily **families = NULL;
+  gint n_families = 0;
+  gint num = 0;
+
+  gdk_threads_enter ();
+
+  context = gdk_pango_context_get();
+  g_assert (context != NULL);
+
+  pango_context_list_families (context, &families, &n_families);
+
+  num = n_families;
+  g_free (families);
+
+  gdk_threads_leave ();
+  
+  return num;
+}
+
+JNIEXPORT jobjectArray JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGraphicsEnvironment_nativeGetScreenDevices
+(JNIEnv *env, jobject obj)
+{
+	jmethodID gdkScreenGraphicsDevice_ctor, gdkScreenGraphicsDevice_init;
+	jclass gdkScreenGraphicsDevice_class;
+	int numScreens = 0, i = 0;
+	GdkDisplay *display;
+	jobjectArray array;
+	jobject instance;
+	
+	gdkScreenGraphicsDevice_class = (*env)->FindClass 
+    (env, "gnu/java/awt/peer/gtk/GdkScreenGraphicsDevice");
+    
+	gdkScreenGraphicsDevice_ctor = (*env)->GetMethodID 
+    (env, gdkScreenGraphicsDevice_class, "<init>",
+     "(Lgnu/java/awt/peer/gtk/GdkGraphicsEnvironment;)V");
+
+	gdkScreenGraphicsDevice_init = (*env)->GetMethodID 
+    (env, gdkScreenGraphicsDevice_class, "init", "()V");
+
+	display = (GdkDisplay *) NSA_GET_DISPLAY_PTR(env, obj);
+	
+	gdk_threads_enter();
+	
+	numScreens = gdk_display_get_n_screens(display);
+	
+	
+	/* Create a suitably sized array. */
+	array = (*env)->NewObjectArray(env,
+                                   numScreens,
+                                   gdkScreenGraphicsDevice_class,
+                                   NULL);
+	
+	/* Create GdkScreenGraphicsDevice instances, store the native pointer to
+	 * the GScreen object with them, run a 2nd initialization phase and
+	 * put the new instance into the result array.
+	 */
+	for ( ; i < numScreens ; i++)
+	{
+		instance = (*env)->NewObject (env, 
+                                      gdkScreenGraphicsDevice_class,
+                                      gdkScreenGraphicsDevice_ctor,
+                                      obj);
+									  
+        NSA_SET_SCREEN_PTR(env,
+                           instance,
+                           gdk_display_get_screen(display, i));
+						   
+        gdk_threads_leave();
+        (*env)->CallVoidMethod(env,
+                               instance,
+                               gdkScreenGraphicsDevice_init);
+		gdk_threads_enter();
+		
+        (*env)->SetObjectArrayElement(env, array, i, instance);
+    }
+	
+    gdk_threads_leave();
+	
+    return array;
+}
+
+JNIEXPORT jobject JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGraphicsEnvironment_nativeGetDefaultScreenDevice
+(JNIEnv *env, jobject obj)
+{
+    jclass gdkScreenGraphicsDevice_class;
+    jmethodID gdkScreenGraphicsDevice_ctor, gdkScreenGraphicsDevice_init;
+    jobject defaultDevice;
+    GdkScreen *defaultScreen;
+    
+    gdkScreenGraphicsDevice_class = (*env)->FindClass 
+    (env, "gnu/java/awt/peer/gtk/GdkScreenGraphicsDevice");
+    
+    gdkScreenGraphicsDevice_ctor = (*env)->GetMethodID 
+    (env, gdkScreenGraphicsDevice_class, "<init>",
+     "(Lgnu/java/awt/peer/gtk/GdkGraphicsEnvironment;)V");
+    
+    gdkScreenGraphicsDevice_init = (*env)->GetMethodID 
+    (env, gdkScreenGraphicsDevice_class, "init", "()V");
+    
+    /* Create the GdkScreenGraphicsDevice instance. */
+    defaultDevice = (*env)->NewObject (env, 
+									   gdkScreenGraphicsDevice_class,
+									   gdkScreenGraphicsDevice_ctor,
+									   obj);
+									   
+    gdk_threads_enter();
+	
+    defaultScreen = gdk_screen_get_default();
+	
+    gdk_threads_leave();
+									   
+	/* Class initialization will have set up the native_state storage
+	 * mechanism for GdkScreenGraphicsDevice.
+	 */
+    NSA_SET_SCREEN_PTR(env, defaultDevice, defaultScreen);
+
+    (*env)->CallVoidMethod(env,
+                           defaultDevice,
+                           gdkScreenGraphicsDevice_init);
+
+    return defaultDevice;	
+}
+
+JNIEXPORT jintArray JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGraphicsEnvironment_getMouseCoordinates
+(JNIEnv *env, jobject obj)
+{
+  jintArray retArray;
+  jint *values;
+  GdkDisplay *display;
+  gint x, y, screenIndex;
+  GdkScreen *screen;
+
+  display = (GdkDisplay *) NSA_GET_DISPLAY_PTR(env, obj);
+  g_assert (display != NULL);
+  
+  gdk_threads_enter ();
+  
+  gdk_display_get_pointer (display, &screen, &x, &y, NULL);
+  screenIndex = gdk_screen_get_number( screen );
+
+  gdk_threads_leave ();
+	
+  retArray = (*env)->NewIntArray (env, 3);
+  values = (*env)->GetIntArrayElements (env, retArray, NULL);
+  
+  values[0] = screenIndex;
+  values[1] = x;
+  values[2] = y;
+
+  (*env)->ReleaseIntArrayElements (env, retArray, values, 0);
+
+  return retArray;
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkPixbufDecoder.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkPixbufDecoder.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkPixbufDecoder.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkPixbufDecoder.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,478 @@
+/* gdkpixbufdecoder.c
+   Copyright (C) 1999, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+
+   This file is part of GNU Classpath.
+   
+   GNU Classpath is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+   
+   GNU Classpath is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+   
+   You should have received a copy of the GNU General Public License
+   along with GNU Classpath; see the file COPYING.  If not, write to the
+   Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+   02110-1301 USA.
+   
+   Linking this library statically or dynamically with other modules is
+   making a combined work based on this library.  Thus, the terms and
+   conditions of the GNU General Public License cover the whole
+   combination.
+   
+   As a special exception, the copyright holders of this library give you
+   permission to link this library with independent modules to produce an
+   executable, regardless of the license terms of these independent
+   modules, and to copy and distribute the resulting executable under
+   terms of your choice, provided that you also meet, for each linked
+   independent module, the terms and conditions of the license of that
+   module.  An independent module is a module which is not derived from
+   or based on this library.  If you modify this library, you may extend
+   this exception to your version of the library, but you are not
+   obligated to do so.  If you do not wish to do so, delete this
+   exception statement from your version. */
+
+#include <gtkpeer.h>
+#include <gdk/gdk.h>
+#include <gdk-pixbuf/gdk-pixbuf.h>
+#include <gdk-pixbuf/gdk-pixbuf-loader.h>
+
+#include <jni.h>
+#include <jcl.h>
+#include "native_state.h"
+#include "gnu_java_awt_peer_gtk_GdkPixbufDecoder.h"
+
+#include <string.h>
+#include <stdlib.h>
+
+static struct state_table *native_pixbufdecoder_state_table;
+
+#define NSA_PB_INIT(env, clazz) \
+  native_pixbufdecoder_state_table = cp_gtk_init_state_table (env, clazz)
+
+#define NSA_GET_PB_PTR(env, obj) \
+  cp_gtk_get_state (env, obj, native_pixbufdecoder_state_table)
+
+#define NSA_SET_PB_PTR(env, obj, ptr) \
+  cp_gtk_set_state (env, obj, native_pixbufdecoder_state_table, (void *)ptr)
+
+#define NSA_DEL_PB_PTR(env, obj) \
+  cp_gtk_remove_state_slot (env, obj, native_pixbufdecoder_state_table)
+
+/* Union used for type punning. */
+union env_union
+{
+  void **void_env;
+  JNIEnv **jni_env;
+};
+
+static JavaVM *vm;
+
+static jmethodID areaPreparedID;
+static jmethodID areaUpdatedID;
+static jmethodID dataOutputWriteID;
+static jmethodID registerFormatID;
+
+static void
+area_prepared_cb (GdkPixbufLoader *loader, 
+	       jobject *decoder)
+{
+  JNIEnv *env = NULL;
+  union env_union e;
+  jint width = 0;
+  jint height = 0;
+  GdkPixbuf *pixbuf = NULL;
+
+  pixbuf = gdk_pixbuf_loader_get_pixbuf (loader);
+  g_assert (pixbuf != NULL);
+
+  width = gdk_pixbuf_get_width (pixbuf); 
+  height = gdk_pixbuf_get_height (pixbuf);
+
+  g_assert (decoder != NULL);
+
+  e.jni_env = &env;
+  (*vm)->GetEnv (vm, e.void_env, JNI_VERSION_1_1);
+
+  (*env)->CallVoidMethod (env,
+			  *decoder,
+			  areaPreparedID,
+			  width, height);
+}
+
+static void
+area_updated_cb (GdkPixbufLoader *loader, 
+	      gint x, gint y, 
+	      gint width, gint height,
+	      jobject *decoder)
+{
+  JNIEnv *env;
+  union env_union e;
+  jint stride_bytes, stride_pixels, n_channels, n_pixels;
+  jintArray jpixels;  
+  jint *java_pixels;
+  guchar *gdk_pixels;
+
+  GdkPixbuf *pixbuf_no_alpha = NULL;
+  GdkPixbuf *pixbuf = NULL;
+
+#ifndef WORDS_BIGENDIAN
+  int i;
+#endif
+
+  pixbuf_no_alpha = gdk_pixbuf_loader_get_pixbuf (loader);
+  if (pixbuf_no_alpha == NULL)
+    return;
+
+  pixbuf = gdk_pixbuf_add_alpha(pixbuf_no_alpha, FALSE, 0, 0, 0);
+  g_assert (gdk_pixbuf_get_has_alpha (pixbuf));
+  
+  stride_bytes = gdk_pixbuf_get_rowstride (pixbuf);
+  n_channels = gdk_pixbuf_get_n_channels (pixbuf);
+  stride_pixels =  stride_bytes / n_channels;
+  n_pixels = height * stride_pixels;
+  gdk_pixels = gdk_pixbuf_get_pixels (pixbuf);
+
+  e.jni_env = &env;
+  (*vm)->GetEnv (vm, e.void_env, JNI_VERSION_1_1);
+
+  jpixels = (*env)->NewIntArray (env, n_pixels);
+
+  java_pixels = (*env)->GetIntArrayElements (env, jpixels, NULL);
+
+  memcpy (java_pixels, 
+	  gdk_pixels + (y * stride_bytes), 
+	  (height * stride_bytes));
+
+#ifndef WORDS_BIGENDIAN
+  /* convert pixels from 0xBBGGRRAA to 0xAARRGGBB */
+  for (i = 0; i < n_pixels; ++i)
+    {
+      java_pixels[i] = SWAPU32 ((unsigned)java_pixels[i]);
+    }
+#endif
+
+  g_object_unref (pixbuf);
+
+  (*env)->ReleaseIntArrayElements (env, jpixels, java_pixels, 0);
+
+  (*env)->CallVoidMethod (env, 
+			  *decoder, 
+			  areaUpdatedID,
+			  (jint) x, (jint) y,
+			  (jint) width, (jint) height,
+			  jpixels,
+			  stride_pixels);
+
+  (*env)->DeleteLocalRef(env, jpixels);
+}
+
+static void
+closed_cb (GdkPixbufLoader *loader __attribute__((unused)), jobject *decoder)
+{
+  JNIEnv *env;
+  union env_union e;
+  e.jni_env = &env;
+  (*vm)->GetEnv (vm, e.void_env, JNI_VERSION_1_1);
+
+  (*env)->DeleteGlobalRef (env, *decoder); 
+  g_free (decoder);
+}
+
+
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkPixbufDecoder_initState
+  (JNIEnv *env, jobject obj)
+{
+  GdkPixbufLoader *loader = NULL;
+  jobject *decoder = NULL;
+
+  decoder = (jobject *) g_malloc (sizeof (jobject));
+  g_assert (decoder != NULL);
+  *decoder = (*env)->NewGlobalRef (env, obj);
+
+  loader = gdk_pixbuf_loader_new ();
+  g_assert (loader != NULL);  
+  g_signal_connect (loader, "area-prepared", G_CALLBACK (area_prepared_cb), decoder);  
+  g_signal_connect (loader, "area-updated", G_CALLBACK (area_updated_cb), decoder);
+  g_signal_connect (loader, "closed", G_CALLBACK (closed_cb), decoder);
+
+  NSA_SET_PB_PTR (env, obj, loader);
+}
+
+static void
+query_formats (JNIEnv *env, jclass clazz)
+{
+  jobject jformat;
+  GSList *formats, *f;
+  GdkPixbufFormat *format;
+  char **ch, *name;
+
+  jclass formatClass;
+  jmethodID addExtensionID;
+  jmethodID addMimeTypeID;
+  jobject string;
+
+  formatClass = (*env)->FindClass
+    (env, "gnu/java/awt/peer/gtk/GdkPixbufDecoder$ImageFormatSpec");
+
+  g_assert(formatClass != NULL);
+
+  addExtensionID = (*env)->GetMethodID (env, formatClass, 
+				        "addExtension", 
+					"(Ljava/lang/String;)V");
+
+  addMimeTypeID = (*env)->GetMethodID (env, formatClass, 
+				       "addMimeType", 
+				       "(Ljava/lang/String;)V");
+  
+  formats = gdk_pixbuf_get_formats ();
+
+  for (f = formats; f; f = f->next)
+    {
+      format = (GdkPixbufFormat *) f->data;
+      name = gdk_pixbuf_format_get_name(format);
+
+      string = (*env)->NewStringUTF(env, name);
+      g_assert(string != NULL);
+
+      jformat = (*env)->CallStaticObjectMethod 
+	(env, clazz, registerFormatID, string,
+	 (jboolean) gdk_pixbuf_format_is_writable(format));
+      (*env)->DeleteLocalRef(env, string);
+
+      g_assert(jformat != NULL);
+      
+      ch = gdk_pixbuf_format_get_extensions(format);
+      while (*ch)
+	{
+	  string = (*env)->NewStringUTF(env, *ch);
+	  g_assert(string != NULL);
+	  (*env)->CallVoidMethod (env, jformat, addExtensionID, string);
+	  (*env)->DeleteLocalRef(env, string);
+	  ++ch;
+	}
+      
+      ch = gdk_pixbuf_format_get_mime_types(format);
+      while (*ch)
+	{
+	  string = (*env)->NewStringUTF(env, *ch);
+	  g_assert(string != NULL);
+	  (*env)->CallVoidMethod (env, jformat, addMimeTypeID, string);
+	  (*env)->DeleteLocalRef(env, string);
+	  ++ch;
+	}
+
+      (*env)->DeleteLocalRef(env, jformat);
+    }
+  
+  g_slist_free(formats);  
+}
+
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkPixbufDecoder_initStaticState 
+  (JNIEnv *env, jclass clazz)
+{
+  jclass writerClass;
+
+  (*env)->GetJavaVM(env, &vm);
+
+  areaPreparedID = (*env)->GetMethodID (env, clazz, 
+				        "areaPrepared", 
+					"(II)V");
+
+  areaUpdatedID = (*env)->GetMethodID (env, clazz,
+				       "areaUpdated",
+				       "(IIII[II)V");
+
+  registerFormatID = (*env)->GetStaticMethodID 
+    (env, clazz, 
+     "registerFormat", 
+     "(Ljava/lang/String;Z)"
+     "Lgnu/java/awt/peer/gtk/GdkPixbufDecoder$ImageFormatSpec;");
+
+  writerClass = (*env)->FindClass
+    (env, "gnu/java/awt/peer/gtk/GdkPixbufDecoder$GdkPixbufWriter");
+  dataOutputWriteID = (*env)->GetMethodID (env, writerClass,
+					     "write", "([B)V");
+
+  query_formats (env, clazz);
+  
+  NSA_PB_INIT (env, clazz);
+}
+
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkPixbufDecoder_finish
+(JNIEnv *env, jobject obj, jboolean needs_close)
+{
+  GdkPixbufLoader *loader = NULL;
+
+  loader = (GdkPixbufLoader *)NSA_DEL_PB_PTR (env, obj);
+  if (loader == NULL)
+    return;
+
+  if (needs_close)
+    gdk_pixbuf_loader_close (loader, NULL);
+  g_object_unref (loader);
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkPixbufDecoder_pumpDone
+(JNIEnv *env, jobject obj)
+{
+  GError *err = NULL;
+  GdkPixbufLoader *loader = NULL;
+
+  loader = (GdkPixbufLoader *)NSA_GET_PB_PTR (env, obj);
+  g_assert (loader != NULL);
+
+  gdk_pixbuf_loader_close (loader, &err);
+
+  if (err != NULL)
+    {
+      JCL_ThrowException (env, "java/io/IOException", err->message);
+      g_error_free (err);
+    }
+}
+
+struct stream_save_request
+{
+  JNIEnv *env;
+  jobject *writer;
+};
+
+static gboolean
+save_to_stream(const gchar *buf,
+	       gsize count,
+	       GError **error __attribute__((unused)),
+	       gpointer data)
+{
+  struct stream_save_request *ssr = (struct stream_save_request *)data;
+
+  jbyteArray jbuf;
+  jbyte *cbuf;
+
+  jbuf = (*(ssr->env))->NewByteArray ((ssr->env), count);
+  cbuf = (*(ssr->env))->GetByteArrayElements ((ssr->env), jbuf, NULL);
+  memcpy (cbuf, buf, count);
+  (*(ssr->env))->ReleaseByteArrayElements ((ssr->env), jbuf, cbuf, 0);
+  (*(ssr->env))->CallVoidMethod ((ssr->env), *(ssr->writer), 
+				 dataOutputWriteID, jbuf);  
+  (*(ssr->env))->DeleteLocalRef((ssr->env), jbuf);
+
+  return TRUE;
+}
+
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkPixbufDecoder_streamImage
+(JNIEnv *env, jclass clazz __attribute__((unused)),
+ jintArray jarr, jstring jenctype, jint width, jint height, 
+ jboolean hasAlpha, jobject writer) 
+{
+  GdkPixbuf* pixbuf;  
+  jint *ints;
+  guchar a, r, g, b, *pix, *p;
+  GError *err = NULL;
+  const char *enctype;
+  int i;
+  struct stream_save_request ssr;
+
+  ssr.writer = &writer;
+  ssr.env = env;
+
+  ints = (*env)->GetIntArrayElements (env, jarr, NULL);
+  pix = g_malloc(width * height * (hasAlpha ? 4 : 3));
+
+  enctype = (*env)->GetStringUTFChars (env, jenctype, NULL);
+  g_assert(enctype != NULL);
+
+  g_assert (pix != NULL);
+  g_assert (ints != NULL);
+
+  p = pix;
+  for (i = 0; i < width*height; ++i)
+    {
+      /* 
+       * Java encodes pixels as integers in a predictable arithmetic order:
+       * 0xAARRGGBB. Since these are jints, JNI has already byte-swapped
+       * them for us if necessary, so they're in "our" endianness, whatever
+       * that is. It uses 4 bytes per pixel whether or not there's an alpha
+       * channel.
+       */
+
+      a = 0xff & (ints[i] >> 24);
+      r = 0xff & (ints[i] >> 16);
+      g = 0xff & (ints[i] >> 8);
+      b = 0xff & ints[i];
+
+      /* 
+       * GDK-pixbuf has a very different storage model:
+       *
+       *  - A different alpha order (alpha after colors).
+       *  - A different packing model (no alpha -> 3-bytes-per-pixel).
+       *  - A different "RGB" order (host memory order, not endian-neutral).
+       */
+
+      *p++ = r;
+      *p++ = g;
+      *p++ = b;
+      if (hasAlpha)
+	*p++ = a;
+    }
+
+  pixbuf =  gdk_pixbuf_new_from_data (pix,
+				      GDK_COLORSPACE_RGB,
+				      (gboolean) hasAlpha,
+				      8, width, height, 
+				      width * (hasAlpha ? 4 : 3), /* rowstride */
+				      NULL, NULL);
+  g_assert (pixbuf != NULL);
+
+  g_assert(gdk_pixbuf_save_to_callback (pixbuf,
+					&save_to_stream,
+					&ssr,
+					enctype,
+					&err, NULL));
+
+  g_object_unref (pixbuf);
+
+  g_free(pix);
+
+  (*env)->ReleaseStringUTFChars (env, jenctype, enctype);  
+  (*env)->ReleaseIntArrayElements (env, jarr, ints, 0);
+}
+
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkPixbufDecoder_pumpBytes
+  (JNIEnv *env, jobject obj, jbyteArray jarr, jint len)
+{
+  GdkPixbufLoader *loader = NULL;
+  jbyte *bytes = NULL;
+  GError *err = NULL;
+
+  g_assert (len >= 1);
+  g_assert (jarr != NULL);
+
+  bytes = (*env)->GetByteArrayElements (env, jarr, NULL);
+  g_assert (bytes != NULL);
+  loader = (GdkPixbufLoader *)NSA_GET_PB_PTR (env, obj);
+  g_assert (loader != NULL);
+
+  gdk_pixbuf_loader_write (loader, (const guchar *) bytes, len, &err);
+
+  (*env)->ReleaseByteArrayElements (env, jarr, bytes, 0);
+
+  if (err != NULL)
+    {
+      JCL_ThrowException (env, "java/io/IOException", err->message);
+      g_error_free (err);
+    }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkRobotPeer.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkRobotPeer.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkRobotPeer.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkRobotPeer.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,337 @@
+/* gdkrobotpeer.c
+   Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#include "gtkpeer.h"
+#include "gnu_java_awt_peer_gtk_GdkRobotPeer.h"
+#include <gdk/gdkx.h>
+#include <X11/extensions/XTest.h>
+
+static int
+awt_button_mask_to_num (int buttons)
+{
+  switch (buttons)
+    {
+    case AWT_BUTTON1_MASK:
+      return 1;
+    case AWT_BUTTON2_MASK:
+      return 2;
+    case AWT_BUTTON3_MASK:
+      return 3;
+    }
+
+  return 0;
+}
+
+JNIEXPORT jboolean JNICALL
+Java_gnu_java_awt_peer_gtk_GdkRobotPeer_initXTest
+  (JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)))
+{
+  GdkDisplay *display;
+  Display *xdisplay;
+  int event_basep;
+  int error_basep;
+  int majorp;
+  int minorp;
+  jboolean result;
+
+  gdk_threads_enter ();
+
+  display = gdk_display_get_default ();
+  xdisplay = GDK_DISPLAY_XDISPLAY (display);
+
+  result = XTestQueryExtension (xdisplay,
+				&event_basep,
+				&error_basep,
+				&majorp,
+				&minorp);
+
+  gdk_threads_leave ();
+
+  return result;
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkRobotPeer_mouseMove
+  (JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)), jint x, jint y)
+{
+  GdkDisplay *display;
+  Display *xdisplay;
+  int result;
+
+  gdk_threads_enter ();
+
+  display = gdk_display_get_default ();
+  xdisplay = GDK_DISPLAY_XDISPLAY (display);
+
+  result = XTestFakeMotionEvent (xdisplay,
+				 -1,
+				 x, y, CurrentTime);
+
+  XFlush (xdisplay);
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkRobotPeer_mousePress
+  (JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)), jint buttons)
+{
+  GdkDisplay *display;
+  Display *xdisplay;
+  int result;
+
+  gdk_threads_enter ();
+
+  display = gdk_display_get_default ();
+  xdisplay = GDK_DISPLAY_XDISPLAY (display);
+
+  result = XTestFakeButtonEvent (xdisplay,
+				 awt_button_mask_to_num (buttons),
+				 True, CurrentTime);
+
+  XFlush (xdisplay);
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkRobotPeer_mouseRelease
+  (JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)), jint buttons)
+{
+  GdkDisplay *display;
+  Display *xdisplay;
+  int result;
+
+  gdk_threads_enter ();
+
+  display = gdk_display_get_default ();
+  xdisplay = GDK_DISPLAY_XDISPLAY (display);
+
+  result = XTestFakeButtonEvent (xdisplay,
+				 awt_button_mask_to_num (buttons),
+				 False, CurrentTime);
+
+  XFlush (xdisplay);
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkRobotPeer_mouseWheel
+  (JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)), jint wheelAmt)
+{
+  GdkDisplay *display;
+  Display *xdisplay;
+  int i = 0;
+
+  gdk_threads_enter ();
+
+  display = gdk_display_get_default ();
+  xdisplay = GDK_DISPLAY_XDISPLAY (display);
+
+  if (wheelAmt < 0)
+    for (i = 0; i < -wheelAmt; i++)
+      {
+	XTestFakeButtonEvent (xdisplay,
+			      4,
+			      True, CurrentTime);
+	XTestFakeButtonEvent (xdisplay,
+			      4,
+			      False, CurrentTime);
+      }
+  else
+    for (i = 0; i < wheelAmt; i++)
+      {
+	XTestFakeButtonEvent (xdisplay,
+			      5,
+			      True, CurrentTime);
+	XTestFakeButtonEvent (xdisplay,
+			      5,
+			      False, CurrentTime);
+      }
+
+  XFlush (xdisplay);
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkRobotPeer_keyPress
+  (JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)), jint keycode)
+{
+  GdkDisplay *display;
+  Display *xdisplay;
+  GdkKeymapKey *keymap_keys = NULL;
+  gint n_keys = 0;
+  guint lookup_keyval = 0;
+  int result;
+
+  gdk_threads_enter ();
+
+  display = gdk_display_get_default ();
+  xdisplay = GDK_DISPLAY_XDISPLAY (display);
+
+  lookup_keyval = cp_gtk_awt_keycode_to_keysym (keycode,
+                                                       AWT_KEY_LOCATION_LEFT);
+
+  if (!gdk_keymap_get_entries_for_keyval (gdk_keymap_get_default (),
+                                          lookup_keyval,
+                                          &keymap_keys,
+                                          &n_keys))
+    {
+      /* No matching keymap entry was found. */
+      g_printerr ("No matching keymap entries were found\n");
+      gdk_threads_leave ();
+      return;
+    }
+
+  /* If n_keys > 1 then there are multiple hardware keycodes that
+     translate to lookup_keyval.  We arbitrarily choose the first
+     hardware keycode from the list returned by
+     gdk_keymap_get_entries_for_keyval. */
+  result = XTestFakeKeyEvent (xdisplay,
+			      keymap_keys[0].keycode,
+			      True, CurrentTime);
+
+  g_free (keymap_keys);
+
+  XFlush (xdisplay);
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkRobotPeer_keyRelease
+  (JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)), jint keycode)
+{
+  GdkDisplay *display;
+  Display *xdisplay;
+  GdkKeymapKey *keymap_keys = NULL;
+  gint n_keys = 0;
+  guint lookup_keyval = 0;
+  int result;
+
+  gdk_threads_enter ();
+
+  display = gdk_display_get_default ();
+  xdisplay = GDK_DISPLAY_XDISPLAY (display);
+
+  lookup_keyval = cp_gtk_awt_keycode_to_keysym (keycode,
+                                                       AWT_KEY_LOCATION_LEFT);
+
+  if (!gdk_keymap_get_entries_for_keyval (gdk_keymap_get_default (),
+                                          lookup_keyval,
+                                          &keymap_keys,
+                                          &n_keys))
+    {
+      /* No matching keymap entry was found. */
+      g_printerr ("No matching keymap entries were found\n");
+      gdk_threads_leave ();
+      return;
+    }
+
+  /* If n_keys > 1 then there are multiple hardware keycodes that
+     translate to lookup_keyval.  We arbitrarily choose the first
+     hardware keycode from the list returned by
+     gdk_keymap_get_entries_for_keyval. */
+  result = XTestFakeKeyEvent (xdisplay,
+			      keymap_keys[0].keycode,
+			      False, CurrentTime);
+
+  g_free (keymap_keys);
+
+  XFlush (xdisplay);
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT jintArray JNICALL
+Java_gnu_java_awt_peer_gtk_GdkRobotPeer_nativeGetRGBPixels
+  (JNIEnv *env, jobject obj __attribute__((unused)), jint x, jint y,
+   jint width, jint height)
+{
+  jint stride_bytes, stride_pixels, n_channels, n_pixels;
+  jintArray jpixels;  
+  jint *java_pixels;
+  guchar *gdk_pixels;
+  GdkPixbuf *pixbuf_no_alpha = NULL;
+  GdkPixbuf *pixbuf = NULL;
+
+#ifndef WORDS_BIGENDIAN
+  int i;
+#endif
+
+  gdk_threads_enter ();
+
+  pixbuf_no_alpha = gdk_pixbuf_get_from_drawable (NULL,
+						  gdk_get_default_root_window (),
+						  NULL, x, y, 0, 0,
+						  width, height);
+
+  pixbuf = gdk_pixbuf_add_alpha(pixbuf_no_alpha, FALSE, 0, 0, 0);
+  g_assert (gdk_pixbuf_get_has_alpha (pixbuf));
+  
+  stride_bytes = gdk_pixbuf_get_rowstride (pixbuf);
+  n_channels = gdk_pixbuf_get_n_channels (pixbuf);
+  stride_pixels =  stride_bytes / n_channels;
+  n_pixels = height * stride_pixels;
+  gdk_pixels = gdk_pixbuf_get_pixels (pixbuf);
+
+  jpixels = (*env)->NewIntArray (env, n_pixels);
+
+  java_pixels = (*env)->GetIntArrayElements (env, jpixels, NULL);
+
+  memcpy (java_pixels,
+	  gdk_pixels,
+	  (height * stride_bytes));
+
+#ifndef WORDS_BIGENDIAN
+  /* convert pixels from 0xBBGGRRAA to 0xAARRGGBB */
+  for (i = 0; i < n_pixels; ++i)
+    {
+      java_pixels[i] = SWAPU32 ((unsigned)java_pixels[i]);
+    }
+#endif
+
+  g_object_unref (pixbuf);
+
+  (*env)->ReleaseIntArrayElements (env, jpixels, java_pixels, 0);
+
+  gdk_threads_leave ();
+
+  return jpixels;
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkScreenGraphicsDevice.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkScreenGraphicsDevice.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkScreenGraphicsDevice.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkScreenGraphicsDevice.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,354 @@
+/* gnu_java_awt_peer_gtk_GdkScreenGraphicsDevice.c
+   Copyright (C) 2006 Free Software Foundation, Inc.
+
+   This file is part of GNU Classpath.
+
+   GNU Classpath is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   GNU Classpath is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with GNU Classpath; see the file COPYING.  If not, write to the
+   Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+   02110-1301 USA.
+
+   Linking this library statically or dynamically with other modules is
+   making a combined work based on this library.  Thus, the terms and
+   conditions of the GNU General Public License cover the whole
+   combination.
+
+   As a special exception, the copyright holders of this library give you
+   permission to link this library with independent modules to produce an
+   executable, regardless of the license terms of these independent
+   modules, and to copy and distribute the resulting executable under
+   terms of your choice, provided that you also meet, for each linked
+   independent module, the terms and conditions of the license of that
+   module.  An independent module is a module which is not derived from
+   or based on this library.  If you modify this library, you may extend
+   this exception to your version of the library, but you are not
+   obligated to do so.  If you do not wish to do so, delete this
+   exception statement from your version. */
+
+#include <jcl.h>
+
+#include <gdk/gdk.h>
+#include <gdk/gdkx.h>
+
+#ifdef HAVE_XRANDR
+#include <X11/Xlib.h>
+#include <X11/extensions/Xrandr.h>
+#endif
+
+#include "gdkdisplay.h"
+
+#include "gnu_java_awt_peer_gtk_GdkScreenGraphicsDevice.h"
+
+struct state_table *cp_gtk_native_screen_state_table;
+
+jclass gdkScreenGraphicsDevice_class;
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkScreenGraphicsDevice_initStaticState
+(JNIEnv *env, jclass klazz)
+{
+	gdkScreenGraphicsDevice_class = (*env)->NewGlobalRef
+    (env, klazz);
+
+	NSA_SCREEN_INIT(env, gdkScreenGraphicsDevice_class);
+}
+
+JNIEXPORT jobject JNICALL
+Java_gnu_java_awt_peer_gtk_GdkScreenGraphicsDevice_nativeGetFixedDisplayMode
+(JNIEnv *env, jobject obj, jobject gdkGraphicsEnv __attribute__((unused)))
+{
+	jclass displayMode_class;
+	jmethodID displayMode_ctor;
+	GdkScreen *screen;
+	jobject fixedDisplayMode = NULL;
+#ifdef HAVE_XRANDR
+	int temp1, temp2;
+	GdkDisplay *display;
+
+    display = (GdkDisplay *) NSA_GET_DISPLAY_PTR(env, gdkGraphicsEnv);
+
+	gdk_threads_enter();
+
+	if (!XRRQueryExtension(GDK_DISPLAY_XDISPLAY(display), &temp1, &temp2))
+	  {
+        displayMode_class = (*env)->FindClass(env, "java/awt/DisplayMode");
+        displayMode_ctor = (*env)->GetMethodID(env,
+                                               displayMode_class,
+                                               "<init>",
+                                               "(IIII)V");
+
+        screen = (GdkScreen *) NSA_GET_SCREEN_PTR(env, obj);
+	  	
+	  	fixedDisplayMode = (*env)->NewObject(env,
+	  	                                     displayMode_class,
+	  	                                     displayMode_ctor,
+	  	                                     gdk_screen_get_width(screen),
+	  	                                     gdk_screen_get_height(screen),
+	  	                                     -1,
+	  	                                     0);
+	  }
+
+	gdk_threads_leave();
+	  
+#else
+
+    displayMode_class = (*env)->FindClass(env, "java/awt/DisplayMode");
+    displayMode_ctor = (*env)->GetMethodID(env,
+                                           displayMode_class,
+                                           "<init>",
+                                           "(IIII)V");
+
+    screen = (GdkScreen *) NSA_GET_SCREEN_PTR(env, obj);
+	  	
+    fixedDisplayMode = (*env)->NewObject(env,
+	                                     displayMode_class,
+	                                     displayMode_ctor,
+	                                     gdk_screen_get_width(screen),
+	                                     gdk_screen_get_height(screen),
+	                                     -1,
+	                                     0);
+
+#endif	  
+	return fixedDisplayMode;
+}
+
+JNIEXPORT jstring JNICALL
+Java_gnu_java_awt_peer_gtk_GdkScreenGraphicsDevice_nativeGetIDString
+(JNIEnv *env, jobject obj)
+{
+	GdkScreen *screen;
+	gchar* displayName;
+	jstring string;
+
+    screen = (GdkScreen *) NSA_GET_SCREEN_PTR(env, obj);
+	
+	gdk_threads_enter();
+	
+	displayName = gdk_screen_make_display_name(screen);
+	
+	gdk_threads_leave();
+	
+    string = (*env)->NewStringUTF(env, displayName);
+    
+    g_free(displayName);
+    
+    return string;
+}
+
+JNIEXPORT jint JNICALL
+Java_gnu_java_awt_peer_gtk_GdkScreenGraphicsDevice_nativeGetDisplayModeRate
+(JNIEnv *env, jobject obj __attribute__((unused)), jobject gdkGraphicsEnv __attribute__((unused)))
+{
+#ifdef HAVE_XRANDR
+
+	GdkDisplay *display;
+	XRRScreenConfiguration *config;
+	int rate;
+	
+	display = (GdkDisplay *) NSA_GET_DISPLAY_PTR(env, gdkGraphicsEnv);
+	
+	gdk_threads_enter();
+	
+	config = XRRGetScreenInfo (GDK_DISPLAY_XDISPLAY(display), GDK_ROOT_WINDOW());
+
+	rate = (int) XRRConfigCurrentRate (config);
+
+    XRRFreeScreenConfigInfo (config);
+
+	gdk_threads_leave();
+	
+	return rate;
+#else
+    JCL_ThrowException(env,
+                       "java/lang/InternalError",
+                       "Method should not have been invoked.");
+    
+    return -1;
+#endif    
+}
+
+JNIEXPORT jint JNICALL
+Java_gnu_java_awt_peer_gtk_GdkScreenGraphicsDevice_nativeGetDisplayModeIndex
+(JNIEnv *env, jobject obj __attribute__((unused)), jobject gdkGraphicsEnv __attribute__((unused)))
+{
+#ifdef HAVE_XRANDR	
+
+	GdkDisplay *display;
+	XRRScreenConfiguration *config;
+	SizeID index;
+	Rotation rotation;
+	
+	display = (GdkDisplay *) NSA_GET_DISPLAY_PTR(env, gdkGraphicsEnv);
+	
+	gdk_threads_enter();
+	
+	config = XRRGetScreenInfo (GDK_DISPLAY_XDISPLAY(display), GDK_ROOT_WINDOW());
+
+	index = XRRConfigCurrentConfiguration (config, &rotation);
+
+    XRRFreeScreenConfigInfo (config);
+
+	gdk_threads_leave();
+	
+	return (int) index;
+
+#else
+
+    JCL_ThrowException(env,
+                       "java/lang/InternalError",
+                       "Method should not have been invoked.");
+   
+    return -1;
+   
+#endif	
+}
+
+JNIEXPORT jobjectArray JNICALL
+Java_gnu_java_awt_peer_gtk_GdkScreenGraphicsDevice_nativeGetDisplayModes
+(JNIEnv *env, jobject obj __attribute__((unused)), jobject gdkGraphicsEnv __attribute__((unused)))
+{
+#ifdef HAVE_XRANDR
+	GdkDisplay *display;
+	XRRScreenConfiguration *config;
+	XRRScreenSize *screenSizes;
+	int nsizes = 0, nrates = 0, i = 0;
+	jclass x11DisplayMode_class;
+	jmethodID x11DisplayMode_ctor;
+	jobjectArray array;
+	jobject instance;
+	short *rates;
+	jshortArray shortArray;
+	
+	display = (GdkDisplay *) NSA_GET_DISPLAY_PTR(env, gdkGraphicsEnv);
+	
+	gdk_threads_enter();
+	
+	config = XRRGetScreenInfo (GDK_DISPLAY_XDISPLAY(display), GDK_ROOT_WINDOW());
+	
+	screenSizes = XRRConfigSizes(config, &nsizes);
+	
+	x11DisplayMode_class = (*env)->FindClass(env, "gnu/java/awt/peer/gtk/GdkScreenGraphicsDevice$X11DisplayMode");
+    
+	x11DisplayMode_ctor = (*env)->GetMethodID(env, x11DisplayMode_class, "<init>", "(II[S)V");
+
+	array = (*env)->NewObjectArray(env, nsizes, x11DisplayMode_class, NULL);
+
+	for (; i < nsizes ; i++)
+	  {
+	  	/* Retrieves refresh rate information. */
+	  	rates = XRRConfigRates(config, i, &nrates);
+	  	
+	  	/* Create a Java short array and put them in. */
+	  	shortArray = (*env)->NewShortArray(env, nrates);
+		(*env)->SetShortArrayRegion(env, shortArray, 0, nrates, (jshort *) rates);
+	  	
+	  	/* Create a GdkScreenGraphicsDevice.X11DisplayMode instance. */
+        instance = (*env)->NewObject(env,
+									 x11DisplayMode_class,
+									 x11DisplayMode_ctor,
+									 screenSizes[i].width,
+									 screenSizes[i].height,
+									 shortArray);
+									 
+		/* Put it into the result array. */
+        (*env)->SetObjectArrayElement(env, array, i, instance);
+	  }
+	  
+	/* Free everything acquired by xlib. */
+	XRRFreeScreenConfigInfo (config);
+
+	gdk_threads_leave();
+	
+	return array;
+#else
+    JCL_ThrowException(env,
+                       "java/lang/InternalError",
+                       "Method should not have been invoked.");
+    
+    return NULL;
+   
+#endif	
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkScreenGraphicsDevice_nativeSetDisplayMode
+(JNIEnv *env, jobject obj __attribute__((unused)), jobject gdkGraphicsEnv __attribute__((unused)), jint index __attribute__((unused)), jshort rate __attribute__((unused)))
+{
+#ifdef HAVE_XRANDR
+	GdkDisplay *display;
+	XRRScreenConfiguration *config;
+	Rotation rotation;
+	
+	display = (GdkDisplay *) NSA_GET_DISPLAY_PTR(env, gdkGraphicsEnv);
+	
+	gdk_threads_enter();
+	
+	config = XRRGetScreenInfo (GDK_DISPLAY_XDISPLAY(display), GDK_ROOT_WINDOW());
+
+	/* The rotation is not exposed to the Java API. So we retrieve its current
+	 * value and set it to the same when switching resolution.
+	 */
+	XRRConfigCurrentConfiguration (config, &rotation);
+	
+	XRRSetScreenConfigAndRate (GDK_DISPLAY_XDISPLAY(display),
+                        		   config,
+                               GDK_ROOT_WINDOW(),
+                               index,
+                               rotation,
+                               rate,
+                               CurrentTime);
+	
+	XRRFreeScreenConfigInfo(config);
+	
+	gdk_threads_leave();
+
+#else
+    JCL_ThrowException(env,
+                       "java/lang/InternalError",
+                       "Method should not have been invoked.");
+#endif	
+}
+
+JNIEXPORT jobject JNICALL
+Java_gnu_java_awt_peer_gtk_GdkScreenGraphicsDevice_nativeGetBounds
+(JNIEnv *env, jobject obj)
+{
+	jclass rectangle_class;
+	jmethodID rectangle_ctor;
+	GdkScreen *screen;
+	GdkWindow *window;
+	int x, y, w, h;
+	jobject instance;
+    
+	rectangle_class = (*env)->FindClass(env, "java/awt/Rectangle");
+    
+    rectangle_ctor = (*env)->GetMethodID 
+    (env, rectangle_class, "<init>", "(IIII)V");
+
+    screen = (GdkScreen *) NSA_GET_SCREEN_PTR(env, obj);
+
+	gdk_threads_enter();
+	
+	window = gdk_screen_get_root_window(screen);
+	
+	gdk_window_get_geometry(window, &x, &y, &w, &h, NULL);
+
+	gdk_threads_leave();
+	
+    instance = (*env)->NewObject(env,
+								 rectangle_class,
+								 rectangle_ctor,
+								 x, y, w, h);
+	
+	return instance;
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,377 @@
+/* gtkbuttonpeer.c -- Native implementation of GtkButtonPeer
+   Copyright (C) 1998, 1999 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+#include "gtkpeer.h"
+#include "gnu_java_awt_peer_gtk_GtkButtonPeer.h"
+
+static jmethodID postActionEventID;
+
+void
+cp_gtk_button_init_jni (void)
+{
+  jclass gtkbuttonpeer;
+
+  gtkbuttonpeer = (*cp_gtk_gdk_env())->FindClass (cp_gtk_gdk_env(),
+                                           "gnu/java/awt/peer/gtk/GtkButtonPeer");
+
+  postActionEventID = (*cp_gtk_gdk_env())->GetMethodID (cp_gtk_gdk_env(),
+							gtkbuttonpeer,
+                                                  "postActionEvent", "(I)V");
+}
+
+static void clicked_cb (GtkButton *button,
+			jobject peer);
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkButtonPeer_create
+  (JNIEnv *env, jobject obj, jstring label)
+{
+  const char *c_label;
+  GtkWidget *eventbox;
+  GtkWidget *button;
+
+  gdk_threads_enter ();
+
+  NSA_SET_GLOBAL_REF (env, obj);
+
+  c_label = (*env)->GetStringUTFChars (env, label, NULL);
+
+  eventbox = gtk_event_box_new ();
+  button = gtk_button_new_with_label (c_label);
+  gtk_container_add (GTK_CONTAINER (eventbox), button);
+  gtk_widget_show (button);
+
+  (*env)->ReleaseStringUTFChars (env, label, c_label);
+  NSA_SET_PTR (env, obj, eventbox);
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkButtonPeer_gtkWidgetGetPreferredDimensions
+  (JNIEnv *env, jobject obj, jintArray jdims)
+{
+  void *ptr;
+  jint *dims;
+  GtkWidget *button;
+  GtkWidget *label;
+  GtkRequisition current_req;
+  GtkRequisition current_label_req;
+  GtkRequisition natural_req;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  button = gtk_bin_get_child (GTK_BIN (ptr));
+  label = gtk_bin_get_child (GTK_BIN (button));
+
+  dims = (*env)->GetIntArrayElements (env, jdims, 0);
+  dims[0] = dims[1] = 0;
+
+  /* Save the button's current size request. */
+  gtk_widget_size_request (GTK_WIDGET (button), &current_req);
+
+  /* Save the label's current size request. */
+  gtk_widget_size_request (GTK_WIDGET (label), &current_label_req);
+
+  /* Get the widget's "natural" size request. */
+  gtk_widget_set_size_request (GTK_WIDGET (button), -1, -1);
+  gtk_widget_set_size_request (GTK_WIDGET (label), -1, -1);
+
+  gtk_widget_size_request (GTK_WIDGET (button), &natural_req);
+
+  /* Reset the button's size request. */
+  gtk_widget_set_size_request (GTK_WIDGET (button),
+                               current_req.width, current_req.height);
+
+  /* Reset the label's size request. */
+  gtk_widget_set_size_request (GTK_WIDGET (label),
+                               current_label_req.width, current_label_req.height);
+
+  dims[0] = natural_req.width;
+  dims[1] = natural_req.height;
+
+  (*env)->ReleaseIntArrayElements (env, jdims, dims, 0);
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkButtonPeer_connectSignals
+  (JNIEnv *env, jobject obj)
+{
+  void *ptr;
+  jobject *gref;
+  GtkWidget *button;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+  gref = NSA_GET_GLOBAL_REF (env, obj);
+
+  button = gtk_bin_get_child (GTK_BIN (ptr));
+
+  /* Button signals */
+  g_signal_connect (G_OBJECT (button), "clicked",
+		    G_CALLBACK (clicked_cb), *gref);
+
+  /* Component signals */
+  cp_gtk_component_connect_signals (G_OBJECT (button), gref);
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkButtonPeer_gtkSetLabel
+  (JNIEnv *env, jobject obj, jstring jtext)
+{
+  const char *text;
+  GtkWidget *button;
+  GtkWidget *label;
+  void *ptr;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  text = (*env)->GetStringUTFChars (env, jtext, NULL);
+
+  button = gtk_bin_get_child (GTK_BIN (ptr));
+  label = gtk_bin_get_child (GTK_BIN (button));
+  gtk_label_set_text (GTK_LABEL (label), text);
+
+  (*env)->ReleaseStringUTFChars (env, jtext, text);
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkButtonPeer_gtkWidgetModifyFont
+  (JNIEnv *env, jobject obj, jstring name, jint style, jint size)
+{
+  const char *font_name;
+  void *ptr;
+  GtkWidget *button;
+  GtkWidget *label;
+  PangoFontDescription *font_desc;
+
+  gdk_threads_enter();
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  font_name = (*env)->GetStringUTFChars (env, name, NULL);
+
+  button = gtk_bin_get_child (GTK_BIN (ptr));
+  label = gtk_bin_get_child (GTK_BIN (button));
+
+  font_desc = pango_font_description_from_string (font_name);
+  pango_font_description_set_size (font_desc,
+                                   size * cp_gtk_dpi_conversion_factor);
+
+  if (style & AWT_STYLE_BOLD)
+    pango_font_description_set_weight (font_desc, PANGO_WEIGHT_BOLD);
+
+  if (style & AWT_STYLE_ITALIC)
+    pango_font_description_set_style (font_desc, PANGO_STYLE_OBLIQUE);
+
+  gtk_widget_modify_font (GTK_WIDGET(label), font_desc);
+
+  pango_font_description_free (font_desc);
+
+  (*env)->ReleaseStringUTFChars (env, name, font_name);
+
+  gdk_threads_leave();
+}
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkButtonPeer_gtkWidgetSetBackground
+  (JNIEnv *env, jobject obj, jint red, jint green, jint blue)
+{
+  GdkColor normal_color;
+  GdkColor prelight_color;
+  GdkColor active_color;
+  int prelight_red;
+  int prelight_blue;
+  int prelight_green;
+  GtkWidget *button;
+  void *ptr;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  normal_color.red = (red / 255.0) * 65535;
+  normal_color.green = (green / 255.0) * 65535;
+  normal_color.blue = (blue / 255.0) * 65535;
+
+  /* This calculation only approximate the active color produced by
+     Sun's AWT. */
+  active_color.red = 0.85 * (red / 255.0) * 65535;
+  active_color.green = 0.85 * (green / 255.0) * 65535;
+  active_color.blue = 0.85 * (blue / 255.0) * 65535;
+
+  /* There is no separate prelight color in Motif. */
+  prelight_red = 1.15 * (red / 255.0) * 65535;
+  prelight_green = 1.15 * (green / 255.0) * 65535;
+  prelight_blue = 1.15 * (blue / 255.0) * 65535;
+
+  prelight_color.red = prelight_red > 65535 ? 65535 : prelight_red;
+  prelight_color.green = prelight_green > 65535 ? 65535 : prelight_green;
+  prelight_color.blue = prelight_blue > 65535 ? 65535 : prelight_blue;
+
+  button = gtk_bin_get_child (GTK_BIN (ptr));
+
+  gtk_widget_modify_bg (button, GTK_STATE_NORMAL, &normal_color);
+  gtk_widget_modify_bg (button, GTK_STATE_ACTIVE, &active_color);
+  gtk_widget_modify_bg (button, GTK_STATE_PRELIGHT, &prelight_color);
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkButtonPeer_gtkWidgetSetForeground
+  (JNIEnv *env, jobject obj, jint red, jint green, jint blue)
+{
+  GdkColor color;
+  GtkWidget *button;
+  GtkWidget *label;
+  void *ptr;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  color.red = (red / 255.0) * 65535;
+  color.green = (green / 255.0) * 65535;
+  color.blue = (blue / 255.0) * 65535;
+
+  button = gtk_bin_get_child (GTK_BIN (ptr));
+  label = gtk_bin_get_child (GTK_BIN (button));
+
+  gtk_widget_modify_fg (label, GTK_STATE_NORMAL, &color);
+  gtk_widget_modify_fg (label, GTK_STATE_ACTIVE, &color);
+  gtk_widget_modify_fg (label, GTK_STATE_PRELIGHT, &color);
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkButtonPeer_gtkActivate
+  (JNIEnv *env, jobject obj)
+{
+  GtkWidget *button;
+  void *ptr;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  button = gtk_bin_get_child (GTK_BIN (ptr));
+  gtk_widget_activate (GTK_WIDGET (button));
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkButtonPeer_gtkWidgetRequestFocus
+  (JNIEnv *env, jobject obj)
+{
+  void *ptr;
+  GtkWidget *button;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  button = gtk_bin_get_child (GTK_BIN (ptr));
+  gtk_widget_grab_focus (button);
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkButtonPeer_setNativeBounds
+  (JNIEnv *env, jobject obj, jint x, jint y, jint width, jint height)
+{
+  GtkWidget *widget, *child;
+  void *ptr;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  widget = GTK_WIDGET (ptr);
+
+  /* We assume that -1 is a width or height and not a request for the
+     widget's natural size. */
+  width = width < 0 ? 0 : width;
+  height = height < 0 ? 0 : height;
+  child = gtk_bin_get_child (GTK_BIN (widget));
+
+  if (!(width == 0 && height == 0))
+    {
+      /* Set the event box's size request... */
+      gtk_widget_set_size_request (widget, width, height);
+      /* ...and the button's size request... */
+      gtk_widget_set_size_request (child, width, height);
+      /* ...and the label's size request. */
+      gtk_widget_set_size_request (gtk_bin_get_child (GTK_BIN (child)), width,
+						      height);
+      if (widget->parent != NULL)
+        gtk_fixed_move (GTK_FIXED (widget->parent), widget, x, y);
+    }
+
+  gdk_threads_leave ();
+}
+
+static void
+clicked_cb (GtkButton* button __attribute__((unused)),
+	    jobject peer)
+{
+  GdkEventButton* event;
+
+  event = (GdkEventButton*) gtk_get_current_event ();
+  g_assert (event);
+
+  (*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), peer,
+				       postActionEventID,
+				       cp_gtk_state_to_awt_mods (event->state));
+
+  gdk_event_free ((GdkEvent*) event);
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCanvasPeer.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCanvasPeer.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCanvasPeer.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCanvasPeer.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,58 @@
+/* gtkcanvaspeer.c -- Native implementation of GtkCanvasPeer
+   Copyright (C) 1999 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+#include "gtkpeer.h"
+#include "gnu_java_awt_peer_gtk_GtkCanvasPeer.h"
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkCanvasPeer_create
+  (JNIEnv *env, jobject obj)
+{
+  gpointer widget;
+
+  gdk_threads_enter ();
+
+  /* Create global reference and save it for future use */
+  NSA_SET_GLOBAL_REF (env, obj);
+
+  widget = gtk_drawing_area_new ();
+
+  NSA_SET_PTR (env, obj, widget);
+
+  gdk_threads_leave ();
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxMenuItemPeer.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxMenuItemPeer.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxMenuItemPeer.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxMenuItemPeer.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,78 @@
+/* gtkmenuitempeer.c -- Native implementation of GtkMenuItemPeer
+   Copyright (C) 1999 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+#include "gtkpeer.h"
+#include "gnu_java_awt_peer_gtk_GtkCheckboxMenuItemPeer.h"
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkCheckboxMenuItemPeer_create
+  (JNIEnv *env, jobject obj, jstring label)
+{
+  GtkWidget *widget;
+  const char *str;
+
+  gdk_threads_enter ();
+  
+  NSA_SET_GLOBAL_REF (env, obj);
+
+  str = (*env)->GetStringUTFChars (env, label, NULL);
+
+  widget = gtk_check_menu_item_new_with_label (str);
+  gtk_widget_show (widget);
+
+  (*env)->ReleaseStringUTFChars (env, label, str);
+
+  NSA_SET_PTR (env, obj, widget);
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkCheckboxMenuItemPeer_setState
+  (JNIEnv *env, jobject obj, jboolean state)
+{
+  void *ptr;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+  
+  gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (ptr), state);
+
+  gdk_threads_leave ();
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxPeer.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxPeer.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxPeer.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxPeer.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,407 @@
+/* gtkcheckboxpeer.c -- Native implementation of GtkCheckboxPeer
+   Copyright (C) 1998, 1999, 2002, 2003, 2004, 2006
+   Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+#include "gtkpeer.h"
+#include "gnu_java_awt_peer_gtk_GtkCheckboxPeer.h"
+#include "gnu_java_awt_peer_gtk_GtkComponentPeer.h"
+#include "jcl.h"
+
+static jmethodID postItemEventID;
+static jmethodID addToGroupMapID;
+static GtkWidget *checkbox_get_widget (GtkWidget *widget);
+static void item_toggled_cb (GtkToggleButton *item, jobject peer);
+
+void
+cp_gtk_checkbox_init_jni (void)
+{
+  jclass gtkcheckboxpeer;
+
+  gtkcheckboxpeer = (*cp_gtk_gdk_env())->FindClass (cp_gtk_gdk_env(),
+                                             "gnu/java/awt/peer/gtk/GtkCheckboxPeer");
+
+  postItemEventID = (*cp_gtk_gdk_env())->GetMethodID (cp_gtk_gdk_env(), gtkcheckboxpeer,
+                                               "postItemEvent", 
+                                               "(Ljava/lang/Object;Z)V");
+  
+  addToGroupMapID = (*cp_gtk_gdk_env())->GetMethodID (cp_gtk_gdk_env(), gtkcheckboxpeer,
+                                               "addToGroupMap", 
+                                               "(J)V");
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_connectSignals
+  (JNIEnv *env, jobject obj)
+{
+  void *ptr;
+  jobject *gref;
+  GtkWidget *bin;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+  gref = NSA_GET_GLOBAL_REF (env, obj);
+  bin = checkbox_get_widget (GTK_WIDGET (ptr));
+
+  /* Checkbox signals */
+  g_signal_connect (G_OBJECT (bin), "toggled",
+                    G_CALLBACK (item_toggled_cb), *gref);
+
+  /* Component signals */
+  cp_gtk_component_connect_signals (G_OBJECT (bin), gref);
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_gtkToggleButtonSetActive
+  (JNIEnv *env, jobject obj, jboolean is_active)
+{
+  void *ptr;
+  GtkWidget *bin;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+  bin = checkbox_get_widget (GTK_WIDGET (ptr));
+  
+  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (bin), is_active);
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_gtkWidgetModifyFont
+  (JNIEnv *env, jobject obj, jstring name, jint style, jint size)
+{
+  const char *font_name;
+  void *ptr;
+  GtkWidget *button;
+  GtkWidget *label;
+  PangoFontDescription *font_desc;
+
+  gdk_threads_enter();
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  button = checkbox_get_widget (GTK_WIDGET (ptr));
+  label = gtk_bin_get_child (GTK_BIN(button));
+
+  if (!label)
+    return;
+
+  font_name = (*env)->GetStringUTFChars (env, name, NULL);
+
+  font_desc = pango_font_description_from_string (font_name);
+  pango_font_description_set_size (font_desc,
+                                   size * cp_gtk_dpi_conversion_factor);
+
+  if (style & AWT_STYLE_BOLD)
+    pango_font_description_set_weight (font_desc, PANGO_WEIGHT_BOLD);
+
+  if (style & AWT_STYLE_ITALIC)
+    pango_font_description_set_style (font_desc, PANGO_STYLE_OBLIQUE);
+  
+  gtk_widget_modify_font (GTK_WIDGET(label), font_desc);
+  
+  pango_font_description_free (font_desc);
+  
+  (*env)->ReleaseStringUTFChars (env, name, font_name);
+  
+  gdk_threads_leave();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_gtkButtonSetLabel
+  (JNIEnv *env, jobject obj, jstring label)
+{
+  const char *c_label;
+  GtkWidget *label_widget;
+  void *ptr;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  c_label = (*env)->GetStringUTFChars (env, label, NULL);
+
+  label_widget = gtk_bin_get_child (GTK_BIN (checkbox_get_widget (GTK_WIDGET (ptr))));
+  gtk_label_set_text (GTK_LABEL (label_widget), c_label);
+
+  (*env)->ReleaseStringUTFChars (env, label, c_label);
+
+  gdk_threads_leave ();
+}
+
+/* A check button is created if we are not part of 
+   a group. 
+   This function is called when initially creating the
+   button, so an eventbox is created.
+ */
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_createCheckButton 
+  (JNIEnv *env, jobject obj)
+{
+  GtkWidget *button;
+  GtkWidget *eventbox;
+
+  gdk_threads_enter ();
+
+  NSA_SET_GLOBAL_REF (env, obj);
+  eventbox = gtk_event_box_new ();
+
+  button = gtk_check_button_new_with_label ("");
+  gtk_container_add (GTK_CONTAINER (eventbox), button);
+  gtk_widget_show (button); 
+
+  NSA_SET_PTR (env, obj, eventbox);
+
+  gdk_threads_leave ();
+}
+
+/* A radio button is created if we are part of a group. 
+   groupPointer points to the corresponding group. If 0,
+   a new group is created.
+   This function is called when initially creating the
+   button, so an eventbox is created.
+ */
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_createRadioButton 
+  (JNIEnv *env, jobject obj, jlong groupPointer)
+{
+  GtkWidget *button;
+  GtkWidget *eventbox;
+  GSList *native_group = NULL;
+  
+  gdk_threads_enter ();
+
+  NSA_SET_GLOBAL_REF (env, obj);
+  eventbox = gtk_event_box_new ();
+
+  if (groupPointer != 0)
+  {
+    native_group = JLONG_TO_PTR (GSList, groupPointer);
+    g_assert (GTK_IS_RADIO_BUTTON (native_group->data));
+  }
+  button = gtk_radio_button_new_with_label (native_group, "");
+  
+  if (native_group == NULL)
+    native_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (button));
+  if (g_slist_index (native_group, GTK_RADIO_BUTTON (button)) == -1)
+  {
+    native_group = g_slist_prepend (native_group, GTK_RADIO_BUTTON (button));
+    GTK_RADIO_BUTTON(button)->group = native_group;  
+  }
+  
+  gtk_container_add (GTK_CONTAINER (eventbox), button);
+  gtk_widget_show (button);
+  
+  NSA_SET_PTR (env, obj, eventbox);
+  
+  (*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), obj,
+                                addToGroupMapID,
+                                PTR_TO_JLONG (native_group));
+  
+  gdk_threads_leave ();
+}
+
+/* Add the object to the group pointed to by groupPointer.
+   If groupPointer is 0, create a new group and create
+   a radio button. Otherwise, creating a radio button in an
+   existing group.
+ */
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_addToGroup 
+  (JNIEnv *env, jobject obj, jlong groupPointer)
+{
+  void *ptr;
+  GtkWidget *container;
+  GtkWidget *check_button;
+  GtkWidget *radio_button;
+  const gchar *label;
+  GSList *native_group = NULL;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+  container = GTK_WIDGET (ptr);
+  check_button = checkbox_get_widget (container);
+  label = gtk_label_get_text (GTK_LABEL (gtk_bin_get_child 
+                                        (GTK_BIN (check_button))));
+                                        
+  /* Need to remove the check_button, and replace it with 
+     a radio button in a group.
+   */
+  if (groupPointer != 0)
+    {
+      native_group = JLONG_TO_PTR (GSList, groupPointer);
+      g_assert (GTK_IS_RADIO_BUTTON (native_group->data));
+    }
+      
+  radio_button = gtk_radio_button_new_with_label (native_group, label);
+  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio_button), 
+             gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check_button)));
+  
+  if (native_group == NULL)
+    native_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio_button));
+  if (g_slist_index (native_group, GTK_RADIO_BUTTON (radio_button)) == -1)
+  {
+    native_group = g_slist_prepend (native_group, GTK_RADIO_BUTTON (radio_button));
+    GTK_RADIO_BUTTON(radio_button)->group = native_group;
+  }
+             
+  gtk_container_remove (GTK_CONTAINER (container), check_button);
+  gtk_container_add (GTK_CONTAINER (container), radio_button);
+  gtk_widget_show (radio_button);
+  
+  (*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), obj,
+                                addToGroupMapID,
+                                PTR_TO_JLONG (native_group));
+  
+  gdk_threads_leave ();
+}
+
+/* Remove the object from the group pointed to by groupPointer.
+   We are removing the radio button and creating a check button. 
+ */
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_removeFromGroup 
+  (JNIEnv *env, jobject obj)
+{
+  void *ptr;
+  GtkWidget *container;
+  GtkWidget *check_button;
+  GtkWidget *radio_button;
+  GSList *native_group;
+  const gchar *label;
+    
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+  container = GTK_WIDGET (ptr);
+  radio_button = checkbox_get_widget (container);
+  label = gtk_label_get_text (GTK_LABEL (gtk_bin_get_child 
+                                        (GTK_BIN (radio_button))));
+                                        
+  /* Need to remove the radio_button, and replace it with 
+     a check button.
+   */   
+  check_button = gtk_check_button_new_with_label (label);
+  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check_button), 
+             gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (radio_button))); 
+             
+  native_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio_button));
+  native_group = g_slist_remove (native_group, GTK_RADIO_BUTTON (radio_button));
+  
+  if (native_group && ! GTK_IS_RADIO_BUTTON (native_group->data))
+    native_group = NULL;
+  
+  GTK_RADIO_BUTTON(radio_button)->group = NULL;
+  
+  gtk_container_remove (GTK_CONTAINER (container), radio_button);  
+  gtk_container_add (GTK_CONTAINER (container), check_button);
+  gtk_widget_show (check_button);
+  
+  (*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), obj,
+                                addToGroupMapID,
+                                PTR_TO_JLONG (native_group));
+  
+  gdk_threads_leave ();
+}
+
+/* Move the radio button to a new group. If groupPointer is
+   0, create a new group.
+ */
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_switchToGroup 
+  (JNIEnv *env, jobject obj, jlong groupPointer)
+{
+  void *ptr;
+  GtkWidget *radio_button;
+  GSList *native_group = NULL;
+  
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+  radio_button = checkbox_get_widget (GTK_WIDGET (ptr));
+  
+  native_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio_button));
+  native_group = g_slist_remove (native_group, GTK_RADIO_BUTTON (radio_button));
+  GTK_RADIO_BUTTON(radio_button)->group = NULL;
+  
+  if (groupPointer != 0)
+  {
+    native_group = JLONG_TO_PTR (GSList, groupPointer);
+    g_assert (GTK_IS_RADIO_BUTTON (native_group->data));
+  }
+  gtk_radio_button_set_group (GTK_RADIO_BUTTON (radio_button), native_group);
+  
+  native_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio_button));
+  if (g_slist_index (native_group, GTK_RADIO_BUTTON (radio_button)) == -1)
+  {
+    native_group = g_slist_prepend (native_group, GTK_RADIO_BUTTON (radio_button));
+    GTK_RADIO_BUTTON(radio_button)->group = native_group;
+  }
+   
+  (*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), obj,
+                                addToGroupMapID,
+                                PTR_TO_JLONG (native_group));
+  
+  gdk_threads_leave ();
+}
+
+static void
+item_toggled_cb (GtkToggleButton *item, jobject peer)
+{
+  (*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), peer,
+                                postItemEventID,
+                                peer,
+                                item->active);
+}
+
+static GtkWidget *
+checkbox_get_widget (GtkWidget *widget)
+{
+  GtkWidget *wid;
+
+  g_assert (GTK_IS_EVENT_BOX (widget));
+  wid = gtk_bin_get_child (GTK_BIN(widget));
+
+  return wid;
+}
+

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,239 @@
+/* gtkchoicepeer.c -- Native implementation of GtkChoicePeer
+   Copyright (C) 1998, 1999, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+#include "gtkpeer.h"
+#include "gnu_java_awt_peer_gtk_GtkChoicePeer.h"
+
+static jmethodID postChoiceItemEventID;
+static GtkWidget *choice_get_widget (GtkWidget *widget);
+
+void
+cp_gtk_choice_init_jni (void)
+{
+  jclass gtkchoicepeer;
+
+  gtkchoicepeer = (*cp_gtk_gdk_env())->FindClass (cp_gtk_gdk_env(),
+                                        "gnu/java/awt/peer/gtk/GtkChoicePeer");
+
+  postChoiceItemEventID = (*cp_gtk_gdk_env())->GetMethodID (cp_gtk_gdk_env(), gtkchoicepeer,
+                                               "postChoiceItemEvent",
+                                               "(I)V");
+}
+
+static void selection_changed_cb (GtkComboBox *combobox, jobject peer);
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkChoicePeer_create 
+  (JNIEnv *env, jobject obj)
+{
+  GtkWidget *combobox;
+  GtkWidget *eventbox;
+  jobject *gref;
+
+  gdk_threads_enter ();
+  
+  NSA_SET_GLOBAL_REF (env, obj);
+  gref = NSA_GET_GLOBAL_REF (env, obj);
+  
+  eventbox = gtk_event_box_new ();
+  combobox = gtk_combo_box_new_text ();
+  gtk_container_add (GTK_CONTAINER (eventbox), combobox);
+  gtk_widget_show (combobox);  
+
+  NSA_SET_PTR (env, obj, eventbox);
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkChoicePeer_connectSignals
+  (JNIEnv *env, jobject obj)
+{
+  void *ptr = NULL;
+  jobject *gref = NULL;
+  GtkWidget *bin;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+  gref = NSA_GET_GLOBAL_REF (env, obj);
+
+  bin = choice_get_widget (GTK_WIDGET (ptr));
+
+  /* Choice signals */
+  g_signal_connect (G_OBJECT (bin), "changed",
+                    G_CALLBACK (selection_changed_cb), *gref);
+
+  /* Component signals */
+  cp_gtk_component_connect_signals (G_OBJECT (bin), gref);
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkChoicePeer_add 
+  (JNIEnv *env, jobject obj, jstring item, jint index)
+{
+  void *ptr;
+  const char *label;
+  GtkWidget *bin;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+  bin = choice_get_widget (GTK_WIDGET (ptr));
+    
+  label = (*env)->GetStringUTFChars (env, item, 0);      
+
+  gtk_combo_box_insert_text (GTK_COMBO_BOX (bin), index, label);
+
+  (*env)->ReleaseStringUTFChars (env, item, label);
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkChoicePeer_nativeRemove 
+  (JNIEnv *env, jobject obj, jint index)
+{
+  void *ptr;
+  GtkWidget *bin;
+  
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+  bin = choice_get_widget (GTK_WIDGET (ptr));
+
+  /* First, unselect everything, to avoid problems when removing items. */
+  gtk_combo_box_set_active (GTK_COMBO_BOX (bin), -1);
+  gtk_combo_box_remove_text (GTK_COMBO_BOX (bin), index);
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkChoicePeer_nativeRemoveAll
+  (JNIEnv *env, jobject obj)
+{
+  void *ptr;
+  GtkTreeModel *model;
+  GtkWidget *bin;
+  gint count, i;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+  bin = choice_get_widget (GTK_WIDGET (ptr));
+  
+  model = gtk_combo_box_get_model (GTK_COMBO_BOX (bin));
+  count = gtk_tree_model_iter_n_children (model, NULL);
+
+  /* First, unselect everything, to avoid problems when removing items. */
+  gtk_combo_box_set_active (GTK_COMBO_BOX (bin), -1);
+
+  for (i = count - 1; i >= 0; i--) {
+    gtk_combo_box_remove_text (GTK_COMBO_BOX (bin), i);
+  }
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkChoicePeer_selectNative
+  (JNIEnv *env, jobject obj, jint index)
+{
+  gdk_threads_enter ();
+
+  Java_gnu_java_awt_peer_gtk_GtkChoicePeer_selectNativeUnlocked
+    (env, obj, index);
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkChoicePeer_selectNativeUnlocked
+  (JNIEnv *env, jobject obj, jint index)
+{
+  void *ptr;
+  GtkWidget *bin;
+  
+  ptr = NSA_GET_PTR (env, obj);
+  bin = choice_get_widget (GTK_WIDGET (ptr));
+  gtk_combo_box_set_active (GTK_COMBO_BOX (bin), (gint)index);
+}
+
+JNIEXPORT jint JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkChoicePeer_nativeGetSelected 
+  (JNIEnv *env, jobject obj)
+{
+  void *ptr;
+  int index;
+  GtkWidget *bin;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+  bin = choice_get_widget (GTK_WIDGET (ptr));
+  
+  index = gtk_combo_box_get_active (GTK_COMBO_BOX (bin));
+
+  gdk_threads_leave ();
+
+  return index;
+}
+
+static void
+selection_changed_cb (GtkComboBox *combobox, jobject peer)
+{
+  gint index = gtk_combo_box_get_active(combobox);
+
+  if (index >= 0)
+    (*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), peer,
+					 postChoiceItemEventID, (jint)index );
+}
+
+static GtkWidget *
+choice_get_widget (GtkWidget *widget)
+{
+  GtkWidget *wid;
+
+  g_assert (GTK_IS_EVENT_BOX (widget));
+  wid = gtk_bin_get_child (GTK_BIN(widget));
+
+  return wid;
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkClipboard.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkClipboard.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkClipboard.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkClipboard.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,417 @@
+/* gtkclipboard.c
+   Copyright (C) 1998, 1999, 2005, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+#include "jcl.h"
+#include "gtkpeer.h"
+#include "gnu_java_awt_peer_gtk_GtkClipboard.h"
+
+#define OBJECT_TARGET 1
+#define TEXT_TARGET   2
+#define IMAGE_TARGET  3
+#define URI_TARGET    4
+
+/* The clipboard and selection plus corresponding GtkClipboard objects. */
+GtkClipboard *cp_gtk_clipboard;
+GtkClipboard *cp_gtk_selection;
+
+jobject cp_gtk_clipboard_instance;
+jobject cp_gtk_selection_instance;
+
+/* Standard (string targets) shared with GtkSelection. */
+jstring cp_gtk_stringTarget;
+jstring cp_gtk_imageTarget;
+jstring cp_gtk_filesTarget;
+
+static jclass gtk_clipboard_class;
+
+static jmethodID setSystemContentsID;
+static jmethodID provideContentID;
+static jmethodID provideTextID;
+static jmethodID provideImageID;
+static jmethodID provideURIsID;
+
+/* Called when clipboard owner changes. Used to update available targets. */
+#if GTK_MINOR_VERSION > 4
+static void
+clipboard_owner_change_cb (GtkClipboard *clipboard,
+			   GdkEvent *event __attribute__((unused)),
+			   gpointer user_data __attribute__((unused)))
+{
+  JNIEnv *env = cp_gtk_gdk_env ();
+  if (clipboard == cp_gtk_clipboard)
+    (*env)->CallVoidMethod (env, cp_gtk_clipboard_instance,
+			    setSystemContentsID, JNI_FALSE);
+  else
+    (*env)->CallVoidMethod (env, cp_gtk_selection_instance,
+                            setSystemContentsID, JNI_FALSE);
+
+}
+#endif
+
+JNIEXPORT jboolean JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkClipboard_initNativeState (JNIEnv *env,
+							 jclass clz,
+							 jobject gtkclipboard,
+							 jobject gtkselection,
+							 jstring string,
+							 jstring image,
+							 jstring files)
+{
+  GdkDisplay* display;
+  jboolean can_cache;
+
+  gtk_clipboard_class = clz;
+  setSystemContentsID = (*env)->GetMethodID (env, gtk_clipboard_class,
+					     "setSystemContents",
+					     "(Z)V");
+  if (setSystemContentsID == NULL)
+    return JNI_FALSE;
+
+  provideContentID = (*env)->GetMethodID (env, gtk_clipboard_class,
+					  "provideContent",
+					  "(Ljava/lang/String;)[B");
+  if (provideContentID == NULL)
+    return JNI_FALSE;
+  
+  provideTextID = (*env)->GetMethodID (env, gtk_clipboard_class,
+				       "provideText",
+				       "()Ljava/lang/String;");
+  if (provideTextID == NULL)
+    return JNI_FALSE;
+  
+  provideImageID = (*env)->GetMethodID (env, gtk_clipboard_class,
+					"provideImage",
+					"()Lgnu/java/awt/peer/gtk/GtkImage;");
+  if (provideImageID == NULL)
+    return JNI_FALSE;
+  
+  provideURIsID = (*env)->GetMethodID (env, gtk_clipboard_class,
+				       "provideURIs",
+				       "()[Ljava/lang/String;");
+  if (provideURIsID == NULL)
+    return JNI_FALSE;
+  
+  cp_gtk_clipboard_instance = (*env)->NewGlobalRef(env, gtkclipboard);
+  cp_gtk_selection_instance = (*env)->NewGlobalRef(env, gtkselection);
+  
+  cp_gtk_stringTarget = (*env)->NewGlobalRef(env, string);
+  cp_gtk_imageTarget = (*env)->NewGlobalRef(env, image);
+  cp_gtk_filesTarget = (*env)->NewGlobalRef(env, files);
+
+  gdk_threads_enter ();
+  cp_gtk_clipboard = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD);
+  cp_gtk_selection = gtk_clipboard_get (GDK_SELECTION_PRIMARY);
+
+  display = gtk_clipboard_get_display (cp_gtk_clipboard);
+  /* Check for support for clipboard owner changes. */
+#if GTK_MINOR_VERSION > 4
+  if (gdk_display_supports_selection_notification (display))
+    {
+      g_signal_connect (cp_gtk_clipboard, "owner-change",
+			G_CALLBACK (clipboard_owner_change_cb), NULL);
+      g_signal_connect (cp_gtk_selection, "owner-change",
+			G_CALLBACK (clipboard_owner_change_cb), NULL);
+      gdk_display_request_selection_notification (display,
+						  GDK_SELECTION_CLIPBOARD);
+      gdk_display_request_selection_notification (display,
+						  GDK_SELECTION_PRIMARY);
+      can_cache = JNI_TRUE;
+    }
+  else
+#endif
+    can_cache = JNI_FALSE;
+
+  gdk_threads_leave ();
+
+  return can_cache;
+}
+
+static void
+clipboard_get_func (GtkClipboard *clipboard,
+		    GtkSelectionData *selection,
+		    guint info,
+		    gpointer user_data __attribute__((unused)))
+{
+  jobject gtk_clipboard_instance;
+  JNIEnv *env = cp_gtk_gdk_env ();
+  
+  if (clipboard == cp_gtk_clipboard)
+    gtk_clipboard_instance = cp_gtk_clipboard_instance;
+  else
+    gtk_clipboard_instance = cp_gtk_selection_instance;
+
+  if (info == OBJECT_TARGET)
+    {
+      const gchar *target_name;
+      jstring target_string;
+      jbyteArray bytes;
+      jint len;
+      jbyte *barray;
+
+      target_name = gdk_atom_name (selection->target);
+      if (target_name == NULL)
+	return;
+      target_string = (*env)->NewStringUTF (env, target_name);
+      if (target_string == NULL)
+	return;
+      bytes = (*env)->CallObjectMethod(env,
+				       gtk_clipboard_instance,
+				       provideContentID,
+				       target_string);
+      if (bytes == NULL)
+	return;
+      len = (*env)->GetArrayLength(env, bytes);
+      if (len <= 0)
+	return;
+      barray = (*env)->GetByteArrayElements(env, bytes, NULL);
+      if (barray == NULL)
+	return;
+      gtk_selection_data_set (selection, selection->target, 8,
+			      (guchar *) barray, len);
+
+      (*env)->ReleaseByteArrayElements(env, bytes, barray, 0);
+
+    }
+  else if (info == TEXT_TARGET)
+    {
+      jstring string;
+      const gchar *text;
+      int len;
+      string = (*env)->CallObjectMethod(env,
+					gtk_clipboard_instance,
+					provideTextID);
+      if (string == NULL)
+	return;
+      len = (*env)->GetStringUTFLength (env, string);
+      if (len == -1)
+	return;
+      text = (*env)->GetStringUTFChars (env, string, NULL);
+      if (text == NULL)
+	return;
+
+      gtk_selection_data_set_text (selection, text, len);
+      (*env)->ReleaseStringUTFChars (env, string, text);
+    }
+  /* Images and URIs/Files support only available with gtk+2.6 or higher. */
+#if GTK_MINOR_VERSION > 4
+  else if (info == IMAGE_TARGET)
+    {
+      jobject gtkimage;
+      GdkPixbuf *pixbuf = NULL;
+      
+      gtkimage = (*env)->CallObjectMethod(env,
+					  gtk_clipboard_instance,
+					  provideImageID);
+      if (gtkimage == NULL)
+	return;
+      
+      pixbuf = cp_gtk_image_get_pixbuf (env, gtkimage);
+      if (pixbuf != NULL)
+	gtk_selection_data_set_pixbuf (selection, pixbuf);
+    }
+  else if (info == URI_TARGET)
+    {
+      jobjectArray uris;
+      jint count;
+      int i;
+      gchar **list;
+
+      uris = (*env)->CallObjectMethod(env,
+				      gtk_clipboard_instance,
+				      provideURIsID);
+      if (uris == NULL)
+	return;
+      count = (*env)->GetArrayLength (env, uris);
+      if (count <= 0)
+	return;
+
+      list = (gchar **) JCL_malloc (env, (count + 1) * sizeof (gchar *));
+      for (i = 0; i < count; i++)
+	{
+	  const char *text;
+	  jstring uri;
+	  
+	  /* Mark NULL in so case of some error we can find the end. */
+	  list[i] = NULL;
+	  uri = (*env)->GetObjectArrayElement (env, uris, i);
+	  if (uri == NULL)
+	    break;
+	  text = (*env)->GetStringUTFChars (env, uri, NULL);
+	  if (text == NULL)
+	    break;
+	  list[i] = strdup (text);
+	  (*env)->ReleaseStringUTFChars (env, uri, text);
+	}
+
+      if (i == count)
+	{
+	  list[count] = NULL;
+	  gtk_selection_data_set_uris (selection, list);
+	}
+
+      for (i = 0; list[i] != NULL; i++)
+	free (list[i]);
+      JCL_free (env, list);
+    }
+#endif
+}
+
+static void
+clipboard_clear_func (GtkClipboard *clipboard,
+		      gpointer user_data __attribute__((unused)))
+{
+  JNIEnv *env = cp_gtk_gdk_env();
+  if (clipboard == cp_gtk_clipboard)
+    (*env)->CallVoidMethod (env, cp_gtk_clipboard_instance,
+			    setSystemContentsID, JNI_TRUE);
+  else
+    (*env)->CallVoidMethod (env, cp_gtk_selection_instance,
+                            setSystemContentsID, JNI_TRUE);
+
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkClipboard_advertiseContent
+(JNIEnv *env,
+ jobject instance,
+ jobjectArray mime_array,
+#if GTK_MINOR_VERSION > 4
+ jboolean add_text, jboolean add_images, jboolean add_uris)
+#else
+ jboolean add_text __attribute__((unused)),
+ jboolean add_images __attribute__((unused)),
+ jboolean add_uris __attribute__((unused)))
+#endif
+{
+  GtkTargetList *target_list;
+  GList *list;
+  GtkTargetEntry *targets;
+  gint n, i;
+
+  gdk_threads_enter ();
+  target_list = gtk_target_list_new (NULL, 0);
+
+  if (mime_array != NULL)
+    {
+      n = (*env)->GetArrayLength (env, mime_array);
+      for (i = 0; i < n; i++)
+	{
+	  const char *text;
+	  jstring target;
+	  GdkAtom atom;
+
+	  target = (*env)->GetObjectArrayElement (env, mime_array, i);
+	  if (target == NULL)
+	    break;
+	  text = (*env)->GetStringUTFChars (env, target, NULL);
+	  if (text == NULL)
+	    break;
+
+	  atom = gdk_atom_intern (text, FALSE);
+	  gtk_target_list_add (target_list, atom, 0, OBJECT_TARGET);
+
+	  (*env)->ReleaseStringUTFChars (env, target, text);
+	}
+    }
+
+  /* Add extra targets that gtk+ can provide/translate for us. */
+#if GTK_MINOR_VERSION > 4
+  if (add_text)
+    gtk_target_list_add_text_targets (target_list, TEXT_TARGET);
+  if (add_images)
+    gtk_target_list_add_image_targets (target_list, IMAGE_TARGET, TRUE);
+  if (add_uris)
+    gtk_target_list_add_uri_targets (target_list, URI_TARGET);
+#else
+  if (add_text)
+    gtk_target_list_add (target_list,
+	                 gdk_atom_intern ("STRING", FALSE),
+	                 0, TEXT_TARGET);
+#endif
+
+
+  /* Turn list into a target table. */
+  n = g_list_length (target_list->list);
+  if (n > 0)
+    {
+      targets = g_new (GtkTargetEntry, n);
+      for (list = target_list->list, i = 0;
+	   list != NULL;
+	   list = list->next, i++)
+	{
+	  GtkTargetPair *pair = (GtkTargetPair *) list->data;
+	  targets[i].target = gdk_atom_name (pair->target);
+	  targets[i].flags = pair->flags;
+	  targets[i].info = pair->info;
+	}
+
+      /* Set the targets plus callback functions and ask for the clipboard
+	 to be stored when the application exists if supported. */
+      if ((*env)->IsSameObject(env, instance, cp_gtk_clipboard_instance))
+	{
+	  if (gtk_clipboard_set_with_data (cp_gtk_clipboard, targets, n,
+					   clipboard_get_func,
+					   clipboard_clear_func,
+					   NULL))
+	    {
+#if GTK_MINOR_VERSION > 4
+	      gtk_clipboard_set_can_store (cp_gtk_clipboard, NULL, 0);
+#endif
+	    }
+	}
+      else
+	{
+	  if (gtk_clipboard_set_with_data (cp_gtk_selection, targets, n,
+					   clipboard_get_func,
+					   clipboard_clear_func,
+					   NULL))
+	    {
+#if GTK_MINOR_VERSION > 4
+	      gtk_clipboard_set_can_store (cp_gtk_selection, NULL, 0);
+#endif
+	    }
+	}
+
+      for (i = 0; i < n; i++)
+	g_free (targets[i].target);
+      g_free (targets);
+    }
+
+  gtk_target_list_unref (target_list);
+  gdk_threads_leave ();
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,1244 @@
+/* gtkcomponentpeer.c -- Native implementation of GtkComponentPeer
+   Copyright (C) 1998, 1999, 2002, 2004, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+#include "gtkpeer.h"
+#include "gnu_java_awt_peer_gtk_GtkComponentPeer.h"
+
+#include <gtk/gtkprivate.h>
+
+#define AWT_DEFAULT_CURSOR 0
+#define AWT_CROSSHAIR_CURSOR 1
+#define AWT_TEXT_CURSOR 2
+#define AWT_WAIT_CURSOR 3
+#define AWT_SW_RESIZE_CURSOR 4
+#define AWT_SE_RESIZE_CURSOR 5
+#define AWT_NW_RESIZE_CURSOR 6
+#define AWT_NE_RESIZE_CURSOR 7
+#define AWT_N_RESIZE_CURSOR 8
+#define AWT_S_RESIZE_CURSOR 9
+#define AWT_W_RESIZE_CURSOR 10
+#define AWT_E_RESIZE_CURSOR 11
+#define AWT_HAND_CURSOR 12
+#define AWT_MOVE_CURSOR 13
+
+/* FIXME: use gtk-double-click-time, gtk-double-click-distance */
+#define MULTI_CLICK_TIME   250
+/* as opposed to a MULTI_PASS_TIME :) */
+
+#define AWT_MOUSE_CLICKED  500
+#define AWT_MOUSE_PRESSED  501
+#define AWT_MOUSE_RELEASED 502
+#define AWT_MOUSE_MOVED    503
+#define AWT_MOUSE_ENTERED  504
+#define AWT_MOUSE_EXITED   505
+#define AWT_MOUSE_DRAGGED  506
+#define AWT_MOUSE_WHEEL    507
+
+#define AWT_WHEEL_UNIT_SCROLL 0
+
+#define AWT_FOCUS_GAINED 1004
+#define AWT_FOCUS_LOST 1005
+
+static GtkWidget *find_fg_color_widget (GtkWidget *widget);
+static GtkWidget *find_bg_color_widget (GtkWidget *widget);
+static GtkWidget *get_widget (GtkWidget *widget);
+
+static jmethodID postMouseEventID;
+static jmethodID postMouseWheelEventID;
+static jmethodID postExposeEventID;
+static jmethodID postFocusEventID;
+
+void
+cp_gtk_component_init_jni (void)
+ {
+  jclass gtkcomponentpeer;
+
+  gtkcomponentpeer = (*cp_gtk_gdk_env())->FindClass (cp_gtk_gdk_env(),
+                                     "gnu/java/awt/peer/gtk/GtkComponentPeer");
+
+  postMouseEventID = (*cp_gtk_gdk_env())->GetMethodID (cp_gtk_gdk_env(), gtkcomponentpeer,
+                                               "postMouseEvent", "(IJIIIIZ)V");
+
+  postMouseWheelEventID = (*cp_gtk_gdk_env())->GetMethodID (cp_gtk_gdk_env(),
+						        gtkcomponentpeer,
+						        "postMouseWheelEvent",
+							"(IJIIIIZIII)V");
+
+  postExposeEventID = (*cp_gtk_gdk_env())->GetMethodID (cp_gtk_gdk_env(), gtkcomponentpeer,
+                                                 "postExposeEvent", "(IIII)V");
+
+  postFocusEventID = (*cp_gtk_gdk_env())->GetMethodID (cp_gtk_gdk_env(), gtkcomponentpeer,
+                                                "postFocusEvent", "(IZ)V");
+}
+
+static gboolean component_button_press_cb (GtkWidget *widget,
+                                           GdkEventButton *event,
+                                           jobject peer);
+static gboolean component_button_release_cb (GtkWidget *widget,
+                                             GdkEventButton *event,
+                                             jobject peer);
+static gboolean component_motion_notify_cb (GtkWidget *widget,
+                                            GdkEventMotion *event,
+                                            jobject peer);
+static gboolean component_scroll_cb (GtkWidget *widget,
+				     GdkEventScroll *event,
+				     jobject peer);
+static gboolean component_enter_notify_cb (GtkWidget *widget,
+                                           GdkEventCrossing *event,
+                                           jobject peer);
+static gboolean component_leave_notify_cb (GtkWidget *widget,
+                                           GdkEventCrossing *event,
+                                           jobject peer);
+static gboolean component_expose_cb (GtkWidget *widget,
+                                     GdkEventExpose *event,
+                                     jobject peer);
+static gboolean component_focus_in_cb (GtkWidget *widget,
+                                       GdkEventFocus *event,
+                                       jobject peer);
+static gboolean component_focus_out_cb (GtkWidget *widget,
+                                        GdkEventFocus *event,
+                                        jobject peer);
+
+static jint
+button_to_awt_mods (int button)
+{
+  switch (button)
+    {
+    case 1:
+      return AWT_BUTTON1_DOWN_MASK | AWT_BUTTON1_MASK;
+    case 2:
+      return AWT_BUTTON2_DOWN_MASK | AWT_BUTTON2_MASK;
+    case 3:
+      return AWT_BUTTON3_DOWN_MASK | AWT_BUTTON3_MASK;
+    }
+
+  return 0;
+}
+
+jint
+cp_gtk_state_to_awt_mods (guint state)
+{
+  jint result = 0;
+
+  if (state & GDK_SHIFT_MASK)
+    result |= (AWT_SHIFT_DOWN_MASK | AWT_SHIFT_MASK);
+  if (state & GDK_CONTROL_MASK)
+    result |= (AWT_CTRL_DOWN_MASK | AWT_CTRL_MASK);
+  if (state & GDK_MOD1_MASK)
+    result |= (AWT_ALT_DOWN_MASK | AWT_ALT_MASK);
+
+  return result;
+}
+
+static jint
+state_to_awt_mods_with_button_states (guint state)
+{
+  jint result = 0;
+
+  if (state & GDK_SHIFT_MASK)
+    result |= AWT_SHIFT_DOWN_MASK | AWT_SHIFT_MASK;
+  if (state & GDK_CONTROL_MASK)
+    result |= AWT_CTRL_DOWN_MASK | AWT_CTRL_MASK;
+  if (state & GDK_MOD1_MASK)
+    result |= AWT_ALT_DOWN_MASK | AWT_ALT_MASK;
+  if (state & GDK_BUTTON1_MASK)
+    result |= AWT_BUTTON1_DOWN_MASK | AWT_BUTTON1_MASK;
+  if (state & GDK_BUTTON2_MASK)
+    result |= AWT_BUTTON2_DOWN_MASK;
+  if (state & GDK_BUTTON3_MASK)
+    result |= AWT_BUTTON3_DOWN_MASK;
+
+  return result;
+}
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetSetCursor 
+  (JNIEnv *env, jobject obj, jint type, jobject image, jint x, jint y) 
+{
+  gdk_threads_enter ();
+
+  Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetSetCursorUnlocked
+    (env, obj, type, image, x, y);
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetSetCursorUnlocked
+  (JNIEnv *env, jobject obj, jint type, jobject image, jint x, jint y) 
+{
+  void *ptr;
+  GtkWidget *widget;
+  GdkWindow *win;
+  GdkCursorType gdk_cursor_type;
+  GdkCursor *gdk_cursor;
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  switch (type)
+    {
+    case AWT_CROSSHAIR_CURSOR:
+      gdk_cursor_type = GDK_CROSSHAIR;
+      break;
+    case AWT_TEXT_CURSOR:
+      gdk_cursor_type = GDK_XTERM;
+      break;
+    case AWT_WAIT_CURSOR:
+      gdk_cursor_type = GDK_WATCH;
+      break;
+    case AWT_SW_RESIZE_CURSOR:
+      gdk_cursor_type = GDK_BOTTOM_LEFT_CORNER;
+      break;
+    case AWT_SE_RESIZE_CURSOR:
+      gdk_cursor_type = GDK_BOTTOM_RIGHT_CORNER;
+      break;
+    case AWT_NW_RESIZE_CURSOR:
+      gdk_cursor_type = GDK_TOP_LEFT_CORNER;
+      break;
+    case AWT_NE_RESIZE_CURSOR:
+      gdk_cursor_type = GDK_TOP_RIGHT_CORNER;
+      break;
+    case AWT_N_RESIZE_CURSOR:
+      gdk_cursor_type = GDK_TOP_SIDE;
+      break;
+    case AWT_S_RESIZE_CURSOR:
+      gdk_cursor_type = GDK_BOTTOM_SIDE;
+      break;
+    case AWT_W_RESIZE_CURSOR:
+      gdk_cursor_type = GDK_LEFT_SIDE;
+      break;
+    case AWT_E_RESIZE_CURSOR:
+      gdk_cursor_type = GDK_RIGHT_SIDE;
+      break;
+    case AWT_HAND_CURSOR:
+      gdk_cursor_type = GDK_HAND2;
+      break;
+    case AWT_MOVE_CURSOR:
+      gdk_cursor_type = GDK_FLEUR;
+      break;
+    default:
+      gdk_cursor_type = GDK_LEFT_PTR;
+    }
+      
+  widget = get_widget(GTK_WIDGET(ptr));
+  
+  win = widget->window;
+  if ((widget->window) == NULL)
+    win = GTK_WIDGET(ptr)->window;
+    
+  if (image == NULL)
+    gdk_cursor = gdk_cursor_new (gdk_cursor_type);
+  else
+    gdk_cursor
+      = gdk_cursor_new_from_pixbuf (gdk_drawable_get_display (win),
+				    cp_gtk_image_get_pixbuf (env, image),
+				    x, y);
+
+  gdk_window_set_cursor (win, gdk_cursor);
+  gdk_cursor_unref (gdk_cursor);
+
+  /* Make sure the cursor is replaced on screen. */
+  gdk_flush();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetSetParent
+  (JNIEnv *env, jobject obj, jobject parent)
+{
+  void *ptr;
+  void *parent_ptr;
+  GtkWidget *widget;
+  GtkWidget *parent_widget;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+  parent_ptr = NSA_GET_PTR (env, parent);
+  
+  widget = GTK_WIDGET (ptr);
+  parent_widget = get_widget(GTK_WIDGET (parent_ptr));
+
+  if (widget->parent == NULL)
+    {
+      if (GTK_IS_WINDOW (parent_widget))
+	{
+	  GList *children = gtk_container_get_children
+	    (GTK_CONTAINER (parent_widget));
+
+          if (GTK_IS_MENU_BAR (children->data))
+            gtk_fixed_put (GTK_FIXED (children->next->data), widget, 0, 0);
+          else
+            gtk_fixed_put (GTK_FIXED (children->data), widget, 0, 0);
+        }
+      else
+        if (GTK_IS_SCROLLED_WINDOW (parent_widget))
+          {
+            gtk_scrolled_window_add_with_viewport 
+              (GTK_SCROLLED_WINDOW (parent_widget), widget);
+            gtk_viewport_set_shadow_type (GTK_VIEWPORT (widget->parent), 
+                                          GTK_SHADOW_NONE);
+
+          }
+        else
+          {
+            if (widget->parent == NULL)
+              gtk_fixed_put (GTK_FIXED (parent_widget), widget, 0, 0);
+          }
+    }
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetSetSensitive
+  (JNIEnv *env, jobject obj, jboolean sensitive)
+{
+  void *ptr;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  gtk_widget_set_sensitive (get_widget(GTK_WIDGET (ptr)), sensitive);
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT jboolean JNICALL
+Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetHasFocus
+(JNIEnv *env, jobject obj)
+{
+  void *ptr;
+  jboolean retval;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+  
+  retval = GTK_WIDGET_HAS_FOCUS((GTK_WIDGET (ptr)));
+
+  gdk_threads_leave ();
+
+  return retval;
+}
+
+JNIEXPORT jboolean JNICALL
+Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetCanFocus
+(JNIEnv *env, jobject obj)
+{
+  void *ptr;
+  jboolean retval;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+  
+  retval = GTK_WIDGET_CAN_FOCUS((GTK_WIDGET (ptr)));
+
+  gdk_threads_leave ();
+
+  return retval;
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetRequestFocus
+  (JNIEnv *env, jobject obj)
+{
+  void *ptr;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+  
+  gtk_widget_grab_focus (get_widget(GTK_WIDGET (ptr)));
+
+  gdk_threads_leave ();
+}
+
+/*
+ * Translate a Java KeyEvent object into a GdkEventKey event, then
+ * pass it to the GTK main loop for processing.
+ */
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetDispatchKeyEvent
+  (JNIEnv *env, jobject obj, jint id, jlong when, jint mods,
+   jint keyCode, jint keyLocation)
+{
+  void *ptr;
+  GdkEvent *event = NULL;
+  GdkKeymapKey *keymap_keys = NULL;
+  gint n_keys = 0;
+  guint lookup_keyval = 0;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  if (id == AWT_KEY_PRESSED)
+    event = gdk_event_new (GDK_KEY_PRESS);
+  else if (id == AWT_KEY_RELEASED)
+    event = gdk_event_new (GDK_KEY_RELEASE);
+  else
+    {
+      gdk_threads_leave ();
+      /* Don't send AWT KEY_TYPED events to GTK. */
+      return;
+    }
+
+  if (GTK_IS_BUTTON (ptr))
+    event->key.window = GTK_BUTTON (get_widget(GTK_WIDGET (ptr)))->event_window;
+  else if (GTK_IS_SCROLLED_WINDOW (get_widget(GTK_WIDGET (ptr))))
+    event->key.window = GTK_WIDGET (GTK_SCROLLED_WINDOW (get_widget(GTK_WIDGET (ptr)))->container.child)->window;
+  else
+    event->key.window = get_widget(GTK_WIDGET (ptr))->window;
+
+  event->key.send_event = 0;
+  event->key.time = (guint32) when;
+
+  if (mods & AWT_SHIFT_DOWN_MASK)
+    event->key.state |= GDK_SHIFT_MASK;
+  if (mods & AWT_CTRL_DOWN_MASK)
+    event->key.state |= GDK_CONTROL_MASK;
+  if (mods & AWT_ALT_DOWN_MASK)
+    event->key.state |= GDK_MOD1_MASK;
+
+  /* This hack is needed because the AWT has no notion of num lock.
+     It infers numlock state from the only Java virtual keys that are
+     affected by it. */
+  if (keyCode == VK_NUMPAD9
+      || keyCode == VK_NUMPAD8
+      || keyCode == VK_NUMPAD7
+      || keyCode == VK_NUMPAD6
+      || keyCode == VK_NUMPAD5
+      || keyCode == VK_NUMPAD4
+      || keyCode == VK_NUMPAD3
+      || keyCode == VK_NUMPAD2
+      || keyCode == VK_NUMPAD1
+      || keyCode == VK_NUMPAD0
+      || keyCode == VK_DECIMAL)
+    event->key.state |= GDK_MOD2_MASK;
+
+  /* These values don't need to be filled in since GTK doesn't use
+     them. */
+  event->key.length = 0;
+  event->key.string = NULL;
+
+  lookup_keyval = cp_gtk_awt_keycode_to_keysym (keyCode, keyLocation);
+
+  if (!gdk_keymap_get_entries_for_keyval (gdk_keymap_get_default (),
+                                          lookup_keyval,
+                                          &keymap_keys,
+                                          &n_keys))
+    {
+      /* No matching keymap entry was found. */
+      g_printerr ("No matching keymap entries were found\n");
+      gdk_threads_leave ();
+      return;
+    }
+
+  /* Note: if n_keys > 1 then there are multiple hardware keycodes
+     that translate to lookup_keyval.  We arbitrarily choose the first
+     hardware keycode from the list returned by
+     gdk_keymap_get_entries_for_keyval. */
+
+  event->key.hardware_keycode = keymap_keys[0].keycode;
+  event->key.group =  keymap_keys[0].group;
+
+  g_free (keymap_keys);
+
+  if (!gdk_keymap_translate_keyboard_state (gdk_keymap_get_default (),
+                                            event->key.hardware_keycode,
+                                            event->key.state,
+                                            event->key.group,
+                                            &event->key.keyval,
+                                            NULL, NULL, NULL))
+    {
+      /* No matching keyval was found. */
+      g_printerr ("No matching keyval was found\n");
+      gdk_threads_leave ();
+      return;
+    }
+
+  /*  keyevent = (GdkEventKey *) event; */
+  /*  g_printerr ("generated event: sent: %d  time: %d  state: %d  keyval: %d  length: %d  string: %s  hardware_keycode: %d  group: %d\n", keyevent->send_event, keyevent->time, keyevent->state, keyevent->keyval, keyevent->length, keyevent->string, keyevent->hardware_keycode, keyevent->group); */
+
+  /* We already received the original key event on the window itself,
+     so we don't want to resend it. */
+  if (!GTK_IS_WINDOW (ptr))
+    {
+      if (GTK_IS_SCROLLED_WINDOW (get_widget(GTK_WIDGET (ptr))))
+        gtk_widget_event (GTK_WIDGET (GTK_SCROLLED_WINDOW (get_widget(GTK_WIDGET (ptr)))->container.child), event);
+      else
+        gtk_widget_event (get_widget(GTK_WIDGET (ptr)), event);
+    }
+
+  gdk_threads_leave ();
+}
+
+/*
+ * Find the origin of a widget's window.
+ */
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWindowGetLocationOnScreen
+  (JNIEnv * env, jobject obj, jintArray jpoint)
+{
+  void *ptr;
+  jint *point;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+  point = (*env)->GetIntArrayElements (env, jpoint, 0);
+
+  gdk_window_get_root_origin (get_widget(GTK_WIDGET (ptr))->window, point, point+1);
+
+  (*env)->ReleaseIntArrayElements(env, jpoint, point, 0);
+
+  gdk_threads_leave ();
+}
+
+/*
+ * Find the origin of a widget
+ */
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetGetLocationOnScreen
+  (JNIEnv * env, jobject obj, jintArray jpoint)
+{
+  void *ptr;
+  jint *point;
+  GtkWidget *widget;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+  point = (*env)->GetIntArrayElements (env, jpoint, 0);
+
+  widget = get_widget(GTK_WIDGET (ptr));
+  while(gtk_widget_get_parent(widget) != NULL)
+    widget = gtk_widget_get_parent(widget);
+  gdk_window_get_position (GTK_WIDGET(widget)->window, point, point+1);
+
+  *point += GTK_WIDGET(ptr)->allocation.x;
+  *(point+1) += GTK_WIDGET(ptr)->allocation.y;
+
+  (*env)->ReleaseIntArrayElements(env, jpoint, point, 0);
+
+  gdk_threads_leave ();
+}
+
+/*
+ * Find this widget's current size.
+ */
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetGetDimensions
+  (JNIEnv *env, jobject obj, jintArray jdims)
+{
+  void *ptr;
+  jint *dims;
+  GtkRequisition requisition;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  dims = (*env)->GetIntArrayElements (env, jdims, 0);  
+  dims[0] = dims[1] = 0;
+
+  gtk_widget_size_request (get_widget(GTK_WIDGET (ptr)), &requisition);
+
+  dims[0] = requisition.width;
+  dims[1] = requisition.height;
+
+  (*env)->ReleaseIntArrayElements (env, jdims, dims, 0);
+
+  gdk_threads_leave ();
+}
+
+/*
+ * Find this widget's preferred size.
+ */
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetGetPreferredDimensions
+  (JNIEnv *env, jobject obj, jintArray jdims)
+{
+  void *ptr;
+  jint *dims;
+  GtkRequisition current_req;
+  GtkRequisition natural_req;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  dims = (*env)->GetIntArrayElements (env, jdims, 0);  
+  dims[0] = dims[1] = 0;
+
+  /* Widgets that extend GtkWindow such as GtkFileChooserDialog may have
+     a default size.  These values seem more useful then the natural
+     requisition values, particularly for GtkFileChooserDialog. */
+  if (GTK_IS_WINDOW (get_widget(GTK_WIDGET (ptr))))
+    {
+      gint width, height;
+      gtk_window_get_default_size (GTK_WINDOW (get_widget(GTK_WIDGET (ptr))), &width, &height);
+
+      dims[0] = width;
+      dims[1] = height;
+    }
+  else
+    {
+      /* Save the widget's current size request. */
+      gtk_widget_size_request (get_widget(GTK_WIDGET (ptr)), &current_req);
+
+      /* Get the widget's "natural" size request. */
+      gtk_widget_set_size_request (get_widget(GTK_WIDGET (ptr)), -1, -1);
+      gtk_widget_size_request (get_widget(GTK_WIDGET (ptr)), &natural_req);
+
+      /* Reset the widget's size request. */
+      gtk_widget_set_size_request (get_widget(GTK_WIDGET (ptr)),
+			           current_req.width, current_req.height);
+
+      dims[0] = natural_req.width;
+      dims[1] = natural_req.height;
+    }
+
+  (*env)->ReleaseIntArrayElements (env, jdims, dims, 0);
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkComponentPeer_setNativeBounds
+  (JNIEnv *env, jobject obj, jint x, jint y, jint width, jint height)
+{
+  GtkWidget *widget;
+  void *ptr;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  widget = GTK_WIDGET (ptr);
+
+  /* We assume that -1 is a width or height and not a request for the
+     widget's natural size. */
+  width = width < 0 ? 0 : width;
+  height = height < 0 ? 0 : height;
+
+  if (GTK_IS_VIEWPORT (widget->parent))
+    gtk_widget_set_size_request (widget, width, height);
+  else
+    {
+      if (!(width == 0 && height == 0))
+        {
+          gtk_widget_set_size_request (widget, width, height);
+          if (widget->parent != NULL)
+            gtk_fixed_move (GTK_FIXED (widget->parent), widget, x, y);
+        }
+    }
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT jintArray JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetGetBackground
+  (JNIEnv *env, jobject obj)
+{
+  void *ptr;
+  jintArray array;
+  int *rgb;
+  GdkColor bg;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  bg = GTK_WIDGET (ptr)->style->bg[GTK_STATE_NORMAL];
+
+  array = (*env)->NewIntArray (env, 3);
+
+  rgb = (*env)->GetIntArrayElements (env, array, NULL);
+  /* convert color data from 16 bit values down to 8 bit values */
+  rgb[0] = bg.red   >> 8;
+  rgb[1] = bg.green >> 8;
+  rgb[2] = bg.blue  >> 8;
+  (*env)->ReleaseIntArrayElements (env, array, rgb, 0);
+
+  gdk_threads_leave ();
+
+  return array;
+}
+
+JNIEXPORT jintArray JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetGetForeground
+  (JNIEnv *env, jobject obj)
+{
+  void *ptr;
+  jintArray array;
+  jint *rgb;
+  GdkColor fg;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  fg = get_widget(GTK_WIDGET (ptr))->style->fg[GTK_STATE_NORMAL];
+
+  array = (*env)->NewIntArray (env, 3);
+
+  rgb = (*env)->GetIntArrayElements (env, array, NULL);
+  /* convert color data from 16 bit values down to 8 bit values */
+  rgb[0] = fg.red   >> 8;
+  rgb[1] = fg.green >> 8;
+  rgb[2] = fg.blue  >> 8;
+  (*env)->ReleaseIntArrayElements (env, array, rgb, 0);
+
+  gdk_threads_leave ();
+
+  return array;
+}
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetSetBackground
+  (JNIEnv *env, jobject obj, jint red, jint green, jint blue)
+{
+  GdkColor normal_color;
+  GdkColor active_color;
+  GtkWidget *widget;
+  void *ptr;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  normal_color.red = (red / 255.0) * 65535;
+  normal_color.green = (green / 255.0) * 65535;
+  normal_color.blue = (blue / 255.0) * 65535;
+
+  /* This calculation only approximates the active colors produced by
+     Sun's AWT. */
+  active_color.red = 0.85 * (red / 255.0) * 65535;
+  active_color.green = 0.85 * (green / 255.0) * 65535;
+  active_color.blue = 0.85 * (blue / 255.0) * 65535;
+
+  widget = find_bg_color_widget (GTK_WIDGET (ptr));
+
+  gtk_widget_modify_bg (widget, GTK_STATE_NORMAL, &normal_color);
+  gtk_widget_modify_bg (widget, GTK_STATE_ACTIVE, &active_color);
+  gtk_widget_modify_bg (widget, GTK_STATE_PRELIGHT, &normal_color);
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetSetForeground
+  (JNIEnv *env, jobject obj, jint red, jint green, jint blue)
+{
+  GdkColor color;
+  GtkWidget *widget;
+  void *ptr;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  color.red = (red / 255.0) * 65535;
+  color.green = (green / 255.0) * 65535;
+  color.blue = (blue / 255.0) * 65535;
+
+  widget = find_fg_color_widget (GTK_WIDGET (ptr));
+
+  gtk_widget_modify_fg (widget, GTK_STATE_NORMAL, &color);
+  gtk_widget_modify_fg (widget, GTK_STATE_ACTIVE, &color);
+  gtk_widget_modify_fg (widget, GTK_STATE_PRELIGHT, &color);
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkComponentPeer_realize (JNIEnv *env, jobject obj)
+{
+  void *ptr;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  gtk_widget_realize (GTK_WIDGET (ptr));
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkComponentPeer_setVisibleNative
+  (JNIEnv *env, jobject obj, jboolean visible)
+{
+  gdk_threads_enter();
+
+  Java_gnu_java_awt_peer_gtk_GtkComponentPeer_setVisibleNativeUnlocked
+    (env, obj, visible);
+
+  gdk_threads_leave();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkComponentPeer_setVisibleNativeUnlocked
+  (JNIEnv *env, jobject obj, jboolean visible)
+{
+  void *ptr;
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  if (visible)
+    gtk_widget_show (GTK_WIDGET (ptr));
+  else
+    gtk_widget_hide (GTK_WIDGET (ptr));
+}
+
+JNIEXPORT jboolean JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkComponentPeer_isEnabled 
+  (JNIEnv *env, jobject obj)
+{
+  void *ptr;
+  jboolean ret_val;
+  
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  ret_val = GTK_WIDGET_IS_SENSITIVE (get_widget(GTK_WIDGET (ptr)));
+
+  gdk_threads_leave ();
+
+  return ret_val;
+}
+
+JNIEXPORT jboolean JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkComponentPeer_modalHasGrab
+  (JNIEnv *env __attribute__((unused)), jclass clazz __attribute__((unused)))
+{
+  GtkWidget *widget;
+  jboolean retval;
+
+  gdk_threads_enter ();
+
+  widget = gtk_grab_get_current ();
+  retval = (widget && GTK_IS_WINDOW (widget) && GTK_WINDOW (widget)->modal);
+
+  gdk_threads_leave ();
+
+  return retval;
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkComponentPeer_connectSignals
+  (JNIEnv *env, jobject obj)
+{
+  void *ptr;
+  jobject *gref;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+  gref = NSA_GET_GLOBAL_REF (env, obj);
+
+  cp_gtk_component_connect_signals (ptr, gref);
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkComponentPeer_setNativeEventMask
+  (JNIEnv *env, jobject obj)
+{
+  void *ptr;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  gtk_widget_add_events (get_widget(GTK_WIDGET (ptr)),
+                         GDK_POINTER_MOTION_MASK
+			 | GDK_BUTTON_MOTION_MASK
+			 | GDK_BUTTON_PRESS_MASK
+			 | GDK_BUTTON_RELEASE_MASK
+			 | GDK_KEY_PRESS_MASK
+			 | GDK_KEY_RELEASE_MASK
+			 | GDK_ENTER_NOTIFY_MASK
+			 | GDK_LEAVE_NOTIFY_MASK
+			 | GDK_STRUCTURE_MASK
+			 | GDK_KEY_PRESS_MASK
+                         | GDK_FOCUS_CHANGE_MASK);
+
+  gdk_threads_leave ();
+}
+
+static GtkWidget *
+get_widget (GtkWidget *widget)
+{
+  GtkWidget *w;
+
+  if (GTK_IS_EVENT_BOX (widget))
+    w = gtk_bin_get_child (GTK_BIN(widget));
+  else
+    w = widget;
+
+  return w;
+}
+
+/* FIXME: these functions should be implemented by overridding the
+   appropriate GtkComponentPeer methods. */
+static GtkWidget *
+find_fg_color_widget (GtkWidget *widget)
+{
+  GtkWidget *fg_color_widget;
+
+  if (GTK_IS_EVENT_BOX (widget)
+      || (GTK_IS_BUTTON (widget)
+	  && !GTK_IS_COMBO_BOX (widget)))
+    fg_color_widget = gtk_bin_get_child (GTK_BIN(widget));
+  else
+    fg_color_widget = widget;
+
+  return fg_color_widget;
+}
+
+static GtkWidget *
+find_bg_color_widget (GtkWidget *widget)
+{
+  GtkWidget *bg_color_widget;
+
+  bg_color_widget = widget;
+
+  return bg_color_widget;
+}
+
+void
+cp_gtk_component_connect_expose_signals (GObject *ptr, jobject *gref)
+{
+  g_signal_connect (G_OBJECT (ptr), "expose-event",
+                    G_CALLBACK (component_expose_cb), *gref);
+}
+
+void
+cp_gtk_component_connect_focus_signals (GObject *ptr, jobject *gref)
+{
+  g_signal_connect (G_OBJECT (ptr), "focus-in-event",
+                    G_CALLBACK (component_focus_in_cb), *gref);
+ 
+  g_signal_connect (G_OBJECT (ptr), "focus-out-event",
+                    G_CALLBACK (component_focus_out_cb), *gref);
+}
+
+void
+cp_gtk_component_connect_mouse_signals (GObject *ptr, jobject *gref)
+{
+  g_signal_connect (G_OBJECT (ptr), "button-press-event",
+                    G_CALLBACK (component_button_press_cb), *gref);
+ 
+  g_signal_connect (G_OBJECT (ptr), "button-release-event",
+                    G_CALLBACK (component_button_release_cb), *gref);
+ 
+  g_signal_connect (G_OBJECT (ptr), "enter-notify-event",
+                    G_CALLBACK (component_enter_notify_cb), *gref);
+ 
+  g_signal_connect (G_OBJECT (ptr), "leave-notify-event",
+                    G_CALLBACK (component_leave_notify_cb), *gref);
+
+  g_signal_connect (G_OBJECT (ptr), "motion-notify-event",
+                    G_CALLBACK (component_motion_notify_cb), *gref);
+
+  g_signal_connect (G_OBJECT (ptr), "scroll-event",
+                    G_CALLBACK (component_scroll_cb), *gref);
+}
+
+void
+cp_gtk_component_connect_signals (GObject *ptr, jobject *gref)
+{
+  cp_gtk_component_connect_expose_signals (ptr, gref);
+  cp_gtk_component_connect_focus_signals (ptr, gref);
+  cp_gtk_component_connect_mouse_signals (ptr, gref);
+}
+
+/* These variables are used to keep track of click counts.  The AWT
+   allows more than a triple click to occur but GTK doesn't report
+   more-than-triple clicks.  Also used for keeping track of scroll events.*/
+static jint click_count = 1;
+static guint32 button_click_time = 0;
+static GdkWindow *button_window = NULL;
+static guint button_number_direction = -1;
+static int hasBeenDragged;
+
+static gboolean
+component_button_press_cb (GtkWidget *widget __attribute__((unused)),
+                           GdkEventButton *event,
+                           jobject peer)
+{
+  /* Ignore double and triple click events. */
+  if (event->type == GDK_2BUTTON_PRESS
+      || event->type == GDK_3BUTTON_PRESS)
+    return FALSE;
+
+  if ((event->time < (button_click_time + MULTI_CLICK_TIME))
+      && (event->window == button_window)
+      && (event->button == button_number_direction))
+    click_count++;
+  else
+    click_count = 1;
+      
+  button_click_time = event->time;
+  button_window = event->window;
+  button_number_direction = event->button;
+
+  (*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), peer,
+                                postMouseEventID,
+                                AWT_MOUSE_PRESSED, 
+                                (jlong)event->time,
+                                cp_gtk_state_to_awt_mods (event->state)
+                                | button_to_awt_mods (event->button),
+                                (jint)event->x,
+                                (jint)event->y, 
+                                click_count, 
+                                (event->button == 3) ? JNI_TRUE :
+                                JNI_FALSE);
+
+  hasBeenDragged = FALSE;
+
+  return FALSE;
+}
+
+static gboolean
+component_button_release_cb (GtkWidget *widget __attribute__((unused)),
+                             GdkEventButton *event,
+                             jobject peer)
+{
+  int width, height;
+
+  (*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), peer,
+                                postMouseEventID,
+                                AWT_MOUSE_RELEASED, 
+                                (jlong)event->time,
+                                cp_gtk_state_to_awt_mods (event->state)
+                                | button_to_awt_mods (event->button),
+                                (jint)event->x,
+                                (jint)event->y, 
+                                click_count,
+                                JNI_FALSE);
+
+  /* Generate an AWT click event only if the release occured in the
+     window it was pressed in, and the mouse has not been dragged since
+     the last time it was pressed. */
+  gdk_drawable_get_size (event->window, &width, &height);
+  if (! hasBeenDragged
+      && event->x >= 0
+      && event->y >= 0
+      && event->x <= width 
+      && event->y <= height)
+    {
+      (*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), peer,
+                                    postMouseEventID,
+                                    AWT_MOUSE_CLICKED, 
+                                    (jlong)event->time,
+                                    cp_gtk_state_to_awt_mods (event->state)
+                                    | button_to_awt_mods (event->button),
+                                    (jint)event->x,
+                                    (jint)event->y, 
+                                    click_count,
+                                    JNI_FALSE);
+    }
+  return FALSE;
+}
+ 
+static gboolean
+component_motion_notify_cb (GtkWidget *widget __attribute__((unused)),
+                            GdkEventMotion *event,
+                            jobject peer)
+{
+  if (event->state & (GDK_BUTTON1_MASK
+                      | GDK_BUTTON2_MASK
+                      | GDK_BUTTON3_MASK
+                      | GDK_BUTTON4_MASK
+                      | GDK_BUTTON5_MASK))
+    {
+      (*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), peer,
+                                    postMouseEventID,
+                                    AWT_MOUSE_DRAGGED,
+                                    (jlong)event->time,
+                                    state_to_awt_mods_with_button_states (event->state),
+                                    (jint)event->x,
+                                    (jint)event->y,
+                                    0,
+                                    JNI_FALSE);
+
+      hasBeenDragged = TRUE;
+    }
+  else
+    {
+      (*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), peer, postMouseEventID,
+                                    AWT_MOUSE_MOVED,
+                                    (jlong)event->time,
+                                    cp_gtk_state_to_awt_mods (event->state),
+                                    (jint)event->x,
+                                    (jint)event->y,
+                                    0,
+                                    JNI_FALSE);
+    }
+  return FALSE;
+}
+
+static gboolean
+component_scroll_cb (GtkWidget *widget __attribute__((unused)),
+		     GdkEventScroll *event,
+		     jobject peer)
+{
+  int rotation;
+  /** Record click count for specific direction. */
+  if ((event->time < (button_click_time + MULTI_CLICK_TIME))
+      && (event->window == button_window)
+      && (event->direction == button_number_direction))
+    click_count++;
+  else
+    click_count = 1;
+      
+  button_click_time = event->time;
+  button_window = event->window;
+  button_number_direction = event->direction;
+
+  if (event->direction == GDK_SCROLL_UP
+      || event->direction == GDK_SCROLL_LEFT)
+    rotation = -1;
+  else
+    rotation = 1;
+
+  (*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), peer,
+				       postMouseWheelEventID,
+				       AWT_MOUSE_WHEEL, 
+				       (jlong)event->time,
+				       cp_gtk_state_to_awt_mods (event->state),
+				       (jint)event->x,
+				       (jint)event->y, 
+				       click_count, 
+				       JNI_FALSE,
+				       AWT_WHEEL_UNIT_SCROLL,
+				       1 /* amount */,
+				       rotation);
+  return FALSE;
+}
+
+static gboolean
+component_enter_notify_cb (GtkWidget *widget __attribute__((unused)),
+                           GdkEventCrossing *event,
+                           jobject peer)
+{
+  /* We are not interested in enter events that are due to
+     grab/ungrab and not to actually crossing boundaries */
+  if (event->mode == GDK_CROSSING_NORMAL)
+    {
+      (*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), peer, postMouseEventID,
+                                    AWT_MOUSE_ENTERED, 
+                                    (jlong)event->time,
+                                    state_to_awt_mods_with_button_states (event->state), 
+                                    (jint)event->x,
+                                    (jint)event->y, 
+                                    0,
+                                    JNI_FALSE);
+    }
+  return FALSE;
+}
+
+static gboolean
+component_leave_notify_cb (GtkWidget *widget __attribute__((unused)),
+                           GdkEventCrossing *event,
+                           jobject peer)
+{
+  /* We are not interested in leave events that are due to
+     grab/ungrab and not to actually crossing boundaries */
+  if (event->mode == GDK_CROSSING_NORMAL)
+    {
+      (*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), peer,
+                                    postMouseEventID,
+                                    AWT_MOUSE_EXITED, 
+                                    (jlong)event->time,
+                                    state_to_awt_mods_with_button_states (event->state),
+                                    (jint)event->x,
+                                    (jint)event->y, 
+                                    0,
+                                    JNI_FALSE);
+    }
+  return FALSE;
+}
+
+static gboolean
+component_expose_cb (GtkWidget *widget __attribute__((unused)),
+                     GdkEventExpose *event,
+                     jobject peer)
+{
+  (*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), peer,
+                                postExposeEventID,
+                                (jint)event->area.x,
+                                (jint)event->area.y,
+                                (jint)event->area.width,
+                                (jint)event->area.height);
+
+  return FALSE;
+}
+
+static gboolean
+component_focus_in_cb (GtkWidget *widget __attribute((unused)),
+                       GdkEventFocus *event __attribute((unused)),
+                       jobject peer)
+{
+  (*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), peer,
+                                postFocusEventID,
+                                AWT_FOCUS_GAINED,
+                                JNI_FALSE);
+
+  return FALSE;
+}
+
+static gboolean
+component_focus_out_cb (GtkWidget *widget __attribute((unused)),
+                        GdkEventFocus *event __attribute((unused)),
+                        jobject peer)
+{
+  (*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), peer,
+                                postFocusEventID,
+                                AWT_FOCUS_LOST,
+                                JNI_FALSE);
+
+  return FALSE;
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEmbeddedWindowPeer.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEmbeddedWindowPeer.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEmbeddedWindowPeer.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEmbeddedWindowPeer.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,84 @@
+/* gnu_java_awt_peer_gtk_GtkEmbeddedWindowPeer.c -- Native
+   implementation of GtkEmbeddedWindowPeer
+   Copyright (C) 2003, 2006  Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+#include "gtkpeer.h"
+#include "gnu_java_awt_peer_gtk_GtkEmbeddedWindowPeer.h"
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkEmbeddedWindowPeer_create
+  (JNIEnv *env, jobject obj, jlong socket_id)
+{
+  GtkWidget *window;
+  GtkWidget *fixed;
+
+  gdk_threads_enter ();
+
+  NSA_SET_GLOBAL_REF (env, obj);
+
+  window = gtk_plug_new ((GdkNativeWindow) socket_id);
+
+  gtk_window_set_decorated (GTK_WINDOW (window), FALSE);
+
+  fixed = gtk_fixed_new ();
+  gtk_container_add (GTK_CONTAINER (window), fixed);
+
+  gtk_widget_show (fixed);
+
+  NSA_SET_PTR (env, obj, window);
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkEmbeddedWindowPeer_construct
+  (JNIEnv *env, jobject obj, jlong socket_id)
+{
+  void *ptr;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  if (GTK_WIDGET_REALIZED (GTK_WIDGET (ptr)))
+    g_printerr ("ERROR: GtkPlug is already realized\n");
+
+  gtk_plug_construct (GTK_PLUG (ptr), (GdkNativeWindow) socket_id);
+
+  gdk_threads_leave ();
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,302 @@
+/* gtkfiledialogpeer.c -- Native implementation of GtkFileDialogPeer
+   Copyright (C) 1998, 1999, 2002, 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+#include "gtkpeer.h"
+#include "gnu_java_awt_peer_gtk_GtkComponentPeer.h"
+#include "gnu_java_awt_peer_gtk_GtkFileDialogPeer.h"
+
+#define AWT_FILEDIALOG_LOAD 0
+#define AWT_FILEDIALOG_SAVE 1
+
+static void handle_response_cb (GtkDialog *dialog,
+                                gint responseId,
+                                jobject peer_obj);
+
+static jmethodID gtkSetFilenameID;
+static jmethodID gtkHideFileDialogID;
+static jmethodID gtkDisposeFileDialogID;
+static jmethodID filenameFilterCallbackID;
+
+void
+cp_gtk_filedialog_init_jni (void)
+{
+  jclass gtkfiledialogpeer;
+
+  gtkfiledialogpeer =
+    (*cp_gtk_gdk_env())->FindClass (cp_gtk_gdk_env(),
+                                    "gnu/java/awt/peer/gtk/GtkFileDialogPeer");
+
+  gtkDisposeFileDialogID =
+    (*cp_gtk_gdk_env())->GetMethodID (cp_gtk_gdk_env(),
+                                      gtkfiledialogpeer,
+                                      "gtkDisposeFileDialog", "()V");
+
+  gtkHideFileDialogID =
+    (*cp_gtk_gdk_env())->GetMethodID (cp_gtk_gdk_env(),
+                                      gtkfiledialogpeer,
+                                      "gtkHideFileDialog", "()V");
+
+  gtkSetFilenameID =
+    (*cp_gtk_gdk_env())->GetMethodID (cp_gtk_gdk_env(),
+                                      gtkfiledialogpeer,
+                                      "gtkSetFilename",
+                                      "(Ljava/lang/String;)V");
+
+  filenameFilterCallbackID =
+    (*cp_gtk_gdk_env())->GetMethodID (cp_gtk_gdk_env(),
+                                      gtkfiledialogpeer,
+                                      "filenameFilterCallback",
+                                      "(Ljava/lang/String;)Z");
+}
+
+/*
+ * Make a new file selection dialog
+ */
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkFileDialogPeer_create 
+  (JNIEnv *env, jobject obj, jobject parent, int mode)
+{
+  void *parentp;
+  gpointer widget;
+
+  gdk_threads_enter ();
+  
+  /* Create global reference and save it for future use */
+  NSA_SET_GLOBAL_REF (env, obj);
+
+  parentp = NSA_GET_PTR(env, parent);
+
+  if (mode == AWT_FILEDIALOG_LOAD)
+    widget = gtk_file_chooser_dialog_new
+      ("Open File",
+       GTK_WINDOW(parentp),
+       GTK_FILE_CHOOSER_ACTION_OPEN,
+       GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+       GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
+       NULL);
+  else
+    {
+      widget = gtk_file_chooser_dialog_new
+        ("Save File",
+         GTK_WINDOW(parentp),
+         GTK_FILE_CHOOSER_ACTION_SAVE,
+         GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+         GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
+         NULL);
+#if GTK_MINOR_VERSION >= 8
+      gtk_file_chooser_set_do_overwrite_confirmation
+        (GTK_FILE_CHOOSER (widget), TRUE);
+#endif
+    }
+
+
+  /* GtkFileChooserDialog is not modal by default */
+  gtk_window_set_modal (GTK_WINDOW (widget), TRUE);
+
+  /* We must add this window to the group so input in the others are
+     disable while it is being shown */
+  gtk_window_group_add_window (cp_gtk_global_window_group,
+                               GTK_WINDOW (widget));
+
+  NSA_SET_PTR (env, obj, widget);
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkFileDialogPeer_connectSignals
+  (JNIEnv *env, jobject obj)
+{
+  void *ptr = NULL;
+  jobject *gref = NULL;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+  gref = NSA_GET_GLOBAL_REF (env, obj);
+
+  /* FileDialog signals */
+  g_signal_connect (G_OBJECT (ptr), "response",
+		    G_CALLBACK (handle_response_cb), *gref);
+
+  /* Component signals */
+  cp_gtk_component_connect_signals (G_OBJECT (ptr), gref);
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT jstring JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkFileDialogPeer_nativeGetDirectory
+    (JNIEnv *env, jobject obj)
+{
+  void *ptr;
+  const char *str;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  str = gtk_file_chooser_get_current_folder (GTK_FILE_CHOOSER(ptr));
+
+  gdk_threads_leave ();
+
+  return (*env)->NewStringUTF(env, str);
+}
+
+
+/* This function interfaces with the Java callback method of the same name.
+   This function extracts the filename from the GtkFileFilterInfo object,
+   and passes it to the Java method.  The Java method will call the filter's
+   accept() method and will give back the return value. */
+static gboolean filename_filter_cb (const GtkFileFilterInfo *filter_info,
+					gpointer obj)
+{
+  jstring *filename;
+  gboolean accepted;
+
+  filename = (*cp_gtk_gdk_env())->NewStringUTF(cp_gtk_gdk_env(), filter_info->filename);
+
+  accepted = (*cp_gtk_gdk_env())->CallBooleanMethod(cp_gtk_gdk_env(), obj,
+                                                    filenameFilterCallbackID,
+                                                    filename);
+
+  return accepted;
+}
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkFileDialogPeer_nativeSetFilenameFilter
+    (JNIEnv *env, jobject obj, jobject filter_obj __attribute__((unused)))
+{
+  void *ptr;
+  GtkFileFilter *filter;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  filter = gtk_file_filter_new();
+  gtk_file_filter_add_custom(filter, GTK_FILE_FILTER_FILENAME,
+			     filename_filter_cb, obj, NULL);
+
+  gtk_file_chooser_set_filter(GTK_FILE_CHOOSER(ptr), filter);
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkFileDialogPeer_nativeSetDirectory
+    (JNIEnv *env, jobject obj, jstring directory)
+{
+  void *ptr;
+  const char *str;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  str = (*env)->GetStringUTFChars (env, directory, 0);
+
+  gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER(ptr), str);
+
+  (*env)->ReleaseStringUTFChars (env, directory, str);
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkFileDialogPeer_nativeSetFile 
+    (JNIEnv *env, jobject obj, jstring filename)
+{
+  void *ptr;
+  const char *str;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+    
+  str = (*env)->GetStringUTFChars (env, filename, 0);
+     
+  gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (ptr), str);
+
+  (*env)->ReleaseStringUTFChars (env, filename, str);
+
+  gdk_threads_leave ();
+}
+
+static void
+handle_response_cb (GtkDialog *dialog __attribute__((unused)),
+                    gint responseId,
+                    jobject peer_obj)
+{
+  void *ptr;
+  G_CONST_RETURN gchar *fileName;
+  jstring str_fileName = NULL;
+
+  /* We only need this for the case when the user closed the window,
+     or clicked ok or cancel. */
+  if (responseId != GTK_RESPONSE_DELETE_EVENT
+      && responseId != GTK_RESPONSE_ACCEPT
+      && responseId != GTK_RESPONSE_CANCEL)
+    return;
+
+  ptr = NSA_GET_PTR (cp_gtk_gdk_env(), peer_obj);
+
+  if (responseId == GTK_RESPONSE_DELETE_EVENT)
+  {
+    /* We can dispose of the dialog now (and unblock show) */
+    (*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), peer_obj,
+                                         gtkDisposeFileDialogID);
+
+    return;
+  }
+
+  if (responseId == GTK_RESPONSE_ACCEPT)
+    {
+      fileName = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (GTK_WIDGET (ptr)));
+      str_fileName = (*cp_gtk_gdk_env())->NewStringUTF (cp_gtk_gdk_env(), fileName);
+    }
+
+  /* Set the Java object field 'file' with this value. */
+  (*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), peer_obj,
+                                       gtkSetFilenameID, str_fileName);
+
+  /* We can hide the dialog now (and unblock show) */
+  (*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), peer_obj,
+                                       gtkHideFileDialogID);
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFramePeer.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFramePeer.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFramePeer.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFramePeer.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,190 @@
+/* gtkframepeer.c -- Native implementation of GtkFramePeer
+   Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc.
+
+   This file is part of GNU Classpath.
+
+   GNU Classpath is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   GNU Classpath is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with GNU Classpath; see the file COPYING.  If not, write to the
+   Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+   02110-1301 USA.
+
+   Linking this library statically or dynamically with other modules is
+   making a combined work based on this library.  Thus, the terms and
+   conditions of the GNU General Public License cover the whole
+   combination.
+
+   As a special exception, the copyright holders of this library give you
+   permission to link this library with independent modules to produce an
+   executable, regardless of the license terms of these independent
+   modules, and to copy and distribute the resulting executable under
+   terms of your choice, provided that you also meet, for each linked
+   independent module, the terms and conditions of the license of that
+   module.  An independent module is a module which is not derived from
+   or based on this library.  If you modify this library, you may extend
+   this exception to your version of the library, but you are not
+   obligated to do so.  If you do not wish to do so, delete this
+   exception statement from your version. */
+
+#include "gtkpeer.h"
+#include "gnu_java_awt_peer_gtk_GtkFramePeer.h"
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkFramePeer_removeMenuBarPeer
+  (JNIEnv *env, jobject obj)
+{
+  void *ptr;
+  void *mptr;
+  void *fixed;
+  GList* children;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  fixed = gtk_container_get_children (GTK_CONTAINER (ptr))->data;
+  children = gtk_container_get_children (GTK_CONTAINER (fixed));
+
+  while (children != NULL && !GTK_IS_MENU_SHELL (children->data))
+  {
+    children = children->next;
+  }
+
+  /* If there's a menu bar, remove it. */
+  if (children != NULL)
+    {
+      mptr = children->data;
+
+      /* This will actually destroy the MenuBar. By removing it from
+         its parent, the reference count for the MenuBar widget will
+         decrement to 0. The widget will be automatically destroyed by
+         GTK. */
+      gtk_container_remove (GTK_CONTAINER (fixed), GTK_WIDGET (mptr));  
+    }
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkFramePeer_setMenuBarPeer
+  (JNIEnv *env, jobject obj, jobject menubar)
+{
+  void *ptr;
+  void *mptr;
+  void *fixed;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  if (menubar)
+    {
+      mptr = NSA_GET_PTR (env, menubar);
+
+      fixed = gtk_container_get_children (GTK_CONTAINER (ptr))->data;
+      gtk_fixed_put (GTK_FIXED (fixed), mptr, 0, 0);
+      gtk_widget_show (mptr);
+    }
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT jint JNICALL
+Java_gnu_java_awt_peer_gtk_GtkFramePeer_getMenuBarHeight
+  (JNIEnv *env, jobject obj __attribute__((unused)), jobject menubar)
+{
+  GtkWidget *ptr;
+  GtkRequisition requisition;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, menubar);
+
+  gtk_widget_size_request (ptr, &requisition);
+
+  gdk_threads_leave ();
+
+  return requisition.height;
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkFramePeer_setMenuBarWidth
+  (JNIEnv *env, jobject obj, jobject menubar, jint width)
+{
+  gdk_threads_enter ();
+
+  Java_gnu_java_awt_peer_gtk_GtkFramePeer_setMenuBarWidthUnlocked
+    (env, obj, menubar, width);
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkFramePeer_setMenuBarWidthUnlocked
+  (JNIEnv *env, jobject obj __attribute__((unused)), jobject menubar, jint width)
+{
+  GtkWidget *ptr;
+  GtkRequisition natural_req;
+
+  if (menubar)
+    {
+      ptr = NSA_GET_PTR (env, menubar);
+
+      /* Get the menubar's natural size request. */
+      gtk_widget_set_size_request (GTK_WIDGET (ptr), -1, -1);
+      gtk_widget_size_request (GTK_WIDGET (ptr), &natural_req);
+
+      /* Set the menubar's size request to width by natural_req.height. */
+      gtk_widget_set_size_request (GTK_WIDGET (ptr),
+                                   width, natural_req.height);
+    }
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkFramePeer_gtkFixedSetVisible
+  (JNIEnv *env, jobject obj, jboolean visible)
+{
+  void *ptr;
+  void *fixed;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  fixed = gtk_container_get_children (GTK_CONTAINER (ptr))->data;
+
+  if (visible)
+    gtk_widget_show (GTK_WIDGET (fixed));
+  else
+    gtk_widget_hide (GTK_WIDGET (fixed));
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkFramePeer_nativeSetIconImage
+  (JNIEnv *env, jobject obj, jobject gtkimage)
+{
+  void *ptr;
+  GdkPixbuf *pixbuf = NULL;
+
+  gdk_threads_enter ();
+
+  pixbuf = cp_gtk_image_get_pixbuf (env, gtkimage);
+  g_assert (pixbuf != NULL);
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  gtk_window_set_icon (GTK_WINDOW (ptr), pixbuf);
+
+  gdk_threads_leave ();
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkGenericPeer.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkGenericPeer.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkGenericPeer.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkGenericPeer.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,94 @@
+/* gtkgenericpeer.c -- Native implementation of GtkGenericPeer
+   Copyright (C) 1998, 1999, 2002, 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+#include "gtkpeer.h"
+#include "gnu_java_awt_peer_gtk_GtkGenericPeer.h"
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkGenericPeer_dispose
+  (JNIEnv *env, jobject obj)
+{
+  void *ptr;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  /* For now the native state for any object must be a widget.
+     However, a subclass could override dispose() if required.  */
+  gtk_widget_destroy (GTK_WIDGET (ptr));
+
+  /* Remove entries from state tables */
+  NSA_DEL_GLOBAL_REF (env, obj);
+  NSA_DEL_PTR (env, obj);
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkGenericPeer_gtkWidgetModifyFont
+  (JNIEnv *env, jobject obj, jstring name, jint style, jint size)
+{
+  const char *font_name;
+  void *ptr;
+  PangoFontDescription *font_desc;
+
+  gdk_threads_enter();
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  font_name = (*env)->GetStringUTFChars (env, name, NULL);
+
+  font_desc = pango_font_description_from_string (font_name);
+  pango_font_description_set_size (font_desc,
+                                   size * cp_gtk_dpi_conversion_factor);
+
+  if (style & AWT_STYLE_BOLD)
+    pango_font_description_set_weight (font_desc, PANGO_WEIGHT_BOLD);
+
+  if (style & AWT_STYLE_ITALIC)
+    pango_font_description_set_style (font_desc, PANGO_STYLE_OBLIQUE);
+
+  gtk_widget_modify_font (GTK_WIDGET(ptr), font_desc);
+
+  pango_font_description_free (font_desc);
+
+  (*env)->ReleaseStringUTFChars (env, name, font_name);
+
+  gdk_threads_leave();
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImage.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImage.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImage.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImage.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,433 @@
+/* gtkimage.c
+   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#include "jcl.h"
+#include "gtkpeer.h"
+#include <cairo-xlib.h>
+#include <gdk/gdkx.h>
+
+#include "gnu_java_awt_peer_gtk_GtkImage.h"
+
+/* The constant fields in java.awt.Image */   
+#define SCALE_DEFAULT      1
+#define SCALE_FAST         2
+#define SCALE_SMOOTH       4
+#define SCALE_REPLICATE    8 
+#define SCALE_AREA_AVERAGING  16
+
+/* local stuff */
+static GdkInterpType mapHints(jint hints);
+static void createRawData (JNIEnv * env, jobject obj, void *ptr);
+static void setWidthHeight (JNIEnv * env, jobject obj, int width, int height);
+
+/**
+ * Loads a pixbuf from a file.
+ */
+JNIEXPORT jboolean JNICALL
+Java_gnu_java_awt_peer_gtk_GtkImage_loadPixbuf
+  (JNIEnv *env, jobject obj, jstring name)
+{
+  const char *filename;
+  int width, height;
+  GdkPixbuf *pixbuf;
+
+  /* Don't use the JCL convert function because it throws an exception
+     on failure */
+  filename = (*env)->GetStringUTFChars (env, name, 0);
+
+  if (filename == NULL)
+    return JNI_FALSE;
+
+  pixbuf = gdk_pixbuf_new_from_file (filename, NULL);
+  if (pixbuf == NULL)
+    {
+      (*env)->ReleaseStringUTFChars (env, name, filename);
+      return JNI_FALSE;
+    }
+
+  width =  gdk_pixbuf_get_width (pixbuf);
+  height = gdk_pixbuf_get_height (pixbuf);
+  
+  createRawData (env, obj, pixbuf);
+  setWidthHeight(env, obj, width, height);
+  (*env)->ReleaseStringUTFChars (env, name, filename);
+
+  return JNI_TRUE;
+}
+
+/*
+ * Creates the image from an array of java bytes.
+ */
+JNIEXPORT jboolean JNICALL
+Java_gnu_java_awt_peer_gtk_GtkImage_loadImageFromData
+  (JNIEnv *env, jobject obj, jbyteArray data)
+{
+  jbyte *src;
+  GdkPixbuf* pixbuf;
+  GdkPixbufLoader* loader;
+  int len;
+  int width;
+  int height;
+
+  src = (*env)->GetByteArrayElements (env, data, NULL);
+  len = (*env)->GetArrayLength (env, data);
+
+  loader = gdk_pixbuf_loader_new ();
+
+  gdk_pixbuf_loader_write (loader, (guchar *)src, len, NULL);
+  gdk_pixbuf_loader_close (loader, NULL);
+
+  (*env)->ReleaseByteArrayElements (env, data, src, 0);
+
+  pixbuf = gdk_pixbuf_loader_get_pixbuf (loader);
+
+  if (pixbuf == NULL)
+    {
+      g_object_unref (loader);
+      createRawData (env, obj, NULL);
+      return JNI_FALSE;
+    }
+
+  g_object_ref (pixbuf);
+  g_object_unref (loader);
+
+  width =  gdk_pixbuf_get_width (pixbuf);
+  height = gdk_pixbuf_get_height (pixbuf);
+
+  createRawData (env, obj, pixbuf);
+  setWidthHeight(env, obj, width, height);
+
+  return JNI_TRUE;
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkImage_createFromPixbuf
+(JNIEnv *env, jobject obj)
+{
+  int width, heigth;
+  GdkPixbuf *pixbuf = cp_gtk_image_get_pixbuf (env, obj);
+  width =  gdk_pixbuf_get_width (pixbuf);
+  heigth = gdk_pixbuf_get_height (pixbuf);
+  setWidthHeight(env, obj, width, heigth);
+}
+
+/**
+ * Returns a copy of the pixel data as a java array.
+ */
+JNIEXPORT jintArray JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkImage_getPixels(JNIEnv *env, jobject obj)
+{
+  GdkPixbuf *pixbuf;
+  int width, height, rowstride;
+  guchar *pixeldata;
+  jintArray result_array;
+  jint *result_array_iter, *dst;
+  int i,j;
+
+  gdk_threads_enter ();
+
+  pixbuf = cp_gtk_image_get_pixbuf (env, obj);
+  width =  gdk_pixbuf_get_width (pixbuf);
+  height = gdk_pixbuf_get_height (pixbuf);
+  rowstride = gdk_pixbuf_get_rowstride (pixbuf);
+
+  result_array = (*env)->NewIntArray (env, (width * height));
+  if (result_array == NULL)
+    {
+      gdk_threads_leave ();
+      return NULL;
+    }
+
+  dst = result_array_iter = 
+    (*env)->GetIntArrayElements (env, result_array, NULL);
+
+
+  pixeldata = gdk_pixbuf_get_pixels (pixbuf);
+
+  g_assert (gdk_pixbuf_get_bits_per_sample (pixbuf) == 8);
+
+  if (gdk_pixbuf_get_has_alpha (pixbuf))
+    {
+      for(i = 0 ; i < height; i++)
+	{
+	  memcpy(dst, (void *)pixeldata, width * 4);
+	  dst += width;
+	  pixeldata += rowstride;
+	}
+    } else {
+
+    /* Add a default alpha value of 0xFF to the pixeldata without alpha
+       information and keep it in the same format as the pixeldata with alpha
+       information. On Little Endian systems: AABBGGRR and on Big Endian
+       systems: RRGGBBAA.  */
+
+      for(i = 0; i < height; i++)
+	{
+	  for(j = 0; j < width; j++)
+
+#ifndef WORDS_BIGENDIAN
+	    dst[j] = 0xFF000000
+	      | (pixeldata[j*3 + 2] & 0xFF) << 16
+	      | (pixeldata[j*3 + 1] & 0xFF) << 8
+	      | (pixeldata[j*3] & 0xFF);
+#else
+	    dst[j] = (pixeldata[j*3] & 0xFF) << 24
+	      | (pixeldata[j*3 + 1] & 0xFF) << 16
+	      | (pixeldata[j*3 + 2] & 0xFF) << 8
+	      | 0xFF;
+#endif
+	  dst += width;
+	  pixeldata += rowstride;
+	}
+    }
+  
+  (*env)->ReleaseIntArrayElements (env, result_array, result_array_iter, 0);
+    
+  gdk_threads_leave ();
+  return result_array;
+}
+
+/**
+ * Returns a copy of the pixel data as a java array.
+ * (GdkPixbuf only)
+ */
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkImage_setPixels(JNIEnv *env, jobject obj,
+					      jintArray pixels)
+{
+  GdkPixbuf *pixbuf = cp_gtk_image_get_pixbuf (env, obj);
+  int width, height, rowstride;
+  guchar *pixeldata;
+  jint *src_array_iter, *src;
+  int i;
+
+  width =  gdk_pixbuf_get_width (pixbuf);
+  height = gdk_pixbuf_get_height (pixbuf);
+  rowstride = gdk_pixbuf_get_rowstride (pixbuf);
+
+  src = src_array_iter = 
+    (*env)->GetIntArrayElements (env, pixels, NULL);
+
+  pixeldata = gdk_pixbuf_get_pixels (pixbuf);
+  for(i = 0 ; i < height; i++)
+    {
+      memcpy((void *)pixeldata, (void *)src, width * 4);
+      src += width;
+      pixeldata += rowstride;
+    }
+
+  (*env)->ReleaseIntArrayElements (env, pixels, src_array_iter, 0);
+}
+
+/**
+ * Allocates a Gtk Pixbuf 
+ */
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkImage_createPixbuf(JNIEnv *env, jobject obj)
+{
+  int width, height;
+  jclass cls;
+  jfieldID field;
+
+  cls = (*env)->GetObjectClass (env, obj);
+  field = (*env)->GetFieldID (env, cls, "width", "I");
+  g_assert (field != 0);
+  width = (*env)->GetIntField (env, obj, field);
+
+  field = (*env)->GetFieldID (env, cls, "height", "I");
+  g_assert (field != 0);
+  height = (*env)->GetIntField (env, obj, field);
+
+  createRawData (env, obj, gdk_pixbuf_new (GDK_COLORSPACE_RGB, 
+					   TRUE,
+					   8,
+					   width,
+					   height));
+}
+
+/**
+ * Allocates a Gtk Pixbuf 
+ */
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkImage_initFromBuffer(JNIEnv *env, jobject obj,
+						   jlong bufferPointer)
+{
+  int width, height;
+  jclass cls;
+  jfieldID field;
+  GdkPixbuf *pixbuf;
+  const guchar *bp = JLONG_TO_PTR(const guchar, bufferPointer);
+
+  g_assert(bp != NULL);
+  cls = (*env)->GetObjectClass( env, obj );
+  field = (*env)->GetFieldID( env, cls, "width", "I" );
+  g_assert( field != 0 );
+  width = (*env)->GetIntField( env, obj, field );
+
+  field = (*env)->GetFieldID( env, cls, "height", "I" );
+  g_assert( field != 0 );
+  height = (*env)->GetIntField( env, obj, field );
+
+  pixbuf = gdk_pixbuf_new_from_data( bp,
+				     GDK_COLORSPACE_RGB, TRUE, 8,
+				     width, height, width * 4, NULL, NULL );
+  g_assert( pixbuf != NULL );
+  createRawData( env, obj, pixbuf );
+}
+
+/**
+ * Frees the Gtk Pixbuf.
+ */
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkImage_freePixbuf(JNIEnv *env, jobject obj)
+{
+  gdk_pixbuf_unref (cp_gtk_image_get_pixbuf (env, obj));
+}
+
+/**
+ * Sets this to a scaled version of the original pixbuf
+ * width and height of the destination GtkImage must be set.
+ */
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkImage_createScaledPixbuf(JNIEnv *env, 
+						       jobject destination, 
+						       jobject source,
+						       jint hints)
+{
+  GdkPixbuf* dst;
+  int width, height;
+  jclass cls;
+  jfieldID field;
+
+  GdkPixbuf *pixbuf;
+
+  cls = (*env)->GetObjectClass (env, destination);
+  field = (*env)->GetFieldID (env, cls, "width", "I");
+  g_assert (field != 0);
+  width = (*env)->GetIntField (env, destination, field);
+
+  field = (*env)->GetFieldID (env, cls, "height", "I");
+  g_assert (field != 0);
+  height = (*env)->GetIntField (env, destination, field);
+
+  pixbuf = cp_gtk_image_get_pixbuf (env, source);
+
+  dst = gdk_pixbuf_scale_simple(pixbuf,
+				width, height,
+				mapHints(hints));
+
+  createRawData (env, destination, (void *)dst);
+}
+
+/**
+ * Used by GtkFramePeer
+ */
+GdkPixbuf *cp_gtk_image_get_pixbuf (JNIEnv *env, jobject obj)
+{
+  jclass cls;
+  jfieldID data_fid;
+  jobject data;
+
+  cls = (*env)->GetObjectClass (env, obj);
+  data_fid = (*env)->GetFieldID (env, cls, "pixbuf", 
+				 "Lgnu/classpath/Pointer;");
+  g_assert (data_fid != 0);
+  data = (*env)->GetObjectField (env, obj, data_fid);
+
+  return (GdkPixbuf *)JCL_GetRawData (env, data);
+}
+
+/**
+ * Maps java.awt.Image scaling hints to the native GDK ones.
+ */
+static GdkInterpType mapHints(jint hints)
+{
+  switch ( hints ) 
+    {
+      /* For FAST, we use the nearest-neighbor. Fastest and lowest quality. */
+    case SCALE_FAST:
+    case SCALE_REPLICATE:
+      return GDK_INTERP_NEAREST;
+
+      /* Hyperbolic for smooth. Slowest too. */
+    case SCALE_SMOOTH:
+      return GDK_INTERP_HYPER;
+      
+      /* the inbetweenish method */
+    case SCALE_AREA_AVERAGING:
+      return GDK_INTERP_TILES;
+
+      /* default to bilinear */
+    }
+  return GDK_INTERP_BILINEAR;
+}
+
+/* Sets the width and height fields of a GtkImage object. */
+static void setWidthHeight (JNIEnv * env, jobject obj, int width, int height)
+{
+  jclass cls;
+  jfieldID field;
+  
+  cls = (*env)->GetObjectClass (env, obj);
+  g_assert (cls != 0);
+  field = (*env)->GetFieldID (env, cls, "width", "I");
+  g_assert (field != 0);
+  (*env)->SetIntField (env, obj, field, (jint)width);
+   
+  field = (*env)->GetFieldID (env, cls, "height", "I");
+  g_assert (field != 0);
+  (*env)->SetIntField (env, obj, field, (jint)height);
+}
+
+/* Store and get the pixbuf pointer */
+static void
+createRawData (JNIEnv * env, jobject obj, void *ptr)
+{
+  jclass cls;
+  jobject data;
+  jfieldID data_fid;
+
+  cls = (*env)->GetObjectClass (env, obj);
+  data_fid = (*env)->GetFieldID (env, cls, "pixbuf", 
+				 "Lgnu/classpath/Pointer;");
+  g_assert (data_fid != 0);
+
+  data = JCL_NewRawDataObject (env, ptr);
+
+  (*env)->SetObjectField (env, obj, data_fid, data);
+}
+

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkLabelPeer.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkLabelPeer.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkLabelPeer.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkLabelPeer.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,221 @@
+/* gtklabelpeer.c -- Native implementation of GtkLabelPeer
+   Copyright (C) 1998, 1999 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+#include "gtkpeer.h"
+#include "gnu_java_awt_peer_gtk_GtkLabelPeer.h"
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkLabelPeer_create
+  (JNIEnv *env, jobject obj, jstring text, jfloat xalign)
+{
+  GtkWidget *label;
+  GtkWidget *eventbox;
+  const char *str;
+
+  gdk_threads_enter ();
+
+  NSA_SET_GLOBAL_REF (env, obj);
+
+  str = (*env)->GetStringUTFChars (env, text, 0);
+
+  eventbox = gtk_event_box_new ();
+  label = gtk_label_new (str);
+  gtk_misc_set_alignment (GTK_MISC (label), xalign, 0.5);
+  gtk_container_add (GTK_CONTAINER (eventbox), label);
+  gtk_widget_show (label);
+
+  (*env)->ReleaseStringUTFChars (env, text, str);
+
+  NSA_SET_PTR (env, obj, eventbox);
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkLabelPeer_gtkWidgetGetPreferredDimensions
+  (JNIEnv *env, jobject obj, jintArray jdims)
+{
+  void *ptr;
+  jint *dims;
+  GtkWidget *label;
+  GtkRequisition current_req;
+  GtkRequisition natural_req;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  label = gtk_bin_get_child (GTK_BIN (ptr));
+
+  dims = (*env)->GetIntArrayElements (env, jdims, 0);  
+  dims[0] = dims[1] = 0;
+
+  /* Save the widget's current size request. */
+  gtk_widget_size_request (GTK_WIDGET (label), &current_req);
+
+  /* Get the widget's "natural" size request. */
+  gtk_widget_set_size_request (GTK_WIDGET (label), -1, -1);
+  gtk_widget_size_request (GTK_WIDGET (label), &natural_req);
+
+  /* Reset the widget's size request. */
+  gtk_widget_set_size_request (GTK_WIDGET (label),
+                               current_req.width, current_req.height);
+
+  dims[0] = natural_req.width;
+  dims[1] = natural_req.height;
+
+  (*env)->ReleaseIntArrayElements (env, jdims, dims, 0);
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkLabelPeer_gtkWidgetModifyFont
+  (JNIEnv *env, jobject obj, jstring name, jint style, jint size)
+{
+  const char *font_name;
+  void *ptr;
+  GtkWidget *label;
+  PangoFontDescription *font_desc;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  font_name = (*env)->GetStringUTFChars (env, name, NULL);
+
+  label = gtk_bin_get_child (GTK_BIN (ptr));
+
+  if (!label)
+    {
+      gdk_threads_leave ();
+      return;
+    }
+
+  font_desc = pango_font_description_from_string (font_name);
+  pango_font_description_set_size (font_desc,
+                                   size * cp_gtk_dpi_conversion_factor);
+
+  if (style & AWT_STYLE_BOLD)
+    pango_font_description_set_weight (font_desc, PANGO_WEIGHT_BOLD);
+
+  if (style & AWT_STYLE_ITALIC)
+    pango_font_description_set_style (font_desc, PANGO_STYLE_OBLIQUE);
+
+  gtk_widget_modify_font (GTK_WIDGET (label), font_desc);
+
+  pango_font_description_free (font_desc);
+
+  (*env)->ReleaseStringUTFChars (env, name, font_name);
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkLabelPeer_setNativeText
+  (JNIEnv *env, jobject obj, jstring text)
+{
+  const char *str;
+  void *ptr;
+  GtkWidget *label;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  str = (*env)->GetStringUTFChars (env, text, 0);
+
+  label = gtk_bin_get_child (GTK_BIN (ptr));
+
+  gtk_label_set_label (GTK_LABEL (label), str);
+
+  (*env)->ReleaseStringUTFChars (env, text, str);
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkLabelPeer_nativeSetAlignment
+  (JNIEnv *env, jobject obj, jfloat xalign)
+{
+  void *ptr;
+  GtkWidget *label;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  label = gtk_bin_get_child (GTK_BIN(ptr));
+
+  gtk_misc_set_alignment (GTK_MISC (label), xalign, 0.5);
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkLabelPeer_setNativeBounds
+  (JNIEnv *env, jobject obj, jint x, jint y, jint width, jint height)
+{
+  GtkWidget *widget;
+  void *ptr;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  widget = GTK_WIDGET (ptr);
+
+  /* We assume that -1 is a width or height and not a request for the
+     widget's natural size. */
+  width = width < 0 ? 0 : width;
+  height = height < 0 ? 0 : height;
+
+  if (!(width == 0 && height == 0))
+    {
+      /* Set the event box's size request... */
+      gtk_widget_set_size_request (widget, width, height);
+      /* ...and the label's size request. */
+      gtk_widget_set_size_request (gtk_bin_get_child (GTK_BIN (widget)),
+                                   width, height);
+
+      if (widget->parent != NULL)
+        gtk_fixed_move (GTK_FIXED (widget->parent), widget, x, y);
+    }
+
+  gdk_threads_leave ();
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,549 @@
+/* GtkListPeer.c -- implements GtkListPeer's native methods
+   Copyright (C) 1998, 1999, 2003, 2004 Free Software Foundation, Inc.
+
+   This file is part of GNU Classpath.
+
+   GNU Classpath is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   GNU Classpath is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with GNU Classpath; see the file COPYING.  If not, write to the
+   Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+   02110-1301 USA.
+
+   Linking this library statically or dynamically with other modules is
+   making a combined work based on this library.  Thus, the terms and
+   conditions of the GNU General Public License cover the whole
+   combination.
+
+   As a special exception, the copyright holders of this library give you
+   permission to link this library with independent modules to produce an
+   executable, regardless of the license terms of these independent
+   modules, and to copy and distribute the resulting executable under
+   terms of your choice, provided that you also meet, for each linked
+   independent module, the terms and conditions of the license of that
+   module.  An independent module is a module which is not derived from
+   or based on this library.  If you modify this library, you may extend
+   this exception to your version of the library, but you are not
+   obligated to do so.  If you do not wish to do so, delete this
+   exception statement from your version. */
+
+#include "gtkpeer.h"
+#include "gnu_java_awt_peer_gtk_GtkListPeer.h"
+
+static jmethodID postListItemEventID;
+static GtkWidget *list_get_widget (GtkWidget *widget);
+
+void
+cp_gtk_list_init_jni (void)
+{
+  jclass gtklistpeer;
+
+  gtklistpeer = (*cp_gtk_gdk_env())->FindClass (cp_gtk_gdk_env(),
+                                         "gnu/java/awt/peer/gtk/GtkListPeer");
+
+  postListItemEventID = (*cp_gtk_gdk_env())->GetMethodID (cp_gtk_gdk_env(), gtklistpeer,
+                                                   "postItemEvent",
+                                                   "(II)V");
+}
+
+enum
+  {
+    COLUMN_STRING,
+    N_COLUMNS
+  };
+
+static gboolean item_highlighted_cb (GtkTreeSelection *selection,
+                                     GtkTreeModel *model,
+                                     GtkTreePath *path,
+                                     gboolean path_currently_selected,
+                                     jobject peer);
+
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkListPeer_create
+  (JNIEnv *env, jobject obj, jint rows)
+{
+  GtkWidget *sw;
+  GtkWidget *list;
+  GtkWidget *eventbox;
+  GtkCellRenderer *renderer;
+  GtkTreeViewColumn *column;
+  GtkListStore *list_store;
+  GtkTreeIter iter;
+  GtkRequisition req;
+  gint i;
+
+  gdk_threads_enter ();
+
+  /* Create global reference and save it for future use */
+  NSA_SET_GLOBAL_REF (env, obj);
+
+  list_store = gtk_list_store_new (N_COLUMNS, G_TYPE_STRING);
+  /* Add the number of rows so that we can calculate the tree view's
+     size request. */
+  for (i = 0; i < rows; i++)
+    {
+      gtk_list_store_append (list_store, &iter);
+      gtk_list_store_set (list_store, &iter,
+                          COLUMN_STRING, "",
+                          -1);
+    }
+  list = gtk_tree_view_new_with_model (GTK_TREE_MODEL (list_store));
+  renderer = gtk_cell_renderer_text_new ();
+  column = gtk_tree_view_column_new_with_attributes (NULL,
+				     renderer,
+				     "text",
+				     COLUMN_STRING,
+				     NULL);
+
+  eventbox = gtk_event_box_new ();
+  sw = gtk_scrolled_window_new (NULL, NULL);
+  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
+				  GTK_POLICY_AUTOMATIC,
+				  GTK_POLICY_AUTOMATIC);
+  gtk_container_add (GTK_CONTAINER (eventbox), sw);
+  
+  gtk_tree_view_append_column (GTK_TREE_VIEW (list), column);
+
+  gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (list), FALSE);
+
+  gtk_widget_size_request (GTK_WIDGET (list), &req);
+
+  gtk_widget_set_size_request (GTK_WIDGET (list), req.width, req.height);
+
+  gtk_container_add (GTK_CONTAINER (sw), list);
+
+  /* Remove the blank rows. */
+  gtk_list_store_clear (list_store);
+
+  gtk_widget_show (list);
+  gtk_widget_show (sw);
+
+  NSA_SET_PTR (env, obj, eventbox);
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkListPeer_connectSignals
+  (JNIEnv *env, jobject obj)
+{
+  void *ptr;
+  jobject *gref;
+  GtkWidget *list;
+  GtkTreeSelection *selection;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+  gref = NSA_GET_GLOBAL_REF (env, obj);
+
+  list = list_get_widget (GTK_WIDGET (ptr));
+
+  selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (list));
+  gtk_tree_selection_set_select_function (selection, item_highlighted_cb,
+                                          *gref, NULL);
+
+  cp_gtk_component_connect_signals (G_OBJECT (list), gref);
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkListPeer_gtkWidgetModifyFont
+  (JNIEnv *env, jobject obj, jstring name, jint style, jint size)
+{
+  const char *font_name;
+  void *ptr;
+  GtkWidget *list;
+  PangoFontDescription *font_desc;
+
+  gdk_threads_enter();
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  list = list_get_widget (GTK_WIDGET (ptr));
+
+  font_name = (*env)->GetStringUTFChars (env, name, NULL);
+
+  font_desc = pango_font_description_from_string (font_name);
+  pango_font_description_set_size (font_desc,
+                                   size * cp_gtk_dpi_conversion_factor);
+
+  if (style & AWT_STYLE_BOLD)
+    pango_font_description_set_weight (font_desc, PANGO_WEIGHT_BOLD);
+
+  if (style & AWT_STYLE_ITALIC)
+    pango_font_description_set_style (font_desc, PANGO_STYLE_OBLIQUE);
+
+  gtk_widget_modify_font (GTK_WIDGET (list), font_desc);
+
+  pango_font_description_free (font_desc);
+
+  (*env)->ReleaseStringUTFChars (env, name, font_name);
+
+  gdk_threads_leave();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkListPeer_gtkWidgetRequestFocus
+  (JNIEnv *env, jobject obj)
+{
+  void *ptr;
+  GtkWidget *list;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+  
+  list = list_get_widget (GTK_WIDGET (ptr));
+  gtk_widget_grab_focus (list);
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkListPeer_append
+  (JNIEnv *env, jobject obj, jobjectArray items)
+{
+  void *ptr;
+  GtkWidget *list;
+  GtkTreeIter iter;
+  GtkTreeModel *list_store;
+  jint count;
+  jint i;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  count = (*env)->GetArrayLength (env, items);
+
+  list = list_get_widget (GTK_WIDGET (ptr));
+  list_store = gtk_tree_view_get_model (GTK_TREE_VIEW (list));
+
+  for (i = 0; i < count; i++)
+    {
+      const char *text;
+      jobject item;
+
+      item = (*env)->GetObjectArrayElement (env, items, i);
+
+      text = (*env)->GetStringUTFChars (env, item, NULL);
+      gtk_list_store_append (GTK_LIST_STORE (list_store), &iter);
+      gtk_list_store_set (GTK_LIST_STORE (list_store), &iter,
+                          COLUMN_STRING, text,
+                          -1);
+      (*env)->ReleaseStringUTFChars (env, item, text);
+      (*env)->DeleteLocalRef(env, item);
+    }
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkListPeer_add
+  (JNIEnv *env, jobject obj, jstring text, jint index)
+{
+  void *ptr;
+  const char *str;
+  GtkWidget *list;
+  GtkTreeIter iter;
+  GtkTreeModel *list_store;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+  str = (*env)->GetStringUTFChars (env, text, NULL);
+
+  list = list_get_widget (GTK_WIDGET (ptr));
+  list_store = gtk_tree_view_get_model (GTK_TREE_VIEW (list));
+
+  if (index == -1)
+    gtk_list_store_append (GTK_LIST_STORE (list_store), &iter);
+  else
+    gtk_list_store_insert (GTK_LIST_STORE (list_store), &iter, index);
+
+  gtk_list_store_set (GTK_LIST_STORE (list_store), &iter,
+                      COLUMN_STRING, str, -1);
+
+  (*env)->ReleaseStringUTFChars (env, text, str);
+
+  gdk_threads_leave ();
+}
+
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkListPeer_delItems
+  (JNIEnv *env, jobject obj, jint start, jint end)
+{
+  void *ptr;
+  GtkWidget *list;
+  GtkTreeIter iter;
+  GtkTreeModel *list_store;
+  jint i;
+  jint num_items;
+    
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  list = list_get_widget (GTK_WIDGET (ptr));
+  list_store = gtk_tree_view_get_model (GTK_TREE_VIEW (list));
+
+  /* Special case: remove all rows. */
+  if (end == -1)
+    gtk_list_store_clear (GTK_LIST_STORE (list_store));
+  else
+    {
+      i = 0;
+      num_items = end - start + 1;
+      gtk_tree_model_iter_nth_child (list_store, &iter, NULL, start);
+      while (i < num_items)
+	{
+	  gtk_list_store_remove (GTK_LIST_STORE (list_store), &iter);
+	  i++;
+	}
+    }
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkListPeer_select
+  (JNIEnv *env, jobject obj, jint index)
+{
+  void *ptr;
+  GtkWidget *list;
+  GtkTreePath *path;
+    
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  list = list_get_widget (GTK_WIDGET (ptr));
+  path = gtk_tree_path_new_from_indices (index, -1);
+  gtk_tree_view_set_cursor (GTK_TREE_VIEW (list), path, NULL, FALSE);
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkListPeer_deselect
+  (JNIEnv *env, jobject obj, jint index)
+{
+  void *ptr;
+  GtkWidget *list;
+  GtkTreeSelection *selection;
+  GtkTreePath *path;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  list = list_get_widget (GTK_WIDGET (ptr));
+  selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (list));
+  path = gtk_tree_path_new_from_indices (index, -1);
+  gtk_tree_selection_unselect_path (selection, path);
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkListPeer_getSize
+  (JNIEnv *env, jobject obj, jint rows, jint visible_rows, jintArray jdims)
+{
+  void *ptr;
+  jint *dims;
+  GtkRequisition current_req;
+  GtkRequisition natural_req;
+  GtkWidget* bin;
+
+  gdk_threads_enter ();
+
+  dims = (*env)->GetIntArrayElements (env, jdims, NULL);
+  dims[0] = dims[1] = 0;
+
+  ptr = NSA_GET_PTR (env, obj);
+  bin = list_get_widget (GTK_WIDGET (ptr));
+  
+  /* Save the widget's current size request. */
+  gtk_widget_size_request (bin, &current_req);
+      
+  /* Get the widget's "natural" size request. */
+  gtk_widget_set_size_request (GTK_WIDGET (ptr), -1, -1);
+  gtk_widget_size_request (bin, &natural_req);
+
+  /* Reset the widget's size request. */
+  gtk_widget_set_size_request (bin,
+                               current_req.width, current_req.height);
+
+  dims[0] = natural_req.width;
+
+  /* Calculate the final height, by comparing the number of rows
+     in the list to the number of rows requested by the caller.
+     FIXME: Is there a GTK method that counts the number of rows
+     in the list? If so, we don't need to bring visible_rows from
+     the Java peer. */
+  if (rows == visible_rows)
+    dims[1] = natural_req.height;
+  else
+    dims[1] = natural_req.height / visible_rows * rows;
+
+  (*env)->ReleaseIntArrayElements (env, jdims, dims, 0);
+
+  gdk_threads_leave ();
+}
+
+
+JNIEXPORT jintArray JNICALL
+Java_gnu_java_awt_peer_gtk_GtkListPeer_getSelectedIndexes
+  (JNIEnv *env, jobject obj)
+{
+  void *ptr;
+  GtkWidget *list;
+  GtkTreeSelection *selection;
+  jintArray result_array;
+  jint *result_array_iter;
+  GList *current_row;
+  GList *rows;
+  gint *indices;
+  jint count;
+  jint i;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  list = list_get_widget (GTK_WIDGET (ptr));
+  selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (list));
+  count = gtk_tree_selection_count_selected_rows (selection);
+  if (count > 0)
+    {
+      current_row = rows = gtk_tree_selection_get_selected_rows (selection, NULL);
+
+      result_array = (*env)->NewIntArray (env, count);
+
+      result_array_iter = (*env)->GetIntArrayElements (env, result_array, NULL);
+
+      for (i = 0; i < count; i++)
+        {
+          indices = gtk_tree_path_get_indices (current_row->data);
+          result_array_iter[i] = indices ? indices[0] : -1;
+          current_row = g_list_next (current_row);
+        }
+
+      if (rows)
+        {
+          g_list_foreach (rows, (GFunc) gtk_tree_path_free, NULL);
+          g_list_free (rows);
+        }
+
+      (*env)->ReleaseIntArrayElements (env, result_array, result_array_iter, 0);
+    }
+  else
+    result_array = NULL;
+
+  gdk_threads_leave ();
+
+  return result_array;
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkListPeer_makeVisible
+  (JNIEnv *env, jobject obj, jint index)
+{
+  void *ptr;
+  GtkWidget *list;
+  GtkTreePath *path;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  list = list_get_widget (GTK_WIDGET (ptr));
+  path = gtk_tree_path_new_from_indices (index, -1);
+  gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (list), path,
+                                NULL, FALSE, 0.0, 0.0);
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkListPeer_setMultipleMode
+  (JNIEnv *env, jobject obj, jboolean mode)
+{
+  void *ptr;
+  GtkWidget *list;
+  GtkTreeSelection *selection;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  list = list_get_widget (GTK_WIDGET (ptr));
+  selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (list));
+  gtk_tree_selection_set_mode (selection,
+                               mode ? GTK_SELECTION_MULTIPLE
+                               : GTK_SELECTION_SINGLE);
+
+  gdk_threads_leave ();
+}
+
+static gboolean
+item_highlighted_cb (GtkTreeSelection *selection __attribute__((unused)),
+                     GtkTreeModel *model,
+                     GtkTreePath *path,
+                     gboolean path_currently_selected,
+                     jobject peer)
+{
+  GtkTreeIter iter;
+  jint row;
+  gint *indices;
+
+  if (gtk_tree_model_get_iter (model, &iter, path))
+    {
+      indices = gtk_tree_path_get_indices (path);
+      row = indices ? indices[0] : -1;
+
+      if (!path_currently_selected)
+        {
+          (*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), peer,
+                                        postListItemEventID,
+                                        row,
+                                        (jint) AWT_ITEM_SELECTED);
+        }
+      else
+        {
+          (*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), peer,
+                                        postListItemEventID,
+                                        row,
+                                        (jint) AWT_ITEM_DESELECTED);
+        }
+    }
+
+  return TRUE;
+}
+
+static GtkWidget *
+list_get_widget (GtkWidget *widget)
+{
+   GtkWidget *wid;
+   g_assert (GTK_IS_EVENT_BOX (widget));
+
+   wid = gtk_bin_get_child (GTK_BIN (widget));
+   g_assert (GTK_IS_SCROLLED_WINDOW (wid));
+
+   wid = gtk_bin_get_child (GTK_BIN (wid));
+
+   return wid;
+}
+

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuBarPeer.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuBarPeer.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuBarPeer.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuBarPeer.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,92 @@
+/* gtkmenubarpeer.c -- Native implementation of GtkMenuBarPeer
+   Copyright (C) 1999, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+#include "gtkpeer.h"
+#include "gnu_java_awt_peer_gtk_GtkMenuBarPeer.h"
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkMenuBarPeer_create
+  (JNIEnv *env, jobject obj)
+{
+  GtkWidget *widget;
+
+  gdk_threads_enter ();
+  
+  NSA_SET_GLOBAL_REF (env, obj);
+
+  widget = gtk_menu_bar_new ();
+  gtk_widget_show (widget);
+
+  NSA_SET_PTR (env, obj, widget);
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkMenuBarPeer_addMenu
+  (JNIEnv *env, jobject obj, jobject menupeer)
+{
+  void *mbar, *menu;
+
+  gdk_threads_enter ();
+
+  mbar = NSA_GET_PTR (env, obj);
+  menu = NSA_GET_PTR (env, menupeer);
+
+  gtk_menu_shell_append (GTK_MENU_SHELL (mbar), GTK_WIDGET (menu));
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkMenuBarPeer_delMenu
+  (JNIEnv *env, jobject obj, jint index)
+{
+  void *ptr;
+  GList *list;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  list = gtk_container_get_children (GTK_CONTAINER (ptr));
+  list = g_list_nth (list, index);
+  gtk_container_remove (GTK_CONTAINER (ptr), GTK_WIDGET (list->data));
+
+  gdk_threads_leave ();
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuComponentPeer.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuComponentPeer.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuComponentPeer.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuComponentPeer.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,56 @@
+/* gtkmenucomponentpeer.c -- Native implementation of GtkMenuComponentPeer
+   Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+#include "gtkpeer.h"
+#include "gnu_java_awt_peer_gtk_GtkMenuComponentPeer.h"
+
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuComponentPeer_dispose
+  (JNIEnv *env, jobject obj)
+{
+  /* For MenuComponents and its subclasses, the widgets are
+     automatically destroyed by Gtk when the parent MenuBar
+     is removed from the Frame. So we avoid the widget
+     destruction in GtkGenericPeer dispose() by overriding
+     it here. */
+     
+  /* However, references to the Java objects still exist in the
+     state tables, so we still have to remove those. */
+     
+  NSA_DEL_GLOBAL_REF (env, obj);
+  NSA_DEL_PTR (env, obj);  
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuItemPeer.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuItemPeer.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuItemPeer.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuItemPeer.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,191 @@
+/* gtkmenuitempeer.c -- Native implementation of GtkMenuItemPeer
+   Copyright (C) 1999 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+#include "gtkpeer.h"
+#include "gnu_java_awt_peer_gtk_GtkMenuItemPeer.h"
+#include "gnu_java_awt_peer_gtk_GtkComponentPeer.h"
+
+static jmethodID postMenuActionEventID;
+
+void
+cp_gtk_menuitem_init_jni (void)
+{
+  jclass gtkmenuitempeer;
+
+  gtkmenuitempeer = (*cp_gtk_gdk_env())->FindClass (cp_gtk_gdk_env(),
+                                      "gnu/java/awt/peer/gtk/GtkMenuItemPeer");
+
+  postMenuActionEventID = (*cp_gtk_gdk_env())->GetMethodID (cp_gtk_gdk_env(),
+                                                     gtkmenuitempeer,
+                                                     "postMenuActionEvent",
+                                                     "()V");
+}
+
+static void item_activate_cb (GtkMenuItem *item __attribute__((unused)),
+                              jobject peer_obj);
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkMenuItemPeer_create
+  (JNIEnv *env, jobject obj, jstring label)
+{
+  GtkWidget *widget;
+  const char *str;
+
+  gdk_threads_enter ();
+
+  NSA_SET_GLOBAL_REF (env, obj);
+
+  str = (*env)->GetStringUTFChars (env, label, NULL);
+
+  /* "-" signals that we need a separator. */
+  if (strcmp (str, "-") == 0)
+    widget = gtk_menu_item_new ();
+  else
+    widget = gtk_menu_item_new_with_label (str);
+
+  gtk_widget_show (widget);
+
+  (*env)->ReleaseStringUTFChars (env, label, str);
+
+  NSA_SET_PTR (env, obj, widget);
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkMenuItemPeer_connectSignals
+  (JNIEnv *env, jobject obj)
+{
+  void *ptr;
+  jobject *gref;
+  
+  gdk_threads_enter ();
+  
+  ptr = NSA_GET_PTR (env, obj);
+  gref = NSA_GET_GLOBAL_REF (env, obj);
+
+  g_signal_connect (G_OBJECT (ptr), "activate",
+                    G_CALLBACK (item_activate_cb), *gref);
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkMenuItemPeer_gtkWidgetModifyFont
+  (JNIEnv *env, jobject obj, jstring name, jint style, jint size)
+{
+  const char *font_name;
+  void *ptr;
+  GtkWidget *label;
+  PangoFontDescription *font_desc;
+
+  gdk_threads_enter();
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  font_name = (*env)->GetStringUTFChars (env, name, NULL);
+
+  label = gtk_bin_get_child (GTK_BIN (ptr));
+
+  if (label)
+    {
+      font_desc = pango_font_description_from_string (font_name);
+      pango_font_description_set_size (font_desc,
+                                   size * cp_gtk_dpi_conversion_factor);
+
+      if (style & AWT_STYLE_BOLD)
+        pango_font_description_set_weight (font_desc, PANGO_WEIGHT_BOLD);
+
+      if (style & AWT_STYLE_ITALIC)
+        pango_font_description_set_style (font_desc, PANGO_STYLE_OBLIQUE);
+
+      gtk_widget_modify_font (GTK_WIDGET(label), font_desc);
+
+      pango_font_description_free (font_desc);
+    }
+
+  (*env)->ReleaseStringUTFChars (env, name, font_name);
+
+  gdk_threads_leave();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkMenuItemPeer_setEnabled
+  (JNIEnv *env, jobject obj, jboolean enabled)
+{
+  void *ptr;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  gtk_widget_set_sensitive (GTK_WIDGET (ptr), enabled);
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkMenuItemPeer_setLabel
+  (JNIEnv *env, jobject obj, jstring label)
+{
+  void *ptr;
+  const char *str;
+  GtkAccelLabel *accel_label;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  str = (*env)->GetStringUTFChars (env, label, NULL);
+
+  accel_label = GTK_ACCEL_LABEL (GTK_BIN (ptr)->child);
+
+  gtk_label_set_text (GTK_LABEL (accel_label), str);
+  gtk_accel_label_refetch (accel_label);
+
+  (*env)->ReleaseStringUTFChars (env, label, str);
+
+  gdk_threads_leave ();
+}
+
+static void
+item_activate_cb (GtkMenuItem *item __attribute__((unused)), jobject peer_obj)
+{
+  (*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), peer_obj,
+                                       postMenuActionEventID);
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuPeer.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuPeer.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuPeer.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuPeer.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,176 @@
+/* gtkmenupeer.c -- Native implementation of GtkMenuPeer
+   Copyright (C) 1999, 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+#include "gtkpeer.h"
+#include "gnu_java_awt_peer_gtk_GtkMenuPeer.h"
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkMenuPeer_setupAccelGroup
+  (JNIEnv *env, jobject obj, jobject parent)
+{
+  void *ptr1, *ptr2;
+
+  gdk_threads_enter ();
+
+  ptr1 = NSA_GET_PTR (env, obj);
+
+  if (!parent)
+    {
+      gtk_menu_set_accel_group (GTK_MENU (GTK_MENU_ITEM (ptr1)->submenu), 
+				gtk_accel_group_new ());
+    }
+  else
+    {
+      GtkAccelGroup *parent_accel;
+
+      ptr2 = NSA_GET_PTR (env, parent);
+      parent_accel = gtk_menu_get_accel_group (GTK_MENU (GTK_MENU_ITEM (ptr2)->submenu));
+      
+      gtk_menu_set_accel_group (GTK_MENU (GTK_MENU_ITEM (ptr1)->submenu),
+				parent_accel);
+    }
+      
+  gdk_threads_leave ();
+}
+
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkMenuPeer_create
+  (JNIEnv *env, jobject obj, jstring label)
+{
+  GtkWidget *menu_title, *menu, *toplevel;
+  const char *str;
+
+  gdk_threads_enter ();
+  
+  NSA_SET_GLOBAL_REF (env, obj);
+
+  str = (*env)->GetStringUTFChars (env, label, NULL);
+
+  menu = gtk_menu_new ();
+  
+  if (str != NULL)
+    menu_title = gtk_menu_item_new_with_label (str);
+  else
+    menu_title = gtk_menu_item_new();
+
+  gtk_menu_item_set_submenu (GTK_MENU_ITEM (menu_title), menu);
+
+  /* Allow this menu to grab the pointer. */
+  toplevel = gtk_widget_get_toplevel (menu);
+  if (GTK_IS_WINDOW (toplevel))
+    {
+      gtk_window_group_add_window (cp_gtk_global_window_group,
+                                   GTK_WINDOW(toplevel));
+    }
+
+  gtk_widget_show (menu_title);
+
+  NSA_SET_PTR (env, obj, menu_title);
+
+  (*env)->ReleaseStringUTFChars (env, label, str);
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkMenuPeer_addTearOff
+  (JNIEnv *env, jobject obj)
+{
+  void *ptr1;
+  GtkWidget *menu, *item;
+
+  gdk_threads_enter ();
+
+  ptr1 = NSA_GET_PTR (env, obj);
+
+  menu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (ptr1));
+  item = gtk_tearoff_menu_item_new ();
+  gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
+  gtk_widget_show (item);
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkMenuPeer_addItem
+  (JNIEnv *env, jobject obj, jobject menuitempeer, jint key, jboolean shift)
+{
+  void *ptr1, *ptr2;
+  GtkWidget *menu;
+
+  gdk_threads_enter ();
+
+  ptr1 = NSA_GET_PTR (env, obj);
+  ptr2 = NSA_GET_PTR (env, menuitempeer);
+
+  menu = gtk_menu_item_get_submenu(GTK_MENU_ITEM(ptr1));
+  gtk_menu_shell_append (GTK_MENU_SHELL(menu), GTK_WIDGET (ptr2));
+
+  if (key)
+    {
+      gtk_widget_add_accelerator (GTK_WIDGET (ptr2), "activate",
+				  gtk_menu_get_accel_group (GTK_MENU (menu)), key, 
+				  (GDK_CONTROL_MASK
+				   | ((shift) ? GDK_SHIFT_MASK : 0)), 
+				  GTK_ACCEL_VISIBLE);
+    }
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkMenuPeer_delItem
+  (JNIEnv *env, jobject obj, jint index)
+{
+  void *ptr;
+  GList *list;
+  GtkWidget *menu;
+  
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  menu = gtk_menu_item_get_submenu(GTK_MENU_ITEM(ptr));
+
+  list = gtk_container_get_children (GTK_CONTAINER (menu));
+  list = g_list_nth (list, index);
+  gtk_container_remove (GTK_CONTAINER (menu), GTK_WIDGET (list->data));
+
+  gdk_threads_leave ();
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPanelPeer.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPanelPeer.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPanelPeer.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPanelPeer.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,112 @@
+/* gtkpanelpeer.c -- Native implementation of GtkPanelPeer
+   Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+#include "gtkpeer.h"
+#include "gnu_java_awt_peer_gtk_GtkComponentPeer.h"
+#include "gnu_java_awt_peer_gtk_GtkPanelPeer.h"
+
+static gboolean panel_focus_in_cb (GtkWidget * widget,
+                                   GdkEventFocus *event,
+                                   jobject peer);
+static gboolean panel_focus_out_cb (GtkWidget * widget,
+                                    GdkEventFocus *event,
+                                    jobject peer);
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkPanelPeer_create
+  (JNIEnv *env, jobject obj)
+{
+  GtkWidget *widget;
+
+  gdk_threads_enter ();
+
+  NSA_SET_GLOBAL_REF (env, obj);
+
+  widget = gtk_fixed_new ();
+
+  gtk_fixed_set_has_window (GTK_FIXED (widget), TRUE);
+
+  GTK_WIDGET_SET_FLAGS (widget, GTK_CAN_FOCUS);
+
+  NSA_SET_PTR (env, obj, widget);
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkPanelPeer_connectSignals
+  (JNIEnv *env, jobject obj)
+{
+  void *ptr;
+  jobject *gref;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+  gref = NSA_GET_GLOBAL_REF (env, obj);
+
+  /* Panel signals.  These callbacks prevent expose events being
+     delivered to the panel when it is focused. */
+  g_signal_connect (G_OBJECT (ptr), "focus-in-event",
+                    G_CALLBACK (panel_focus_in_cb), *gref);
+
+  g_signal_connect (G_OBJECT (ptr), "focus-out-event",
+                    G_CALLBACK (panel_focus_out_cb), *gref);
+
+  /* Component signals.  Exclude focus signals. */
+  cp_gtk_component_connect_expose_signals (ptr, gref);
+  cp_gtk_component_connect_mouse_signals (ptr, gref);
+
+  gdk_threads_leave ();
+}
+
+static gboolean
+panel_focus_in_cb (GtkWidget * widget  __attribute__((unused)),
+		    GdkEventFocus *event  __attribute__((unused)),
+		    jobject peer __attribute__((unused)))
+{
+  return TRUE;
+}
+
+static gboolean
+panel_focus_out_cb (GtkWidget * widget __attribute__((unused)),
+		     GdkEventFocus *event __attribute__((unused)),
+		     jobject peer __attribute__((unused)))
+{
+  return TRUE;
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPopupMenuPeer.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPopupMenuPeer.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPopupMenuPeer.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPopupMenuPeer.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,105 @@
+/* gtkpopupmenupeer.c -- Native implementation of GtkPopupMenuPeer
+   Copyright (C) 1999, 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+#include "gtkpeer.h"
+#include "gnu_java_awt_peer_gtk_GtkPopupMenuPeer.h"
+
+struct pos
+{
+  gint x;
+  gint y;
+};
+
+static void 
+menu_pos (GtkMenu *menu __attribute__((unused)),
+	  gint *x, gint *y,
+	  gboolean *push_in,
+	  gpointer user_data)
+{
+  struct pos *p = (struct pos *) user_data;
+
+  *x = p->x;
+  *y = p->y;
+  *push_in = TRUE;
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkPopupMenuPeer_show
+  (JNIEnv *env, jobject obj, jint x, jint y, jlong time)
+{
+  void *ptr;
+  struct pos *p;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  p = g_malloc (sizeof (struct pos));
+  p->x = x;
+  p->y = y;
+  
+  gtk_menu_popup (GTK_MENU (GTK_MENU_ITEM (ptr)->submenu), 
+		  NULL, NULL, menu_pos, p, 0, time);
+
+  g_free (p);
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkPopupMenuPeer_setupAccelGroup
+  (JNIEnv *env, jobject obj, jobject parent)
+{
+  void *ptr1, *ptr2;
+  GtkMenu *menu;
+
+  gdk_threads_enter ();
+
+  ptr1 = NSA_GET_PTR (env, obj);
+  ptr2 = NSA_GET_PTR (env, parent);
+
+  menu = GTK_MENU (GTK_MENU_ITEM (ptr1)->submenu);
+  gtk_menu_set_accel_group (menu, gtk_accel_group_new ());
+  /* FIXME: update this to use GTK-2.4 GtkActions. */
+#if 0
+  _gtk_accel_group_attach (gtk_menu_get_accel_group (menu),
+			   G_OBJECT (gtk_widget_get_toplevel (ptr2)));
+#endif
+
+  gdk_threads_leave ();
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollPanePeer.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollPanePeer.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollPanePeer.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollPanePeer.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,222 @@
+/* gtkscrollpanepeer.c -- Native implementation of GtkScrollPanePeer
+   Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+#include "gtkpeer.h"
+#include "gnu_java_awt_peer_gtk_GtkScrollPanePeer.h"
+
+#define AWT_SCROLLPANE_SCROLLBARS_AS_NEEDED 0
+#define AWT_SCROLLPANE_SCROLLBARS_ALWAYS 1
+#define AWT_SCROLLPANE_SCROLLBARS_NEVER 2
+
+static GtkWidget *scrollpane_get_widget (GtkWidget *widget);
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkScrollPanePeer_create 
+  (JNIEnv *env, jobject obj, int width, int height)
+{
+  GtkWidget *sw;
+  GtkWidget *eventbox;
+  
+  gdk_threads_enter ();
+  
+  /* Create global reference and save it for future use */
+  NSA_SET_GLOBAL_REF (env, obj);
+
+  sw = gtk_scrolled_window_new (NULL, NULL);
+  gtk_widget_set_size_request (sw, width, height);
+  eventbox = gtk_event_box_new ();
+  gtk_container_add (GTK_CONTAINER (eventbox), sw);
+  gtk_widget_show (sw);
+
+  NSA_SET_PTR (env, obj, eventbox);
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkScrollPanePeer_setScrollPosition
+  (JNIEnv *env, jobject obj, jint x, jint y)
+{
+  GtkAdjustment *hadj, *vadj;
+  GtkScrolledWindow *sw;
+  void *ptr;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  sw = GTK_SCROLLED_WINDOW (scrollpane_get_widget (GTK_WIDGET (ptr)));
+
+  hadj = gtk_scrolled_window_get_hadjustment (sw);
+  vadj = gtk_scrolled_window_get_vadjustment (sw);
+
+  gtk_adjustment_set_value (hadj, x);
+  gtk_adjustment_set_value (vadj, y);
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkScrollPanePeer_gtkScrolledWindowSetHScrollIncrement
+  (JNIEnv *env, jobject obj, jint u)
+{
+  GtkAdjustment *hadj;
+  GtkScrolledWindow *sw;
+  void *ptr;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  sw = GTK_SCROLLED_WINDOW (scrollpane_get_widget (GTK_WIDGET (ptr)));
+
+  hadj = gtk_scrolled_window_get_hadjustment (sw);
+  hadj->step_increment = u;
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkScrollPanePeer_gtkScrolledWindowSetVScrollIncrement
+  (JNIEnv *env, jobject obj, jint u)
+{
+  GtkAdjustment *vadj;
+  GtkScrolledWindow *sw;
+  void *ptr;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  sw = GTK_SCROLLED_WINDOW (scrollpane_get_widget (GTK_WIDGET (ptr)));
+
+  vadj = gtk_scrolled_window_get_hadjustment (sw);
+  vadj->step_increment = u;
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT jint JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkScrollPanePeer_getHScrollbarHeight
+  (JNIEnv *env, jobject obj)
+{
+  void *ptr;
+  GtkScrolledWindow *sw;
+  GtkRequisition requisition;
+  jint height = 0;
+  jint spacing = 0;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  sw = GTK_SCROLLED_WINDOW (scrollpane_get_widget (GTK_WIDGET (ptr)));
+
+  gtk_widget_size_request (sw->hscrollbar, &requisition);
+  gtk_widget_style_get (GTK_WIDGET (sw), "scrollbar_spacing", &spacing, NULL);
+  height = requisition.height + spacing;
+
+  gdk_threads_leave ();
+
+  return height;
+}
+
+JNIEXPORT jint JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkScrollPanePeer_getVScrollbarWidth
+  (JNIEnv *env, jobject obj)
+{
+  void *ptr;
+  GtkScrolledWindow *sw;
+  GtkRequisition requisition;
+  jint width = 0;
+  jint spacing = 0;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  sw = GTK_SCROLLED_WINDOW (scrollpane_get_widget (GTK_WIDGET (ptr)));
+
+  gtk_widget_size_request (sw->vscrollbar, &requisition);
+  gtk_widget_style_get (GTK_WIDGET (sw), "scrollbar_spacing", &spacing, NULL);
+  width = requisition.width + spacing;
+
+  gdk_threads_leave ();
+
+  return width;
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkScrollPanePeer_setPolicy
+  (JNIEnv *env, jobject obj, jint policy)
+{
+  void *ptr;
+  GtkWidget *sw;
+  
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  switch (policy)
+    {
+    case AWT_SCROLLPANE_SCROLLBARS_AS_NEEDED:
+      policy = GTK_POLICY_AUTOMATIC;
+      break;
+    case AWT_SCROLLPANE_SCROLLBARS_ALWAYS:
+      policy = GTK_POLICY_ALWAYS;
+      break;
+    case AWT_SCROLLPANE_SCROLLBARS_NEVER:
+      policy = GTK_POLICY_NEVER;
+      break;
+    }
+
+  sw = scrollpane_get_widget (GTK_WIDGET (ptr));
+  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), policy, policy);
+
+  gdk_threads_leave ();
+}
+
+static GtkWidget *
+scrollpane_get_widget (GtkWidget *widget)
+{
+  GtkWidget *wid;
+  g_assert (GTK_IS_EVENT_BOX (widget));
+  wid = gtk_bin_get_child (GTK_BIN(widget));
+
+  return wid;
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollbarPeer.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollbarPeer.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollbarPeer.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollbarPeer.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,296 @@
+/* gtkscrollbarpeer.c -- Native implementation of GtkScrollbarPeer
+   Copyright (C) 1998, 1999, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+#include <math.h>
+#include "gtkpeer.h"
+#include "gnu_java_awt_peer_gtk_GtkComponentPeer.h"
+#include "gnu_java_awt_peer_gtk_GtkScrollbarPeer.h"
+
+#define AWT_ADJUSTMENT_UNIT_INCREMENT 1
+#define AWT_ADJUSTMENT_UNIT_DECREMENT 2
+#define AWT_ADJUSTMENT_BLOCK_DECREMENT 3
+#define AWT_ADJUSTMENT_BLOCK_INCREMENT 4
+#define AWT_ADJUSTMENT_TRACK 5
+
+static jmethodID postAdjustmentEventID;
+static GtkWidget *scrollbar_get_widget (GtkWidget *widget);
+
+void
+cp_gtk_scrollbar_init_jni (void)
+{
+  jclass gtkscrollbarpeer;
+
+  gtkscrollbarpeer = (*cp_gtk_gdk_env())->FindClass (cp_gtk_gdk_env(),
+                                     "gnu/java/awt/peer/gtk/GtkScrollbarPeer");
+
+  postAdjustmentEventID = (*cp_gtk_gdk_env())->GetMethodID (cp_gtk_gdk_env(),
+                                                     gtkscrollbarpeer,
+                                                     "postAdjustmentEvent",
+                                                     "(II)V");
+}
+
+#if GTK_MINOR_VERSION > 4
+static gboolean slider_moved_cb (GtkRange *range,
+                                 GtkScrollType scroll,
+                                 gdouble value,
+                                 jobject obj);
+#else
+static void post_change_event_cb (GtkRange *range,
+                                  jobject peer);
+#endif
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkScrollbarPeer_create
+  (JNIEnv *env, jobject obj, jint orientation, jint value,
+   jint min, jint max, jint step_incr, jint page_incr, jint visible_amount)
+{
+  GtkWidget *scrollbar;
+  GtkWidget *eventbox;
+  GtkObject *adj;
+
+  /* Create global reference and save it for future use */
+  NSA_SET_GLOBAL_REF (env, obj);
+
+  gdk_threads_enter ();
+
+  /* A little hack because gtk_range_set_range() doesn't allow min == max. */
+  if (min == max)
+    {
+      if (visible_amount == 0)
+	visible_amount = 1;
+      max++;
+    }
+
+  adj = gtk_adjustment_new ((gdouble) value,
+                            (gdouble) min,
+                            (gdouble) max,
+			    (gdouble) step_incr,
+                            (gdouble) page_incr,
+			    (gdouble) visible_amount);
+
+  scrollbar = orientation
+    ? gtk_vscrollbar_new (GTK_ADJUSTMENT (adj))
+    : gtk_hscrollbar_new (GTK_ADJUSTMENT (adj));
+  eventbox = gtk_event_box_new ();
+  gtk_container_add (GTK_CONTAINER (eventbox), scrollbar);
+  gtk_widget_show (scrollbar);
+  
+  GTK_RANGE (scrollbar)->round_digits = 0;
+  /* These calls seem redundant but they are not.  They clamp values
+     so that the slider's entirety is always between the two
+     steppers. */
+  gtk_range_set_range (GTK_RANGE (scrollbar), (gdouble) min, (gdouble) max);
+  gtk_range_set_value (GTK_RANGE (scrollbar), (gdouble) value);
+
+  gdk_threads_leave ();
+
+  NSA_SET_PTR (env, obj, eventbox);
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkScrollbarPeer_connectSignals
+  (JNIEnv *env, jobject obj)
+{
+  void *ptr = NSA_GET_PTR (env, obj);
+  GtkWidget *wid = scrollbar_get_widget (GTK_WIDGET (ptr));
+  jobject *gref = NSA_GET_GLOBAL_REF (env, obj);
+  g_assert (gref);
+
+  gdk_threads_enter ();
+
+  /* Scrollbar signals */
+#if GTK_MINOR_VERSION > 4
+  g_signal_connect (G_OBJECT (wid), "change-value",
+                    G_CALLBACK (slider_moved_cb), *gref);
+#else
+  g_signal_connect (G_OBJECT (wid), "value-changed",
+                    G_CALLBACK (post_change_event_cb), *gref);
+#endif
+
+  /* Component signals */
+  cp_gtk_component_connect_signals (G_OBJECT (wid), gref);
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkScrollbarPeer_setLineIncrement
+  (JNIEnv *env, jobject obj, jint amount)
+{
+  void *ptr;
+  GtkAdjustment *adj;
+  GtkWidget *wid;
+
+  ptr = NSA_GET_PTR (env, obj);
+  wid = scrollbar_get_widget (GTK_WIDGET (ptr));
+  
+  gdk_threads_enter ();
+
+  adj = gtk_range_get_adjustment (GTK_RANGE (wid));
+  adj->step_increment = (gdouble) amount;
+  gtk_adjustment_changed (adj);
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkScrollbarPeer_setPageIncrement
+  (JNIEnv *env, jobject obj, jint amount)
+{
+  void *ptr;
+  GtkAdjustment *adj;
+  GtkWidget *wid;
+  
+  ptr = NSA_GET_PTR (env, obj);
+  wid = scrollbar_get_widget (GTK_WIDGET (ptr));
+  
+  gdk_threads_enter ();
+
+  adj = gtk_range_get_adjustment (GTK_RANGE (wid));
+  adj->page_increment = (gdouble) amount;
+  gtk_adjustment_changed (adj);
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkScrollbarPeer_setBarValues
+  (JNIEnv *env, jobject obj, jint value, jint visible, jint min, jint max)
+{
+  void *ptr;
+  GtkAdjustment *adj;
+  GtkWidget *wid;
+  
+  ptr = NSA_GET_PTR (env, obj);
+  wid = scrollbar_get_widget (GTK_WIDGET (ptr));
+  
+  gdk_threads_enter ();
+
+  /* A little hack because gtk_range_set_range() doesn't allow min == max. */
+  if (min == max)
+    {
+      if (visible == 0)
+	visible = 1;
+      max++;
+    }
+
+  adj = gtk_range_get_adjustment (GTK_RANGE (wid));
+  adj->page_size = (gdouble) visible;
+
+  gtk_range_set_range (GTK_RANGE (wid), (gdouble) min, (gdouble) max);
+  gtk_range_set_value (GTK_RANGE (wid), (gdouble) value);
+
+  gdk_threads_leave ();
+}
+
+#if GTK_MINOR_VERSION > 4
+static gboolean
+slider_moved_cb (GtkRange *range,
+                 GtkScrollType scroll,
+                 gdouble value,
+                 jobject obj)
+{
+  GtkAdjustment *adj = gtk_range_get_adjustment (GTK_RANGE (range));
+  
+  value = CLAMP (value, adj->lower,
+                 (adj->upper - adj->page_size));
+
+  if (range->round_digits >= 0)
+    {
+      gdouble power;
+      gint i;
+
+      i = range->round_digits;
+      power = 1;
+      while (i--)
+        power *= 10;
+      
+      value = floor ((value * power) + 0.5) / power;
+    }
+  
+  switch (scroll)
+    {
+    case GTK_SCROLL_STEP_BACKWARD:
+      (*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), obj, postAdjustmentEventID,
+                                    AWT_ADJUSTMENT_UNIT_DECREMENT,
+                                    (jint) value);
+      break;
+    case GTK_SCROLL_STEP_FORWARD:
+      (*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), obj, postAdjustmentEventID,
+                                    AWT_ADJUSTMENT_UNIT_INCREMENT,
+                                    (jint) value);
+      break;
+    case GTK_SCROLL_PAGE_BACKWARD:
+      (*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), obj, postAdjustmentEventID,
+                                    AWT_ADJUSTMENT_BLOCK_DECREMENT,
+                                    (jint) value);
+      break;
+    case GTK_SCROLL_PAGE_FORWARD:
+      (*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), obj, postAdjustmentEventID,
+                                    AWT_ADJUSTMENT_BLOCK_INCREMENT,
+                                    (jint) value);
+      break;
+    default:
+      /* GTK_SCROLL_JUMP: */
+      (*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), obj, postAdjustmentEventID,
+                                    AWT_ADJUSTMENT_TRACK,
+                                    (jint) value);
+      break;
+    }
+  return FALSE;
+}
+#else
+static void
+post_change_event_cb (GtkRange *range, jobject peer)
+{
+  GtkAdjustment *adj;
+  adj = gtk_range_get_adjustment (range);
+  (*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), peer, postAdjustmentEventID,
+				AWT_ADJUSTMENT_TRACK, (jint) adj->value);
+}
+#endif
+
+static GtkWidget *
+scrollbar_get_widget (GtkWidget *widget)
+{
+  GtkWidget *wid;
+  g_assert (GTK_IS_EVENT_BOX (widget));
+  wid = gtk_bin_get_child (GTK_BIN(widget));
+
+  return wid;
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkSelection.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkSelection.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkSelection.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkSelection.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,481 @@
+/* gtkselection.c -- Native C functions for GtkSelection class using gtk+.
+   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+#include "jcl.h"
+#include "gtkpeer.h"
+#include "gnu_java_awt_peer_gtk_GtkSelection.h"
+
+static jmethodID mimeTypesAvailableID;
+
+/* Note this is actually just a GtkClipboardReceivedFunc, not a real
+   GtkClipboardTargetsReceivedFunc, see requestMimeTypes. */
+static void
+clipboard_targets_received (GtkClipboard *clipboard
+			    __attribute__((unused)),
+			    GtkSelectionData *target_data,
+			    gpointer selection)
+{
+  GdkAtom *targets = NULL;
+  gint targets_len = 0;
+  gchar **target_strings = NULL;
+  jobjectArray strings = NULL;
+  int strings_len = 0;
+  gboolean include_text = FALSE;
+  gboolean include_image = FALSE;
+  gboolean include_uris = FALSE;
+  jobject selection_obj = (jobject) selection;
+  JNIEnv *env = cp_gtk_gdk_env ();
+
+  if (target_data != NULL && target_data->length > 0)
+    {
+      include_text = gtk_selection_data_targets_include_text (target_data);
+
+#if GTK_MINOR_VERSION > 4
+      include_image = gtk_selection_data_targets_include_image (target_data,
+								TRUE);
+#endif
+      if (gtk_selection_data_get_targets (target_data, &targets, &targets_len))
+	{
+	  int i;
+	  GdkAtom uri_list_atom = gdk_atom_intern ("text/uri-list", FALSE);
+	  target_strings = g_new (gchar*, targets_len);
+	  if (target_strings != NULL)
+	    for (i = 0; i < targets_len; i++)
+	      {
+		gchar *name =  gdk_atom_name (targets[i]);
+		if (strchr (name, '/') != NULL)
+		  {
+		    target_strings[i] = name;
+		    strings_len++;
+		    if (! include_uris && targets[i] == uri_list_atom)
+		      include_uris = TRUE;
+		  }
+		else
+		  target_strings[i] = NULL;
+	      }
+	}
+
+      if (target_strings != NULL)
+	{
+	  int i = 0, j = 0;
+	  jclass stringClass;
+	  
+	  if (include_text)
+	    strings_len++;
+	  if (include_image)
+	    strings_len++;
+	  if (include_uris)
+	    strings_len++;
+	  
+	  stringClass = (*env)->FindClass (env, "java/lang/String");
+	  strings = (*env)->NewObjectArray (env, strings_len, stringClass,
+					    NULL);
+	  if (strings != NULL)
+	    {
+	      if (include_text)
+		(*env)->SetObjectArrayElement (env, strings, i++,
+					       cp_gtk_stringTarget);
+	      if (include_image)
+		(*env)->SetObjectArrayElement (env, strings, i++,
+					       cp_gtk_imageTarget);
+	      if (include_uris)
+		(*env)->SetObjectArrayElement (env, strings, i++,
+					       cp_gtk_filesTarget);
+	      
+	      while(i < strings_len)
+		{
+		  if (target_strings[j] == NULL)
+		    j++;
+		  else
+		    {
+		      jstring string;
+		      string = (*env)->NewStringUTF (env,
+						     target_strings[j++]);
+		      if (string == NULL)
+			break;
+		      (*env)->SetObjectArrayElement (env, strings, i++,
+						     string);
+		      (*env)->DeleteLocalRef (env, string);
+		    }
+		}
+	    }
+
+	  for (i = 0; i < targets_len; i++)
+	    g_free (target_strings[i]);
+	  g_free (target_strings);
+	}
+    }
+
+  (*env)->CallVoidMethod (env, selection_obj,
+			  mimeTypesAvailableID,
+			  strings);
+  (*env)->DeleteGlobalRef (env, selection_obj);
+}
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkSelection_requestMimeTypes
+(JNIEnv *env, jobject selection, jboolean clipboard)
+{
+  jobject selection_obj;
+  GtkClipboard *gtk_clipboard;
+  selection_obj = (*env)->NewGlobalRef(env, selection);
+  if (selection_obj == NULL)
+    return;
+
+  if (mimeTypesAvailableID == NULL)
+    {
+      jclass gtk_selection_class;
+      gtk_selection_class = (*env)->GetObjectClass (env, selection_obj);
+      mimeTypesAvailableID = (*env)->GetMethodID (env, gtk_selection_class,
+						"mimeTypesAvailable",
+						"([Ljava/lang/String;)V");
+      if (mimeTypesAvailableID == NULL)
+	return;
+    }
+
+  if (clipboard)
+    gtk_clipboard = cp_gtk_clipboard;
+  else
+    gtk_clipboard = cp_gtk_selection;
+
+  /* We would have liked to call gtk_clipboard_request_targets ()
+     since that is more general. But the result of that, an array of
+     GdkAtoms, cannot be used with the
+     gtk_selection_data_targets_include_<x> functions (despite what
+     the name suggests). */
+  gdk_threads_enter ();
+  gtk_clipboard_request_contents (gtk_clipboard,
+				  gdk_atom_intern ("TARGETS", FALSE),
+				  clipboard_targets_received,
+				  (gpointer) selection_obj);
+  gdk_threads_leave ();
+}
+
+
+static jmethodID textAvailableID;
+
+static void
+clipboard_text_received (GtkClipboard *clipboard
+			 __attribute__((unused)),
+			 const gchar *text,
+			 gpointer selection)
+{
+  jstring string;
+  jobject selection_obj = (jobject) selection;
+
+  JNIEnv *env = cp_gtk_gdk_env ();
+  if (text != NULL)
+    string = (*env)->NewStringUTF (env, text);
+  else
+    string = NULL;
+
+  (*env)->CallVoidMethod (env, selection_obj,
+                          textAvailableID,
+                          string);
+  (*env)->DeleteGlobalRef (env, selection_obj);
+
+  if (string != NULL)
+    (*env)->DeleteLocalRef (env, string);
+
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkSelection_requestText
+(JNIEnv *env, jobject selection, jboolean clipboard)
+{
+  jobject selection_obj;
+  GtkClipboard *gtk_clipboard;
+  selection_obj = (*env)->NewGlobalRef(env, selection);
+  if (selection_obj == NULL)
+    return;
+
+  if (textAvailableID == NULL)
+    {
+      jclass gtk_selection_class;
+      gtk_selection_class = (*env)->GetObjectClass (env, selection_obj);
+      textAvailableID = (*env)->GetMethodID (env, gtk_selection_class,
+					     "textAvailable",
+					     "(Ljava/lang/String;)V");
+      if (textAvailableID == NULL)
+        return;
+    }
+
+  if (clipboard)
+    gtk_clipboard = cp_gtk_clipboard;
+  else
+    gtk_clipboard = cp_gtk_selection;
+
+  gdk_threads_enter ();
+  gtk_clipboard_request_text (gtk_clipboard,
+			      clipboard_text_received,
+			      (gpointer) selection_obj);
+  gdk_threads_leave ();
+}
+
+static jmethodID imageAvailableID;
+
+static void
+clipboard_image_received (GtkClipboard *clipboard
+			  __attribute__((unused)),
+			  GdkPixbuf *pixbuf,
+			  gpointer selection)
+{
+  jobject pointer = NULL;
+  jobject selection_obj = (jobject) selection;
+  JNIEnv *env = cp_gtk_gdk_env ();
+
+  if (pixbuf != NULL)
+    {
+      g_object_ref (pixbuf);
+      pointer = JCL_NewRawDataObject (env, (void *) pixbuf);
+    }
+
+  (*env)->CallVoidMethod (env, selection_obj,
+			  imageAvailableID,
+                          pointer);
+  (*env)->DeleteGlobalRef (env, selection_obj);
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkSelection_requestImage (JNIEnv *env,
+						      jobject obj,
+						      jboolean clipboard)
+{
+  jobject selection_obj;
+  GtkClipboard *gtk_clipboard;
+  selection_obj = (*env)->NewGlobalRef(env, obj);
+  if (selection_obj == NULL)
+    return;
+
+  if (imageAvailableID == NULL)
+    {
+      jclass gtk_selection_class;
+      gtk_selection_class = (*env)->GetObjectClass (env, selection_obj);
+      imageAvailableID = (*env)->GetMethodID (env, gtk_selection_class,
+					     "imageAvailable",
+					     "(Lgnu/classpath/Pointer;)V");
+      if (imageAvailableID == NULL)
+        return;
+    }
+
+  if (clipboard)
+    gtk_clipboard = cp_gtk_clipboard;
+  else
+    gtk_clipboard = cp_gtk_selection;
+
+#if GTK_MINOR_VERSION > 4
+  gdk_threads_enter ();
+  gtk_clipboard_request_image (gtk_clipboard,
+			       clipboard_image_received,
+			       (gpointer) selection_obj);
+  gdk_threads_leave ();
+#else
+  clipboard_image_received (gtk_clipboard, NULL, (gpointer) selection_obj);
+#endif
+}
+
+static jmethodID urisAvailableID;
+
+static void
+clipboard_uris_received (GtkClipboard *clipboard
+			 __attribute__((unused)),
+			 GtkSelectionData *uri_data,
+			 gpointer selection)
+{
+  gchar **uris = NULL;
+  jobjectArray strings = NULL;
+  jobject selection_obj = (jobject) selection;
+  JNIEnv *env = cp_gtk_gdk_env ();
+
+#if GTK_MINOR_VERSION > 4
+  if (uri_data != NULL)
+    uris = gtk_selection_data_get_uris (uri_data);
+#else
+  if (uri_data != NULL)
+    uris = NULL;
+#endif
+
+  if (uris != NULL)
+    {
+      int len, i;
+      gchar **count = uris;
+      jclass stringClass = (*env)->FindClass (env, "java/lang/String");
+
+      len = 0;
+      while (count[len])
+	len++;
+
+      strings = (*env)->NewObjectArray (env, len, stringClass, NULL);
+      if (strings != NULL)
+	{
+	  for (i = 0; i < len; i++)
+	    {
+	      jstring string = (*env)->NewStringUTF (env, uris[i]);
+	      if (string == NULL)
+		break;
+	      (*env)->SetObjectArrayElement (env, strings, i, string);
+	      (*env)->DeleteLocalRef (env, string);
+	    }
+	}
+      g_strfreev (uris);
+    }
+
+  (*env)->CallVoidMethod (env, selection_obj,
+                          urisAvailableID,
+                          strings);
+  (*env)->DeleteGlobalRef (env, selection_obj);
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkSelection_requestURIs (JNIEnv *env,
+						     jobject obj,
+						     jboolean clipboard)
+{
+#if GTK_MINOR_VERSION > 4
+  GdkAtom uri_atom;
+#endif
+  jobject selection_obj;
+  GtkClipboard *gtk_clipboard;
+  selection_obj = (*env)->NewGlobalRef(env, obj);
+  if (selection_obj == NULL)
+    return;
+
+  if (urisAvailableID == NULL)
+    {
+      jclass gtk_selection_class;
+      gtk_selection_class = (*env)->GetObjectClass (env, selection_obj);
+      urisAvailableID = (*env)->GetMethodID (env, gtk_selection_class,
+					     "urisAvailable",
+                                             "([Ljava/lang/String;)V");
+      if (urisAvailableID == NULL)
+        return;
+    }
+
+  if (clipboard)
+    gtk_clipboard = cp_gtk_clipboard;
+  else
+    gtk_clipboard = cp_gtk_selection;
+
+#if GTK_MINOR_VERSION > 4
+  /* There is no real request_uris so we have to make one ourselves. */
+  gdk_threads_enter ();
+  uri_atom = gdk_atom_intern ("text/uri-list", FALSE);
+  gtk_clipboard_request_contents (gtk_clipboard,
+				  uri_atom,
+				  clipboard_uris_received,
+				  (gpointer) selection_obj);
+  gdk_threads_leave ();
+#else
+  clipboard_uris_received (gtk_clipboard, NULL, (gpointer) selection_obj);
+#endif
+}
+
+static jmethodID bytesAvailableID;
+
+static void
+clipboard_bytes_received (GtkClipboard *clipboard
+			  __attribute__((unused)),
+			  GtkSelectionData *selection_data,
+			  gpointer selection)
+{
+  jbyteArray bytes = NULL;
+  jobject selection_obj = (jobject) selection;
+  JNIEnv *env = cp_gtk_gdk_env ();
+
+   if (selection_data != NULL && selection_data->length > 0)
+    {
+      bytes = (*env)->NewByteArray (env, selection_data->length);
+      if (bytes != NULL)
+	(*env)->SetByteArrayRegion(env, bytes, 0, selection_data->length,
+				   (jbyte *) selection_data->data);
+    }
+
+  (*env)->CallVoidMethod (env, selection_obj,
+                          bytesAvailableID,
+                          bytes);
+  (*env)->DeleteGlobalRef (env, selection_obj);
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkSelection_requestBytes (JNIEnv *env,
+						      jobject obj,
+						      jboolean clipboard,
+						      jstring target_string)
+{
+  int len;
+  const gchar *target_text;
+  GdkAtom target_atom;
+  jobject selection_obj;
+  GtkClipboard *gtk_clipboard;
+  selection_obj = (*env)->NewGlobalRef(env, obj);
+  if (selection_obj == NULL)
+    return;
+
+  if (bytesAvailableID == NULL)
+    {
+      jclass gtk_selection_class;
+      gtk_selection_class = (*env)->GetObjectClass (env, selection_obj);
+      bytesAvailableID = (*env)->GetMethodID (env, gtk_selection_class,
+					      "bytesAvailable",
+					      "([B)V");
+      if (bytesAvailableID == NULL)
+        return;
+    }
+
+  len = (*env)->GetStringUTFLength (env, target_string);
+  if (len == -1)
+    return;
+  target_text = (*env)->GetStringUTFChars (env, target_string, NULL);
+  if (target_text == NULL)
+    return;
+
+  if (clipboard)
+    gtk_clipboard = cp_gtk_clipboard;
+  else
+    gtk_clipboard = cp_gtk_selection;
+
+  gdk_threads_enter ();
+  target_atom = gdk_atom_intern (target_text, FALSE);
+  gtk_clipboard_request_contents (gtk_clipboard,
+                                  target_atom,
+                                  clipboard_bytes_received,
+                                  (gpointer) selection_obj);
+  gdk_threads_leave ();
+
+  (*env)->ReleaseStringUTFChars (env, target_string, target_text);
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextAreaPeer.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextAreaPeer.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextAreaPeer.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextAreaPeer.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,547 @@
+/* gtktextareapeer.c -- Native implementation of GtkTextAreaPeer
+   Copyright (C) 1998, 1999, 2003 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+#include "gtkpeer.h"
+#include "gnu_java_awt_peer_gtk_GtkTextAreaPeer.h"
+
+#define AWT_TEXTAREA_SCROLLBARS_BOTH 0
+#define AWT_TEXTAREA_SCROLLBARS_VERTICAL_ONLY 1
+#define AWT_TEXTAREA_SCROLLBARS_HORIZONTAL_ONLY 2
+
+static GtkWidget *textarea_get_widget (GtkWidget *widget);
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkTextAreaPeer_create
+  (JNIEnv *env, jobject obj,
+   jint textview_width, jint textview_height,  jint scroll)
+{
+  GtkWidget *text;
+  GtkWidget *sw;
+  GtkWidget *eventbox;
+
+  gdk_threads_enter ();
+
+  /* Create global reference and save it for future use */
+  NSA_SET_GLOBAL_REF (env, obj);
+
+  text = gtk_text_view_new ();
+  gtk_widget_set_size_request (text, textview_width, textview_height);
+  gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW (text), TRUE);
+
+  gtk_widget_show (text);
+
+  eventbox = gtk_event_box_new ();
+  sw = gtk_scrolled_window_new (NULL, NULL);
+  gtk_container_add (GTK_CONTAINER (sw), text);
+  gtk_container_add (GTK_CONTAINER (eventbox), sw);
+  gtk_widget_show (sw);
+  
+  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
+     /* horizontal scrollbar */
+     (scroll == AWT_TEXTAREA_SCROLLBARS_BOTH
+      || scroll == AWT_TEXTAREA_SCROLLBARS_HORIZONTAL_ONLY) ? 
+       GTK_POLICY_ALWAYS : GTK_POLICY_NEVER,
+     /* vertical scrollbar */
+     (scroll == AWT_TEXTAREA_SCROLLBARS_BOTH
+      || scroll == AWT_TEXTAREA_SCROLLBARS_VERTICAL_ONLY) ? 
+       GTK_POLICY_ALWAYS : GTK_POLICY_NEVER);
+
+  gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (text),
+			       (scroll == AWT_TEXTAREA_SCROLLBARS_BOTH
+				|| scroll == AWT_TEXTAREA_SCROLLBARS_HORIZONTAL_ONLY)
+			       ? GTK_WRAP_NONE : GTK_WRAP_WORD);
+
+  NSA_SET_PTR (env, obj, eventbox);
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkTextAreaPeer_connectSignals
+  (JNIEnv *env, jobject obj)
+{
+  GtkWidget *text = NULL;
+  GtkTextBuffer *buf;
+  void *ptr;
+  jobject *gref;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+  gref = NSA_GET_GLOBAL_REF (env, obj);
+
+  /* Unwrap the text view from the scrolled window */
+  text = textarea_get_widget (GTK_WIDGET (ptr));
+
+  buf = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text));
+
+  /* TextComponent signals */
+  cp_gtk_textcomponent_connect_signals (G_OBJECT (buf), gref);
+
+  /* Component signals */
+  cp_gtk_component_connect_signals (G_OBJECT (text), gref);
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkTextAreaPeer_insert
+  (JNIEnv *env, jobject obj, jstring contents, jint position)
+{
+  GtkTextBuffer *buf;
+  GtkTextIter iter;
+  GtkWidget *text;
+  void *ptr;
+  const char *str;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+  str = (*env)->GetStringUTFChars (env, contents, NULL);
+  
+  text = textarea_get_widget (GTK_WIDGET (ptr));
+
+  buf = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text));
+  gtk_text_buffer_get_iter_at_offset (buf, &iter, position);
+  gtk_text_buffer_insert (buf, &iter, str, strlen (str));
+
+  (*env)->ReleaseStringUTFChars (env, contents, str);
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkTextAreaPeer_replaceRange
+  (JNIEnv *env, jobject obj, jstring contents, jint start, jint end)
+{
+  GtkWidget *text;
+  GtkTextBuffer *buf;
+  GtkTextIter iter, startIter, endIter;
+  void *ptr;
+  const char *str;
+  int mystart = start;
+  int myend = end;
+
+  gdk_threads_enter ();
+  
+  ptr = NSA_GET_PTR (env, obj);
+  str = (*env)->GetStringUTFChars (env, contents, NULL);
+  
+  text = textarea_get_widget (GTK_WIDGET (ptr));
+  
+  buf = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text));
+
+  gtk_text_buffer_get_iter_at_offset (buf, &startIter, mystart);
+  gtk_text_buffer_get_iter_at_offset (buf, &endIter, myend);
+  gtk_text_buffer_delete (buf, &startIter, &endIter);
+
+  gtk_text_buffer_get_iter_at_offset (buf, &iter, mystart);
+  gtk_text_buffer_insert(buf, &iter, str, strlen (str));
+
+  (*env)->ReleaseStringUTFChars (env, contents, str);
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkTextAreaPeer_gtkWidgetModifyFont
+  (JNIEnv *env, jobject obj, jstring name, jint style, jint size)
+{
+  const char *font_name;
+  void *ptr;
+  GtkWidget *text;
+  PangoFontDescription *font_desc;
+
+  gdk_threads_enter();
+
+  ptr = NSA_GET_PTR (env, obj);
+  
+  text = textarea_get_widget (GTK_WIDGET (ptr));
+
+  font_name = (*env)->GetStringUTFChars (env, name, NULL);
+
+  font_desc = pango_font_description_from_string (font_name);
+  pango_font_description_set_size (font_desc,
+                                   size * cp_gtk_dpi_conversion_factor);
+
+  if (style & AWT_STYLE_BOLD)
+    pango_font_description_set_weight (font_desc, PANGO_WEIGHT_BOLD);
+
+  if (style & AWT_STYLE_ITALIC)
+    pango_font_description_set_style (font_desc, PANGO_STYLE_OBLIQUE);
+
+  gtk_widget_modify_font (GTK_WIDGET (text), font_desc);
+
+  pango_font_description_free (font_desc);
+
+  (*env)->ReleaseStringUTFChars (env, name, font_name);
+
+  gdk_threads_leave();
+}
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkTextAreaPeer_gtkWidgetRequestFocus
+  (JNIEnv *env, jobject obj)
+{
+  void *ptr;
+  GtkWidget *text;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+  
+  text = textarea_get_widget (GTK_WIDGET (ptr));
+
+  gtk_widget_grab_focus (text);
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT jint JNICALL
+Java_gnu_java_awt_peer_gtk_GtkTextAreaPeer_getHScrollbarHeight
+  (JNIEnv *env, jobject obj)
+{
+  void *ptr;
+  GtkWidget *bin;
+  GtkScrolledWindow *sw;
+  GtkRequisition requisition;
+  jint height = 0;
+  jint spacing = 0;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  bin = gtk_bin_get_child (GTK_BIN (ptr));
+  sw = GTK_SCROLLED_WINDOW (bin);
+
+  if (sw)
+    {
+      gtk_widget_size_request (sw->hscrollbar, &requisition);
+      gtk_widget_style_get (GTK_WIDGET (sw), "scrollbar_spacing", &spacing, NULL);
+      height = requisition.height + spacing;
+    }
+
+  gdk_threads_leave ();
+
+  return height;
+}
+
+JNIEXPORT jint JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkTextAreaPeer_getVScrollbarWidth
+  (JNIEnv *env, jobject obj)
+{
+  void *ptr;
+  GtkWidget *bin;
+  GtkScrolledWindow *sw;
+  GtkRequisition requisition;
+  jint width = 0;
+  jint spacing = 0;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+  
+  bin = gtk_bin_get_child (GTK_BIN (ptr));
+  sw = GTK_SCROLLED_WINDOW (bin);
+
+  if (sw)
+    {
+      gtk_widget_size_request (sw->vscrollbar, &requisition);
+      gtk_widget_style_get (GTK_WIDGET (sw), "scrollbar_spacing", &spacing, NULL);
+      width = requisition.width + spacing;
+    }
+
+  gdk_threads_leave ();
+
+  return width;
+}
+
+JNIEXPORT jint JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkTextAreaPeer_getCaretPosition
+  (JNIEnv *env, jobject obj)
+{
+  void *ptr;
+  int pos = 0;
+  GtkWidget *text = NULL;
+  GtkTextBuffer *buf;
+  GtkTextMark *mark;
+  GtkTextIter iter;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+  
+  text = textarea_get_widget (GTK_WIDGET (ptr));
+
+  buf = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text));
+  mark = gtk_text_buffer_get_insert (buf);
+  gtk_text_buffer_get_iter_at_mark (buf, &iter, mark);
+  pos = gtk_text_iter_get_offset (&iter);
+
+  gdk_threads_leave ();
+  
+  return pos;
+}
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkTextAreaPeer_setCaretPosition
+  (JNIEnv *env, jobject obj, jint pos)
+{
+  void *ptr;
+  GtkWidget *text = NULL;
+  GtkTextBuffer *buf;
+  GtkTextIter iter;
+  GtkTextMark *oldmark;
+  GtkTextIter olditer;
+  int oldpos;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+  
+  text = textarea_get_widget (GTK_WIDGET (ptr));
+
+  buf = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text));
+
+  /* Save old position. */
+  oldmark = gtk_text_buffer_get_insert (buf);
+  gtk_text_buffer_get_iter_at_mark (buf, &olditer, oldmark);
+  oldpos = gtk_text_iter_get_offset (&olditer);
+
+  /* Move to new position. */
+  gtk_text_buffer_get_iter_at_offset (buf, &iter, pos);
+  gtk_text_buffer_place_cursor (buf, &iter);
+
+  /* Scroll to new position. Alignment is determined
+     comparing the new position to the old position. */
+  if (oldpos > pos)
+    gtk_text_view_scroll_to_iter (GTK_TEXT_VIEW (text),
+                                  &iter, 0, TRUE, 0, 0);
+  else if (oldpos < pos)
+    gtk_text_view_scroll_to_iter (GTK_TEXT_VIEW (text),
+                                  &iter, 0, TRUE, 1, 1);
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT jint JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkTextAreaPeer_getSelectionStart
+  (JNIEnv *env, jobject obj)
+{
+  void *ptr;
+  int pos = 0;
+  GtkWidget *text = NULL;
+  GtkTextBuffer *buf;
+  GtkTextIter start;
+  GtkTextIter end;
+  GtkTextMark *mark;
+  GtkTextIter iter;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  text = textarea_get_widget (GTK_WIDGET (ptr));
+
+  buf = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text));
+
+  if (gtk_text_buffer_get_selection_bounds (buf, &start, &end))
+    {
+      pos = gtk_text_iter_get_offset (&start);
+    }
+  else
+    {
+      mark = gtk_text_buffer_get_insert (buf);
+      gtk_text_buffer_get_iter_at_mark (buf, &iter, mark);
+      pos = gtk_text_iter_get_offset (&iter);
+    }
+
+  gdk_threads_leave ();
+
+  return pos;
+}
+
+JNIEXPORT jint JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkTextAreaPeer_getSelectionEnd
+  (JNIEnv *env, jobject obj)
+{
+  void *ptr;
+  int pos = 0;
+  GtkWidget *text = NULL;
+  GtkTextBuffer *buf;
+  GtkTextIter start;
+  GtkTextIter end;
+  GtkTextMark *mark;
+  GtkTextIter iter;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  text = textarea_get_widget (GTK_WIDGET (ptr));
+
+  buf = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text));
+
+  if (gtk_text_buffer_get_selection_bounds (buf, &start, &end))
+    {
+      pos = gtk_text_iter_get_offset (&end);
+    }
+  else
+    {
+      mark = gtk_text_buffer_get_insert (buf);
+      gtk_text_buffer_get_iter_at_mark (buf, &iter, mark);
+      pos = gtk_text_iter_get_offset (&iter);
+    }
+
+  gdk_threads_leave ();
+
+  return pos;
+}
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkTextAreaPeer_select
+  (JNIEnv *env, jobject obj, jint start, jint end)
+{
+  void *ptr;
+  GtkWidget *text = NULL;
+  GtkTextBuffer *buf;
+  GtkTextIter iter;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  text = textarea_get_widget (GTK_WIDGET (ptr));
+
+  buf = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text));
+  gtk_text_buffer_get_iter_at_offset (buf, &iter, start);
+  /* quickly move both 'insert' and 'selection_bound' to the 
+     same position */
+  gtk_text_buffer_place_cursor (buf, &iter);  
+  gtk_text_buffer_get_iter_at_offset (buf, &iter, end);
+  gtk_text_buffer_move_mark_by_name (buf, "selection_bound", &iter);
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkTextAreaPeer_setEditable
+  (JNIEnv *env, jobject obj, jboolean state)
+{
+  void *ptr;
+  GtkWidget *text = NULL;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  text = textarea_get_widget (GTK_WIDGET (ptr));
+
+  gtk_text_view_set_editable (GTK_TEXT_VIEW (text), state);
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT jstring JNICALL
+Java_gnu_java_awt_peer_gtk_GtkTextAreaPeer_getText
+  (JNIEnv *env, jobject obj)
+{
+  void *ptr;
+  char *contents = NULL;
+  jstring jcontents;
+  GtkWidget *text = NULL;
+  GtkTextBuffer *buf;
+  GtkTextIter start, end;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  text = textarea_get_widget (GTK_WIDGET (ptr));
+
+  buf = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text));
+  gtk_text_buffer_get_start_iter (buf, &start);
+  gtk_text_buffer_get_end_iter (buf, &end);
+  contents = gtk_text_buffer_get_text (buf, &start, &end, FALSE);
+
+  jcontents = (*env)->NewStringUTF (env, contents);
+  g_free (contents);
+
+  gdk_threads_leave ();
+
+  return jcontents;
+}
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkTextAreaPeer_setText
+  (JNIEnv *env, jobject obj, jstring contents)
+{
+  void *ptr;
+  const char *str;
+  GtkWidget *text = NULL;
+  GtkTextBuffer *buf;
+  
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+  str = (*env)->GetStringUTFChars (env, contents, NULL);
+
+  text = textarea_get_widget (GTK_WIDGET (ptr));
+
+  buf = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text));
+  gtk_text_buffer_set_text (buf, str, strlen (str));
+
+  (*env)->ReleaseStringUTFChars (env, contents, str);
+
+  gdk_threads_leave ();
+}
+
+static GtkWidget *
+textarea_get_widget (GtkWidget *widget)
+{
+   GtkWidget *wid;
+   g_assert (GTK_IS_EVENT_BOX (widget));
+
+   wid = gtk_bin_get_child (GTK_BIN (widget));
+   g_assert (GTK_IS_SCROLLED_WINDOW (wid));
+
+   wid = gtk_bin_get_child (GTK_BIN (wid));
+
+   return wid;
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextFieldPeer.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextFieldPeer.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextFieldPeer.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextFieldPeer.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,388 @@
+/* gtktextfieldpeer.c -- Native implementation of GtkTextFieldPeer
+   Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+#include "gtkpeer.h"
+#include "gnu_java_awt_peer_gtk_GtkTextFieldPeer.h"
+
+/* the color used for highlighting when the foreground is black,
+   since black highlights aren't a Good Idea. */
+#define BB_RED    16962
+#define BB_GREEN  26985
+#define BB_BLUE   31611
+
+static jmethodID postTextEventID;
+
+void
+cp_gtk_textcomponent_init_jni (void)
+{
+  jclass gtkcomponentpeer;
+
+  gtkcomponentpeer = (*cp_gtk_gdk_env())->FindClass (cp_gtk_gdk_env(),
+                                              "gnu/java/awt/peer/gtk/GtkComponentPeer");
+
+  postTextEventID = (*cp_gtk_gdk_env())->GetMethodID (cp_gtk_gdk_env(), gtkcomponentpeer,
+					     "postTextEvent",
+					     "()V");
+}
+
+static void textcomponent_changed_cb (GtkEditable *editable, jobject peer);
+
+static jint get_border_width (GtkWidget *entry);
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkTextFieldPeer_create
+  (JNIEnv *env, jobject obj, jint text_width)
+{
+  GtkWidget *entry;
+
+  gdk_threads_enter ();
+
+  /* Create global reference and save it for future use */
+  NSA_SET_GLOBAL_REF (env, obj);
+
+  entry = gtk_entry_new ();
+  gtk_widget_set_size_request (entry,
+			       text_width + 2 * get_border_width (entry), -1);
+
+  NSA_SET_PTR (env, obj, entry);
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkTextFieldPeer_connectSignals
+  (JNIEnv *env, jobject obj)
+{
+  void *ptr;
+  jobject *gref;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+  gref = NSA_GET_GLOBAL_REF (env, obj);
+
+  /* TextComponent signals */
+  cp_gtk_textcomponent_connect_signals (G_OBJECT (ptr), gref);
+
+  /* Component signals */
+  cp_gtk_component_connect_signals (G_OBJECT (ptr), gref);
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkTextFieldPeer_gtkWidgetSetBackground
+  (JNIEnv *env, jobject obj, jint red, jint green, jint blue)
+{
+  GdkColor color;
+  void *ptr;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  color.red = (red / 255.0) * 65535;
+  color.green = (green / 255.0) * 65535;
+  color.blue = (blue / 255.0) * 65535;
+
+  gtk_widget_modify_base (GTK_WIDGET (ptr), GTK_STATE_NORMAL, &color);
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkTextFieldPeer_gtkWidgetSetForeground
+  (JNIEnv *env, jobject obj, jint red, jint green, jint blue)
+{
+  GdkColor color;
+  void *ptr;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  color.red = (red / 255.0) * 65535;
+  color.green = (green / 255.0) * 65535;
+  color.blue = (blue / 255.0) * 65535;
+  
+  gtk_widget_modify_text (GTK_WIDGET (ptr), GTK_STATE_NORMAL, &color);
+
+  if ( red == 0 && green == 0 && blue == 0)
+    {
+      color.red = BB_RED;
+      color.green = BB_GREEN;
+      color.blue = BB_BLUE;
+    }
+  gtk_widget_modify_base (GTK_WIDGET (ptr), GTK_STATE_SELECTED, &color);
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT jint JNICALL
+Java_gnu_java_awt_peer_gtk_GtkTextFieldPeer_gtkEntryGetBorderWidth
+  (JNIEnv *env, jobject obj)
+{
+  void *ptr;
+  int border_width = 0;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  border_width = get_border_width (GTK_WIDGET (ptr));
+
+  gdk_threads_leave ();
+
+  return border_width;
+}
+
+/* GTK hard-codes this value.  It is the space between a GtkEntry's
+   frame and its text. */
+#define INNER_BORDER 2
+
+static jint
+get_border_width (GtkWidget *entry)
+{
+  gint focus_width;
+  gboolean interior_focus;
+  int x_border_width = INNER_BORDER;
+
+  gtk_widget_style_get (entry,
+			"interior-focus", &interior_focus,
+			"focus-line-width", &focus_width,
+			NULL);
+
+  if (GTK_ENTRY (entry)->has_frame)
+    x_border_width += entry->style->xthickness;
+
+  if (!interior_focus)
+    x_border_width += focus_width;
+
+  return x_border_width;
+}
+
+#undef INNER_BORDER
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkTextFieldPeer_setEchoChar
+  (JNIEnv *env, jobject obj, jchar c)
+{
+  void *ptr;
+  GtkEntry *entry;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  entry = GTK_ENTRY (ptr);
+
+  if (c != 0)
+    {
+      /* FIXME: use gtk_entry_set_invisible_char (GtkEntry *entry,
+	 gunichar ch) here.  That means we must convert from jchar
+	 (utf16) to gunichar (ucs4). */
+      gtk_entry_set_visibility (entry, FALSE);
+    }
+  else
+    gtk_entry_set_visibility (entry, TRUE);
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT jint JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkTextFieldPeer_getCaretPosition
+  (JNIEnv *env, jobject obj)
+{
+  void *ptr;
+  int pos = 0;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  pos = gtk_editable_get_position (GTK_EDITABLE (ptr));
+
+  gdk_threads_leave ();
+  
+  return pos;
+}
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkTextFieldPeer_setCaretPosition
+  (JNIEnv *env, jobject obj, jint pos)
+{
+  void *ptr;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  gtk_editable_set_position (GTK_EDITABLE (ptr), pos);
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT jint JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkTextFieldPeer_getSelectionStart
+  (JNIEnv *env, jobject obj)
+{
+  void *ptr;
+  int pos = 0;
+  int starti, endi;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  if (gtk_editable_get_selection_bounds (GTK_EDITABLE (ptr), &starti, &endi))
+    pos = starti;
+  else
+    pos = gtk_editable_get_position (GTK_EDITABLE (ptr));
+
+  gdk_threads_leave ();
+
+  return pos;
+}
+
+JNIEXPORT jint JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkTextFieldPeer_getSelectionEnd
+  (JNIEnv *env, jobject obj)
+{
+  void *ptr;
+  int pos = 0;
+  int starti, endi;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  if (gtk_editable_get_selection_bounds (GTK_EDITABLE (ptr), &starti, &endi))
+    pos = endi;
+  else
+    pos = gtk_editable_get_position (GTK_EDITABLE (ptr));
+
+  gdk_threads_leave ();
+
+  return pos;
+}
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkTextFieldPeer_select
+  (JNIEnv *env, jobject obj, jint start, jint end)
+{
+  void *ptr;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  gtk_editable_select_region (GTK_EDITABLE (ptr), start, end);
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkTextFieldPeer_setEditable
+  (JNIEnv *env, jobject obj, jboolean state)
+{
+  void *ptr;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  gtk_editable_set_editable (GTK_EDITABLE (ptr), state);
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT jstring JNICALL
+Java_gnu_java_awt_peer_gtk_GtkTextFieldPeer_getText
+  (JNIEnv *env, jobject obj)
+{
+  void *ptr;
+  char *contents = NULL;
+  jstring jcontents;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+  
+  contents = gtk_editable_get_chars (GTK_EDITABLE (ptr), 0, -1);
+
+  jcontents = (*env)->NewStringUTF (env, contents);
+
+  g_free (contents);
+
+  gdk_threads_leave ();
+
+  return jcontents;
+}
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkTextFieldPeer_setText
+  (JNIEnv *env, jobject obj, jstring contents)
+{
+  void *ptr;
+  const char *str;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+  str = (*env)->GetStringUTFChars (env, contents, NULL);
+  
+  gtk_entry_set_text (GTK_ENTRY (ptr), str);
+
+  (*env)->ReleaseStringUTFChars (env, contents, str);
+
+  gdk_threads_leave ();
+}
+
+void
+cp_gtk_textcomponent_connect_signals (GObject *ptr, jobject *gref)
+{
+  g_signal_connect (G_OBJECT(ptr), "changed",
+                    G_CALLBACK (textcomponent_changed_cb), *gref);
+}
+
+static void
+textcomponent_changed_cb (GtkEditable *editable __attribute__((unused)),
+			  jobject peer)
+{
+  (*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), peer, postTextEventID);
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,493 @@
+/* gtktoolkit.c -- Native portion of GtkToolkit
+   Copyright (C) 1998, 1999, 2005  Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+#include "gtkpeer.h"
+#include "gnu_java_awt_peer_gtk_GtkToolkit.h"
+#include "gthread-jni.h"
+#include "jcl.h"
+#include <gdk/gdkx.h>
+
+#define RC_FILE ".classpath-gtkrc"
+
+/* From java.awt.SystemColor */
+#define AWT_DESKTOP                  0
+#define AWT_ACTIVE_CAPTION           1
+#define AWT_ACTIVE_CAPTION_TEXT      2
+#define AWT_ACTIVE_CAPTION_BORDER    3
+#define AWT_INACTIVE_CAPTION         4
+#define AWT_INACTIVE_CAPTION_TEXT    5
+#define AWT_INACTIVE_CAPTION_BORDER  6
+#define AWT_WINDOW                   7
+#define AWT_WINDOW_BORDER            8
+#define AWT_WINDOW_TEXT              9
+#define AWT_MENU                    10
+#define AWT_MENU_TEXT               11
+#define AWT_TEXT                    12
+#define AWT_TEXT_TEXT               13
+#define AWT_TEXT_HIGHLIGHT          14
+#define AWT_TEXT_HIGHLIGHT_TEXT     15
+#define AWT_TEXT_INACTIVE_TEXT      16
+#define AWT_CONTROL                 17
+#define AWT_CONTROL_TEXT            18
+#define AWT_CONTROL_HIGHLIGHT       19
+#define AWT_CONTROL_LT_HIGHLIGHT    20
+#define AWT_CONTROL_SHADOW          21
+#define AWT_CONTROL_DK_SHADOW       22
+#define AWT_SCROLLBAR               23
+#define AWT_INFO                    24
+#define AWT_INFO_TEXT               25
+#define AWT_NUM_COLORS              26
+
+struct state_table *cp_gtk_native_state_table;
+struct state_table *cp_gtk_native_global_ref_table;
+
+static jclass gtkgenericpeer;
+static JavaVM *java_vm;
+static jmethodID printCurrentThreadID;
+
+union env_union
+{
+  void *void_env;
+  JNIEnv *jni_env;
+};
+
+JNIEnv *
+cp_gtk_gdk_env()
+{
+  union env_union tmp;
+  g_assert((*java_vm)->GetEnv(java_vm, &tmp.void_env, JNI_VERSION_1_2) == JNI_OK);
+  return tmp.jni_env;
+}
+
+
+GtkWindowGroup *cp_gtk_global_window_group;
+double cp_gtk_dpi_conversion_factor;
+
+static void init_glib_threads(JNIEnv *, jint);
+
+static void init_dpi_conversion_factor (void);
+static void dpi_changed_cb (GtkSettings  *settings,
+                            GParamSpec   *pspec);
+
+#if GTK_MINOR_VERSION > 4
+static GLogFunc old_glog_func;
+static void glog_func (const gchar *log_domain,
+		       GLogLevelFlags log_level,
+		       const gchar *message,
+		       gpointer user_data);
+#endif
+
+/*
+ * Call gtk_init.  It is very important that this happen before any other
+ * gtk calls.
+ *
+ * The portableNativeSync argument may have the values:
+ *   1 if the Java property gnu.classpath.awt.gtk.portable.native.sync
+ *     is set to "true".  
+ *   0 if it is set to "false"
+ *  -1 if unset.
+ */
+
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkToolkit_gtkInit (JNIEnv *env, 
+					       jclass clazz __attribute__((unused)),
+					       jint portableNativeSync)
+{
+  int argc = 1;
+  char **argv;
+  char *homedir, *rcpath = NULL;
+
+  gtkgenericpeer = (*env)->FindClass(env, "gnu/java/awt/peer/gtk/GtkGenericPeer");
+
+  gtkgenericpeer = (*env)->NewGlobalRef(env, gtkgenericpeer);
+
+  printCurrentThreadID = (*env)->GetStaticMethodID (env, gtkgenericpeer,
+                                                    "printCurrentThread", "()V");
+ 
+  NSA_INIT (env, gtkgenericpeer);
+
+  g_assert((*env)->GetJavaVM(env, &java_vm) == 0);
+
+  /* GTK requires a program's argc and argv variables, and requires that they
+     be valid.  Set it up. */
+  argv = (char **) g_malloc (sizeof (char *) * 2);
+  argv[0] = (char *) g_malloc(1);
+  argv[0][0] = '\0';
+  argv[1] = NULL;
+
+  init_glib_threads(env, portableNativeSync);
+
+  /* From GDK 2.0 onwards we have to explicitly call gdk_threads_init */
+  gdk_threads_init();
+
+  gtk_init (&argc, &argv);
+
+#if SYNCHRONIZE_GDK
+  XSynchronize (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), True);
+#endif
+
+  gtk_widget_set_default_colormap (gdk_rgb_get_colormap ());
+
+  /* Make sure queued calls don't get sent to GTK/GDK while 
+     we're shutting down. */
+  atexit (gdk_threads_enter);
+
+  if ((homedir = getenv ("HOME")))
+    {
+      rcpath = (char *) g_malloc (strlen (homedir) + strlen (RC_FILE) + 2);
+      sprintf (rcpath, "%s/%s", homedir, RC_FILE);
+    }
+  
+  gtk_rc_parse ((rcpath) ? rcpath : RC_FILE);
+
+  g_free (rcpath);
+  g_free (argv[0]);
+  g_free (argv);
+
+  /* On errors or warning print a whole stacktrace. */
+#if GTK_MINOR_VERSION > 4
+  old_glog_func = g_log_set_default_handler (&glog_func, NULL);
+#endif
+
+  cp_gtk_button_init_jni ();
+  cp_gtk_checkbox_init_jni ();
+  cp_gtk_choice_init_jni ();
+  cp_gtk_component_init_jni ();
+  cp_gtk_filedialog_init_jni ();
+  cp_gtk_list_init_jni ();
+  cp_gtk_menuitem_init_jni ();
+  cp_gtk_scrollbar_init_jni ();
+  cp_gtk_textcomponent_init_jni ();
+  cp_gtk_window_init_jni ();
+
+  cp_gtk_global_window_group = gtk_window_group_new ();
+
+  init_dpi_conversion_factor ();
+}
+
+
+/** Initialize GLIB's threads properly, based on the value of the
+    gnu.classpath.awt.gtk.portable.native.sync Java system property.  If
+    that's unset, use the PORTABLE_NATIVE_SYNC config.h macro.  (TODO: 
+    In some release following 0.10, that config.h macro will go away.)
+    */ 
+static void 
+init_glib_threads(JNIEnv *env, jint portableNativeSync)
+{
+  if (portableNativeSync < 0)
+    {
+#ifdef PORTABLE_NATIVE_SYNC /* Default value, if not set by the Java system
+                               property */ 
+      portableNativeSync = 1;
+#else
+      portableNativeSync = 0;
+#endif
+    }
+  
+  (*env)->GetJavaVM( env, &cp_gtk_the_vm );
+  if (!g_thread_supported ())
+    {
+      if (portableNativeSync)
+        g_thread_init ( &cp_gtk_portable_native_sync_jni_functions );
+      else
+        g_thread_init ( NULL );
+    }
+  else
+    {
+      /* Warn if portable native sync is desired but the threading
+         system is already initialized.  In that case we can't
+         override the threading implementation with our portable
+         native sync functions. */
+      if (portableNativeSync)
+        g_printerr ("peer warning: portable native sync disabled.\n");
+    }
+
+  /* Debugging progress message; uncomment if needed: */
+  /*   printf("called gthread init\n"); */
+}
+
+void
+cp_gtk_print_current_thread (void)
+{
+  (*cp_gtk_gdk_env())->CallStaticVoidMethod (cp_gtk_gdk_env(), gtkgenericpeer, printCurrentThreadID);
+}
+
+/* This is a big hack, needed until this pango bug is resolved:
+   http://bugzilla.gnome.org/show_bug.cgi?id=119081.
+   See: http://mail.gnome.org/archives/gtk-i18n-list/2003-August/msg00001.html
+   for details. */
+static void
+init_dpi_conversion_factor ()
+{
+  GtkSettings *settings = gtk_settings_get_default ();
+  GObjectClass *klass;
+
+  klass = G_OBJECT_CLASS (GTK_SETTINGS_GET_CLASS (settings));
+  if (g_object_class_find_property (klass, "gtk-xft-dpi"))
+    {
+      int int_dpi;
+      g_object_get (settings, "gtk-xft-dpi", &int_dpi, NULL);
+      /* If int_dpi == -1 gtk-xft-dpi returns the default value. So we
+	 have to do approximate calculation here.  */
+      if (int_dpi < 0)
+	cp_gtk_dpi_conversion_factor = PANGO_SCALE * 72.0 / 96.;
+      else
+	cp_gtk_dpi_conversion_factor =
+          PANGO_SCALE * 72.0 / (int_dpi / PANGO_SCALE);
+
+      g_signal_connect (settings, "notify::gtk-xft-dpi",
+			G_CALLBACK (dpi_changed_cb), NULL);
+    }
+  else
+    /* Approximate. */
+    cp_gtk_dpi_conversion_factor = PANGO_SCALE * 72.0 / 96.;
+}
+
+static void
+dpi_changed_cb (GtkSettings  *settings,
+		GParamSpec *pspec __attribute__((unused)))
+{
+  int int_dpi;
+  g_object_get (settings, "gtk-xft-dpi", &int_dpi, NULL);
+  if (int_dpi < 0)
+    cp_gtk_dpi_conversion_factor = PANGO_SCALE * 72.0 / 96.;
+  else
+    cp_gtk_dpi_conversion_factor =
+      PANGO_SCALE * 72.0 / (int_dpi / PANGO_SCALE);
+}
+
+#if GTK_MINOR_VERSION > 4
+static void
+glog_func (const gchar *log_domain,
+	   GLogLevelFlags log_level,
+	   const gchar *message,
+	   gpointer user_data)
+{
+  old_glog_func (log_domain, log_level, message, user_data);
+  if (log_level & (G_LOG_LEVEL_ERROR
+		   | G_LOG_LEVEL_CRITICAL
+		   | G_LOG_LEVEL_WARNING))
+    {
+      JNIEnv *env = cp_gtk_gdk_env ();
+      jthrowable *exc = (*env)->ExceptionOccurred(env);
+      gchar *detail = g_strconcat (log_domain, ": ", message, NULL);
+      JCL_ThrowException (env, "java/lang/InternalError", detail);
+      g_free (detail);
+      (*env)->ExceptionDescribe (env);
+      if (exc != NULL)
+	(*env)->Throw (env, exc);
+      else
+	(*env)->ExceptionClear (env);
+    }
+}
+#endif
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkToolkit_gtkMain
+(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)))
+{
+  gdk_threads_enter ();
+
+  gtk_main ();
+
+  gdk_threads_leave ();
+}
+
+
+static jint gdk_color_to_java_color (GdkColor color);
+
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkToolkit_beep
+  (JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)))
+{
+  gdk_threads_enter ();
+
+  gdk_beep ();
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkToolkit_sync
+  (JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)))
+{
+  gdk_threads_enter ();
+
+  gdk_flush ();
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkToolkit_getScreenSizeDimensions
+  (JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
+   jintArray jdims)
+{
+  jint *dims = (*env)->GetIntArrayElements (env, jdims, 0);  
+
+  gdk_threads_enter ();
+
+  dims[0] = gdk_screen_width ();
+  dims[1] = gdk_screen_height ();
+
+  gdk_threads_leave ();
+
+  (*env)->ReleaseIntArrayElements(env, jdims, dims, 0);
+}
+
+JNIEXPORT jint JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkToolkit_getScreenResolution
+  (JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)))
+{
+  jint res;
+
+  gdk_threads_enter ();
+
+  res = gdk_screen_width () / (gdk_screen_width_mm () / 25.4);
+
+  gdk_threads_leave ();
+
+  return res;
+}
+
+/**
+ * Report the number of mouse buttons
+ * Returns the number of buttons of the first mouse found, or -1 if no mouse
+ * seems to be connected.
+ */
+JNIEXPORT jint JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkToolkit_getMouseNumberOfButtons
+  (JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)))
+{
+  jint res = -1;
+  GList *devices;
+  GdkDevice *d;
+
+  gdk_threads_enter ();
+
+  /* FIXME: Why doesn't this return the correct number? */
+  devices = gdk_devices_list();
+
+  while( res == -1 && devices != NULL )
+    {
+      d = GDK_DEVICE( devices->data );
+      if( d->source == GDK_SOURCE_MOUSE )
+	res = d->num_keys;
+      devices = devices->next;
+    }
+
+  gdk_threads_leave ();
+
+  return res;
+}
+
+#define CONVERT(type, state) \
+  gdk_color_to_java_color (style->type[GTK_STATE_ ## state])
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkToolkit_loadSystemColors
+  (JNIEnv *env, jobject obj __attribute__((unused)),
+   jintArray jcolors)
+{
+  jint *colors;
+  GtkStyle *style;
+
+  /* FIXME: this was deadlocking so assume it is thread-safe for now;
+     we need to replace this call with a .properties file anyway. */
+#if 0
+  gdk_threads_enter ();
+#endif
+
+  colors = (*env)->GetIntArrayElements (env, jcolors, 0);
+
+  style = gtk_widget_get_default_style ();
+
+  colors[AWT_DESKTOP]                 = CONVERT (bg, SELECTED);
+  colors[AWT_ACTIVE_CAPTION]          = CONVERT (bg, SELECTED);
+  colors[AWT_ACTIVE_CAPTION_TEXT]     = CONVERT (text, SELECTED);
+  colors[AWT_ACTIVE_CAPTION_BORDER]   = CONVERT (fg, NORMAL);
+  colors[AWT_INACTIVE_CAPTION]        = CONVERT (base, INSENSITIVE);
+  colors[AWT_INACTIVE_CAPTION_TEXT]   = CONVERT (fg, INSENSITIVE);
+  colors[AWT_INACTIVE_CAPTION_BORDER] = CONVERT (fg, INSENSITIVE);
+  colors[AWT_WINDOW]                  = CONVERT (bg, NORMAL);
+  colors[AWT_WINDOW_BORDER]           = CONVERT (fg, NORMAL);
+  colors[AWT_WINDOW_TEXT]             = CONVERT (fg, NORMAL);
+  colors[AWT_MENU]                    = CONVERT (bg, NORMAL);
+  colors[AWT_MENU_TEXT]               = CONVERT (fg, NORMAL);
+  colors[AWT_TEXT]                    = CONVERT (bg, NORMAL);
+  colors[AWT_TEXT_TEXT]               = CONVERT (fg, NORMAL);
+  colors[AWT_TEXT_HIGHLIGHT]          = CONVERT (bg, SELECTED);
+  colors[AWT_TEXT_HIGHLIGHT_TEXT]     = CONVERT (fg, SELECTED);
+  colors[AWT_TEXT_INACTIVE_TEXT]      = CONVERT (bg, INSENSITIVE);
+  colors[AWT_CONTROL]                 = CONVERT (bg, NORMAL);
+  colors[AWT_CONTROL_TEXT]            = CONVERT (fg, NORMAL);
+  colors[AWT_CONTROL_HIGHLIGHT]       = CONVERT (base, ACTIVE);
+  colors[AWT_CONTROL_LT_HIGHLIGHT]    = CONVERT (bg, PRELIGHT);
+  colors[AWT_CONTROL_SHADOW]          = CONVERT (bg, ACTIVE);
+  colors[AWT_CONTROL_DK_SHADOW]       = CONVERT (fg, INSENSITIVE);
+  colors[AWT_SCROLLBAR]               = CONVERT (base, INSENSITIVE);
+  colors[AWT_INFO]                    = CONVERT (bg, NORMAL);
+  colors[AWT_INFO_TEXT]               = CONVERT (fg, NORMAL);
+
+  (*env)->ReleaseIntArrayElements(env, jcolors, colors, 0);
+
+#if 0
+  gdk_threads_leave ();
+#endif
+}
+
+#undef CONVERT
+
+static jint
+gdk_color_to_java_color (GdkColor gdk_color)
+{
+  guchar red;
+  guchar green;
+  guchar blue;
+  float factor;
+
+  factor = 255.0 / 65535.0;
+
+  red   = (float) gdk_color.red   * factor;
+  green = (float) gdk_color.green * factor;
+  blue  = (float) gdk_color.blue  * factor;
+
+  return (jint) (0xff000000 | (red << 16) | (green << 8) | blue);
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkVolatileImage.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkVolatileImage.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkVolatileImage.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkVolatileImage.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,196 @@
+/* gnu_java_awt_peer_gtk_VolatileImage.c
+   Copyright (C)  2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#include "jcl.h"
+#include "gtkpeer.h"
+#include <gdk/gdkx.h>
+#include <gdk/gdktypes.h>
+#include <gdk/gdkprivate.h>
+#include <gdk/gdkx.h>
+#include <gdk-pixbuf/gdk-pixbuf.h>
+#include <gdk-pixbuf/gdk-pixdata.h>
+
+#include "gnu_java_awt_peer_gtk_GtkVolatileImage.h"
+#include "cairographics2d.h"
+
+
+/**
+ * Creates a cairo surface, ARGB32, native ordering, premultiplied alpha.
+ */
+JNIEXPORT jlong JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkVolatileImage_init (JNIEnv *env, 
+						  jobject obj __attribute__ ((__unused__)), 
+						  jobject peer,
+						  jint width, jint height)
+{
+  GtkWidget *widget = NULL;
+  GdkPixmap* pixmap;
+  void *ptr = NULL;
+
+  gdk_threads_enter();
+
+  if( peer != NULL )
+    {
+      ptr = NSA_GET_PTR (env, peer);
+      g_assert (ptr != NULL);
+      
+      widget = GTK_WIDGET (ptr);
+      g_assert (widget != NULL);
+      pixmap = gdk_pixmap_new( widget->window, width, height, -1 );
+    }
+  else
+    pixmap = gdk_pixmap_new( NULL, width, height, 
+			     gdk_rgb_get_visual()->depth );
+
+  gdk_threads_leave();
+
+  g_assert( pixmap != NULL );
+
+  return PTR_TO_JLONG( pixmap );
+}
+
+/**
+ * Destroy the surface
+ */
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkVolatileImage_destroy
+(JNIEnv *env __attribute__((unused)), jobject obj __attribute((unused)),
+ jlong pointer)
+{
+  GdkPixmap* pixmap = JLONG_TO_PTR(GdkPixmap, pointer);
+  if( pixmap != NULL )
+    {
+      gdk_threads_enter();
+      g_object_unref( pixmap );
+      gdk_threads_leave();
+    }
+}
+
+/**
+ * Gets all pixels in an array
+ */
+JNIEXPORT jintArray JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkVolatileImage_nativeGetPixels
+(JNIEnv *env, jobject obj, jlong pointer)
+{
+  /* jint *pixeldata, *jpixdata; */
+  jint *jpixdata;
+  GdkPixmap *pixmap;
+  jintArray jpixels;
+  int width, height, depth, size;
+  jclass cls;
+  jfieldID field;
+
+  cls = (*env)->GetObjectClass (env, obj);
+  field = (*env)->GetFieldID (env, cls, "width", "I");
+  g_assert (field != 0);
+  width = (*env)->GetIntField (env, obj, field);
+
+  field = (*env)->GetFieldID (env, cls, "height", "I");
+  g_assert (field != 0);
+  height = (*env)->GetIntField (env, obj, field);
+
+  pixmap = JLONG_TO_PTR(GdkPixmap, pointer);
+  g_assert(pixmap != NULL);
+
+  gdk_threads_enter();
+
+  /* get depth in bytes */
+  depth = gdk_drawable_get_depth( pixmap ) >> 3;
+  size = width * height * 4;
+  jpixels = (*env)->NewIntArray ( env, size );
+  jpixdata = (*env)->GetIntArrayElements (env, jpixels, NULL);
+  /*  memcpy (jpixdata, pixeldata, size * sizeof( jint )); */
+
+  (*env)->ReleaseIntArrayElements (env, jpixels, jpixdata, 0);
+
+  gdk_threads_leave();
+
+  return jpixels;
+}
+
+/**
+ * Copy area
+ */
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkVolatileImage_nativeCopyArea
+(JNIEnv *env __attribute__((unused)), jobject obj __attribute((unused)),
+ jlong pointer, jint x, jint y, jint w, jint h, jint dx, jint dy)
+{
+  GdkPixbuf *pixbuf;
+  GdkPixmap* pixmap = JLONG_TO_PTR(GdkPixmap, pointer);
+
+  g_assert (pixmap != NULL);
+
+  gdk_threads_enter();
+  
+  pixbuf = gdk_pixbuf_new( GDK_COLORSPACE_RGB, TRUE, 8, w, h );
+  gdk_pixbuf_get_from_drawable( pixbuf, pixmap, NULL, x, y, 0, 0, w, h );
+  gdk_draw_pixbuf (pixmap, NULL, pixbuf,
+		   0, 0, x + dx, y + dy, 
+		   w, h, 
+		   GDK_RGB_DITHER_NORMAL, 0, 0);
+  gdk_threads_leave();
+}
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkVolatileImage_nativeDrawVolatile
+(JNIEnv *env __attribute__((unused)), jobject obj __attribute((unused)),
+ jlong pointer, jlong srcptr, jint x, jint y, jint w, jint h)
+{
+  GdkPixmap *dst, *src;
+  GdkGC *gc;
+
+  src = JLONG_TO_PTR(GdkPixmap, srcptr);
+  dst = JLONG_TO_PTR(GdkPixmap, pointer);
+  g_assert (src != NULL);
+  g_assert (dst != NULL);
+
+  gdk_threads_enter();
+ 
+  gc = gdk_gc_new( dst );
+  gdk_draw_drawable(dst,
+		    gc,
+		    src,
+		    0, 0,
+		    x, y,
+		    w, h);
+  g_object_unref( gc );
+
+  gdk_threads_leave();
+}
+

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,2192 @@
+/* gtkwindowpeer.c -- Native implementation of GtkWindowPeer
+   Copyright (C) 1998, 1999, 2002, 2004, 2005, 2006
+   Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+#include "gtkpeer.h"
+#include "gnu_java_awt_peer_gtk_GtkWindowPeer.h"
+#include <gdk/gdkprivate.h>
+#include <gdk/gdkx.h>
+#include <X11/Xatom.h>
+#include <gdk/gdkkeysyms.h>
+
+#define AWT_WINDOW_OPENED 200
+#define AWT_WINDOW_CLOSING 201
+#define AWT_WINDOW_CLOSED 202
+#define AWT_WINDOW_ICONIFIED 203
+#define AWT_WINDOW_DEICONIFIED 204
+#define AWT_WINDOW_ACTIVATED 205
+#define AWT_WINDOW_DEACTIVATED 206
+#define AWT_WINDOW_GAINED_FOCUS 207
+#define AWT_WINDOW_LOST_FOCUS 208
+#define AWT_WINDOW_STATE_CHANGED 209
+
+/* Virtual Keys */
+/* This list should be kept in the same order as the VK_ field
+   declarations in KeyEvent.java. */
+#define VK_ENTER '\n'
+#define VK_BACK_SPACE '\b'
+#define VK_TAB '\t'
+#define VK_CANCEL 3
+#define VK_CLEAR 12
+#define VK_SHIFT 16
+#define VK_CONTROL 17
+#define VK_ALT 18
+#define VK_PAUSE 19
+#define VK_CAPS_LOCK 20
+#define VK_ESCAPE 27
+#define VK_SPACE ' '
+#define VK_PAGE_UP 33
+#define VK_PAGE_DOWN 34
+#define VK_END 35
+#define VK_HOME 36
+#define VK_LEFT 37
+#define VK_UP 38
+#define VK_RIGHT 39
+#define VK_DOWN 40
+#define VK_COMMA ','
+#define VK_MINUS '-'
+#define VK_PERIOD '.'
+#define VK_SLASH '/'
+#define VK_0 '0'
+#define VK_1 '1'
+#define VK_2 '2'
+#define VK_3 '3'
+#define VK_4 '4'
+#define VK_5 '5'
+#define VK_6 '6'
+#define VK_7 '7'
+#define VK_8 '8'
+#define VK_9 '9'
+#define VK_SEMICOLON ';'
+#define VK_EQUALS '='
+#define VK_A 'A'
+#define VK_B 'B'
+#define VK_C 'C'
+#define VK_D 'D'
+#define VK_E 'E'
+#define VK_F 'F'
+#define VK_G 'G'
+#define VK_H 'H'
+#define VK_I 'I'
+#define VK_J 'J'
+#define VK_K 'K'
+#define VK_L 'L'
+#define VK_M 'M'
+#define VK_N 'N'
+#define VK_O 'O'
+#define VK_P 'P'
+#define VK_Q 'Q'
+#define VK_R 'R'
+#define VK_S 'S'
+#define VK_T 'T'
+#define VK_U 'U'
+#define VK_V 'V'
+#define VK_W 'W'
+#define VK_X 'X'
+#define VK_Y 'Y'
+#define VK_Z 'Z'
+#define VK_OPEN_BRACKET '['
+#define VK_BACK_SLASH '\\'
+#define VK_CLOSE_BRACKET ']'
+/* See gtkpeer.h */
+/* #define VK_NUMPAD0 96 */
+/* #define VK_NUMPAD1 97 */
+/* #define VK_NUMPAD2 98 */
+/* #define VK_NUMPAD3 99 */
+/* #define VK_NUMPAD4 100 */
+/* #define VK_NUMPAD5 101 */
+/* #define VK_NUMPAD6 102 */
+/* #define VK_NUMPAD7 103 */
+/* #define VK_NUMPAD8 104 */
+/* #define VK_NUMPAD9 105 */
+#define VK_MULTIPLY 106
+#define VK_ADD 107
+#define VK_SEPARATER 108
+#define VK_SEPARATOR 108
+#define VK_SUBTRACT 109
+/* See gtkpeer.h */
+/* #define VK_DECIMAL 110 */
+#define VK_DIVIDE 111
+#define VK_DELETE 127
+#define VK_NUM_LOCK 144
+#define VK_SCROLL_LOCK 145
+#define VK_F1 112
+#define VK_F2 113
+#define VK_F3 114
+#define VK_F4 115
+#define VK_F5 116
+#define VK_F6 117
+#define VK_F7 118
+#define VK_F8 119
+#define VK_F9 120
+#define VK_F10 121
+#define VK_F11 122
+#define VK_F12 123
+#define VK_F13 61440
+#define VK_F14 61441
+#define VK_F15 61442
+#define VK_F16 61443
+#define VK_F17 61444
+#define VK_F18 61445
+#define VK_F19 61446
+#define VK_F20 61447
+#define VK_F21 61448
+#define VK_F22 61449
+#define VK_F23 61450
+#define VK_F24 61451
+#define VK_PRINTSCREEN 154
+#define VK_INSERT 155
+#define VK_HELP 156
+#define VK_META 157
+#define VK_BACK_QUOTE 192
+#define VK_QUOTE 222
+#define VK_KP_UP 224
+#define VK_KP_DOWN 225
+#define VK_KP_LEFT 226
+#define VK_KP_RIGHT 227
+#define VK_DEAD_GRAVE 128
+#define VK_DEAD_ACUTE 129
+#define VK_DEAD_CIRCUMFLEX 130
+#define VK_DEAD_TILDE 131
+#define VK_DEAD_MACRON 132
+#define VK_DEAD_BREVE 133
+#define VK_DEAD_ABOVEDOT 134
+#define VK_DEAD_DIAERESIS 135
+#define VK_DEAD_ABOVERING 136
+#define VK_DEAD_DOUBLEACUTE 137
+#define VK_DEAD_CARON 138
+#define VK_DEAD_CEDILLA 139
+#define VK_DEAD_OGONEK 140
+#define VK_DEAD_IOTA 141
+#define VK_DEAD_VOICED_SOUND 142
+#define VK_DEAD_SEMIVOICED_SOUND 143
+#define VK_AMPERSAND 150
+#define VK_ASTERISK 151
+#define VK_QUOTEDBL 152
+#define VK_LESS 153
+#define VK_GREATER 160
+#define VK_BRACELEFT 161
+#define VK_BRACERIGHT 162
+#define VK_AT 512
+#define VK_COLON 513
+#define VK_CIRCUMFLEX 514
+#define VK_DOLLAR 515
+#define VK_EURO_SIGN 516
+#define VK_EXCLAMATION_MARK 517
+#define VK_INVERTED_EXCLAMATION_MARK 518
+#define VK_LEFT_PARENTHESIS 519
+#define VK_NUMBER_SIGN 520
+#define VK_PLUS 521
+#define VK_RIGHT_PARENTHESIS 522
+#define VK_UNDERSCORE 523
+#define VK_FINAL 24
+#define VK_CONVERT 28
+#define VK_NONCONVERT 29
+#define VK_ACCEPT 30
+#define VK_MODECHANGE 31
+#define VK_KANA 21
+#define VK_KANJI 25
+#define VK_ALPHANUMERIC 240
+#define VK_KATAKANA 241
+#define VK_HIRAGANA 242
+#define VK_FULL_WIDTH 243
+#define VK_HALF_WIDTH 244
+#define VK_ROMAN_CHARACTERS 245
+#define VK_ALL_CANDIDATES 256
+#define VK_PREVIOUS_CANDIDATE 257
+#define VK_CODE_INPUT 258
+#define VK_JAPANESE_KATAKANA 259
+#define VK_JAPANESE_HIRAGANA 260
+#define VK_JAPANESE_ROMAN 261
+#define VK_KANA_LOCK 262
+#define VK_INPUT_METHOD_ON_OFF 263
+#define VK_CUT 65489
+#define VK_COPY 65485
+#define VK_PASTE 65487
+#define VK_UNDO 65483
+#define VK_AGAIN 65481
+#define VK_FIND 65488
+#define VK_PROPS 65482
+#define VK_STOP 65480
+#define VK_COMPOSE 65312
+#define VK_ALT_GRAPH 65406
+#define VK_UNDEFINED 0
+#define VK_BEGIN 65368
+#define VK_CONTEXT_MENU 525
+#define VK_WINDOWS 524
+
+ 
+#define AWT_KEY_CHAR_UNDEFINED 0
+
+#define AWT_FRAME_STATE_NORMAL 0
+#define AWT_FRAME_STATE_ICONIFIED 1
+#define AWT_FRAME_STATE_MAXIMIZED_HORIZ 2
+#define AWT_FRAME_STATE_MAXIMIZED_VERT 4
+#define AWT_FRAME_STATE_MAXIMIZED_BOTH 6
+
+static jmethodID postKeyEventID;
+static jmethodID postWindowEventID;
+static jmethodID postConfigureEventID;
+static jmethodID postInsetsChangedEventID;
+static jmethodID windowGetWidthID;
+static jmethodID windowGetHeightID;
+
+void
+cp_gtk_window_init_jni (void)
+{
+  jclass gtkwindowpeer;
+
+  gtkwindowpeer = (*cp_gtk_gdk_env())->FindClass (cp_gtk_gdk_env(),
+                                           "gnu/java/awt/peer/gtk/GtkWindowPeer");
+
+  postKeyEventID = (*cp_gtk_gdk_env())->GetMethodID (cp_gtk_gdk_env(), gtkwindowpeer,
+                                              "postKeyEvent", "(IJIICI)V");
+
+  postWindowEventID = (*cp_gtk_gdk_env())->GetMethodID (cp_gtk_gdk_env(), gtkwindowpeer,
+                                                 "postWindowEvent",
+                                                 "(ILjava/awt/Window;I)V");
+
+  postConfigureEventID = (*cp_gtk_gdk_env())->GetMethodID (cp_gtk_gdk_env(), gtkwindowpeer, 
+                                                    "postConfigureEvent", "(IIII)V");
+
+  postInsetsChangedEventID = (*cp_gtk_gdk_env())->GetMethodID (cp_gtk_gdk_env(), gtkwindowpeer,
+                                                        "postInsetsChangedEvent",
+                                                        "(IIII)V");
+
+  windowGetWidthID = (*cp_gtk_gdk_env())->GetMethodID (cp_gtk_gdk_env(), gtkwindowpeer,
+                                                "getWidth", "()I");
+
+  windowGetHeightID = (*cp_gtk_gdk_env())->GetMethodID (cp_gtk_gdk_env(), gtkwindowpeer,
+                                                 "getHeight", "()I");
+
+  gtkwindowpeer = (*cp_gtk_gdk_env())->FindClass (cp_gtk_gdk_env(),
+                                           "gnu/java/awt/peer/gtk/GtkWindowPeer");
+}
+
+/* Get the first keyval in the keymap for this event's keycode.  The
+   first keyval corresponds roughly to Java's notion of a virtual key.
+   Returns the uppercase version of the first keyval or -1 if no
+   keyval was found for the given hardware keycode. */
+static gint
+get_first_keyval_from_keymap (GdkEventKey *event)
+{
+  guint keyval;
+  guint *keyvals;
+  gint n_entries;
+
+  if (!gdk_keymap_get_entries_for_keycode (NULL,
+                                           event->hardware_keycode,
+                                           NULL,
+                                           &keyvals,
+                                           &n_entries))
+    {
+      /* No keyval found for hardware keycode */
+      return -1;
+    }
+  keyval = keyvals[0];
+  g_free (keyvals);
+
+  return gdk_keyval_to_upper (keyval);
+}
+
+/* Return the AWT key code for the given keysym or -1 if no keyval was
+   found for the given hardware keycode. */
+#ifdef __GNUC__
+__inline
+#endif
+static jint
+keysym_to_awt_keycode (GdkEventKey *event)
+{
+  gint ukeyval;
+  guint state;
+
+  ukeyval = get_first_keyval_from_keymap (event);
+
+  if (ukeyval < 0)
+    return -1;
+
+  state = event->state;
+
+  /* VK_A through VK_Z */
+  if (ukeyval >= GDK_A && ukeyval <= GDK_Z)
+    return ukeyval;
+
+  /* VK_0 through VK_9 */
+  if (ukeyval >= GDK_0 && ukeyval <= GDK_9)
+    return ukeyval;
+
+  switch (ukeyval)
+    {
+    case GDK_Return:
+    case GDK_KP_Enter:
+      return VK_ENTER;
+    case GDK_BackSpace:
+      return VK_BACK_SPACE;
+    case GDK_Tab:
+      return VK_TAB;
+    case GDK_Cancel:
+      return VK_CANCEL;
+    case GDK_Clear:
+      return VK_CLEAR;
+    case GDK_Shift_L:
+    case GDK_Shift_R:
+      return VK_SHIFT;
+    case GDK_Control_L:
+    case GDK_Control_R:
+      return VK_CONTROL;
+    case GDK_Alt_L:
+    case GDK_Alt_R:
+      return VK_ALT;
+    case GDK_Pause:
+      return VK_PAUSE;
+    case GDK_Caps_Lock:
+      return VK_CAPS_LOCK;
+    case GDK_Escape:
+      return VK_ESCAPE;
+    case GDK_space:
+      return VK_SPACE;
+    case GDK_KP_Page_Up:
+      /* For keys on the numeric keypad, the JVM produces one of two
+         virtual keys, depending on the num lock state. */
+      if (state & GDK_MOD2_MASK)
+        return VK_NUMPAD9;
+      else
+        return VK_PAGE_UP;
+    case GDK_Page_Up:
+      return VK_PAGE_UP;
+    case GDK_KP_Page_Down:
+      if (state & GDK_MOD2_MASK)
+        return VK_NUMPAD3;
+      else
+        return VK_PAGE_DOWN;
+    case GDK_Page_Down:
+      return VK_PAGE_DOWN;
+    case GDK_KP_End:
+      if (state & GDK_MOD2_MASK)
+        return VK_NUMPAD1;
+      else
+        return VK_END;
+    case GDK_End:
+      return VK_END;
+    case GDK_KP_Home:
+      if (state & GDK_MOD2_MASK)
+        return VK_NUMPAD7;
+      else
+        return VK_HOME;
+    case GDK_Home:
+      return VK_HOME;
+    case GDK_KP_Begin:
+      if (state & GDK_MOD2_MASK)
+        return VK_NUMPAD5;
+      else
+        return VK_UNDEFINED;
+    case GDK_Left:
+      return VK_LEFT;
+    case GDK_Up:
+      return VK_UP;
+    case GDK_Right:
+      return VK_RIGHT;
+    case GDK_Down:
+      return VK_DOWN;
+    case GDK_comma:
+      return VK_COMMA;
+    case GDK_minus:
+      return VK_MINUS;
+    case GDK_period:
+      return VK_PERIOD;
+    case GDK_slash:
+      return VK_SLASH;
+      /*
+      return VK_0;
+      return VK_1;
+      return VK_2;
+      return VK_3;
+      return VK_4;
+      return VK_5;
+      return VK_6;
+      return VK_7;
+      return VK_8;
+      return VK_9;
+      */
+    case GDK_semicolon:
+      return VK_SEMICOLON;
+    case GDK_equal:
+      return VK_EQUALS;
+      /*
+      return VK_A;
+      return VK_B;
+      return VK_C;
+      return VK_D;
+      return VK_E;
+      return VK_F;
+      return VK_G;
+      return VK_H;
+      return VK_I;
+      return VK_J;
+      return VK_K;
+      return VK_L;
+      return VK_M;
+      return VK_N;
+      return VK_O;
+      return VK_P;
+      return VK_Q;
+      return VK_R;
+      return VK_S;
+      return VK_T;
+      return VK_U;
+      return VK_V;
+      return VK_W;
+      return VK_X;
+      return VK_Y;
+      return VK_Z;
+      */
+    case GDK_bracketleft:
+      return VK_OPEN_BRACKET;
+    case GDK_backslash:
+      return VK_BACK_SLASH;
+    case GDK_bracketright:
+      return VK_CLOSE_BRACKET;
+    case GDK_KP_0:
+      return VK_NUMPAD0;
+    case GDK_KP_1:
+      return VK_NUMPAD1;
+    case GDK_KP_2:
+      return VK_NUMPAD2;
+    case GDK_KP_3:
+      return VK_NUMPAD3;
+    case GDK_KP_4:
+      return VK_NUMPAD4;
+    case GDK_KP_5:
+      return VK_NUMPAD5;
+    case GDK_KP_6:
+      return VK_NUMPAD6;
+    case GDK_KP_7:
+      return VK_NUMPAD7;
+    case GDK_KP_8:
+      return VK_NUMPAD8;
+    case GDK_KP_9:
+      return VK_NUMPAD9;
+    case GDK_KP_Multiply:
+      return VK_MULTIPLY;
+    case GDK_KP_Add:
+      return VK_ADD;
+      /*
+      return VK_SEPARATER;
+      */
+    case GDK_KP_Separator:
+      return VK_SEPARATOR;
+    case GDK_KP_Subtract:
+      return VK_SUBTRACT;
+    case GDK_KP_Decimal:
+      return VK_DECIMAL;
+    case GDK_KP_Divide:
+      return VK_DIVIDE;
+    case GDK_KP_Delete:
+      if (state & GDK_MOD2_MASK)
+        return VK_DECIMAL;
+      else
+        return VK_DELETE;
+    case GDK_Delete:
+      return VK_DELETE;
+    case GDK_Num_Lock:
+      return VK_NUM_LOCK;
+    case GDK_Scroll_Lock:
+      return VK_SCROLL_LOCK;
+    case GDK_F1:
+      return VK_F1;
+    case GDK_F2:
+      return VK_F2;
+    case GDK_F3:
+      return VK_F3;
+    case GDK_F4:
+      return VK_F4;
+    case GDK_F5:
+      return VK_F5;
+    case GDK_F6:
+      return VK_F6;
+    case GDK_F7:
+      return VK_F7;
+    case GDK_F8:
+      return VK_F8;
+    case GDK_F9:
+      return VK_F9;
+    case GDK_F10:
+      return VK_F10;
+    case GDK_F11:
+      return VK_F11;
+    case GDK_F12:
+      return VK_F12;
+    case GDK_F13:
+      return VK_F13;
+    case GDK_F14:
+      return VK_F14;
+    case GDK_F15:
+      return VK_F15;
+    case GDK_F16:
+      return VK_F16;
+    case GDK_F17:
+      return VK_F17;
+    case GDK_F18:
+      return VK_F18;
+    case GDK_F19:
+      return VK_F19;
+    case GDK_F20:
+      return VK_F20;
+    case GDK_F21:
+      return VK_F21;
+    case GDK_F22:
+      return VK_F22;
+    case GDK_F23:
+      return VK_F23;
+    case GDK_F24:
+      return VK_F24;
+    case GDK_Print:
+      return VK_PRINTSCREEN;
+    case GDK_KP_Insert:
+      if (state & GDK_MOD2_MASK)
+        return VK_NUMPAD0;
+      else
+        return VK_INSERT;
+    case GDK_Insert:
+      return VK_INSERT;
+    case GDK_Help:
+      return VK_HELP;
+    case GDK_Meta_L:
+    case GDK_Meta_R:
+      return VK_META;
+    case GDK_grave:
+      return VK_BACK_QUOTE;
+    case GDK_apostrophe:
+      return VK_QUOTE;
+    case GDK_KP_Up:
+      if (state & GDK_MOD2_MASK)
+        return VK_NUMPAD8;
+      else
+        return VK_KP_UP;
+    case GDK_KP_Down:
+      if (state & GDK_MOD2_MASK)
+        return VK_NUMPAD2;
+      else
+        return VK_KP_DOWN;
+    case GDK_KP_Left:
+      if (state & GDK_MOD2_MASK)
+        return VK_NUMPAD4;
+      else
+        return VK_KP_LEFT;
+    case GDK_KP_Right:
+      if (state & GDK_MOD2_MASK)
+        return VK_NUMPAD6;
+      else
+        return VK_KP_RIGHT;
+    case GDK_dead_grave:
+      return VK_DEAD_GRAVE;
+    case GDK_dead_acute:
+      return VK_DEAD_ACUTE;
+    case GDK_dead_circumflex:
+      return VK_DEAD_CIRCUMFLEX;
+    case GDK_dead_tilde:
+      return VK_DEAD_TILDE;
+    case GDK_dead_macron:
+      return VK_DEAD_MACRON;
+    case GDK_dead_breve:
+      return VK_DEAD_BREVE;
+    case GDK_dead_abovedot:
+      return VK_DEAD_ABOVEDOT;
+    case GDK_dead_diaeresis:
+      return VK_DEAD_DIAERESIS;
+    case GDK_dead_abovering:
+      return VK_DEAD_ABOVERING;
+    case GDK_dead_doubleacute:
+      return VK_DEAD_DOUBLEACUTE;
+    case GDK_dead_caron:
+      return VK_DEAD_CARON;
+    case GDK_dead_cedilla:
+      return VK_DEAD_CEDILLA;
+    case GDK_dead_ogonek:
+      return VK_DEAD_OGONEK;
+    case GDK_dead_iota:
+      return VK_DEAD_IOTA;
+    case GDK_dead_voiced_sound:
+      return VK_DEAD_VOICED_SOUND;
+    case GDK_dead_semivoiced_sound:
+      return VK_DEAD_SEMIVOICED_SOUND;
+    case GDK_ampersand:
+      return VK_AMPERSAND;
+    case GDK_asterisk:
+      return VK_ASTERISK;
+    case GDK_quotedbl:
+      return VK_QUOTEDBL;
+    case GDK_less:
+      return VK_LESS;
+    case GDK_greater:
+      return VK_GREATER;
+    case GDK_braceleft:
+      return VK_BRACELEFT;
+    case GDK_braceright:
+      return VK_BRACERIGHT;
+    case GDK_at:
+      return VK_AT;
+    case GDK_colon:
+      return VK_COLON;
+    case GDK_asciicircum:
+      return VK_CIRCUMFLEX;
+    case GDK_dollar:
+      return VK_DOLLAR;
+    case GDK_EuroSign:
+      return VK_EURO_SIGN;
+    case GDK_exclam:
+      return VK_EXCLAMATION_MARK;
+    case GDK_exclamdown:
+      return VK_INVERTED_EXCLAMATION_MARK;
+    case GDK_parenleft:
+      return VK_LEFT_PARENTHESIS;
+    case GDK_numbersign:
+      return VK_NUMBER_SIGN;
+    case GDK_plus:
+      return VK_PLUS;
+    case GDK_parenright:
+      return VK_RIGHT_PARENTHESIS;
+    case GDK_underscore:
+      return VK_UNDERSCORE;
+      /*
+      return VK_FINAL;
+      return VK_CONVERT;
+      return VK_NONCONVERT;
+      return VK_ACCEPT;
+      */
+    case GDK_Mode_switch:
+      return VK_MODECHANGE;
+      /*
+      return VK_KANA;
+      */
+    case GDK_Kanji:
+      return VK_KANJI;
+      /*
+      return VK_ALPHANUMERIC;
+      */
+    case GDK_Katakana:
+      return VK_KATAKANA;
+    case GDK_Hiragana:
+      return VK_HIRAGANA;
+      /*
+      return VK_FULL_WIDTH;
+      return VK_HALF_WIDTH;
+      return VK_ROMAN_CHARACTERS;
+      return VK_ALL_CANDIDATES;
+      */
+    case GDK_PreviousCandidate:
+      return VK_PREVIOUS_CANDIDATE;
+    case GDK_Codeinput:
+      return VK_CODE_INPUT;
+      /*
+      return VK_JAPANESE_KATAKANA;
+      return VK_JAPANESE_HIRAGANA;
+      return VK_JAPANESE_ROMAN;
+      */
+    case GDK_Kana_Lock:
+      return VK_KANA_LOCK;
+      /*
+      return VK_INPUT_METHOD_ON_OFF;
+      return VK_CUT;
+      return VK_COPY;
+      return VK_PASTE;
+      */
+    case GDK_Undo:
+      return VK_UNDO;
+    case GDK_Redo:
+      return VK_AGAIN;
+      /*
+      return VK_FIND;
+      return VK_PROPS;
+      return VK_STOP;
+      return VK_COMPOSE;
+      */
+    case GDK_ISO_Level3_Shift:
+      return VK_ALT_GRAPH;
+      /*
+	case VK_BEGIN:
+      */
+    case GDK_Menu:
+      return VK_CONTEXT_MENU;
+    case GDK_Super_L:
+    case GDK_Super_R:
+      return VK_WINDOWS;
+
+    default:
+      return VK_UNDEFINED;
+    }
+}
+
+/* Return the AWT key location code for the given keysym or -1 if no
+   keyval was found for the given hardware keycode. */
+static jint
+keysym_to_awt_keylocation (GdkEventKey *event)
+{
+  gint ukeyval;
+
+  ukeyval = get_first_keyval_from_keymap (event);
+
+  if (ukeyval < 0)
+    return -1;
+
+  /* VK_A through VK_Z */
+  if (ukeyval >= GDK_A && ukeyval <= GDK_Z)
+    return AWT_KEY_LOCATION_STANDARD;
+
+  /* VK_0 through VK_9 */
+  if (ukeyval >= GDK_0 && ukeyval <= GDK_9)
+    return AWT_KEY_LOCATION_STANDARD;
+
+  switch (ukeyval)
+    {
+    case GDK_Shift_L:
+    case GDK_Control_L:
+    case GDK_Alt_L:
+    case GDK_Meta_L:
+      return AWT_KEY_LOCATION_LEFT;
+
+    case GDK_Shift_R:
+    case GDK_Control_R:
+    case GDK_Alt_R:
+    case GDK_Meta_R:
+      return AWT_KEY_LOCATION_RIGHT;
+
+    case GDK_Return:
+    case GDK_BackSpace:
+    case GDK_Tab:
+    case GDK_Cancel:
+    case GDK_Clear:
+    case GDK_Pause:
+    case GDK_Caps_Lock:
+    case GDK_Escape:
+    case GDK_space:
+    case GDK_Page_Up:
+    case GDK_Page_Down:
+    case GDK_End:
+    case GDK_Home:
+    case GDK_Left:
+    case GDK_Up:
+    case GDK_Right:
+    case GDK_Down:
+    case GDK_comma:
+    case GDK_minus:
+    case GDK_period:
+    case GDK_slash:
+    case GDK_semicolon:
+    case GDK_equal:
+    case GDK_bracketleft:
+    case GDK_backslash:
+    case GDK_bracketright:
+    case GDK_Delete:
+    case GDK_Scroll_Lock:
+    case GDK_F1:
+    case GDK_F2:
+    case GDK_F3:
+    case GDK_F4:
+    case GDK_F5:
+    case GDK_F6:
+    case GDK_F7:
+    case GDK_F8:
+    case GDK_F9:
+    case GDK_F10:
+    case GDK_F11:
+    case GDK_F12:
+    case GDK_F13:
+    case GDK_F14:
+    case GDK_F15:
+    case GDK_F16:
+    case GDK_F17:
+    case GDK_F18:
+    case GDK_F19:
+    case GDK_F20:
+    case GDK_F21:
+    case GDK_F22:
+    case GDK_F23:
+    case GDK_F24:
+    case GDK_Print:
+    case GDK_Insert:
+    case GDK_Help:
+    case GDK_grave:
+    case GDK_apostrophe:
+    case GDK_dead_grave:
+    case GDK_dead_acute:
+    case GDK_dead_circumflex:
+    case GDK_dead_tilde:
+    case GDK_dead_macron:
+    case GDK_dead_breve:
+    case GDK_dead_abovedot:
+    case GDK_dead_diaeresis:
+    case GDK_dead_abovering:
+    case GDK_dead_doubleacute:
+    case GDK_dead_caron:
+    case GDK_dead_cedilla:
+    case GDK_dead_ogonek:
+    case GDK_dead_iota:
+    case GDK_dead_voiced_sound:
+    case GDK_dead_semivoiced_sound:
+    case GDK_ampersand:
+    case GDK_asterisk:
+    case GDK_quotedbl:
+    case GDK_less:
+    case GDK_greater:
+    case GDK_braceleft:
+    case GDK_braceright:
+    case GDK_at:
+    case GDK_colon:
+    case GDK_asciicircum:
+    case GDK_dollar:
+    case GDK_EuroSign:
+    case GDK_exclam:
+    case GDK_exclamdown:
+    case GDK_parenleft:
+    case GDK_numbersign:
+    case GDK_plus:
+    case GDK_parenright:
+    case GDK_underscore:
+    case GDK_Mode_switch:
+    case GDK_Kanji:
+    case GDK_Katakana:
+    case GDK_Hiragana:
+    case GDK_PreviousCandidate:
+    case GDK_Codeinput:
+    case GDK_Kana_Lock:
+      return AWT_KEY_LOCATION_STANDARD;
+
+    case GDK_KP_Enter:
+    case GDK_KP_Page_Up:
+    case GDK_KP_Page_Down:
+    case GDK_KP_End:
+    case GDK_KP_Home:
+    case GDK_KP_Begin:
+    case GDK_KP_0:
+    case GDK_KP_1:
+    case GDK_KP_2:
+    case GDK_KP_3:
+    case GDK_KP_4:
+    case GDK_KP_5:
+    case GDK_KP_6:
+    case GDK_KP_7:
+    case GDK_KP_8:
+    case GDK_KP_9:
+    case GDK_KP_Multiply:
+    case GDK_KP_Add:
+    case GDK_KP_Separator:
+    case GDK_KP_Subtract:
+    case GDK_KP_Decimal:
+    case GDK_KP_Divide:
+    case GDK_KP_Delete:
+    case GDK_Num_Lock:
+    case GDK_KP_Insert:
+    case GDK_KP_Up:
+    case GDK_KP_Down:
+    case GDK_KP_Left:
+    case GDK_KP_Right:
+      return AWT_KEY_LOCATION_NUMPAD;
+
+    default:
+      return AWT_KEY_LOCATION_UNKNOWN;
+    }
+}
+
+static jchar
+keyevent_to_awt_keychar (GdkEventKey *event)
+{
+  if (event->length > 0)
+    {
+      /* Translate GDK carriage return to Java linefeed. */
+      if (event->string[0] == 13)
+        return VK_ENTER;
+      else
+        return event->string[0];
+    }
+  else
+    {
+      switch (event->keyval)
+        {
+        case GDK_BackSpace:
+          return VK_BACK_SPACE;
+        case GDK_Tab:
+          return VK_TAB;
+        case GDK_Delete:
+        case GDK_KP_Delete:
+          return VK_DELETE;
+        default:
+          return AWT_KEY_CHAR_UNDEFINED;
+        }
+    }
+}
+
+/* Modifier key events need special treatment.  In Sun's peer
+   implementation, when a modifier key is pressed, the KEY_PRESSED
+   event has that modifier in its modifiers list.  The corresponding
+   KEY_RELEASED event's modifier list does not contain the modifier.
+   For example, pressing and releasing the shift key will produce a
+   key press event with modifiers=Shift, and a key release event with
+   no modifiers.  GDK's key events behave in the exact opposite way,
+   so this translation code is needed. */
+static jint
+keyevent_state_to_awt_mods (GdkEventKey *event)
+{
+  jint result = 0;
+  guint state;
+
+  if (event->type == GDK_KEY_PRESS)
+    {
+      state = event->state;
+
+      if (event->keyval == GDK_Shift_L
+          || event->keyval == GDK_Shift_R)
+        result |= AWT_SHIFT_DOWN_MASK | AWT_SHIFT_MASK;
+      else
+        {
+          if (state & GDK_SHIFT_MASK)
+            result |= AWT_SHIFT_DOWN_MASK | AWT_SHIFT_MASK;
+        }
+
+      if (event->keyval == GDK_Control_L
+          || event->keyval == GDK_Control_R)
+        result |= AWT_CTRL_DOWN_MASK | AWT_CTRL_MASK;
+      else
+        {
+          if (state & GDK_CONTROL_MASK)
+            result |= AWT_CTRL_DOWN_MASK | AWT_CTRL_MASK;
+        }
+
+      if (event->keyval == GDK_Alt_L
+          || event->keyval == GDK_Alt_R)
+        result |= AWT_ALT_DOWN_MASK | AWT_ALT_MASK;
+      else
+        {
+          if (state & GDK_MOD1_MASK)
+            result |= AWT_ALT_DOWN_MASK | AWT_ALT_MASK;
+        }
+    }
+  else if (event->type == GDK_KEY_RELEASE)
+    {
+      state = event->state;
+
+      if (event->keyval != GDK_Shift_L
+          && event->keyval != GDK_Shift_R)
+        {
+          if (state & GDK_SHIFT_MASK)
+            result |= AWT_SHIFT_DOWN_MASK | AWT_SHIFT_MASK;
+        }
+      if (event->keyval != GDK_Control_L
+          && event->keyval != GDK_Control_R)
+        {
+          if (state & GDK_CONTROL_MASK)
+            result |= AWT_CTRL_DOWN_MASK | AWT_CTRL_MASK;
+        }
+
+      if (event->keyval != GDK_Alt_L
+          && event->keyval != GDK_Alt_R)
+        {
+          if (state & GDK_MOD1_MASK)
+            result |= AWT_ALT_DOWN_MASK | AWT_ALT_MASK;
+        }
+    }
+
+  return result;
+}
+
+static gboolean window_configure_cb (GtkWidget *widget,
+                                     GdkEventConfigure *event,
+                                     jobject peer);
+
+/* FIXME: we're currently seeing the double-activation that occurs
+   with metacity and GTK.  See
+   http://bugzilla.gnome.org/show_bug.cgi?id=140977 for details. */
+
+static void window_get_frame_extents (GtkWidget *window,
+                                      int *top, int *left,
+                                      int *bottom, int *right);
+
+static void request_frame_extents (GtkWidget *window);
+
+static Bool property_notify_predicate (Display *display,
+                                       XEvent  *xevent,
+                                       XPointer arg);
+
+static gboolean window_delete_cb (GtkWidget *widget, GdkEvent *event,
+			      jobject peer);
+static void window_destroy_cb (GtkWidget *widget, GdkEvent *event,
+			       jobject peer);
+static void window_show_cb (GtkWidget *widget, jobject peer);
+static void window_focus_state_change_cb (GtkWidget *widget,
+                                          GParamSpec *pspec,
+                                          jobject peer);
+static gboolean window_focus_in_cb (GtkWidget * widget,
+                                    GdkEventFocus *event,
+                                    jobject peer);
+static gboolean window_focus_out_cb (GtkWidget * widget,
+                                     GdkEventFocus *event,
+                                     jobject peer);
+static gboolean window_window_state_cb (GtkWidget *widget,
+					GdkEvent *event,
+					jobject peer);
+static gboolean window_property_changed_cb (GtkWidget *widget,
+					    GdkEventProperty *event,
+					    jobject peer);
+static void realize_cb (GtkWidget *widget, jobject peer);
+
+static gboolean
+window_configure_cb (GtkWidget *widget __attribute__((unused)),
+                     GdkEventConfigure *event,
+                     jobject peer)
+{
+  (*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), peer,
+                                postConfigureEventID,
+                                (jint) event->x,
+                                (jint) event->y,
+                                (jint) event->width,
+                                (jint) event->height);
+
+  return FALSE;
+}
+
+static gboolean
+key_press_cb (GtkWidget *widget __attribute__((unused)),
+              GdkEventKey *event,
+              jobject peer)
+{
+  jint keycode;
+  jint keylocation;
+
+  keycode = keysym_to_awt_keycode (event);
+  keylocation = keysym_to_awt_keylocation (event);
+
+  /* Return immediately if an error occurs translating a hardware
+     keycode to a keyval. */
+  if (keycode < 0 || keylocation < 0)
+    return TRUE;
+
+  (*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), peer,
+                                postKeyEventID,
+                                (jint) AWT_KEY_PRESSED,
+                                (jlong) event->time,
+                                keyevent_state_to_awt_mods (event),
+                                keycode,
+                                keyevent_to_awt_keychar (event),
+                                keylocation);
+
+  /* FIXME: generation of key typed events needs to be moved
+     to GtkComponentPeer.postKeyEvent.  If the key in a key
+     press event is not an "action" key
+     (KeyEvent.isActionKey) and is not a modifier key, then
+     it should generate a key typed event. */
+  return TRUE;
+}
+
+
+static gboolean
+key_release_cb (GtkWidget *widget __attribute__((unused)),
+                GdkEventKey *event,
+                jobject peer)
+{
+  jint keycode;
+  jint keylocation;
+
+  keycode = keysym_to_awt_keycode (event);
+  keylocation = keysym_to_awt_keylocation (event);
+
+  /* Return immediately if an error occurs translating a hardware
+     keycode to a keyval. */
+  if (keycode < 0 || keylocation < 0)
+    return TRUE;
+
+  (*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), peer,
+                                postKeyEventID,
+                                (jint) AWT_KEY_RELEASED,
+                                (jlong) event->time,
+                                keyevent_state_to_awt_mods (event),
+                                keycode,
+                                keyevent_to_awt_keychar (event),
+                                keylocation);
+
+  return TRUE;
+}
+
+/* Union used for type punning. */
+union extents_union
+{
+  guchar **gu_extents;
+  unsigned long **extents;
+};
+
+union atom_list_union
+{
+  guchar **gu_extents;
+  Atom **atom_list;
+};
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkWindowPeer_create
+  (JNIEnv *env, jobject obj, jint type, jboolean decorated, jobject parent)
+{
+  GtkWidget *window_widget;
+  GtkWindow *window;
+  void *window_parent;
+  GtkWidget *fixed;
+
+  gdk_threads_enter ();
+  
+  NSA_SET_GLOBAL_REF (env, obj);
+
+  window_widget = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+  window = GTK_WINDOW (window_widget);
+
+  /* Keep this window in front of its parent, if it has one. */
+  if (parent)
+    {
+      window_parent = NSA_GET_PTR (env, parent);
+      gtk_window_set_transient_for (window, GTK_WINDOW(window_parent));
+    }
+
+  gtk_window_set_decorated (window, decorated);
+
+  gtk_window_set_type_hint (window, type);
+
+  gtk_window_group_add_window (cp_gtk_global_window_group, window);
+
+  fixed = gtk_fixed_new ();
+
+  gtk_container_add (GTK_CONTAINER (window_widget), fixed);
+
+  gtk_widget_show (fixed);
+
+  NSA_SET_PTR (env, obj, window_widget);
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkWindowPeer_gtkWindowSetTitle
+  (JNIEnv *env, jobject obj, jstring title)
+{
+  const char *c_title;
+  void *ptr;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  c_title = (*env)->GetStringUTFChars (env, title, NULL);
+
+  gtk_window_set_title (GTK_WINDOW (ptr), c_title);
+
+  (*env)->ReleaseStringUTFChars (env, title, c_title);
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkWindowPeer_gtkWindowSetResizable
+  (JNIEnv *env, jobject obj, jboolean resizable)
+{
+  void *ptr;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+  gtk_window_set_resizable (GTK_WINDOW (ptr), resizable);
+  g_object_set (G_OBJECT (ptr), "allow-shrink", resizable, NULL);
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkWindowPeer_gtkWindowSetModal
+  (JNIEnv *env, jobject obj, jboolean modal)
+{
+  void *ptr;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  gtk_window_set_modal (GTK_WINDOW (ptr), modal);
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkWindowPeer_gtkWindowSetAlwaysOnTop
+  (JNIEnv *env, jobject obj, jboolean alwaysOnTop)
+{
+  void *ptr;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  gtk_window_set_keep_above (GTK_WINDOW (ptr), alwaysOnTop);
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT jboolean JNICALL
+Java_gnu_java_awt_peer_gtk_GtkWindowPeer_gtkWindowHasFocus
+(JNIEnv *env, jobject obj)
+{
+  void *ptr;
+  jboolean retval;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  retval = gtk_window_has_toplevel_focus (GTK_WINDOW (ptr));
+
+  gdk_threads_leave ();
+  return retval;
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkWindowPeer_setVisibleNative
+  (JNIEnv *env, jobject obj, jboolean visible)
+{
+  gdk_threads_enter ();
+
+  Java_gnu_java_awt_peer_gtk_GtkWindowPeer_setVisibleNativeUnlocked
+    (env, obj, visible);
+
+  gdk_flush ();
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkWindowPeer_setVisibleNativeUnlocked
+  (JNIEnv *env, jobject obj, jboolean visible)
+{
+  void *ptr;
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  if (visible)
+    gtk_widget_show (GTK_WIDGET (ptr));
+  else
+    gtk_widget_hide (GTK_WIDGET (ptr));
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkWindowPeer_connectSignals
+  (JNIEnv *env, jobject obj)
+{
+  void *ptr;
+  jobject *gref;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+  gref = NSA_GET_GLOBAL_REF (env, obj);
+
+  g_signal_connect (G_OBJECT (ptr), "delete-event",
+		    G_CALLBACK (window_delete_cb), *gref);
+
+  g_signal_connect (G_OBJECT (ptr), "destroy-event",
+		    G_CALLBACK (window_destroy_cb), *gref);
+
+  g_signal_connect (G_OBJECT (ptr), "show",
+		    G_CALLBACK (window_show_cb), *gref);
+
+  g_signal_connect (G_OBJECT (ptr), "notify::has-toplevel-focus",
+  		    G_CALLBACK (window_focus_state_change_cb), *gref);
+
+  g_signal_connect (G_OBJECT (ptr), "focus-in-event",
+                    G_CALLBACK (window_focus_in_cb), *gref);
+
+  g_signal_connect (G_OBJECT (ptr), "focus-out-event",
+                    G_CALLBACK (window_focus_out_cb), *gref);
+
+  g_signal_connect (G_OBJECT (ptr), "window-state-event",
+		    G_CALLBACK (window_window_state_cb), *gref);
+
+  g_signal_connect (G_OBJECT (ptr), "property-notify-event",
+		    G_CALLBACK (window_property_changed_cb), *gref);
+
+  g_signal_connect_after (G_OBJECT (ptr), "realize",
+                          G_CALLBACK (realize_cb), *gref);
+
+  g_signal_connect (G_OBJECT (ptr), "key-press-event",
+                    G_CALLBACK (key_press_cb), *gref);
+
+  g_signal_connect (G_OBJECT (ptr), "key-release-event",
+                    G_CALLBACK (key_release_cb), *gref);
+
+  g_signal_connect_after (G_OBJECT (ptr), "window-state-event",
+                          G_CALLBACK (window_window_state_cb), *gref);
+
+  g_signal_connect (G_OBJECT (ptr), "configure-event",
+                    G_CALLBACK (window_configure_cb), *gref);
+
+  cp_gtk_component_connect_expose_signals (ptr, gref);
+  cp_gtk_component_connect_mouse_signals (ptr, gref);
+
+  /* FIXME: override focus signals here to prevent child fixed repaint? */
+
+  gdk_threads_leave ();
+}
+
+/* Realize the window here so that its frame extents are known now.
+   That way Window.pack can operate with the accurate insets returned
+   by the window manager rather than the default estimates. */
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkWindowPeer_realize (JNIEnv *env, jobject obj)
+{
+  void *ptr;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  gtk_widget_realize (GTK_WIDGET (ptr));
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkWindowPeer_toBack (JNIEnv *env, 
+    jobject obj)
+{
+  void *ptr;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+    
+  gdk_window_lower (GTK_WIDGET (ptr)->window);
+  gdk_flush ();
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkWindowPeer_toFront (JNIEnv *env, 
+    jobject obj)
+{
+  void *ptr;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+    
+  gdk_window_raise (GTK_WIDGET (ptr)->window);
+  gdk_flush ();
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkWindowPeer_setSize
+  (JNIEnv *env, jobject obj, jint width, jint height)
+{
+  void *ptr;
+
+  gdk_threads_enter ();
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  /* Avoid GTK runtime assertion failures. */
+  width = (width < 1) ? 1 : width;
+  height = (height < 1) ? 1 : height;
+
+  gtk_widget_set_size_request (GTK_WIDGET(ptr), width, height);
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkWindowPeer_nativeSetBounds
+  (JNIEnv *env, jobject obj, jint x, jint y, jint width, jint height)
+{
+  gdk_threads_enter ();
+
+  Java_gnu_java_awt_peer_gtk_GtkWindowPeer_nativeSetBoundsUnlocked
+    (env, obj, x, y, width, height);
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkWindowPeer_nativeSetLocationUnlocked
+  (JNIEnv *env, jobject obj, jint x, jint y)
+{
+  void *ptr;
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  gtk_window_move (GTK_WINDOW(ptr), x, y);
+
+  if (GTK_WIDGET (ptr)->window != NULL)
+    gdk_window_move (GTK_WIDGET (ptr)->window, x, y);
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkWindowPeer_nativeSetLocation
+  (JNIEnv *env, jobject obj, jint x, jint y)
+{
+  gdk_threads_enter ();
+
+  Java_gnu_java_awt_peer_gtk_GtkWindowPeer_nativeSetLocationUnlocked
+    (env, obj, x, y);
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkWindowPeer_nativeSetBoundsUnlocked
+  (JNIEnv *env, jobject obj, jint x, jint y, jint width, jint height)
+{
+  void *ptr;
+  gint current_width;
+  gint current_height;
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  /* Avoid GTK runtime assertion failures. */
+  width = (width < 1) ? 1 : width;
+  height = (height < 1) ? 1 : height;
+
+  gtk_window_move (GTK_WINDOW(ptr), x, y);
+  /* The call to gdk_window_move is needed in addition to the call to
+     gtk_window_move.  If gdk_window_move isn't called, then the
+     following set of operations doesn't give the expected results:
+
+     1. show a window
+     2. manually move it to another position on the screen
+     3. hide the window
+     4. reposition the window with Component.setLocation
+     5. show the window
+
+     Instead of being at the position set by setLocation, the window
+     is reshown at the position to which it was moved manually. */
+  if (GTK_WIDGET (ptr)->window != NULL)
+    gdk_window_move (GTK_WIDGET (ptr)->window, x, y);
+
+  /* Only request resizing if the actual width or height change, otherwise
+   * we get unnecessary flickers because resizing causes GTK to clear the
+   * window content, even if the actual size doesn't change. */
+  gtk_window_get_size(GTK_WINDOW(ptr), &current_width, &current_height);
+  if (current_width != width || current_height != height)
+    {
+      /* Need to change the widget's request size. */
+      gtk_widget_set_size_request (GTK_WIDGET(ptr), width, height);
+      /* Also need to call gtk_window_resize.  If the resize is requested
+	 by the program and the window's "resizable" property is true then
+	 the size request will not be honoured. */
+      gtk_window_resize (GTK_WINDOW (ptr), width, height);
+    }
+}
+
+static void
+window_get_frame_extents (GtkWidget *window,
+                          int *top, int *left, int *bottom, int *right)
+{
+  unsigned long *extents = NULL;
+  union extents_union gu_ex;
+
+  /* Guess frame extents in case _NET_FRAME_EXTENTS is not
+     supported. */
+  if (!gtk_window_get_decorated (GTK_WINDOW (window)))
+    {
+      *top = 0;
+      *left = 0;
+      *bottom = 0;
+      *right = 0;
+
+      return;
+    }
+
+  *top = 23;
+  *left = 6;
+  *bottom = 6;
+  *right = 6;
+
+  /* Request that the window manager set window's
+     _NET_FRAME_EXTENTS property. */
+  request_frame_extents (window);
+
+  /* Attempt to retrieve window's frame extents. */
+  gu_ex.extents = &extents;
+  if (gdk_property_get (window->window,
+                        gdk_atom_intern ("_NET_FRAME_EXTENTS", FALSE),
+                        gdk_atom_intern ("CARDINAL", FALSE),
+                        0,
+                        sizeof (unsigned long) * 4,
+                        FALSE,
+                        NULL,
+                        NULL,
+                        NULL,
+                        gu_ex.gu_extents))
+    {
+      *left = extents [0];
+      *right = extents [1];
+      *top = extents [2];
+      *bottom = extents [3];
+    }
+}
+
+static Atom extents_atom = 0;
+
+/* Requests that the window manager set window's
+   _NET_FRAME_EXTENTS property. */
+static void
+request_frame_extents (GtkWidget *window)
+{
+  const char *request_str = "_NET_REQUEST_FRAME_EXTENTS";
+  GdkAtom request_extents = gdk_atom_intern (request_str, FALSE);
+
+  /* Check if the current window manager supports
+     _NET_REQUEST_FRAME_EXTENTS. */
+  if (gdk_net_wm_supports (request_extents))
+    {
+      GdkDisplay *display = gtk_widget_get_display (window);
+      Display *xdisplay = GDK_DISPLAY_XDISPLAY (display);
+
+      GdkWindow *root_window = gdk_get_default_root_window ();
+      Window xroot_window = GDK_WINDOW_XID (root_window);
+
+      Atom extents_request_atom =
+	gdk_x11_get_xatom_by_name_for_display (display, request_str);
+
+      XEvent xevent;
+      XEvent notify_xevent;
+
+      unsigned long window_id = GDK_WINDOW_XID (GDK_DRAWABLE(window->window));
+
+      if (!extents_atom)
+	{
+	  const char *extents_str = "_NET_FRAME_EXTENTS";
+	  extents_atom =
+	    gdk_x11_get_xatom_by_name_for_display (display, extents_str);
+	}
+
+      xevent.xclient.type = ClientMessage;
+      xevent.xclient.message_type = extents_request_atom;
+      xevent.xclient.display = xdisplay;
+      xevent.xclient.window = window_id;
+      xevent.xclient.format = 32;
+      xevent.xclient.data.l[0] = 0;
+      xevent.xclient.data.l[1] = 0;
+      xevent.xclient.data.l[2] = 0;
+      xevent.xclient.data.l[3] = 0;
+      xevent.xclient.data.l[4] = 0;
+
+      XSendEvent (xdisplay, xroot_window, False,
+		  (SubstructureRedirectMask | SubstructureNotifyMask),
+                  &xevent);
+
+      XIfEvent(xdisplay, &notify_xevent,
+	       property_notify_predicate, (XPointer) &window_id);
+    }
+}
+
+static Bool
+property_notify_predicate (Display *xdisplay __attribute__((unused)),
+                           XEvent  *event,
+                           XPointer window_id)
+{
+  unsigned long *window = (unsigned long *) window_id;
+
+  if (event->xany.type == PropertyNotify
+      && event->xany.window == *window
+      && event->xproperty.atom == extents_atom)
+    return True;
+  else
+    return False;
+}
+
+static gboolean
+window_delete_cb (GtkWidget *widget __attribute__((unused)),
+		  GdkEvent *event __attribute__((unused)),
+		  jobject peer)
+{
+  (*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), peer,
+			      postWindowEventID,
+			      (jint) AWT_WINDOW_CLOSING,
+			      (jobject) NULL, (jint) 0);
+
+  /* Prevents that the Window dissappears ("destroy"
+     not being signalled). This is necessary because it
+     should be up to a WindowListener implementation
+     how the AWT Frame responds to close requests. */
+  return TRUE;
+}
+
+static void
+window_destroy_cb (GtkWidget *widget __attribute__((unused)),
+		   GdkEvent *event __attribute__((unused)),
+		   jobject peer)
+{
+  (*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), peer,
+			      postWindowEventID,
+			      (jint) AWT_WINDOW_CLOSED,
+			      (jobject) NULL, (jint) 0);
+}
+
+static void
+window_show_cb (GtkWidget *widget __attribute__((unused)),
+		jobject peer)
+{
+  (*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), peer,
+			      postWindowEventID,
+			      (jint) AWT_WINDOW_OPENED,
+			      (jobject) NULL, (jint) 0);
+}
+
+static void
+window_focus_state_change_cb (GtkWidget *widget,
+			      GParamSpec *pspec __attribute__((unused)),
+			      jobject peer)
+{
+  if (GTK_WINDOW (widget)->has_toplevel_focus)
+    (*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), peer,
+                                postWindowEventID,
+                                (jint) AWT_WINDOW_ACTIVATED,
+                                (jobject) NULL, (jint) 0);
+  else
+    (*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), peer,
+                                postWindowEventID,
+                                (jint) AWT_WINDOW_DEACTIVATED,
+                                (jobject) NULL, (jint) 0);
+}
+
+static gboolean
+window_focus_in_cb (GtkWidget * widget  __attribute__((unused)),
+		    GdkEventFocus *event  __attribute__((unused)),
+		    jobject peer)
+{
+  (*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), peer,
+                              postWindowEventID,
+                              (jint) AWT_WINDOW_GAINED_FOCUS,
+                              (jobject) NULL, (jint) 0);
+
+  return FALSE;
+}
+
+static gboolean
+window_focus_out_cb (GtkWidget * widget __attribute__((unused)),
+		     GdkEventFocus *event __attribute__((unused)),
+		     jobject peer)
+{
+  (*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), peer,
+                              postWindowEventID,
+                              (jint) AWT_WINDOW_LOST_FOCUS,
+                              (jobject) NULL, (jint) 0);
+
+  return FALSE;
+}
+
+static gboolean
+window_window_state_cb (GtkWidget *widget __attribute__((unused)),
+			GdkEvent *event,
+			jobject peer)
+{
+  jint new_state;
+
+  /* Handle WINDOW_ICONIFIED and WINDOW_DEICONIFIED events. */
+  if (event->window_state.changed_mask & GDK_WINDOW_STATE_ICONIFIED)
+    {
+      /* We've either been iconified or deiconified. */
+      if (event->window_state.new_window_state & GDK_WINDOW_STATE_ICONIFIED)
+	{
+	  /* We've been iconified. */
+	  (*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), peer,
+				      postWindowEventID,
+				      (jint) AWT_WINDOW_ICONIFIED,
+				      (jobject) NULL, (jint) 0);
+	}
+      else
+	{
+	  /* We've been deiconified. */
+	  (*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), peer,
+				      postWindowEventID,
+				      (jint) AWT_WINDOW_DEICONIFIED,
+				      (jobject) NULL, (jint) 0);
+	}
+    }
+
+  /* Post a WINDOW_STATE_CHANGED event, passing the new frame state to
+     GtkWindowPeer. */
+  new_state = AWT_FRAME_STATE_NORMAL;
+
+  if (event->window_state.new_window_state & GDK_WINDOW_STATE_ICONIFIED)
+    new_state |= AWT_FRAME_STATE_ICONIFIED;
+
+  (*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), peer,
+			      postWindowEventID,
+			      (jint) AWT_WINDOW_STATE_CHANGED,
+			      (jobject) NULL, new_state);
+
+  return TRUE;
+}
+
+static gboolean
+window_property_changed_cb (GtkWidget *widget __attribute__((unused)),
+                            GdkEventProperty *event,
+                            jobject peer)
+{
+  unsigned long *extents;
+  union extents_union gu_ex;
+
+  gu_ex.extents = &extents;
+  if (gdk_atom_intern ("_NET_FRAME_EXTENTS", FALSE) == event->atom
+      && gdk_property_get (event->window,
+                           gdk_atom_intern ("_NET_FRAME_EXTENTS", FALSE),
+                           gdk_atom_intern ("CARDINAL", FALSE),
+                           0,
+                           sizeof (unsigned long) * 4,
+                           FALSE,
+                           NULL,
+                           NULL,
+                           NULL,
+                           gu_ex.gu_extents))
+    {
+      (*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), peer,
+				    postInsetsChangedEventID,
+				    (jint) extents[2],  /* top */
+				    (jint) extents[0],  /* left */
+				    (jint) extents[3],  /* bottom */
+				    (jint) extents[1]); /* right */
+    }
+  
+
+  return FALSE;
+}
+
+static void
+realize_cb (GtkWidget *widget, jobject peer)
+{
+  jint top = 0;
+  jint left = 0;
+  jint bottom = 0;
+  jint right = 0;
+  jint width = 0;
+  jint height = 0;
+
+  width = (*cp_gtk_gdk_env())->CallIntMethod (cp_gtk_gdk_env(), peer, windowGetWidthID);
+  height = (*cp_gtk_gdk_env())->CallIntMethod (cp_gtk_gdk_env(), peer, windowGetHeightID);
+
+  window_get_frame_extents (widget, &top, &left, &bottom, &right);
+
+  (*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), peer,
+				postInsetsChangedEventID,
+				top, left, bottom, right);
+
+  gtk_window_set_default_size (GTK_WINDOW (widget),
+			       MAX (1, width - left - right),
+			       MAX (1, height - top - bottom));
+
+  /* set the size like we do in nativeSetBounds */
+  gtk_widget_set_size_request (widget,
+			       MAX (1, width - left - right),
+			       MAX (1, height - top - bottom));
+
+  gtk_window_resize (GTK_WINDOW (widget),
+		     MAX (1, width - left - right),
+		     MAX (1, height - top - bottom));
+}
+
+/*
+ * This method returns a GDK keyval that corresponds to one of the
+ * keysyms in the X keymap table.  The return value is only used to
+ * determine the keyval's corresponding hardware keycode, and doesn't
+ * reflect an accurate translation of a Java virtual key value to a
+ * GDK keyval.
+ */
+#ifdef __GNUC__
+__inline
+#endif
+guint
+cp_gtk_awt_keycode_to_keysym (jint keyCode, jint keyLocation)
+{
+  /* GDK_A through GDK_Z */
+  if (keyCode >= VK_A && keyCode <= VK_Z)
+    return gdk_keyval_to_lower (keyCode);
+
+  /* GDK_0 through GDK_9 */
+  if (keyCode >= VK_0 && keyCode <= VK_9)
+    return keyCode;
+
+  switch (keyCode)
+    {
+    case VK_ENTER:
+      return keyLocation == AWT_KEY_LOCATION_NUMPAD ? GDK_KP_Enter : GDK_Return;
+    case VK_BACK_SPACE:
+      return GDK_BackSpace;
+    case VK_TAB:
+      return GDK_Tab;
+    case VK_CANCEL:
+      return GDK_Cancel;
+    case VK_CLEAR:
+      return GDK_Clear;
+    case VK_SHIFT:
+      return keyLocation == AWT_KEY_LOCATION_LEFT ? GDK_Shift_L : GDK_Shift_R;
+    case VK_CONTROL:
+      return keyLocation == AWT_KEY_LOCATION_LEFT ? GDK_Control_L : GDK_Control_R;
+    case VK_ALT:
+      return keyLocation == AWT_KEY_LOCATION_LEFT ? GDK_Alt_L : GDK_Alt_R;
+    case VK_PAUSE:
+      return GDK_Pause;
+    case VK_CAPS_LOCK:
+      return GDK_Caps_Lock;
+    case VK_ESCAPE:
+      return GDK_Escape;
+    case VK_SPACE:
+      return GDK_space;
+    case VK_PAGE_UP:
+      return keyLocation == AWT_KEY_LOCATION_NUMPAD ? GDK_KP_Page_Up : GDK_Page_Up;
+    case VK_PAGE_DOWN:
+      return keyLocation == AWT_KEY_LOCATION_NUMPAD ? GDK_KP_Page_Down : GDK_Page_Down;
+    case VK_END:
+      return keyLocation == AWT_KEY_LOCATION_NUMPAD ? GDK_KP_End : GDK_End;
+    case VK_HOME:
+      return keyLocation == AWT_KEY_LOCATION_NUMPAD ? GDK_KP_Home : GDK_Home;
+    case VK_LEFT:
+      return GDK_Left;
+    case VK_UP:
+      return GDK_Up;
+    case VK_RIGHT:
+      return GDK_Right;
+    case VK_DOWN:
+      return GDK_Down;
+    case VK_COMMA:
+      return GDK_comma;
+    case VK_MINUS:
+      return GDK_minus;
+    case VK_PERIOD:
+      return GDK_period;
+    case VK_SLASH:
+      return GDK_slash;
+      /*
+    case VK_0:
+    case VK_1:
+    case VK_2:
+    case VK_3:
+    case VK_4:
+    case VK_5:
+    case VK_6:
+    case VK_7:
+    case VK_8:
+    case VK_9:
+      */
+    case VK_SEMICOLON:
+      return GDK_semicolon;
+    case VK_EQUALS:
+      return GDK_equal;
+      /*
+    case VK_A:
+    case VK_B:
+    case VK_C:
+    case VK_D:
+    case VK_E:
+    case VK_F:
+    case VK_G:
+    case VK_H:
+    case VK_I:
+    case VK_J:
+    case VK_K:
+    case VK_L:
+    case VK_M:
+    case VK_N:
+    case VK_O:
+    case VK_P:
+    case VK_Q:
+    case VK_R:
+    case VK_S:
+    case VK_T:
+    case VK_U:
+    case VK_V:
+    case VK_W:
+    case VK_X:
+    case VK_Y:
+    case VK_Z:
+      */
+    case VK_OPEN_BRACKET:
+      return GDK_bracketleft;
+    case VK_BACK_SLASH:
+      return GDK_backslash;
+    case VK_CLOSE_BRACKET:
+      return GDK_bracketright;
+    case VK_NUMPAD0:
+      return GDK_KP_0;
+    case VK_NUMPAD1:
+      return GDK_KP_1;
+    case VK_NUMPAD2:
+      return GDK_KP_2;
+    case VK_NUMPAD3:
+      return GDK_KP_3;
+    case VK_NUMPAD4:
+      return GDK_KP_4;
+    case VK_NUMPAD5:
+      return GDK_KP_5;
+    case VK_NUMPAD6:
+      return GDK_KP_6;
+    case VK_NUMPAD7:
+      return GDK_KP_7;
+    case VK_NUMPAD8:
+      return GDK_KP_8;
+    case VK_NUMPAD9:
+      return GDK_KP_9;
+    case VK_MULTIPLY:
+      return GDK_KP_Multiply;
+    case VK_ADD:
+      return GDK_KP_Add;
+      /*
+    case VK_SEPARATER:
+      */
+    case VK_SEPARATOR:
+      return GDK_KP_Separator;
+    case VK_SUBTRACT:
+      return GDK_KP_Subtract;
+    case VK_DECIMAL:
+      return GDK_KP_Decimal;
+    case VK_DIVIDE:
+      return GDK_KP_Divide;
+    case VK_DELETE:
+      return keyLocation == AWT_KEY_LOCATION_NUMPAD ? GDK_KP_Delete : GDK_Delete;
+    case VK_NUM_LOCK:
+      return GDK_Num_Lock;
+    case VK_SCROLL_LOCK:
+      return GDK_Scroll_Lock;
+    case VK_F1:
+      return GDK_F1;
+    case VK_F2:
+      return GDK_F2;
+    case VK_F3:
+      return GDK_F3;
+    case VK_F4:
+      return GDK_F4;
+    case VK_F5:
+      return GDK_F5;
+    case VK_F6:
+      return GDK_F6;
+    case VK_F7:
+      return GDK_F7;
+    case VK_F8:
+      return GDK_F8;
+    case VK_F9:
+      return GDK_F9;
+    case VK_F10:
+      return GDK_F10;
+    case VK_F11:
+      return GDK_F11;
+    case VK_F12:
+      return GDK_F12;
+    case VK_F13:
+      return GDK_F13;
+    case VK_F14:
+      return GDK_F14;
+    case VK_F15:
+      return GDK_F15;
+    case VK_F16:
+      return GDK_F16;
+    case VK_F17:
+      return GDK_F17;
+    case VK_F18:
+      return GDK_F18;
+    case VK_F19:
+      return GDK_F19;
+    case VK_F20:
+      return GDK_F20;
+    case VK_F21:
+      return GDK_F21;
+    case VK_F22:
+      return GDK_F22;
+    case VK_F23:
+      return GDK_F23;
+    case VK_F24:
+      return GDK_F24;
+    case VK_PRINTSCREEN:
+      return GDK_Print;
+    case VK_INSERT:
+      return keyLocation == AWT_KEY_LOCATION_NUMPAD ? GDK_KP_Insert : GDK_Insert;
+    case VK_HELP:
+      return GDK_Help;
+    case VK_META:
+      return keyLocation == AWT_KEY_LOCATION_LEFT ? GDK_Meta_L : GDK_Meta_R;
+    case VK_BACK_QUOTE:
+      return GDK_grave;
+    case VK_QUOTE:
+      return GDK_apostrophe;
+    case VK_KP_UP:
+      return GDK_KP_Up;
+    case VK_KP_DOWN:
+      return GDK_KP_Down;
+    case VK_KP_LEFT:
+      return GDK_KP_Left;
+    case VK_KP_RIGHT:
+      return GDK_KP_Right;
+    case VK_DEAD_GRAVE:
+      return GDK_dead_grave;
+    case VK_DEAD_ACUTE:
+      return GDK_dead_acute;
+    case VK_DEAD_CIRCUMFLEX:
+      return GDK_dead_circumflex;
+    case VK_DEAD_TILDE:
+      return GDK_dead_tilde;
+    case VK_DEAD_MACRON:
+      return GDK_dead_macron;
+    case VK_DEAD_BREVE:
+      return GDK_dead_breve;
+    case VK_DEAD_ABOVEDOT:
+      return GDK_dead_abovedot;
+    case VK_DEAD_DIAERESIS:
+      return GDK_dead_diaeresis;
+    case VK_DEAD_ABOVERING:
+      return GDK_dead_abovering;
+    case VK_DEAD_DOUBLEACUTE:
+      return GDK_dead_doubleacute;
+    case VK_DEAD_CARON:
+      return GDK_dead_caron;
+    case VK_DEAD_CEDILLA:
+      return GDK_dead_cedilla;
+    case VK_DEAD_OGONEK:
+      return GDK_dead_ogonek;
+    case VK_DEAD_IOTA:
+      return GDK_dead_iota;
+    case VK_DEAD_VOICED_SOUND:
+      return GDK_dead_voiced_sound;
+    case VK_DEAD_SEMIVOICED_SOUND:
+      return GDK_dead_semivoiced_sound;
+    case VK_AMPERSAND:
+      return GDK_ampersand;
+    case VK_ASTERISK:
+      return GDK_asterisk;
+    case VK_QUOTEDBL:
+      return GDK_quotedbl;
+    case VK_LESS:
+      return GDK_less;
+    case VK_GREATER:
+      return GDK_greater;
+    case VK_BRACELEFT:
+      return GDK_braceleft;
+    case VK_BRACERIGHT:
+      return GDK_braceright;
+    case VK_AT:
+      return GDK_at;
+    case VK_COLON:
+      return GDK_colon;
+    case VK_CIRCUMFLEX:
+      return GDK_asciicircum;
+    case VK_DOLLAR:
+      return GDK_dollar;
+    case VK_EURO_SIGN:
+      return GDK_EuroSign;
+    case VK_EXCLAMATION_MARK:
+      return GDK_exclam;
+    case VK_INVERTED_EXCLAMATION_MARK:
+      return GDK_exclamdown;
+    case VK_LEFT_PARENTHESIS:
+      return GDK_parenleft;
+    case VK_NUMBER_SIGN:
+      return GDK_numbersign;
+    case VK_PLUS:
+      return GDK_plus;
+    case VK_RIGHT_PARENTHESIS:
+      return GDK_parenright;
+    case VK_UNDERSCORE:
+      return GDK_underscore;
+      /*
+    case VK_FINAL:
+    case VK_CONVERT:
+    case VK_NONCONVERT:
+    case VK_ACCEPT:
+      */
+    case VK_MODECHANGE:
+      return GDK_Mode_switch;
+      /*
+    case VK_KANA:
+      */
+    case VK_KANJI:
+      return GDK_Kanji;
+      /*
+    case VK_ALPHANUMERIC:
+      */
+    case VK_KATAKANA:
+      return GDK_Katakana;
+    case VK_HIRAGANA:
+      return GDK_Hiragana;
+      /*
+    case VK_FULL_WIDTH:
+    case VK_HALF_WIDTH:
+    case VK_ROMAN_CHARACTERS:
+    case VK_ALL_CANDIDATES:
+      */
+    case VK_PREVIOUS_CANDIDATE:
+      return GDK_PreviousCandidate;
+    case VK_CODE_INPUT:
+      return GDK_Codeinput;
+      /*
+    case VK_JAPANESE_KATAKANA:
+    case VK_JAPANESE_HIRAGANA:
+    case VK_JAPANESE_ROMAN:
+      */
+    case VK_KANA_LOCK:
+      return GDK_Kana_Lock;
+      /*
+    case VK_INPUT_METHOD_ON_OFF:
+    case VK_CUT:
+    case VK_COPY:
+    case VK_PASTE:
+      */
+    case VK_UNDO:
+      return GDK_Undo;
+    case VK_AGAIN:
+      return GDK_Redo;
+      /*
+    case VK_FIND:
+    case VK_PROPS:
+    case VK_STOP:
+    case VK_COMPOSE:
+      */
+    case VK_ALT_GRAPH:
+      return GDK_ISO_Level3_Shift;
+      /*
+	case VK_BEGIN:
+      */
+    case VK_CONTEXT_MENU:
+      return GDK_Menu;
+    case VK_WINDOWS:
+      return GDK_Super_R;
+
+    default:
+      return GDK_VoidSymbol;
+    }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gthread-jni.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gthread-jni.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gthread-jni.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gthread-jni.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,2592 @@
+/* gthread-jni.c -- JNI threading routines for GLIB
+   Copyright (C) 1998, 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+/************************************************************************/
+/* Header				     				*/
+/************************************************************************/
+
+/*
+ * @author Julian Dolby (dolby at us.ibm.com)
+ * @date February 7, 2003  implemented for GLIB v.1
+ * 
+ *
+ * @author Steven Augart 
+ * <steve+classpath at augart dot com>, <augart at watson dot ibm dot com>
+ * @date April 30, 2004 -- May 10 2004: Support new functions for Glib v.2,
+ * fix cond_wait to free and re-acquire the mutex,
+ * replaced trylock stub implementation with a full one.
+ *
+ *  This code implements the GThreadFunctions interface for GLIB using 
+ * Java threading primitives.  All of the locking and conditional variable
+ * functionality required by GThreadFunctions is implemented using the
+ * monitor and wait/notify functionality of Java objects.  The thread-
+ * local functionality uses the java.lang.ThreadLocal class. 
+ *
+ *  Classpath's AWT support uses GTK+ peers.  GTK+ uses GLIB.  GLIB by default
+ * uses the platform's native threading model -- pthreads in most cases.  If
+ * the Java runtime doesn't use the native threading model, then it needs this
+ * code in order to use Classpath's (GTK+-based) AWT routines.
+ *
+ *  This code should be portable; I believe it makes no assumptions
+ * about the underlying VM beyond that it implements the JNI functionality
+ * that this code uses.
+ *
+ *  Currently, use of this code is governed by the configuration option
+ * --enable-portable-native-sync.  We will soon add a VM hook so the VM can
+ * select which threading model it wants to use at run time; at that point,
+ * the configuration option will go away.
+ *
+ * The code in this file uses only JNI 1.1, except for one JNI 1.2 function:
+ * GetEnv, in the JNI Invocation API.  (There seems to be no way around using
+ * GetEnv).
+ *
+ * ACKNOWLEDGEMENT:
+ * 
+ *  I would like to thank Mark Wielaard for his kindness in spending at least
+ * six hours of his own time in reviewing this code and correcting my GNU
+ * coding and commenting style.  --Steve Augart
+ *
+ *
+ * NOTES:
+ *
+ *  This code has been tested with Jikes RVM and with Kaffe.
+ *
+ *  This code should have proper automated unit tests.  I manually tested it
+ *  by running an application that uses AWT. --Steven Augart
+ *
+ * MINOR NIT:
+ *
+ *  - Using a jboolean in the arglist to "throw()" and "rethrow()"
+ *    triggers many warnings from GCC's -Wconversion operation, because that
+ *    is not the same as the conversion (upcast to an int) that would occur in
+ *    the absence of a prototype.
+ *    
+ *    It would be very slightly more efficient to just pass the jboolean, but
+ *    is not worth the clutter of messages.  The right solution would be to
+ *    turn off the -Wconversion warning for just this file, *except* that
+ *    -Wconversion also warns you against constructs such as:
+ *        unsigned u = -1;
+ *    and that is a useful warning.  So I went from a "jboolean" to a
+ *    "gboolean"  (-Wconversion is not enabled by default for GNU Classpath,
+ *    but it is in my own CFLAGS, which, for gcc 3.3.3, read: -pipe -ggdb3 -W
+ *    -Wall -Wbad-function-cast -Wcast-align -Wpointer-arith -Wcast-qual
+ *    -Wshadow -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations
+ *    -fkeep-static-consts -fkeep-inline-functions -Wundef -Wwrite-strings
+ *    -Wno-aggregate-return -Wmissing-noreturn -Wnested-externs -Wtrigraphs
+ *    -Wconversion -Wsign-compare -Wno-float-equal -Wmissing-format-attribute
+ *    -Wno-unreachable-code -Wdisabled-optimization )
+ */
+
+#include <config.h>
+
+/************************************************************************/
+/* Configuration							*/
+/************************************************************************/
+
+/** Tracing and Reporting  **/
+#define TRACE_API_CALLS	    0	/* announce entry and exit into each method,
+				   by printing to stderr. */
+
+#define TRACE_MONITORS      0	/* Every enterMonitor() and exitMonitor() goes
+				   to stderr. */
+
+/** Trouble handling.  There is a discussion below of this.  **/ 
+#define EXPLAIN_TROUBLE	    1	/* Describe any unexpected trouble that
+				   happens.  This is a superset
+				   of EXPLAIN_BROKEN, and if set trumps an
+				   unset EXPLAIN_BROKEN.  It is not a strict
+				   superset, since at the moment there is no
+				   TROUBLE that is not also BROKEN.   
+
+				   Use criticalMsg() to describe the problem.
+				 */
+
+#define EXPLAIN_BROKEN	    1	/* Describe trouble that is serious enough to
+				   be BROKEN.  (Right now all trouble is at
+				   least BROKEN.) */
+
+/* There is no EXPLAIN_BADLY_BROKEN definition.  We always explain
+   BADLY_BROKEN trouble, since there is no other way to report it.  */
+
+
+/** Error Handling  **/
+#define DIE_IF_BROKEN	    1	/* Dies if serious trouble happens.  There is
+				   really no non-serious trouble, except
+				   possibly problems that arise during
+				   pthread_create, which are reported by a
+				   GError.
+
+				   If you do not set DIE_IF_BROKEN, then
+				   trouble will raise a Java RuntimeException.
+				   We probably do want to die right away,
+				   since anything that's BROKEN really
+				   indicates a programming error or a
+				   system-wide error, and that's what the glib
+				   documentation says you should do in case of
+				   that kind of error in a glib-style
+				   function.  But it does work to turn this
+				   off.  */
+
+#if  DIE_IF_BROKEN
+#define DIE_IF_BADLY_BROKEN 1	/* DIE_IF_BROKEN implies DIE_IF_BADLY_BROKEN */
+#else
+#define DIE_IF_BADLY_BROKEN 1	/* Die if the system is badly broken --
+				   that is, if we have further trouble while
+				   attempting to throw an exception
+				   upwards, or if we are unable to generate
+				   one of the classes we'll need in order to
+				   throw wrapped exceptions upward.
+
+				   If unset, we will print a warning message,
+				   and limp along anyway.  Not that the system
+				   is likely to work.  */
+#endif
+
+/** Performance tuning parameters **/
+
+#define ENABLE_EXPENSIVE_ASSERTIONS 0	/* Enable expensive assertions? */
+
+#define DELETE_LOCAL_REFS   1	/* Whether to delete local references.   
+
+				   JNI only guarantees that there wil be 16
+				   available.  (Jikes RVM provides an number
+				   only limited by VM memory.)
+
+				   Jikes RVM will probably perform faster if
+				   this is turned off, but other VMs may need
+				   this to be turned on in order to perform at
+				   all, or might need it if things change.
+
+				   Remember, we don't know how many of those
+				   local refs might have already been used up
+				   by higher layers of JNI code that end up
+				   calling g_thread_self(),
+				   g_thread_set_private(), and so on.
+
+				   We set this to 1 for GNU Classpath, since
+				   one of our principles is "always go for the
+				   most robust implementation" */
+
+#define  HAVE_JNI_VERSION_1_2   0 /* Assume we don't.  We could
+				     dynamically check for this.  We will
+				     assume JNI 1.2 in later versions of
+				     Classpath.  
+
+                                     As it stands, the code in this file
+                                     already needs one JNI 1.2 function:
+                                     GetEnv, in the JNI Invocation API.
+
+				     TODO This code hasn't been tested yet.
+				     And really hasn't been implemented yet.
+				     */ 
+
+/************************************************************************/
+/* Global data				     				*/
+/************************************************************************/
+
+#if defined HAVE_STDINT_H
+#include <stdint.h>		/* provides intptr_t */
+#elif defined HAVE_INTTYPES_H
+#include <inttypes.h>
+#endif
+#include <stdarg.h>		/* va_list */
+#include <glib.h>
+#include "gthread-jni.h"
+#include <assert.h>		/* assert() */
+
+/* For Java thread priority constants. */
+#include <gnu_java_awt_peer_gtk_GThreadNativeMethodRunner.h>
+
+/* Since not all JNI header generators actually define constants we
+ define them here explicitly. */
+#ifndef gnu_java_awt_peer_gtk_GThreadNativeMethodRunner_MIN_PRIORITY
+#define gnu_java_awt_peer_gtk_GThreadNativeMethodRunner_MIN_PRIORITY 1
+#endif
+#ifndef gnu_java_awt_peer_gtk_GThreadNativeMethodRunner_NORM_PRIORITY
+#define gnu_java_awt_peer_gtk_GThreadNativeMethodRunner_NORM_PRIORITY 5
+#endif
+#ifndef gnu_java_awt_peer_gtk_GThreadNativeMethodRunner_MAX_PRIORITY
+#define gnu_java_awt_peer_gtk_GThreadNativeMethodRunner_MAX_PRIORITY 10
+#endif
+
+/*  The VM handle.  This is set in
+    Java_gnu_java_awt_peer_gtk_GtkMainThread_gtkInit */
+JavaVM *cp_gtk_the_vm;
+
+/* Unions used for type punning. */
+union env_union
+{
+  void **void_env;
+  JNIEnv **jni_env;
+};
+
+union func_union
+{
+  void *void_func;
+  GThreadFunc g_func;
+};
+
+/* Forward Declarations for Functions  */
+static int threadObj_set_priority (JNIEnv * env, jobject threadObj,
+				   GThreadPriority gpriority);
+static void fatalMsg (const char fmt[], ...)
+     __attribute__ ((format (printf, 1, 2)))
+     __attribute__ ((noreturn));
+
+static void criticalMsg (const char fmt[], ...)
+     __attribute__ ((format (printf, 1, 2)));
+
+static void tracing (const char fmt[], ...)
+     __attribute__ ((format (printf, 1, 2)));
+
+static jint javaPriorityLevel (GThreadPriority priority)
+     __attribute__ ((const));
+
+/************************************************************************/
+/* Trouble-handling, including utilities to reflect exceptions		*/
+/* back to the VM.  Also some status reporting.				*/
+/************************************************************************/
+
+/* How are we going to handle problems?
+
+   There are several approaches:
+
+   1)  Report them with the GError mechanism.
+
+       (*thread_create)() is the only one of these functions that takes a
+       GError pointer.  And the only G_THREAD error defined maps onto EAGAIN.
+       We don't have any errors in our (*thread_create)() implementation that
+       can be mapped to EAGAIN.  So this idea is a non-starter.
+
+   2)  Reflect the exception back to the VM, wrapped in a RuntimeException.
+       This will fail sometimes, if we're so broken (BADLY_BROKEN) that we
+       fail to throw the exception. 
+
+   3)  Abort execution.  This is what the glib functions themselves do for
+       errors that they can't report via GError.
+
+       Enable DIE_IF_BROKEN and/or DIE_IF_BADLY_BROKEN to
+       make this the default for BROKEN and/or BADLY_BROKEN trouble.
+
+   4) Display messages to stderr.  We always do this for BADLY_BROKEN
+      trouble.  The glib functions do that for errors they can't report via
+      GError. 
+
+   There are some complications.
+
+   When I attempted to report a problem in g_thread_self() using g_critical (a
+   macro around g_log(), I found that g_log in turn looks for thread-private
+   data and calls g_thread_self() again.
+
+   We got a segfault, probably due to stack overflow.  So, this code doesn't
+   use the g_critical() and g_error() functions any more.  Nor do we use
+   g_assert(); we use the C library's assert() instead.
+*/
+
+
+#define WHERE __FILE__ ":" G_STRINGIFY(__LINE__) ": "
+
+/* This is portable to older compilers that lack variable-argument macros.
+   This used to be just g_critical(), but then we ran into the error reporting
+   problem discussed above.
+*/
+static void
+fatalMsg (const char fmt[], ...)
+{
+  va_list ap;
+  va_start (ap, fmt);
+  vfprintf (stderr, fmt, ap);
+  va_end (ap);
+  fputs ("\nAborting execution\n", stderr);
+  abort ();
+}
+
+
+static void
+criticalMsg (const char fmt[], ...)
+{
+  va_list ap;
+  va_start (ap, fmt);
+  vfprintf (stderr, fmt, ap);
+  va_end (ap);
+  putc ('\n', stderr);
+}
+
+/* Unlike the other two, this one does not append a newline.  This is only
+   used if one of the TRACE_ macros is defined.  */
+static void
+tracing (const char fmt[], ...)
+{
+  va_list ap;
+  va_start (ap, fmt);
+  vfprintf (stderr, fmt, ap);
+  va_end (ap);
+}
+
+#define assert_not_reached()						\
+  do									\
+    {									\
+      fputs(WHERE "You should never get here.  Aborting execution.\n", 	\
+	    stderr);							\
+      abort();								\
+    }									\
+  while(0)
+
+
+#if DIE_IF_BADLY_BROKEN
+#define BADLY_BROKEN fatalMsg
+#else
+#define BADLY_BROKEN criticalMsg
+/* So, the user may still attempt to recover, even though we do not advise
+   this. */
+#endif
+
+/* I find it so depressing to have to use C without varargs macros. */
+#define BADLY_BROKEN_MSG WHERE "Something fundamental"		\
+	" to GNU Classpath's AWT JNI broke while we were trying to pass up a Java error message"
+
+#define BADLY_BROKEN0()				\
+    BADLY_BROKEN(BADLY_BROKEN_MSG);
+#define	    BADLY_BROKEN1(msg)			\
+    BADLY_BROKEN(BADLY_BROKEN_MSG ": " msg)
+#define	    BADLY_BROKEN2(msg, arg)			\
+    BADLY_BROKEN(BADLY_BROKEN_MSG ": " msg, arg)
+#define	    BADLY_BROKEN3(msg, arg, arg2) 		\
+    BADLY_BROKEN(BADLY_BROKEN_MSG ": " msg, arg1, arg2)
+#define	    BADLY_BROKEN4(msg, arg, arg2, arg3) 		\
+    BADLY_BROKEN(BADLY_BROKEN_MSG ": " msg, arg1, arg2, arg3)
+
+#define DELETE_LOCAL_REF(env, ref) 		\
+  do 						\
+    {						\
+      if ( DELETE_LOCAL_REFS )			\
+	{					\
+	  (*env)->DeleteLocalRef (env, ref);	\
+	  (ref) = NULL;				\
+	}					\
+    }						\
+  while(0)
+
+/* Cached info for Exception-wrapping */
+
+static jclass runtimeException_class;	/* java.lang.RuntimeException */
+static jmethodID runtimeException_ctor; /* constructor for it */
+
+
+/* Throw a new RuntimeException.  It may wrap around an existing exception.
+   1 if we did rethrow, -1 if we had trouble while rethrowing.
+   isBroken is always true in this case. */
+static int
+throw (JNIEnv * env, jthrowable cause, const char *message,
+       gboolean isBroken, const char *file, int line)
+{
+  jstring jmessage;
+  gboolean describedException = FALSE;	/* Did we already describe the
+					   exception to stderr or the
+					   equivalent?   */
+  jthrowable wrapper;
+
+  /* allocate local message in Java */
+  const char fmt[] = "In AWT JNI, %s (at %s:%d)";
+  size_t len = strlen (message) + strlen (file) + sizeof fmt + 25;
+  char *buf;
+
+  if (EXPLAIN_TROUBLE || (isBroken && EXPLAIN_BROKEN))
+    {
+      criticalMsg ("%s:%d: AWT JNI failure%s: %s\n", file, line,
+		   isBroken ? " (BROKEN)" : "", message);
+      if (cause)
+	{
+	  jthrowable currentException = (*env)->ExceptionOccurred (env);
+
+	  if (cause == currentException)
+	    {
+	      criticalMsg ("Description follows to System.err:");
+	      (*env)->ExceptionDescribe (env);
+	      /* ExceptionDescribe has the side-effect of clearing the pending
+	         exception; relaunch it.  */
+	      describedException = TRUE;
+
+	      if ((*env)->Throw (env, cause))
+		{
+		  BADLY_BROKEN1
+		    ("Relaunching an exception with Throw failed.");
+		  return -1;
+		}
+	    }
+	  else
+	    {
+	      DELETE_LOCAL_REF (env, currentException);
+	      criticalMsg (WHERE
+			   "currentException != cause; something else happened"
+			   " while handling an exception.");
+	    }
+	}
+    }				/* if (EXPLAIN_TROUBLE) */
+
+  if (isBroken && DIE_IF_BROKEN)
+    fatalMsg ("%s:%d: Aborting execution; BROKEN: %s\n", file, line, message);
+
+  if ((buf = malloc (len)))
+    {
+      memset (buf, 0, len);
+      g_snprintf (buf, len, fmt, message, file, line);
+      jmessage = (*env)->NewStringUTF (env, buf);
+      free (buf);
+    }
+  else
+    {
+      jmessage = NULL;
+    }
+
+  /* Create the RuntimeException wrapper object and throw it.  It is OK for
+     CAUSE to be NULL. */
+  wrapper = (jthrowable) (*env)->NewObject
+    (env, runtimeException_class, runtimeException_ctor, jmessage, cause);
+  DELETE_LOCAL_REF (env, jmessage);
+
+  if (!wrapper)
+    {
+      /* I think this should only happen:
+         - if there are bugs in my JNI code, or
+         - if the VM is broken, or 
+         - if we run out of memory. 
+       */
+      if (EXPLAIN_TROUBLE)
+	{
+	  criticalMsg (WHERE "GNU Classpath: JNI NewObject() could not create"
+		       " a new java.lang.RuntimeException.");
+	  criticalMsg ("We were trying to warn about the following"
+		       " previous failure:");
+	  criticalMsg ("%s:%d: %s", file, line, message);
+	  criticalMsg ("The latest (NewObject()) exception's description"
+		       " follows, to System.err:");
+	  (*env)->ExceptionDescribe (env);
+	}
+      BADLY_BROKEN1 ("Failure of JNI NewObject()"
+		     " to make a java.lang.RuntimeException");
+      return -1;
+    }
+
+
+  /* throw it */
+  if ((*env)->Throw (env, wrapper))
+    {
+      /* Throw() should just never fail, unless we're in such severe trouble
+         that we might as well die. */
+      BADLY_BROKEN1
+	("GNU Classpath: Failure of JNI Throw to report an Exception");
+      return -1;
+    }
+
+  DELETE_LOCAL_REF (env, wrapper);
+  return 1;
+}
+
+
+
+/* Rethrow an exception we received, wrapping it with a RuntimeException.  1
+   if we did rethrow, -1 if we had trouble while rethrowing.
+   CAUSE should be identical to the most recent exception that happened, so
+   that ExceptionDescribe will work.  (Otherwise nix.) */
+static int
+rethrow (JNIEnv * env, jthrowable cause, const char *message,
+	 gboolean isBroken, const char *file, int line)
+{
+  assert (cause);
+  return throw (env, cause, message, isBroken, file, line);
+}
+
+
+/* This function checks for a pending exception, and rethrows it with
+ * a wrapper RuntimeException to deal with possible type problems (in
+ * case some calling piece of code does not expect the exception being
+ * thrown) and to include the given extra message.
+ *
+ * Returns 0 if no problems found (so no exception thrown), 1 if we rethrew an
+ * exception.   Returns -1 on failure. 
+ */
+static int
+maybe_rethrow (JNIEnv * env, const char *message, gboolean isBroken,
+	       const char *file, int line)
+{
+  jthrowable cause = (*env)->ExceptionOccurred (env);
+  int ret = 0;
+
+  /* rethrow if an exception happened */
+  if (cause)
+    {
+      ret = rethrow (env, cause, message, isBroken, file, line);
+      DELETE_LOCAL_REF (env, cause);
+    }
+
+  return 0;
+}
+
+/* MAYBE_TROUBLE() is used to include a source location in the exception
+   message. Once we have run maybe_rethrow, if there WAS trouble, 
+   return TRUE, else FALSE.   
+
+   MAYBE_TROUBLE() is actually never used; all problems that throw exceptions
+   are BROKEN, at least.  Nothing is recoverable :(.  See the discussion of
+   possible errors at thread_create_jni_impl().  */
+#define MAYBE_TROUBLE(_env, _message)				\
+	maybe_rethrow(_env, _message, FALSE, __FILE__, __LINE__)
+
+/* MAYBE_TROUBLE(), but something would be BROKEN if it were true. */
+#define MAYBE_BROKEN(_env, _message)				\
+	maybe_rethrow(_env, _message, TRUE, __FILE__, __LINE__)
+
+/* Like MAYBE_TROUBLE(), TROUBLE() is never used. */
+#define TROUBLE(_env, _message)						\
+	rethrow(_env, (*env)->ExceptionOccurred (env), _message, FALSE, \
+		__FILE__, __LINE__)
+
+#define BROKEN(_env, _message)						\
+	rethrow (_env, (*env)->ExceptionOccurred (env), _message, TRUE, \
+		 __FILE__, __LINE__)
+
+/* Like MAYBE_TROUBLE(), NEW_TROUBLE() is never used. */
+#define NEW_TROUBLE(_env, _message)					\
+	throw (_env, NULL,  _message, FALSE, __FILE__, __LINE__)
+
+#define NEW_BROKEN(_env, _message)				\
+	throw (_env, NULL, _message, TRUE, __FILE__, __LINE__)
+
+/* Like MAYBE_TROUBLE(), RETHROW_CAUSE() is never used. */
+#define RETHROW_CAUSE(_env, _cause, _message)				\
+	rethrow (_env, _cause, _message, FALSE, __FILE__, __LINE__)
+
+#define BROKEN_CAUSE(_env, _cause, _message)				\
+	rethrow (_env, _cause, _message, TRUE, __FILE__, __LINE__)
+
+/* Macros to handle the possibility that someone might have called one of the
+   GThreadFunctions API functions with a Java exception pending.  It is
+   generally discouraged to continue to use JNI after a Java exception has
+   been raised.  Sun's JNI book advises that one trap JNI errors immediately
+   and not continue with an exception pending.
+
+   These are #if'd out for these reasons:
+
+   1) They do not work in the C '89 subset that Classpath is currently 
+      (2004 May 10) sticking to; HIDE_OLD_TROUBLE() includes a declaration
+      that should be in scope for the rest of the function, so it needs a
+      language version that lets you mix declarations and statements.  (This
+      could be worked around if it were important.)
+
+   2) They chew up more time and resources.  
+
+   3) There does not ever seem to be old trouble -- the assertion in
+      HIDE_OLD_TROUBLE never goes off. 
+
+   You will want to re-enable them if this code needs to be used in a context
+   where old exceptions might be pending when the GThread functions are
+   called.
+
+   The implementations in this file are responsible for skipping around calls
+   to SHOW_OLD_TROUBLE() if they've raised exceptions during the call.  So, if
+   we reach SHOW_OLD_TROUBLE, we are guaranteed that there are no exceptions
+   pending. */
+#if 1
+#define HIDE_OLD_TROUBLE(env)				\
+    assert ( NULL == (*env)->ExceptionOccurred (env) )
+
+#define SHOW_OLD_TROUBLE()	\
+    assert ( NULL == (*env)->ExceptionOccurred (env) )
+#else  /* 0 */
+#define HIDE_OLD_TROUBLE(env)					\
+   jthrowable savedTrouble = (*env)->ExceptionOccurred (env);	\
+   (*env)->ExceptionClear (env);
+
+#define SHOW_OLD_TROUBLE() do 					\
+{								\
+  assert ( NULL == (*env)->ExceptionOccurred (env) )		\
+  if (savedTrouble) 						\
+    {								\
+      if ((*env)->Throw (env, savedTrouble)) 			\
+	  BADLY_BROKEN ("ReThrowing the savedTrouble failed");	\
+    }								\
+  DELETE_LOCAL_REF (env, savedTrouble);				\
+} while(0)
+
+#endif /* 0 */
+
+/* Set up the cache of jclass and jmethodID primitives we need
+   in order to throw new exceptions and rethrow exceptions.  We do this
+   independently of the other caching.  We need to have this cache set up
+   first, so that we can then report errors properly. 
+
+   If any errors while setting up the error cache, the world is BADLY_BROKEN.
+
+   May be called more than once.
+
+   Returns -1 if the cache was not initialized properly, 1 if it was.  
+*/
+static int
+setup_exception_cache (JNIEnv * env)
+{
+  static int exception_cache_initialized = 0;	/* -1 for trouble, 1 for proper
+						   init.  */
+
+  jclass lcl_class;		/* a class used for local refs */
+
+  if (exception_cache_initialized)
+    return exception_cache_initialized;
+  lcl_class = (*env)->FindClass (env, "java/lang/RuntimeException");
+  if ( ! lcl_class )
+    {
+      BADLY_BROKEN1 ("Broken Class library or VM?"
+		     "  Couldn't find java/lang/RuntimeException");
+      return exception_cache_initialized = -1;
+    }
+  /* Pin it down. */
+  runtimeException_class = (jclass) (*env)->NewGlobalRef (env, lcl_class);
+  DELETE_LOCAL_REF (env, lcl_class);
+  if (!runtimeException_class)
+    {
+      BADLY_BROKEN1 ("Serious trouble: could not turn"
+		     " java.lang.RuntimeException into a global reference");
+      return exception_cache_initialized = -1;
+    }
+
+  runtimeException_ctor = 
+    (*env)->GetMethodID (env, runtimeException_class, "<init>",
+			   "(Ljava/lang/String;Ljava/lang/Throwable;)V");
+  if ( ! runtimeException_ctor )
+    {
+      BADLY_BROKEN1 ("Serious trouble: classpath couldn't find a"
+		     " two-arg constructor for java/lang/RuntimeException");
+      return exception_cache_initialized = -1;
+    }
+
+  return exception_cache_initialized = 1;
+}
+
+
+/**********************************************************/
+/***** The main cache *************************************/
+/**********************************************************/
+
+/** This is a cache of all classes, methods, and field IDs that we use during
+   the run.  We maintain a permanent global reference to each of the classes
+   we cache, since otherwise the (local) jclass that refers to that class
+   would go out of scope and possibly be reused in further calls.
+
+   The permanent global reference also achieves the secondary goal of
+   protecting the validity of the methods and field IDs in case the classes
+   were otherwise unloaded and then later loaded again.  Obviously, this will
+   never happen to classes such as java.lang.Thread and java.lang.Object, but
+   the primary reason for maintaining permanent global refs is sitll valid.
+
+   The code in jnilink.c has a similar objective.  TODO: Consider using that
+   code instead.
+
+   --Steven Augart
+*/
+
+/* All of these are cached classes and method IDs: */
+/* java.lang.Object */
+static jclass obj_class;		/* java.lang.Object */
+static jmethodID obj_ctor;		/* no-arg Constructor for java.lang.Object */
+static jmethodID obj_notify_mth;	/* java.lang.Object.notify() */
+static jmethodID obj_notifyall_mth;	/* java.lang.Object.notifyall() */
+static jmethodID obj_wait_mth;		/* java.lang.Object.wait() */
+static jmethodID obj_wait_nanotime_mth; /* java.lang.Object.wait(JI) */
+
+/* GThreadMutex and its methods */
+static jclass mutex_class;
+static jmethodID mutex_ctor;
+static jfieldID mutex_lockForPotentialLockers_fld;
+static jfieldID mutex_potentialLockers_fld;
+
+/* java.lang.Thread and its methods*/
+static jclass thread_class;		/* java.lang.Thread */
+static jmethodID thread_current_mth;	/* Thread.currentThread() */
+static jmethodID thread_equals_mth;	/* Thread.equals() */
+static jmethodID thread_join_mth;	/* Thread.join() */
+static jmethodID thread_setPriority_mth; /* Thread.setPriority() */
+static jmethodID thread_stop_mth;	/* Thread.stop() */
+static jmethodID thread_yield_mth;	/* Thread.yield() */
+
+/* java.lang.ThreadLocal and its methods */
+static jclass threadlocal_class;	/* java.lang.ThreadLocal */
+static jmethodID threadlocal_ctor;	/* Its constructor */
+static jmethodID threadlocal_set_mth;	/* ThreadLocal.set() */
+static jmethodID threadlocal_get_mth;	/* ThreadLocal.get() */
+
+/* java.lang.Long and its methods */
+static jclass long_class;		/* java.lang.Long */
+static jmethodID long_ctor;		/* constructor for it: (J) */
+static jmethodID long_longValue_mth;	/* longValue()J */
+
+
+/* GThreadNativeMethodRunner */
+static jclass runner_class;
+static jmethodID runner_ctor;
+static jmethodID runner_threadToThreadID_mth;
+static jmethodID runner_threadIDToThread_mth;
+static jmethodID runner_deRegisterJoinable_mth;
+static jmethodID runner_start_mth;	/* Inherited Thread.start() */
+
+
+/* java.lang.InterruptedException */
+static jclass interrupted_exception_class;
+
+
+
+
+/* Returns a negative value if there was trouble during initialization.
+   Returns a positive value of the cache was initialized correctly.
+   Never returns zero. */
+static int
+setup_cache (JNIEnv * env)
+{
+  jclass lcl_class;
+  static int initialized = 0;	/* 1 means initialized, 0 means uninitialized,
+				   -1 means mis-initialized */
+
+  if (initialized)
+    return initialized;
+
+  /* make sure we can report on trouble */
+  if (setup_exception_cache (env) < 0)
+    return initialized = -1;
+
+#ifdef JNI_VERSION_1_2
+  if (HAVE_JNI_VERSION_1_2)
+    assert ( ! (*env)->ExceptionCheck (env));
+  else
+#endif
+    assert ( ! (*env)->ExceptionOccurred (env));
+
+  /* java.lang.Object and its methods */
+  lcl_class = (*env)->FindClass (env, "java/lang/Object");
+  if (!lcl_class)
+    {
+      BROKEN (env, "cannot find java.lang.Object");
+      return initialized = -1;
+    }
+
+  /* Pin it down. */
+  obj_class = (jclass) (*env)->NewGlobalRef (env, lcl_class);
+  DELETE_LOCAL_REF (env, lcl_class);
+  if (!obj_class)
+    {
+      BROKEN (env, "Cannot get a global reference to java.lang.Object");
+      return initialized = -1;
+    }
+
+  obj_ctor = (*env)->GetMethodID (env, obj_class, "<init>", "()V");
+  if (!obj_ctor)
+    {
+      BROKEN (env, "cannot find constructor for java.lang.Object");
+      return initialized = -1;
+    }
+
+  obj_notify_mth = (*env)->GetMethodID (env, obj_class, "notify", "()V");
+  if ( ! obj_notify_mth )
+    {
+      BROKEN (env, "cannot find java.lang.Object.notify()V");
+      return initialized = -1;
+    }
+
+  obj_notifyall_mth =
+    (*env)->GetMethodID (env, obj_class, "notifyAll", "()V");
+  if ( ! obj_notifyall_mth)
+    {
+      BROKEN (env, "cannot find java.lang.Object.notifyall()V");
+      return initialized = -1;
+    }
+
+  obj_wait_mth = (*env)->GetMethodID (env, obj_class, "wait", "()V");
+  if ( ! obj_wait_mth )
+    {
+      BROKEN (env, "cannot find Object.<wait()V>");
+      return initialized = -1;
+    }
+
+  obj_wait_nanotime_mth = 
+    (*env)->GetMethodID (env, obj_class, "wait", "(JI)V");
+  if ( ! obj_wait_nanotime_mth )
+    {
+      BROKEN (env, "cannot find Object.<wait(JI)V>");
+      return initialized = -1;
+    }
+
+  /* GThreadMutex and its methods */
+  lcl_class = (*env)->FindClass (env, "gnu/java/awt/peer/gtk/GThreadMutex");
+  if ( ! lcl_class)
+    {
+      BROKEN (env, "cannot find gnu.java.awt.peer.gtk.GThreadMutex");
+      return initialized = -1;
+    }
+  /* Pin it down. */
+  mutex_class = (jclass) (*env)->NewGlobalRef (env, lcl_class);
+  DELETE_LOCAL_REF (env, lcl_class);
+  if ( ! mutex_class)
+    {
+      BROKEN (env, "Cannot get a global reference to GThreadMutex");
+      return initialized = -1;
+    }
+
+  mutex_ctor = (*env)->GetMethodID (env, mutex_class, "<init>", "()V");
+  if ( ! mutex_ctor)
+    {
+      BROKEN (env, "cannot find zero-arg constructor for GThreadMutex");
+      return initialized = -1;
+    }
+
+  mutex_potentialLockers_fld = (*env)->GetFieldID
+    (env, mutex_class, "potentialLockers", "I");
+  if ( ! mutex_class )
+    {
+      BROKEN (env, "cannot find GThreadMutex.potentialLockers");
+      return initialized = -1;
+    }
+
+  if (! (mutex_lockForPotentialLockers_fld = (*env)->GetFieldID
+	 (env, mutex_class, "lockForPotentialLockers", "Ljava/lang/Object;")))
+    {
+      BROKEN (env, "cannot find GThreadMutex.lockForPotentialLockers");
+      return initialized = -1;
+    }
+
+
+  /* java.lang.Thread */
+  if (! (lcl_class = (*env)->FindClass (env, "java/lang/Thread")))
+    {
+      BROKEN (env, "cannot find java.lang.Thread");
+      return initialized = -1;
+    }
+
+  /* Pin it down. */
+  thread_class = (jclass) (*env)->NewGlobalRef (env, lcl_class);
+  DELETE_LOCAL_REF (env, lcl_class);
+  if (!thread_class)
+    {
+      BROKEN (env, "Cannot get a global reference to java.lang.Thread");
+      return initialized = -1;
+    }
+
+  thread_current_mth =
+    (*env)->GetStaticMethodID (env, thread_class, "currentThread",
+			       "()Ljava/lang/Thread;");
+  if (!thread_current_mth)
+    {
+      BROKEN (env, "cannot find Thread.currentThread() method");
+      return initialized = -1;
+    }
+
+  thread_equals_mth = 
+    (*env)->GetMethodID (env, thread_class, "equals", "(Ljava/lang/Object;)Z");
+  if (!thread_equals_mth)
+    {
+      BROKEN (env, "cannot find Thread.equals() method");
+      return initialized = -1;
+    }
+
+  thread_join_mth = (*env)->GetMethodID (env, thread_class, "join", "()V");
+  if (!thread_join_mth)
+    {
+      BROKEN (env, "cannot find Thread.join() method");
+      return initialized = -1;
+    }
+
+  thread_stop_mth = (*env)->GetMethodID (env, thread_class, "stop", "()V");
+  if ( ! thread_stop_mth )
+    {
+      BROKEN (env, "cannot find Thread.stop() method");
+      return initialized = -1;
+    }
+
+  thread_setPriority_mth = 
+    (*env)->GetMethodID (env, thread_class, "setPriority", "(I)V");
+  if ( ! thread_setPriority_mth )
+    {
+      BROKEN (env, "cannot find Thread.setPriority() method");
+      return initialized = -1;
+    }
+
+  thread_yield_mth = 
+    (*env)->GetStaticMethodID (env, thread_class, "yield", "()V");
+  if ( ! thread_yield_mth )
+    {
+      BROKEN (env, "cannot find Thread.yield() method");
+      return initialized = -1;
+    }
+
+  /* java.lang.ThreadLocal */
+  lcl_class = (*env)->FindClass (env, "java/lang/ThreadLocal");
+  if ( ! lcl_class )
+    {
+      BROKEN (env, "cannot find class java.lang.ThreadLocal");
+      return initialized = -1;
+    }
+
+  /* Pin it down. */
+  threadlocal_class = (jclass) (*env)->NewGlobalRef (env, lcl_class);
+  DELETE_LOCAL_REF (env, lcl_class);
+  if ( ! threadlocal_class )
+    {
+      BROKEN (env, "Cannot get a global reference to java.lang.ThreadLocal");
+      return initialized = -1;
+    }
+
+  threadlocal_ctor = (*env)->GetMethodID (env, threadlocal_class, 
+                                          "<init>", "()V");
+  if ( ! threadlocal_ctor )
+    {
+      BROKEN (env, "cannot find ThreadLocal.<init>()V");
+      return initialized = -1;
+    }
+  
+  threadlocal_get_mth = (*env)->GetMethodID (env, threadlocal_class,
+                                             "get", "()Ljava/lang/Object;");
+  if ( ! threadlocal_get_mth )
+    {
+      BROKEN (env, "cannot find java.lang.ThreadLocal.get()Object");
+      return initialized = -1;
+    }
+
+  threadlocal_set_mth = (*env)->GetMethodID (env, threadlocal_class,
+                                             "set", "(Ljava/lang/Object;)V");
+  if ( ! threadlocal_set_mth )
+    {
+      BROKEN (env, "cannot find ThreadLocal.set(Object)V");
+      return initialized = -1;
+    }
+
+  /* java.lang.Long */
+  lcl_class = (*env)->FindClass (env, "java/lang/Long");
+  if ( ! lcl_class )
+    {
+      BROKEN (env, "cannot find class java.lang.Long");
+      return initialized = -1;
+    }
+
+  /* Pin it down. */
+  long_class = (jclass) (*env)->NewGlobalRef (env, lcl_class);
+  DELETE_LOCAL_REF (env, lcl_class);
+  if (!long_class)
+    {
+      BROKEN (env, "Cannot get a global reference to java.lang.Long");
+      return initialized = -1;
+    }
+
+  long_ctor = (*env)->GetMethodID (env, long_class, "<init>", "(J)V");
+  if (!long_ctor)
+    {
+      BROKEN (env, "cannot find method java.lang.Long.<init>(J)V");
+      return initialized = -1;
+    }
+
+  long_longValue_mth =
+    (*env)->GetMethodID (env, long_class, "longValue", "()J");
+  if (!long_longValue_mth)
+    {
+      BROKEN (env, "cannot find method java.lang.Long.longValue()J");
+      return initialized = -1;
+    }
+
+
+  /* GThreadNativeMethodRunner */
+  lcl_class = 
+    (*env)->FindClass (env,
+                       "gnu/java/awt/peer/gtk/GThreadNativeMethodRunner");
+  if ( ! lcl_class )
+    {
+      BROKEN (env,
+	      "cannot find gnu.java.awt.peer.gtk.GThreadNativeMethodRunner");
+      return initialized = -1;
+    }
+
+  /* Pin it down. */
+  runner_class = (jclass) (*env)->NewGlobalRef (env, lcl_class);
+  DELETE_LOCAL_REF (env, lcl_class);
+  if (!runner_class)
+    {
+      BROKEN (env,
+	      "Cannot get a global reference to the class GThreadNativeMethodRunner");
+      return initialized = -1;
+    }
+
+  runner_ctor = (*env)->GetMethodID (env, runner_class, "<init>", "(JJZ)V");
+  if ( ! runner_ctor )
+    {
+      BROKEN (env,
+	      "cannot find method GThreadNativeMethodRunner.<init>(JJZ)");
+      return initialized = -1;
+    }
+      
+  runner_start_mth = (*env)->GetMethodID (env, runner_class, "start", "()V");
+  if ( ! runner_start_mth )
+    {
+      BROKEN (env, "cannot find method GThreadNativeMethodRunner.start()V");
+      return initialized = -1;
+    }
+
+
+  runner_threadToThreadID_mth = 
+    (*env)->GetStaticMethodID (env, runner_class,
+                               "threadToThreadID", "(Ljava/lang/Thread;)I");
+  if ( ! runner_threadToThreadID_mth )
+    {
+      BROKEN (env,
+	      "cannot find method GThreadNativeMethodRunner.threadToThreadID(java.lang.Thread)I");
+      return initialized = -1;
+    }
+
+
+  runner_threadIDToThread_mth = 
+    (*env)->GetStaticMethodID (env, runner_class,
+                               "threadIDToThread", "(I)Ljava/lang/Thread;");
+  if ( ! runner_threadIDToThread_mth )
+    {
+      BROKEN (env,
+	      "cannot find method GThreadNativeMethodRunner.threadIDToThread(I)java.lang.Thread");
+      return initialized = -1;
+    }
+
+
+  runner_deRegisterJoinable_mth =
+    (*env)->GetStaticMethodID (env, runner_class, "deRegisterJoinable",
+			       "(Ljava/lang/Thread;)V");
+  if (!runner_deRegisterJoinable_mth)
+    {
+      BROKEN (env,
+	      "cannot find method GThreadNativeMethodRunner.deRegisterJoinable(java.lang.Thread)V");
+      return initialized = -1;
+    }
+
+
+  /* java.lang.InterruptedException */
+  lcl_class = (*env)->FindClass (env, "java/lang/InterruptedException");
+  if ( ! lcl_class )
+    {
+      BROKEN (env, "cannot find class java.lang.InterruptedException");
+      return initialized = -1;
+    }
+
+  /* Pin it down. */
+  interrupted_exception_class = (jclass) (*env)->NewGlobalRef (env, lcl_class);
+  DELETE_LOCAL_REF (env, lcl_class);
+  if (!interrupted_exception_class)
+    {
+      BROKEN (env, "Cannot make a global reference"
+	      " to java.lang.InterruptedException");
+      return initialized = -1;
+    }
+
+#ifdef JNI_VERSION_1_2
+  if (HAVE_JNI_VERSION_1_2)
+    assert ( ! (*env)->ExceptionCheck (env));
+  else
+#endif
+    assert ( ! (*env)->ExceptionOccurred (env));
+
+
+  return initialized = 1;
+}
+
+
+
+
+
+/************************************************************************/
+/* Utilities to allocate and free java.lang.Objects			*/
+/************************************************************************/
+
+/* The condition variables are java.lang.Object objects,
+ * which this method allocates and returns a global ref.  Note that global
+ * refs must be explicitly freed (isn't C fun?).
+ */
+static jobject
+allocatePlainObject (JNIEnv * env)
+{
+  jobject lcl_obj, global_obj;
+
+  lcl_obj = (*env)->NewObject (env, obj_class, obj_ctor);
+  if (!lcl_obj)
+    {
+      BROKEN (env, "cannot allocate object");
+      return NULL;
+    }
+
+  global_obj = (*env)->NewGlobalRef (env, lcl_obj);
+  DELETE_LOCAL_REF (env, lcl_obj);
+  if (!global_obj)
+    {
+      NEW_BROKEN (env, "cannot make global ref for a new plain Java object");
+      /* Deliberate fall-through */
+    }
+
+  return global_obj;
+}
+
+/*  Frees any Java object given a global ref (isn't C fun?) */
+static void
+freeObject (JNIEnv * env, jobject obj)
+{
+  if (obj)
+    {
+      (*env)->DeleteGlobalRef (env, obj);
+      /* DeleteGlobalRef can never fail */
+    }
+}
+
+
+/************************************************************************/
+/* Utilities to allocate and free Java mutexes				*/
+/************************************************************************/
+
+/* The mutexes are gnu.java.awt.peer.gtk.GThreadMutex objects,
+ * which this method allocates and returns a global ref.  Note that global
+ * refs must be explicitly freed (isn't C fun?).
+ *
+ * Free this with freeObject()
+ */
+static jobject
+allocateMutexObject (JNIEnv * env)
+{
+  jobject lcl_obj, global_obj;
+
+  lcl_obj = (*env)->NewObject (env, mutex_class, mutex_ctor);
+  if (!lcl_obj)
+    {
+      BROKEN (env, "cannot allocate a GThreadMutex");
+      return NULL;
+    }
+
+  global_obj = (*env)->NewGlobalRef (env, lcl_obj);
+  DELETE_LOCAL_REF (env, lcl_obj);
+  if (!global_obj)
+    {
+      NEW_BROKEN (env, "cannot make global ref");
+      /* Deliberate fallthrough */
+    }
+
+  return global_obj;
+}
+
+
+/************************************************************************/
+/* Locking code				     				*/
+/************************************************************************/
+
+/* Lock a Java object */
+#define ENTER_MONITOR(env, m)			\
+    enterMonitor(env, m, G_STRINGIFY(m))
+
+/* Return -1 on failure, 0 on success. */
+static int
+enterMonitor (JNIEnv * env, jobject monitorObj, const char monName[])
+{
+  if (TRACE_MONITORS)
+    tracing ("  <MonitorEnter(%s)>", monName);
+  assert (monitorObj);
+  if ((*env)->MonitorEnter (env, monitorObj) < 0)
+    {
+      BROKEN (env, "cannot enter monitor");
+      return -1;
+    }
+  return 0;
+}
+
+
+/* Unlock a Java object */
+#define EXIT_MONITOR(env, m)			\
+    exitMonitor(env, m, G_STRINGIFY(m))
+
+static int
+exitMonitor (JNIEnv * env, jobject mutexObj, const char monName[])
+{
+  if (TRACE_MONITORS)
+    tracing (" <MonitorExit(%s)>", monName);
+  assert (mutexObj);
+  if ((*env)->MonitorExit (env, mutexObj) < 0)
+    {
+      BROKEN (env, "cannot exit monitor ");
+      return -1;
+    }
+  return 0;
+}
+
+
+/************************************************************************/
+/* Miscellaneous utilities		     				*/
+/************************************************************************/
+
+/* Get the Java Thread object that corresponds to a particular thread ID. 
+   A negative thread Id gives us a null object.
+
+   Returns a local reference. 
+*/
+static jobject
+getThreadFromThreadID (JNIEnv * env, gpointer gThreadID)
+{
+  jint threadNum = GPOINTER_TO_INT(gThreadID);
+  jobject thread;
+
+  if (threadNum < 0)
+    {
+      NEW_BROKEN (env, "getThreadFromThreadID asked to look up"
+		       " a negative thread index");
+      return NULL;
+    }
+
+  thread = (*env)->CallStaticObjectMethod
+    (env, runner_class, runner_threadIDToThread_mth, threadNum);
+
+  if (MAYBE_BROKEN (env, "cannot get Thread for threadID "))
+    return NULL;
+
+  return thread;
+}
+
+/** Return the unique threadID of THREAD.
+
+   Error handling: Return (gpointer) -1 on all failures, 
+   and propagate an exception. 
+*/
+static gpointer
+getThreadIDFromThread (JNIEnv * env, jobject thread)
+{
+  jint threadNum;
+
+  if (ENABLE_EXPENSIVE_ASSERTIONS)
+    assert ((*env)->IsInstanceOf (env, thread, thread_class));
+
+  HIDE_OLD_TROUBLE (env);
+
+  threadNum = (*env)->CallStaticIntMethod
+    (env, runner_class, runner_threadToThreadID_mth, thread);
+
+  if (MAYBE_BROKEN (env, "cannot get ThreadID for a Thread "))
+    {
+      threadNum = -1;
+      goto done;
+    }
+
+
+  SHOW_OLD_TROUBLE ();
+
+done:
+  return GINT_TO_POINTER(threadNum);
+}
+
+
+/************************************************************************/
+/* The Actual JNI functions that we pass to the function vector.	*/
+/************************************************************************/
+
+
+/************************************************************************/
+/* Mutex Functions                                                  	*/
+/************************************************************************/
+
+/*** Mutex Utilities  ****/
+struct mutexObj_cache
+{
+  jobject lockForPotentialLockersObj;	/* Lock for the potentialLockers
+					   field.  Local reference. */
+  jobject lockObj;		/* The real lock we use.  This is a GLOBAL
+				   reference and must not be freed. */
+};
+
+/* Initialize the cache of sub-locks for a particular mutex object.
+
+  -1 on error, 0 on success.  The caller is not responsible for freeing the
+   partially-populated cache in case of failure (but in practice does anyway)
+   (This actually never fails, though, since GetObjectField allegedly never
+   fails.)  
+
+   Guaranteed to leave all fields of the cache initialized, even if only to
+   zero. 
+*/
+static int
+populate_mutexObj_cache (JNIEnv * env, jobject mutexObj,
+			 struct mutexObj_cache *mcache)
+{
+  mcache->lockObj = mutexObj;	/* the mutexObj is its own lock.  */
+  assert (mcache->lockObj);
+
+  mcache->lockForPotentialLockersObj = (*env)->GetObjectField
+    (env, mutexObj, mutex_lockForPotentialLockers_fld);
+  /* GetObjectField can never fail. */
+
+  /*  Retrieving a NULL object could only happen if we somehow got a
+      a mutex object that was not properly intialized. */ 
+  assert (mcache->lockForPotentialLockersObj);
+
+  return 0;
+}
+
+
+/* Clean out the mutexObj_cache, even if it was never populated. */
+static void
+clean_mutexObj_cache (JNIEnv * env, struct mutexObj_cache *mcache)
+{
+  /* OK to pass NULL refs to DELETE_LOCAL_REF */
+  DELETE_LOCAL_REF (env, mcache->lockForPotentialLockersObj);
+  /* mcache->lockObj is a GLOBAL reference. */
+  mcache->lockObj = NULL;
+}
+
+/* -1 on failure, 0 on success.
+   The mutexObj_cache is already populated for this particular object. */
+static int
+mutexObj_lock (JNIEnv * env, jobject mutexObj, struct mutexObj_cache *mcache)
+{
+  jint potentialLockers;
+
+  if (ENTER_MONITOR (env, mcache->lockForPotentialLockersObj))
+    return -1;
+
+  assert(mutexObj);
+  potentialLockers = 
+    (*env)->GetIntField (env, mutexObj, mutex_potentialLockers_fld);
+  /* GetIntField() never fails. */
+
+  ++potentialLockers;
+
+  (*env)->SetIntField
+    (env, mutexObj, mutex_potentialLockers_fld, potentialLockers);
+
+  if (EXIT_MONITOR (env, mcache->lockForPotentialLockersObj))
+    return -1;
+
+  if (ENTER_MONITOR (env, mcache->lockObj))
+    return -1;
+
+  SHOW_OLD_TROUBLE ();
+
+  return 0;
+}
+
+/* Unlock a GMutex, once we're already in JNI and have already gotten the
+   mutexObj for it.  This skips the messages that TRACE_API_CALLS would
+   print.
+
+   Returns -1 on error, 0 on success. */
+static int
+mutexObj_unlock (JNIEnv * env, jobject mutexObj,
+		 struct mutexObj_cache *mcache)
+{
+  jint potentialLockers;
+  int ret = -1;			/* assume failure until we suceed.  */
+
+  /* Free the lock first, so that someone waiting for the lock can get it
+     ASAP. */
+  /* This is guaranteed not to block. */
+  if (EXIT_MONITOR (env, mcache->lockObj) < 0)
+    goto done;
+
+  /* Kick down potentialLockers by one.  We do this AFTER we free the lock, so
+     that we hold it no longer than necessary. */
+  if (ENTER_MONITOR (env, mcache->lockForPotentialLockersObj) < 0)
+    goto done;
+
+  potentialLockers = (*env)->GetIntField
+    (env, mutexObj, mutex_potentialLockers_fld);
+  /* GetIntField never fails */
+
+  assert (potentialLockers >= 1);
+  --potentialLockers;
+
+  (*env)->SetIntField
+    (env, mutexObj, mutex_potentialLockers_fld, potentialLockers);
+  /* Never fails, so the JNI book says. */
+
+  /* Clean up. */
+  if (EXIT_MONITOR (env, mcache->lockForPotentialLockersObj) < 0)
+    goto done;
+  ret = 0;
+
+done:
+  return ret;
+}
+
+/*** Mutex Implementations ****/
+
+/* Create a mutex, which is a java.lang.Object for us.
+   In case of failure, we'll return NULL.  Which will implicitly 
+   cause future calls to fail. */
+static GMutex *
+mutex_new_jni_impl (void)
+{
+  jobject mutexObj;
+  JNIEnv *env;
+  union env_union e;
+
+  if (TRACE_API_CALLS)
+    tracing ("mutex_new_jni_impl()");
+
+  e.jni_env = &env;
+  (*cp_gtk_the_vm)->GetEnv (cp_gtk_the_vm, e.void_env, JNI_VERSION_1_1);
+
+  if (setup_cache (env) < 0)
+    {
+      mutexObj = NULL;
+      goto done;
+    }
+
+  mutexObj = allocateMutexObject (env);
+
+done:
+  if (TRACE_API_CALLS)
+    tracing (" ==> %p \n", mutexObj);
+
+  return (GMutex *) mutexObj;
+
+}
+
+/* Lock a mutex. */
+static void
+mutex_lock_jni_impl (GMutex * mutex)
+{
+  struct mutexObj_cache mcache;
+  jobject mutexObj = (jobject) mutex;
+  JNIEnv *env;
+  union env_union e;
+
+  if (TRACE_API_CALLS)
+    tracing ("mutex_lock_jni_impl( mutexObj = %p )", mutexObj);
+
+  assert (mutexObj);
+  e.jni_env = &env;
+  (*cp_gtk_the_vm)->GetEnv (cp_gtk_the_vm, e.void_env, JNI_VERSION_1_1);
+
+  if (setup_cache (env) < 0)
+    goto done;
+
+  HIDE_OLD_TROUBLE (env);
+
+  if (populate_mutexObj_cache (env, mutexObj, &mcache) < 0)
+    goto done;
+
+  mutexObj_lock (env, mutexObj, &mcache);
+  /* No need to error check; we've already reported it in any case. */
+
+done:
+  clean_mutexObj_cache (env, &mcache);
+  if (TRACE_API_CALLS)
+    tracing (" ==> VOID \n");
+}
+
+
+/*  Try to lock a mutex.  Return TRUE if we succeed, FALSE if we fail.  
+    FALSE on error. */
+static gboolean
+mutex_trylock_jni_impl (GMutex * gmutex)
+{
+  jobject mutexObj = (jobject) gmutex;
+  jint potentialLockers;
+  gboolean ret = FALSE;
+  JNIEnv *env;
+  union env_union e;
+  struct mutexObj_cache mcache;
+
+  if (TRACE_API_CALLS)
+    tracing ("mutex_trylock_jni_impl(mutexObj=%p)", mutexObj);
+
+  assert (mutexObj);
+
+  e.jni_env = &env;
+  (*cp_gtk_the_vm)->GetEnv (cp_gtk_the_vm, e.void_env, JNI_VERSION_1_1);
+  if (setup_cache (env) < 0)
+    goto done;
+  HIDE_OLD_TROUBLE (env);
+
+  if (populate_mutexObj_cache (env, mutexObj, &mcache) < 0)
+    goto done;
+
+  if (ENTER_MONITOR (env, mcache.lockForPotentialLockersObj))
+    goto done;
+
+  potentialLockers = (*env)->GetIntField
+    (env, mutexObj, mutex_potentialLockers_fld);
+
+  assert (potentialLockers >= 0);
+
+  if (potentialLockers)
+    {
+      /* Already locked.  Clean up and leave. */
+      EXIT_MONITOR (env, mcache.lockForPotentialLockersObj);	
+      /* Ignore any error code from EXIT_MONITOR; there's nothing we could do
+	 at this level, in any case. */
+      goto done;
+    }
+
+  /* Guaranteed not to block. */
+  if (ENTER_MONITOR (env, mcache.lockObj))
+    {
+      /* Clean up the existing lock. */
+      EXIT_MONITOR (env, mcache.lockForPotentialLockersObj);	
+      /* Ignore any error code from EXIT_MONITOR; there's nothing we could do
+	 at this level, in any case. */
+      goto done;
+    }
+  
+
+  /* We have the monitor.  Record that fact. */
+  potentialLockers = 1;
+  (*env)->SetIntField
+    (env, mutexObj, mutex_potentialLockers_fld, potentialLockers);
+  /* Set*Field() never fails */
+
+  ret = TRUE;			/* We have the lock. */
+
+  /* Clean up. */
+  if (EXIT_MONITOR (env, mcache.lockForPotentialLockersObj))
+      goto done;		/* If we fail at this point, still keep the
+				   main lock.  */
+
+  SHOW_OLD_TROUBLE ();
+done:
+  clean_mutexObj_cache (env, &mcache);
+  if (TRACE_API_CALLS)
+    tracing (" ==> %s\n", ret ? "TRUE" : "FALSE");
+  return ret;
+}
+
+
+/* Unlock a mutex. */
+static void
+mutex_unlock_jni_impl (GMutex * gmutex)
+{
+  jobject mutexObj = (jobject) gmutex;
+  struct mutexObj_cache mcache;
+  JNIEnv *env;
+  union env_union e;
+
+  if (TRACE_API_CALLS)
+    tracing ("mutex_unlock_jni_impl(mutexObj=%p)", mutexObj);
+
+  e.jni_env = &env;
+  (*cp_gtk_the_vm)->GetEnv (cp_gtk_the_vm, e.void_env, JNI_VERSION_1_1);
+  if (setup_cache (env) < 0)
+    goto done;
+  HIDE_OLD_TROUBLE (env);
+
+  assert (mutexObj);
+
+  if ( populate_mutexObj_cache (env, mutexObj, &mcache) < 0)
+    goto done;
+
+  (void) mutexObj_unlock (env, mutexObj, &mcache);
+
+  SHOW_OLD_TROUBLE ();
+
+done:
+  clean_mutexObj_cache (env, &mcache);
+  if (TRACE_API_CALLS)
+    tracing (" ==> VOID\n");
+}
+
+
+
+/* Free a mutex (isn't C fun?).  OK this time for it to be NULL.  
+   No failure conditions, for a change.  */
+static void
+mutex_free_jni_impl (GMutex * mutex)
+{
+  jobject mutexObj = (jobject) mutex;
+  JNIEnv *env;
+  union env_union e;
+
+  e.jni_env = &env;
+  (*cp_gtk_the_vm)->GetEnv (cp_gtk_the_vm, e.void_env, JNI_VERSION_1_1);
+
+  if (TRACE_API_CALLS)
+    tracing ("mutex_free_jni_impl(%p)", mutexObj);
+
+  freeObject (env, mutexObj);
+
+  if (TRACE_API_CALLS)
+    tracing (" ==> VOID\n");
+}
+
+
+
+
+/************************************************************************/
+/* Condition variable code		     				*/
+/************************************************************************/
+
+/* Create a new condition variable.  This is a java.lang.Object for us. */
+static GCond *
+cond_new_jni_impl (void)
+{
+  jobject condObj;
+  JNIEnv *env;
+  union env_union e;
+
+  if (TRACE_API_CALLS)
+    tracing ("mutex_free_jni_impl()");
+
+  e.jni_env = &env;
+  (*cp_gtk_the_vm)->GetEnv (cp_gtk_the_vm, e.void_env, JNI_VERSION_1_1);
+
+  condObj = allocatePlainObject (env);
+
+  if (TRACE_API_CALLS)
+    tracing (" ==> %p\n", condObj);
+
+  return (GCond *) condObj;
+}
+
+/*  Signal on a condition variable.  This is simply calling Object.notify
+ * for us.
+ */
+static void
+cond_signal_jni_impl (GCond * gcond)
+{
+  JNIEnv *env;
+  union env_union e;
+  jobject condObj = (jobject) gcond;
+
+  if (TRACE_API_CALLS)
+    tracing ("cond_signal_jni_impl(condObj = %p)", condObj);
+
+  e.jni_env = &env;
+  (*cp_gtk_the_vm)->GetEnv (cp_gtk_the_vm, e.void_env, JNI_VERSION_1_1);
+  if (setup_cache (env) < 0)
+    goto done;
+  HIDE_OLD_TROUBLE (env);
+
+  assert (condObj);
+
+  /* Must have locked an object to call notify */
+  if (ENTER_MONITOR (env, condObj))
+    goto done;
+
+  (*env)->CallVoidMethod (env, condObj, obj_notify_mth);
+  if (MAYBE_BROKEN (env, "cannot signal mutex with Object.notify()"))
+    {
+      if (EXIT_MONITOR (env, condObj))
+	BADLY_BROKEN1 ("Failed to unlock a monitor; the VM may deadlock.");
+      goto done;
+    }
+
+  EXIT_MONITOR (env, condObj);
+
+  SHOW_OLD_TROUBLE ();
+
+done:
+  if (TRACE_API_CALLS)
+    tracing (" ==> VOID\n");
+}
+
+/*  Broadcast to all waiting on a condition variable.  This is simply 
+ * calling Object.notifyAll for us.
+ */
+static void
+cond_broadcast_jni_impl (GCond * gcond)
+{
+  jobject condObj = (jobject) gcond;
+  JNIEnv *env;
+  union env_union e;
+
+  if (TRACE_API_CALLS)
+    tracing ("cond_broadcast_jni_impl(condObj=%p)", condObj);
+
+  e.jni_env = &env;
+  (*cp_gtk_the_vm)->GetEnv (cp_gtk_the_vm, e.void_env, JNI_VERSION_1_1);
+  if (setup_cache (env) < 0)
+    goto done;
+  HIDE_OLD_TROUBLE (env);
+
+  assert (condObj);
+  /* Must have locked an object to call notifyAll */
+  if (ENTER_MONITOR (env, condObj))
+    goto done;
+
+  (*env)->CallVoidMethod (env, condObj, obj_notifyall_mth);
+  if (MAYBE_BROKEN (env, "cannot broadcast to mutex with Object.notify()"))
+    {
+      EXIT_MONITOR (env, condObj);
+      goto done;
+    }
+
+  EXIT_MONITOR (env, condObj);
+
+  SHOW_OLD_TROUBLE ();
+
+done:
+  if (TRACE_API_CALLS)
+    tracing (" ==> VOID\n");
+}
+
+
+/* Wait on a condition variable.  For us, this simply means calling
+ * Object.wait.
+ *
+ * Throws a Java exception on trouble; may leave the mutexes set arbitrarily.
+ * XXX TODO: Further improve error recovery.
+ */
+static void
+cond_wait_jni_impl (GCond * gcond, GMutex * gmutex)
+{
+  struct mutexObj_cache cache;
+  jobject condObj = (jobject) gcond;
+  jobject mutexObj = (jobject) gmutex;
+  JNIEnv *env;
+  union env_union e;
+
+  if (TRACE_API_CALLS)
+    tracing ("cond_wait_jni_impl(condObj=%p, mutexObj=%p)",
+	     condObj, mutexObj);
+
+  e.jni_env = &env;
+  (*cp_gtk_the_vm)->GetEnv (cp_gtk_the_vm, e.void_env, JNI_VERSION_1_1);
+  if (setup_cache (env) < 0)
+    goto done;
+  HIDE_OLD_TROUBLE (env);
+
+  assert (condObj);
+  assert (mutexObj);
+  /* Must have locked a Java object to call wait on it */
+  if (ENTER_MONITOR (env, condObj) < 0)
+    goto done;
+
+  /* Our atomicity is now guaranteed; we're protected by the Java monitor on
+     condObj.  Unlock the GMutex. */
+  if (mutexObj_unlock (env, mutexObj, &cache))
+    goto done;
+
+  (*env)->CallVoidMethod (env, condObj, obj_wait_mth);
+  if (MAYBE_BROKEN (env, "cannot wait on condObj"))
+    {
+      EXIT_MONITOR (env, condObj);	/* ignore err checking */
+      goto done;
+    }
+
+  /* Re-acquire the lock on the GMutex.  Do this while we're protected by the
+     Java monitor on condObj. */
+  if (mutexObj_lock (env, mutexObj, &cache))
+    goto done;
+
+  EXIT_MONITOR (env, condObj);
+
+  SHOW_OLD_TROUBLE ();
+
+done:
+  if (TRACE_API_CALLS)
+    tracing (" ==> VOID\n");
+}
+
+
+/** Wait on a condition variable until a timeout.  This is a little tricky
+ * for us.  We first call Object.wait(J) giving it the appropriate timeout
+ * value.  On return, we check whether an InterruptedException happened.  If
+ * so, that is Java-speak for wait timing out.  
+ * 
+ * We return FALSE if we timed out.  Return TRUE if the condition was
+ * signalled first, before we timed out.
+ *
+ * In case of trouble we throw a Java exception.  Whether we return FALSE or
+ * TRUE depends upon whether the condition was raised before the trouble
+ * happened. 
+ *
+ * I believe that this function goes to the proper lengths to try to unlock
+ * all of the locked mutexes and monitors, as appropriate, and that it further
+ * tries to make sure that the thrown exception is the current one, not any
+ * future cascaded one from something like a failure to unlock the monitors.
+ */
+static gboolean
+cond_timed_wait_jni_impl (GCond * gcond, GMutex * gmutex, GTimeVal * end_time)
+{
+  JNIEnv *env;
+  union env_union e;
+  jlong time_millisec;
+  jint time_nanosec;
+  jthrowable cause;
+  jobject condObj = (jobject) gcond;
+  jobject mutexObj = (jobject) gmutex;
+  gboolean condRaised = FALSE;	/*  Condition has not been raised yet. */
+  struct mutexObj_cache cache;
+  gboolean interrupted;
+
+  if (TRACE_API_CALLS)
+    {
+      tracing ("cond_timed_wait_jni_impl(cond=%p, mutex=%p,"
+	       " end_time=< sec=%lu, usec=%lu >)", condObj, mutexObj,
+	       (unsigned long) end_time->tv_sec,
+	       (unsigned long) end_time->tv_usec);
+    }
+
+
+  e.jni_env = &env;
+  (*cp_gtk_the_vm)->GetEnv (cp_gtk_the_vm, e.void_env, JNI_VERSION_1_1);
+  if (setup_cache (env) < 0)
+    goto done;
+  HIDE_OLD_TROUBLE (env);
+
+  time_millisec = end_time->tv_sec * 1000 + end_time->tv_usec / 1000;
+  time_nanosec = 1000 * (end_time->tv_usec % 1000);
+
+  /* Must have locked an object to call wait */
+  if (ENTER_MONITOR (env, condObj) < 0)
+    goto done;
+
+  if (mutexObj_unlock (env, mutexObj, &cache) < 0)
+    {
+      if (EXIT_MONITOR (env, condObj) < 0)
+	criticalMsg
+	  ("Unable to unlock an existing lock on a condition; your proram may deadlock");
+      goto done;
+    }
+
+
+  (*env)->CallVoidMethod (env, condObj, obj_wait_nanotime_mth,
+			  time_millisec, time_nanosec);
+
+  /* If there was trouble, save that fact, and the reason for the trouble.  We
+     want to respond to this condition as fast as possible. */
+  cause = (*env)->ExceptionOccurred (env);
+
+  if ( ! cause )
+    {
+      condRaised = TRUE;	/* condition was signalled */
+    }
+  else if ((*env)->IsInstanceOf (env, cause, interrupted_exception_class))
+    {
+      condRaised = FALSE;	/* Condition was not raised before timeout.
+				   (This is redundant with the initialization
+				   of condRaised above) */
+      (*env)->ExceptionClear (env);	/* Clear the InterruptedException. */
+      cause = NULL;		/* no pending cause now.  */
+    }
+  else
+    {
+      interrupted = FALSE;	/* Trouble, but not because of
+				   InterruptedException.  Assume the condition
+				   was not raised. */
+      /* Leave condRaised set to FALSE */
+    }
+
+  /* Irrespective of whether there is a pending problem to report, go ahead
+     and try to clean up.  This may end up throwing an exception that is
+     different from the one that was thrown by the call to Object.wait().
+     So we will override it with the first exception (don't want to have
+     cascading problems). */
+  if (mutexObj_lock (env, mutexObj, &cache) && !cause)
+    {
+      cause = (*env)->ExceptionOccurred (env);
+      assert (cause);
+    }
+
+  if (EXIT_MONITOR (env, condObj) && !cause)
+    {
+      cause = (*env)->ExceptionOccurred (env);
+      assert (cause);
+    }
+
+  if (cause)			/* Raise the first cause. */
+    {
+      BROKEN_CAUSE (env, cause, "error in timed wait or during its cleanup");
+      goto done;
+    }
+
+  SHOW_OLD_TROUBLE ();
+
+done:
+  if (TRACE_API_CALLS)
+    tracing (" ==> condRaised = %s\n", condRaised ? "TRUE" : "FALSE");
+  return condRaised;
+}
+
+
+/* Free a condition variable.  (isn't C fun?).  Can not fail. */
+static void
+cond_free_jni_impl (GCond * cond)
+{
+  jobject condObj = (jobject) cond;
+  JNIEnv *env;
+  union env_union e;
+
+  if (TRACE_API_CALLS)
+    tracing ("cond_free_jni_impl(condObj = %p)", condObj);
+  e.jni_env = &env;
+  (*cp_gtk_the_vm)->GetEnv (cp_gtk_the_vm, e.void_env, JNI_VERSION_1_1);
+
+  freeObject (env, condObj);
+
+  if (TRACE_API_CALLS)
+    tracing (" ==> VOID\n");
+}
+
+
+/************************************************************************/
+/* Thread-local data code		     				*/
+/************************************************************************/
+
+/* Create a new thread-local key.  We use java.lang.ThreadLocal objects
+ * for this.  This returns the pointer representation of a Java global
+ * reference. 
+ * 
+ * We will throw a Java exception and return NULL in case of failure.
+ */
+static GPrivate *
+private_new_jni_impl (GDestroyNotify notify __attribute__ ((unused)))
+{
+  JNIEnv *env;
+  union env_union e;
+  jobject lcl_key;
+  jobject global_key;
+  GPrivate *gkey = NULL;	/* Error return code */
+
+  if (TRACE_API_CALLS)
+    tracing ("private_new_jni_impl()");
+
+  e.jni_env = &env;
+  (*cp_gtk_the_vm)->GetEnv (cp_gtk_the_vm, e.void_env, JNI_VERSION_1_1);
+  if (setup_cache (env) < 0)
+    goto done;
+  HIDE_OLD_TROUBLE (env);
+
+  lcl_key = (*env)->NewObject (env, threadlocal_class, threadlocal_ctor);
+  if ( ! lcl_key )
+    {
+      BROKEN (env, "cannot allocate a ThreadLocal");
+      goto done;
+    }
+
+  global_key = ((*env)->NewGlobalRef (env, lcl_key));
+  DELETE_LOCAL_REF (env, lcl_key);
+  if ( ! global_key)
+    {
+      NEW_BROKEN (env, "cannot create a GlobalRef to a new ThreadLocal");
+      goto done;
+    }
+
+  gkey = (GPrivate *) global_key;
+  SHOW_OLD_TROUBLE ();
+
+done:
+  if (TRACE_API_CALLS)
+    tracing (" ==> %p\n", (void *) gkey);
+
+  return gkey;
+}
+
+/*  Get this thread's value for a thread-local key.  This is simply
+ * ThreadLocal.get for us.  Return NULL if no value.  (I can't think of
+ * anything else to do.)
+ */
+static gpointer
+private_get_jni_impl (GPrivate * gkey)
+{
+  JNIEnv *env;
+  union env_union e;
+  jobject val_wrapper;
+  jobject keyObj = (jobject) gkey;
+  gpointer thread_specific_data = NULL;	/* Init to the error-return value */
+
+  jlong val;
+
+  if (TRACE_API_CALLS)
+    tracing ("private_get_jni_impl(keyObj=%p)", keyObj);
+
+  e.jni_env = &env;
+  (*cp_gtk_the_vm)->GetEnv (cp_gtk_the_vm, e.void_env, JNI_VERSION_1_1);
+  if (setup_cache (env) < 0)
+    goto done;
+  HIDE_OLD_TROUBLE (env);
+
+  val_wrapper = (*env)->CallObjectMethod (env, keyObj, threadlocal_get_mth);
+  if (MAYBE_BROKEN (env, "cannot find thread-local object"))
+    goto done;
+
+  if (! val_wrapper ) 
+    {
+      /* It's Java's "null" object.  No ref found.  This is OK; we must never
+         have set a value in this thread.  Note that this next statement is
+         not necessary, strictly speaking, since we're already initialized to
+         NULL.  A good optimizing C compiler will detect that and optimize out
+         this statement. */
+      thread_specific_data = NULL;
+      goto done;
+    }
+
+  val = (*env)->CallLongMethod (env, val_wrapper, long_longValue_mth);
+
+  if (MAYBE_BROKEN (env, "cannot get thread local value"))
+    goto done;
+
+  thread_specific_data = (gpointer) (intptr_t) val;
+
+  /* Only re-raise the old pending exception if a new one hasn't come along to
+     supersede it.  */
+  SHOW_OLD_TROUBLE ();
+
+done:
+
+  if (TRACE_API_CALLS)
+    tracing (" ==> %p\n", thread_specific_data);
+
+  return thread_specific_data;
+}
+
+/* Set this thread's value for a thread-local key.  This is simply
+ * ThreadLocal.set() for us.
+ */
+static void
+private_set_jni_impl (GPrivate * gkey, gpointer thread_specific_data)
+{
+  JNIEnv *env;
+  union env_union e;
+  jobject val_wrapper;
+  jobject keyObj = (jobject) gkey;
+
+
+  if (TRACE_API_CALLS)
+    tracing ("private_set_jni_impl(keyObj=%p, thread_specific_data=%p)",
+	     keyObj, thread_specific_data);
+
+  e.jni_env = &env;
+  (*cp_gtk_the_vm)->GetEnv (cp_gtk_the_vm, e.void_env, JNI_VERSION_1_1);
+  if (setup_cache (env) < 0)
+    goto done;
+  HIDE_OLD_TROUBLE (env);
+
+  /* We are just going to always use a Java long to represent a C pointer.
+     Otherwise all of the code would end up being conditionalized for various
+     pointer sizes, and that seems like too much of a hassle, in order to save
+     a paltry few bytes, especially given the horrendous overhead of JNI in
+     any case. 
+   */
+
+  val_wrapper = (*env)->NewObject (env, long_class, long_ctor,
+				   (jlong) (intptr_t) thread_specific_data);
+  if ( ! val_wrapper )
+    {
+      BROKEN (env, "cannot create a java.lang.Long");
+      goto done;
+    }
+
+  /* At this point, we now have set lcl_obj as a numeric class that wraps
+     around the thread-specific data we were given. */
+  (*env)->CallVoidMethod (env, keyObj, threadlocal_set_mth, val_wrapper);
+  if (MAYBE_BROKEN (env, "cannot set thread local value"))
+    goto done;
+
+  SHOW_OLD_TROUBLE ();
+done:
+  if (TRACE_API_CALLS)
+    tracing (" ==> VOID\n");
+}
+
+
+/** Create an object of type gnu.java.awt.peer.gtk.GThreadNativeMethodRunner.
+    Run it.
+
+    We need to create joinable threads.  We handle the notion of a joinable
+    thread by determining whether or not we are going to maintain a permanent
+    hard reference to it until it croaks.
+
+    Posix does not appear to have a Java-like concept of daemon threads, where
+    the JVM will exit when there are only daemon threads running.
+
+    Error handling: 
+
+    To quote from the glib guide:
+       "GError should only be used to report recoverable runtime errors, never
+        to report programming errors."   
+
+    So how do we consider the failure to create a thread?  Well, each of the
+    failure cases in this function are discussed, and none of them are really
+    recoverable.
+
+    The glib library is really designed so that you should fail
+    catastrophically in case of "programming errors".  The only error defined
+    for the GThread functions is G_THREAD_ERROR_AGAIN, and that for
+    thread_create.
+
+    Most of these GThread functions could fail if we run out of memory, for
+    example, but the only one capable of reporting that fact is
+    thread_create. */
+static void
+thread_create_jni_impl (GThreadFunc	    func,
+			gpointer            data,
+			gulong              stack_size __attribute__((unused)),
+			gboolean            joinable,
+			gboolean            bound __attribute__((unused)),
+			GThreadPriority     gpriority,
+			/* This prototype is horrible.  threadIDp is actually
+			   a gpointer to the thread's thread-ID.  Which is, 
+			   of course, itself a gpointer-typed value.  Ouch. */ 
+			gpointer            threadIDp, 
+			/* Do not touch the GError stuff unless you have
+			   RECOVERABLE trouble.   There is no recoverable
+			   trouble in this implementation.  */ 
+			GError	      **errorp __attribute__((unused)))
+{
+  JNIEnv *env;
+  union env_union e;
+  union func_union f;
+  jboolean jjoinable = joinable;
+  jobject newThreadObj;
+  gpointer threadID;		/* to be filled in */
+
+  if (TRACE_API_CALLS)
+    {
+      f.g_func = func;
+      tracing ("thread_create_jni_impl(func=%p, data=%p, joinable=%s,"
+               " threadIDp=%p, *(int *) threadIDp = %d)",
+               f.void_func, data, joinable ? "TRUE" : "FALSE",
+               threadIDp, *(int *) threadIDp);
+    }
+
+  e.jni_env = &env;
+  (*cp_gtk_the_vm)->GetEnv (cp_gtk_the_vm, e.void_env, JNI_VERSION_1_1);
+  if (setup_cache (env) < 0)
+    {
+      /*  The failed call to setup the cache is certainly not recoverable;
+	  not appropriate for G_THREAD_ERROR_AGAIN.  */
+      *(gpointer *) threadIDp = NULL;
+      goto done;
+    }
+  HIDE_OLD_TROUBLE (env);
+
+  /* If a thread is joinable, then notify its constructor.  The constructor
+     will enter a hard reference for it, and the hard ref. won't go away until
+     the thread has been joined. */
+  newThreadObj = 
+    (*env)->NewObject (env, runner_class, runner_ctor, 
+                       (jlong) (intptr_t) func, (jlong) (intptr_t) data, 
+                       jjoinable);
+  if ( ! newThreadObj )
+    {
+      BROKEN (env, "creating a new thread failed in the constructor");
+      *(gpointer *) threadIDp = NULL;
+      /*  The failed call to the constructor does not throw any errors such
+	  that G_THREAD_ERROR_AGAIN is appropriate.  No other recoverable
+	  errors defined.  Once again, we go back to the VM. */
+      goto done;
+    }
+
+  if (threadObj_set_priority (env, newThreadObj, gpriority) < 0)
+    {
+      *(gpointer *) threadIDp = NULL;
+      /* None of these possible exceptions from Thread.setPriority() are
+	 recoverable, so they are not appropriate for EAGAIN.  So we should
+	 fail. */  
+      goto done;
+    }
+
+  (*env)->CallVoidMethod (env, runner_class, runner_start_mth);
+
+  if (MAYBE_BROKEN (env, "starting a new thread failed"))
+    {
+      *(gpointer *) threadIDp = NULL;
+      /* The only exception Thread.start() throws is
+	 IllegalStateException.  And that would indicate a programming error. 
+
+	 So there are no situations such that G_THREAD_ERROR_AGAIN would be
+	 OK. 
+
+	 So, we don't use g_set_error() here to perform any error reporting.
+	 */
+      goto done;
+    }
+
+  threadID = getThreadIDFromThread (env, newThreadObj);
+
+  *(gpointer *) threadIDp = threadID;
+  SHOW_OLD_TROUBLE ();
+
+done:
+  if (TRACE_API_CALLS)
+    tracing (" ==> (threadID = %p) \n", threadID);
+}
+
+
+/* Wraps a call to g_thread_yield. */
+static void
+thread_yield_jni_impl (void)
+{
+  JNIEnv *env;
+  union env_union e;
+
+  if (TRACE_API_CALLS)
+    tracing ("thread_yield_jni_impl()");
+
+  e.jni_env = &env;
+  (*cp_gtk_the_vm)->GetEnv (cp_gtk_the_vm, e.void_env, JNI_VERSION_1_1);
+  if (setup_cache (env) < 0)
+    goto done;
+  HIDE_OLD_TROUBLE (env);
+
+  (*env)->CallStaticVoidMethod (env, thread_class, thread_yield_mth);
+  if (MAYBE_BROKEN (env, "Thread.yield() failed"))
+    goto done;
+
+  SHOW_OLD_TROUBLE ();
+
+done:
+  if (TRACE_API_CALLS)
+    tracing (" ==> VOID\n");
+}
+
+
+static void
+thread_join_jni_impl (gpointer threadID)
+{
+  JNIEnv *env;
+  union env_union e;
+  jobject threadObj = NULL;
+
+  if ( TRACE_API_CALLS )
+    tracing ("thread_join_jni_impl(threadID=%p) ", threadID);
+
+  e.jni_env = &env;
+  (*cp_gtk_the_vm)->GetEnv (cp_gtk_the_vm, e.void_env, JNI_VERSION_1_1);
+  if (setup_cache (env) < 0)
+    goto done;
+  HIDE_OLD_TROUBLE (env);
+
+  threadObj = getThreadFromThreadID (env, threadID);
+  if ( ! threadObj )		/* Already reported with BROKEN  */
+    goto done;
+
+  (*env)->CallVoidMethod (env, threadObj, thread_join_mth);
+  if (MAYBE_BROKEN (env, "Thread.join() failed"))
+    goto done;
+
+
+  (*env)->CallStaticVoidMethod
+    (env, runner_class, runner_deRegisterJoinable_mth, threadObj);
+  if (MAYBE_BROKEN (env, "Thread.deRegisterJoinableThread() failed"))
+    goto done;
+
+  SHOW_OLD_TROUBLE ();
+
+done:
+  DELETE_LOCAL_REF (env, threadObj);
+  if (TRACE_API_CALLS)
+    tracing (" ==> VOID \n");
+}
+
+/* Terminate the current thread.  Unlike pthread_exit(), here we do not need
+   to bother with a return value or exit value for the thread which is about
+   to croak.  (The gthreads abstraction doesn't use it.)  However, we *do*
+   need to bail immediately.  We handle this with Thread.stop(), which is
+   a deprecated method.
+
+   It's deprecated since we might leave objects protected by monitors in
+   half-constructed states on the way out -- Thread.stop() throws a
+   ThreadDeath exception, which is usually unchecked.  There is no good
+   solution that I can see. */ 
+static void
+thread_exit_jni_impl (void)
+{
+  JNIEnv *env;
+  union env_union e;
+  jobject this_thread;
+
+  if (TRACE_API_CALLS)
+    tracing ("thread_exit_jni_impl() ");
+
+  e.jni_env = &env;
+  (*cp_gtk_the_vm)->GetEnv (cp_gtk_the_vm, e.void_env, JNI_VERSION_1_1);
+  if (setup_cache (env) < 0)
+    goto done;
+
+  HIDE_OLD_TROUBLE (env);
+
+  this_thread = (*env)->
+    CallStaticObjectMethod (env, thread_class, thread_current_mth);
+
+  if ( ! this_thread )
+    {
+      BROKEN (env, "cannot get current thread");
+      goto done;
+    }
+
+  (*env)->CallVoidMethod (env, this_thread, thread_stop_mth);
+  if (MAYBE_BROKEN (env, "cannot call Thread.stop() on current thread"))
+    goto done;
+
+  SHOW_OLD_TROUBLE ();
+
+done:
+  if (TRACE_API_CALLS)
+    tracing (" ==> VOID \n");
+}
+
+
+/* Translate a GThreadPriority to a Java priority level. */
+static jint
+javaPriorityLevel (GThreadPriority priority)
+{
+  /* We have these fields in java.lang.Thread to play with:
+
+     static int MIN_PRIORITY     The minimum priority that a thread can have.
+     static int NORM_PRIORITY    The default priority that is assigned to a 
+     thread.
+     static int MAX_PRIORITY     The maximum priority that a thread can have.
+
+     We get these from the header file generated by javah, even though they're
+     documented as being 1, 5, and 10.
+   */
+  static const jint minJPri	= 
+    gnu_java_awt_peer_gtk_GThreadNativeMethodRunner_MIN_PRIORITY;
+  static const jint normJPri	= 
+    gnu_java_awt_peer_gtk_GThreadNativeMethodRunner_NORM_PRIORITY;
+  static const jint maxJPri	= 
+    gnu_java_awt_peer_gtk_GThreadNativeMethodRunner_MAX_PRIORITY;
+
+  switch (priority)
+    {
+    case G_THREAD_PRIORITY_LOW:
+      return minJPri;
+      break;
+
+    default:
+      assert_not_reached ();
+      /* Deliberate fall-through if assertions are turned off; also shuts up
+         GCC warnings if they're turned on.   */
+    case G_THREAD_PRIORITY_NORMAL:
+      return normJPri;
+      break;
+
+    case G_THREAD_PRIORITY_HIGH:
+      return (normJPri + maxJPri) / 2;
+      break;
+
+    case G_THREAD_PRIORITY_URGENT:
+      return maxJPri;
+      break;
+    }
+}
+
+
+/** It would be safe not to implement this, according to the JNI docs, since
+    not all platforms do thread priorities.  However, we might as well
+    provide the hint for those who want it. 
+*/
+static void
+thread_set_priority_jni_impl (gpointer gThreadID, GThreadPriority gpriority)
+{
+  jobject threadObj = NULL;
+  JNIEnv *env;
+  union env_union e;
+
+  if (TRACE_API_CALLS)
+    tracing ("thread_set_priority_jni_impl(gThreadID=%p, gpriority = %u) ",
+	     gThreadID, gpriority);
+
+  e.jni_env = &env;
+  (*cp_gtk_the_vm)->GetEnv (cp_gtk_the_vm, e.void_env, JNI_VERSION_1_1);
+
+  if (setup_cache (env) < 0)
+    goto done;
+
+  HIDE_OLD_TROUBLE (env);
+
+
+  threadObj = getThreadFromThreadID (env, gThreadID);
+  if ( ! threadObj)		/* Reported with BROKEN already.  */
+    goto done;
+
+  if (threadObj_set_priority (env, threadObj, gpriority))
+    goto done;
+
+  SHOW_OLD_TROUBLE ();
+
+done:
+  DELETE_LOCAL_REF (env, threadObj);
+
+  if (TRACE_API_CALLS)
+    tracing (" ==> VOID\n");
+}
+
+
+/** It would be safe not to implement this, according to the JNI docs, since
+    not all platforms do thread priorities.  However, we might as well
+    provide the hint for those who want it.
+
+    -1 on failure, 0 on success. */
+static int
+threadObj_set_priority (JNIEnv * env, jobject threadObj,
+			GThreadPriority gpriority)
+{
+  jint javaPriority = javaPriorityLevel (gpriority);
+  (*env)->CallVoidMethod (env, threadObj, thread_setPriority_mth,
+			  javaPriority);
+  return MAYBE_BROKEN (env, "Thread.setPriority() failed");
+}
+
+
+/** Return the result of Thread.currentThread(), a static method. */
+static void
+thread_self_jni_impl (/* Another confusing glib prototype.  This is
+			 actually  a gpointer to the thread's thread-ID.
+			 Which is, of course, a gpointer. */
+		      gpointer my_thread_IDp)
+{
+  JNIEnv *env;
+  union env_union e;
+  jobject this_thread;
+  gpointer my_threadID;
+
+  if (TRACE_API_CALLS)
+    tracing ("thread_self_jni_impl(my_thread_IDp=%p)", my_thread_IDp);
+
+  e.jni_env = &env;
+  (*cp_gtk_the_vm)->GetEnv (cp_gtk_the_vm, e.void_env, JNI_VERSION_1_1);
+
+  if (setup_cache (env) < 0)
+    return;
+
+  HIDE_OLD_TROUBLE (env);
+
+  this_thread = (*env)->
+    CallStaticObjectMethod (env, thread_class, thread_current_mth);
+  if (! this_thread )
+    {
+      BROKEN (env, "cannot get current thread");
+      my_threadID = NULL;
+      goto done;
+    }
+
+  my_threadID = getThreadIDFromThread (env, this_thread);
+  SHOW_OLD_TROUBLE ();
+
+done:
+  if (TRACE_API_CALLS)
+    tracing (" ==> (my_threadID = %p) \n", my_threadID);
+
+  *(gpointer *) my_thread_IDp = my_threadID;
+}
+
+
+static gboolean
+thread_equal_jni_impl (gpointer thread1, gpointer thread2)
+{
+  JNIEnv *env;
+  union env_union e;
+
+  gpointer threadID1 = *(gpointer *) thread1;
+  gpointer threadID2 = *(gpointer *) thread2;
+
+  jobject thread1_obj = NULL;
+  jobject thread2_obj = NULL;
+  gboolean ret;
+
+  if (TRACE_API_CALLS)
+    tracing ("thread_equal_jni_impl(threadID1=%p, threadID2=%p)",
+	     threadID1, threadID2);
+
+  e.jni_env = &env;
+  (*cp_gtk_the_vm)->GetEnv (cp_gtk_the_vm, e.void_env, JNI_VERSION_1_1);
+  if (setup_cache (env) < 0)
+    {
+      ret = FALSE;		/* what is safer?  We really don't ever want
+				   to return from here.  */
+      goto done;
+    }
+
+  HIDE_OLD_TROUBLE (env);
+  thread1_obj = getThreadFromThreadID (env, threadID1);
+  thread2_obj = getThreadFromThreadID (env, threadID2);
+
+  ret = (*env)->CallBooleanMethod (env, thread1_obj,
+				   thread_equals_mth, thread2_obj);
+
+  if (MAYBE_BROKEN (env, "Thread.equals() failed"))
+    {
+      ret = FALSE;
+      goto done;
+    }
+
+  SHOW_OLD_TROUBLE ();
+
+
+done:
+  DELETE_LOCAL_REF (env, thread1_obj);
+  DELETE_LOCAL_REF (env, thread2_obj);
+
+  if (TRACE_API_CALLS)
+    tracing (" ==> %s\n", ret ? "TRUE" : "FALSE");
+
+  return ret;
+}
+
+
+
+
+/************************************************************************/
+/* GLIB interface			     				*/
+/************************************************************************/
+
+/* set of function pointers to give to glib. */
+GThreadFunctions cp_gtk_portable_native_sync_jni_functions = {
+  mutex_new_jni_impl,		/* mutex_new */
+  mutex_lock_jni_impl,		/* mutex_lock */
+  mutex_trylock_jni_impl,	/* mutex_trylock */
+  mutex_unlock_jni_impl,	/* mutex_unlock */
+  mutex_free_jni_impl,		/* mutex_free */
+  cond_new_jni_impl,		/* cond_new */
+  cond_signal_jni_impl,		/* cond_signal */
+  cond_broadcast_jni_impl,	/* cond_broadcast */
+  cond_wait_jni_impl,		/* cond_wait */
+  cond_timed_wait_jni_impl,	/* cond_timed_wait */
+  cond_free_jni_impl,		/* cond_free */
+  private_new_jni_impl,		/* private_new */
+  private_get_jni_impl,		/* private_get */
+  private_set_jni_impl,		/* private_set */
+  thread_create_jni_impl,	/* thread_create */
+  thread_yield_jni_impl,	/* thread_yield */
+  thread_join_jni_impl,		/* thread_join */
+  thread_exit_jni_impl,		/* thread_exit */
+  thread_set_priority_jni_impl,	/* thread_set_priority */
+  thread_self_jni_impl,		/* thread_self */
+  thread_equal_jni_impl,	/* thread_equal */
+};
+
+
+/* Keep c-font-lock-extra-types in alphabetical order. */
+/* Local Variables: */
+/* c-file-style: "gnu" */
+/* c-font-lock-extra-types: ("\\sw+_t" "gboolean" "GError" "gpointer"
+   "GPrivate" "GThreadFunc" "GThreadFunctions" "GThreadPriority" 
+   "gulong" 
+   "JNIEnv" 
+   "jboolean" "jclass" "jfieldID" "jint" "jlong" "jmethodID" "jobject" "jstring" "jthrowable" ) */
+/* End: */

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gthread-jni.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gthread-jni.h?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gthread-jni.h (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gthread-jni.h Thu Nov  8 16:56:19 2007
@@ -0,0 +1,48 @@
+/* gthread-jni.h
+   Copyright (C) 1998, 2002 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#ifndef __GTHREADJNI_H__
+#define __GTHREADJNI_H__
+
+#include <jni.h>
+#include <glib.h>
+#include "gtkpeer.h"
+
+extern GThreadFunctions cp_gtk_portable_native_sync_jni_functions;
+extern JavaVM *cp_gtk_the_vm;
+
+#endif /* __GTHREADJNI_H__ */

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gtk_jawt.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gtk_jawt.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gtk_jawt.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gtk_jawt.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,168 @@
+/* gtk_jawt.c -- GTK implementation of classpath_jawt.h
+   Copyright (C) 2005 Free Software Foundation, Inc.
+
+   This file is part of GNU Classpath.
+
+   GNU Classpath is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   GNU Classpath is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with GNU Classpath; see the file COPYING.  If not, write to the
+   Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+   02110-1301 USA.
+
+   Linking this library statically or dynamically with other modules is
+   making a combined work based on this library.  Thus, the terms and
+   conditions of the GNU General Public License cover the whole
+   combination.
+
+   As a special exception, the copyright holders of this library give you
+   permission to link this library with independent modules to produce an
+   executable, regardless of the license terms of these independent
+   modules, and to copy and distribute the resulting executable under
+   terms of your choice, provided that you also meet, for each linked
+   independent module, the terms and conditions of the license of that
+   module.  An independent module is a module which is not derived from
+   or based on this library.  If you modify this library, you may extend
+   this exception to your version of the library, but you are not
+   obligated to do so.  If you do not wish to do so, delete this
+   exception statement from your version. */
+
+
+#include "gtkpeer.h"
+#include <gtk/gtk.h>
+#include <gdk/gdkx.h>
+#include "classpath_jawt.h"
+
+jint
+classpath_jawt_get_awt_version ()
+{
+  return CLASSPATH_JAWT_VERSION;
+}
+
+/* Does not require locking: meant to be called after the drawing
+   surface is locked. */
+Display*
+classpath_jawt_get_default_display (JNIEnv* env, jobject canvas)
+{
+  GdkDisplay *display;
+  Display *xdisplay;
+  GtkWidget *widget;
+  void *ptr;
+  jobject peer;
+  jclass class_id;
+  jmethodID method_id;
+
+  /* retrieve peer object */
+  class_id = (*env)->GetObjectClass (env, canvas);
+
+  method_id = (*env)->GetMethodID (env, class_id,
+				   "getPeer",
+				   "()Ljava/awt/peer/ComponentPeer;");
+
+  peer = (*env)->CallObjectMethod (env, canvas, method_id);
+
+  ptr = NSA_GET_PTR (env, peer);
+
+  widget = GTK_WIDGET (ptr);
+
+  if (GTK_WIDGET_REALIZED (widget))
+    {
+      display = gtk_widget_get_display (widget);
+
+      xdisplay = GDK_DISPLAY_XDISPLAY (display);
+
+      return xdisplay;
+    }
+  else
+    return NULL;
+}
+
+/* Does not require locking: meant to be called after the drawing
+   surface is locked. */
+VisualID
+classpath_jawt_get_visualID (JNIEnv* env, jobject canvas)
+{
+  GtkWidget *widget;
+  Visual *visual;
+  void *ptr;
+  jobject peer;
+  jclass class_id;
+  jmethodID method_id;
+
+  class_id = (*env)->GetObjectClass (env, canvas);
+
+  method_id = (*env)->GetMethodID (env, class_id,
+				   "getPeer",
+				   "()Ljava/awt/peer/ComponentPeer;");
+
+  peer = (*env)->CallObjectMethod (env, canvas, method_id);
+
+  ptr = NSA_GET_PTR (env, peer);
+
+  widget = GTK_WIDGET (ptr);
+
+  if (GTK_WIDGET_REALIZED (widget))
+    {
+      visual = gdk_x11_visual_get_xvisual (gtk_widget_get_visual (widget));
+      g_assert (visual != NULL);
+
+      return visual->visualid;
+    }
+  else
+    return (VisualID) NULL;
+}
+
+/* Does not require locking: meant to be called after the drawing
+   surface is locked. */
+Drawable
+classpath_jawt_get_drawable (JNIEnv* env, jobject canvas)
+{
+  GtkWidget *widget;
+  int drawable;
+  void *ptr;
+  jobject peer;
+  jclass class_id;
+  jmethodID method_id;
+
+  class_id = (*env)->GetObjectClass (env, canvas);
+
+  method_id = (*env)->GetMethodID (env, class_id,
+				   "getPeer",
+				   "()Ljava/awt/peer/ComponentPeer;");
+
+  peer = (*env)->CallObjectMethod (env, canvas, method_id);
+
+  ptr = NSA_GET_PTR (env, peer);
+
+  widget = GTK_WIDGET (ptr);
+
+  if (GTK_WIDGET_REALIZED (widget))
+    {
+      drawable = GDK_DRAWABLE_XID (widget->window);
+
+      return drawable;
+    }
+  else
+    return (Drawable) NULL;
+}
+
+jint
+classpath_jawt_lock ()
+{
+  gdk_threads_enter ();
+  return 0;
+}
+
+void
+classpath_jawt_unlock ()
+{
+  gdk_threads_leave ();
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gtkpeer.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gtkpeer.h?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gtkpeer.h (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/gtk-peer/gtkpeer.h Thu Nov  8 16:56:19 2007
@@ -0,0 +1,237 @@
+/* gtkpeer.h -- Some global variables and #defines
+   Copyright (C) 1998, 1999, 2004, 2005, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+#include <cairo.h>
+#include <gtk/gtk.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <config.h>
+#include "native_state.h"
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+#include <jni.h>
+
+#ifndef __GTKPEER_H__
+#define __GTKPEER_H__
+
+#ifndef __GNUC__
+#define __attribute__(x) /* nothing */
+#endif
+
+extern struct state_table *cp_gtk_native_state_table;
+extern struct state_table *cp_gtk_native_global_ref_table;
+extern struct state_table *cp_gtk_native_graphics2d_state_table;
+
+#define NSA_INIT(env, clazz) \
+   do {cp_gtk_native_state_table = cp_gtk_init_state_table (env, clazz); \
+   cp_gtk_native_global_ref_table = cp_gtk_init_state_table (env, clazz);} while (0)
+
+#define NSA_GET_PTR(env, obj) \
+  cp_gtk_get_state (env, obj, cp_gtk_native_state_table)
+
+#define NSA_SET_PTR(env, obj, ptr) \
+  cp_gtk_set_state (env, obj, cp_gtk_native_state_table, (void *)ptr)
+
+#define NSA_DEL_PTR(env, obj) \
+  cp_gtk_remove_state_slot (env, obj, cp_gtk_native_state_table)
+
+#define NSA_GET_GLOBAL_REF(env, obj) \
+  cp_gtk_get_state (env, obj, cp_gtk_native_global_ref_table)
+
+#define NSA_SET_GLOBAL_REF(env, obj) \
+  do {jobject *globRefPtr; \
+    globRefPtr = (jobject *) malloc (sizeof (jobject)); \
+    *globRefPtr = (*env)->NewGlobalRef (env, obj); \
+    cp_gtk_set_state (env, obj, cp_gtk_native_global_ref_table, (void *)globRefPtr);} while (0)
+
+#define NSA_DEL_GLOBAL_REF(env, obj) \
+  do {jobject *globRefPtr = cp_gtk_get_state (env, obj, cp_gtk_native_global_ref_table); \
+    cp_gtk_remove_state_slot (env, obj, cp_gtk_native_global_ref_table); \
+    (*env)->DeleteGlobalRef (env, *globRefPtr); \
+    free (globRefPtr);} while (0)
+
+#define NSA_G2D_INIT(env, clazz) \
+  cp_gtk_native_graphics2d_state_table = cp_gtk_init_state_table (env, clazz)
+
+#define NSA_GET_G2D_PTR(env, obj) \
+  cp_gtk_get_state (env, obj, cp_gtk_native_graphics2d_state_table)
+
+#define NSA_SET_G2D_PTR(env, obj, ptr) \
+  cp_gtk_set_state (env, obj, cp_gtk_native_graphics2d_state_table, (void *)ptr)
+
+#define NSA_DEL_G2D_PTR(env, obj) \
+  cp_gtk_remove_state_slot (env, obj, cp_gtk_native_graphics2d_state_table)
+
+#define SWAPU32(w)							\
+  (((w) << 24) | (((w) & 0xff00) << 8) | (((w) >> 8) & 0xff00) | ((w) >> 24))
+
+/* New-style event masks. */
+#define AWT_BUTTON1_DOWN_MASK (1 << 10)
+#define AWT_BUTTON2_DOWN_MASK (1 << 11)
+#define AWT_BUTTON3_DOWN_MASK (1 << 12)
+
+#define AWT_SHIFT_DOWN_MASK   (1 << 6)
+#define AWT_CTRL_DOWN_MASK    (1 << 7)
+#define AWT_META_DOWN_MASK    (1 << 8)
+#define AWT_ALT_DOWN_MASK     (1 << 9)
+
+/* Old-style event masks. */
+#define AWT_BUTTON1_MASK (1 << 4)
+#define AWT_BUTTON2_MASK (1 << 3)
+#define AWT_BUTTON3_MASK (1 << 2)
+
+#define AWT_SHIFT_MASK   (1 << 0)
+#define AWT_CTRL_MASK    (1 << 1)
+#define AWT_META_MASK    (1 << 2)
+#define AWT_ALT_MASK     (1 << 3)
+
+#define AWT_ITEM_SELECTED 1
+#define AWT_ITEM_DESELECTED 2
+     
+#define AWT_KEY_TYPED    400
+#define AWT_KEY_PRESSED  401
+#define AWT_KEY_RELEASED 402
+
+#define AWT_KEY_LOCATION_UNKNOWN 0
+#define AWT_KEY_LOCATION_STANDARD 1
+#define AWT_KEY_LOCATION_LEFT 2
+#define AWT_KEY_LOCATION_RIGHT 3
+#define AWT_KEY_LOCATION_NUMPAD 4
+
+#define AWT_STYLE_PLAIN  0
+#define AWT_STYLE_BOLD   1
+#define AWT_STYLE_ITALIC 2
+
+/* Used in GtkComponentPeer and GtkWindowPeer */
+#define VK_NUMPAD0 96
+#define VK_NUMPAD1 97
+#define VK_NUMPAD2 98
+#define VK_NUMPAD3 99
+#define VK_NUMPAD4 100
+#define VK_NUMPAD5 101
+#define VK_NUMPAD6 102
+#define VK_NUMPAD7 103
+#define VK_NUMPAD8 104
+#define VK_NUMPAD9 105
+#define VK_DECIMAL 110
+
+JNIEnv *cp_gtk_gdk_env(void);
+
+/* Global variables */
+extern double cp_gtk_dpi_conversion_factor;
+extern GtkWindowGroup *cp_gtk_global_window_group;
+
+/* Shared global clipboard and selection for GtkClipboard and GtkSelection. */
+extern GtkClipboard *cp_gtk_clipboard;
+extern GtkClipboard *cp_gtk_selection;
+
+extern jobject cp_gtk_clipboard_instance;
+extern jobject cp_gtk_selection_instance;
+
+/* Standard target (strings) for GtkClipboard and GtkSelection. */
+extern jstring cp_gtk_stringTarget;
+extern jstring cp_gtk_imageTarget;
+extern jstring cp_gtk_filesTarget;
+
+/* Union used for type punning. */
+union widget_union
+{
+  void **void_widget;
+  GtkWidget **widget;
+};
+
+/* Constant conversion helpers */
+guint cp_gtk_awt_keycode_to_keysym (jint keyCode, jint keyLocation);
+jint cp_gtk_state_to_awt_mods (guint state);
+
+/* Image helpers */
+GdkPixbuf *cp_gtk_image_get_pixbuf (JNIEnv *env, jobject obj);
+
+/* Component Graphics helpers */
+void cp_gtk_grab_current_drawable(GtkWidget *widget, GdkDrawable **draw,
+				  GdkWindow **win);
+
+/* JNI initialization functions */
+void cp_gtk_button_init_jni (void);
+void cp_gtk_checkbox_init_jni (void);
+void cp_gtk_choice_init_jni (void);
+void cp_gtk_component_init_jni (void);
+void cp_gtk_filedialog_init_jni (void);
+void cp_gtk_list_init_jni (void);
+void cp_gtk_menuitem_init_jni (void);
+void cp_gtk_scrollbar_init_jni (void);
+void cp_gtk_textcomponent_init_jni (void);
+void cp_gtk_window_init_jni (void);
+
+/* Signal connection convience functions */
+void cp_gtk_component_connect_expose_signals (GObject *ptr, jobject *gref);
+void cp_gtk_component_connect_focus_signals (GObject *ptr, jobject *gref);
+void cp_gtk_component_connect_mouse_signals (GObject *ptr, jobject *gref);
+void cp_gtk_component_connect_signals (GObject *ptr, jobject *gref);
+void cp_gtk_textcomponent_connect_signals (GObject *ptr, jobject *gref);
+
+/* Debugging */
+void cp_gtk_print_current_thread (void);
+
+GdkPixmap *cp_gtk_get_pixmap( JNIEnv *env, jobject obj);
+
+#define SYNCHRONIZE_GDK 0
+
+#define DEBUG_LOCKING 0
+
+#if DEBUG_LOCKING
+#define gdk_threads_enter()                          \
+{                                                    \
+  g_print ("locking: %s, %d\n", __FILE__, __LINE__); \
+  cp_gtk_print_current_thread ();                    \
+  gdk_threads_enter ();                              \
+  g_print ("locked: %s, %d\n", __FILE__, __LINE__); \
+  cp_gtk_print_current_thread ();                    \
+}
+#define gdk_threads_leave()                            \
+{                                                      \
+  g_print ("unlocking: %s, %d\n", __FILE__, __LINE__); \
+  cp_gtk_print_current_thread ();                      \
+  gdk_threads_leave ();                                \
+  g_print ("unlocked: %s, %d\n", __FILE__, __LINE__);  \
+  cp_gtk_print_current_thread ();                      \
+}
+#endif
+
+#endif /* __GTKPEER_H */

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-io/Makefile.am
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-io/Makefile.am?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-io/Makefile.am (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-io/Makefile.am Thu Nov  8 16:56:19 2007
@@ -0,0 +1,11 @@
+nativeexeclib_LTLIBRARIES = libjavaio.la 
+
+libjavaio_la_SOURCES = 	java_io_VMFile.c \
+			java_io_VMObjectInputStream.c \
+			java_io_VMObjectStreamClass.c
+
+libjavaio_la_LIBADD = $(top_builddir)/native/jni/classpath/jcl.lo
+
+AM_LDFLAGS = @CLASSPATH_MODULE@
+AM_CPPFLAGS = @CLASSPATH_INCLUDES@
+AM_CFLAGS = @WARNING_CFLAGS@ @STRICT_WARNING_CFLAGS@ @ERROR_CFLAGS@

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-io/Makefile.in
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-io/Makefile.in?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-io/Makefile.in (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-io/Makefile.in Thu Nov  8 16:56:19 2007
@@ -0,0 +1,598 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = native/jni/java-io
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/../../config/depstand.m4 \
+	$(top_srcdir)/../../config/lead-dot.m4 \
+	$(top_srcdir)/../../config/multi.m4 \
+	$(top_srcdir)/../../libtool.m4 $(top_srcdir)/m4/acattribute.m4 \
+	$(top_srcdir)/m4/accross.m4 $(top_srcdir)/m4/acinclude.m4 \
+	$(top_srcdir)/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \
+	$(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
+	$(top_srcdir)/m4/pkg.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/include/config.h
+CONFIG_CLEAN_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+    *) f=$$p;; \
+  esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(nativeexeclibdir)"
+nativeexeclibLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(nativeexeclib_LTLIBRARIES)
+libjavaio_la_DEPENDENCIES =  \
+	$(top_builddir)/native/jni/classpath/jcl.lo
+am_libjavaio_la_OBJECTS = java_io_VMFile.lo \
+	java_io_VMObjectInputStream.lo java_io_VMObjectStreamClass.lo
+libjavaio_la_OBJECTS = $(am_libjavaio_la_OBJECTS)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \
+	$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+	$(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(libjavaio_la_SOURCES)
+DIST_SOURCES = $(libjavaio_la_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BUILD_CLASS_FILES_FALSE = @BUILD_CLASS_FILES_FALSE@
+BUILD_CLASS_FILES_TRUE = @BUILD_CLASS_FILES_TRUE@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CLASSPATH_CONVENIENCE = @CLASSPATH_CONVENIENCE@
+CLASSPATH_INCLUDES = @CLASSPATH_INCLUDES@
+CLASSPATH_MODULE = @CLASSPATH_MODULE@
+COLLECTIONS_PREFIX = @COLLECTIONS_PREFIX@
+CP = @CP@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CREATE_ALSA_LIBRARIES_FALSE = @CREATE_ALSA_LIBRARIES_FALSE@
+CREATE_ALSA_LIBRARIES_TRUE = @CREATE_ALSA_LIBRARIES_TRUE@
+CREATE_API_DOCS_FALSE = @CREATE_API_DOCS_FALSE@
+CREATE_API_DOCS_TRUE = @CREATE_API_DOCS_TRUE@
+CREATE_COLLECTIONS_FALSE = @CREATE_COLLECTIONS_FALSE@
+CREATE_COLLECTIONS_TRUE = @CREATE_COLLECTIONS_TRUE@
+CREATE_CORE_JNI_LIBRARIES_FALSE = @CREATE_CORE_JNI_LIBRARIES_FALSE@
+CREATE_CORE_JNI_LIBRARIES_TRUE = @CREATE_CORE_JNI_LIBRARIES_TRUE@
+CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
+CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
+CREATE_GCONF_PEER_LIBRARIES_FALSE = @CREATE_GCONF_PEER_LIBRARIES_FALSE@
+CREATE_GCONF_PEER_LIBRARIES_TRUE = @CREATE_GCONF_PEER_LIBRARIES_TRUE@
+CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
+CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
+CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
+CREATE_JNI_HEADERS_TRUE = @CREATE_JNI_HEADERS_TRUE@
+CREATE_JNI_LIBRARIES_FALSE = @CREATE_JNI_LIBRARIES_FALSE@
+CREATE_JNI_LIBRARIES_TRUE = @CREATE_JNI_LIBRARIES_TRUE@
+CREATE_PLUGIN_FALSE = @CREATE_PLUGIN_FALSE@
+CREATE_PLUGIN_TRUE = @CREATE_PLUGIN_TRUE@
+CREATE_QT_PEER_LIBRARIES_FALSE = @CREATE_QT_PEER_LIBRARIES_FALSE@
+CREATE_QT_PEER_LIBRARIES_TRUE = @CREATE_QT_PEER_LIBRARIES_TRUE@
+CREATE_WRAPPERS_FALSE = @CREATE_WRAPPERS_FALSE@
+CREATE_WRAPPERS_TRUE = @CREATE_WRAPPERS_TRUE@
+CREATE_XMLJ_LIBRARY_FALSE = @CREATE_XMLJ_LIBRARY_FALSE@
+CREATE_XMLJ_LIBRARY_TRUE = @CREATE_XMLJ_LIBRARY_TRUE@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DATE = @DATE@
+DEFAULT_PREFS_PEER = @DEFAULT_PREFS_PEER@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+ECJ = @ECJ@
+EGREP = @EGREP@
+ENABLE_LOCAL_SOCKETS_FALSE = @ENABLE_LOCAL_SOCKETS_FALSE@
+ENABLE_LOCAL_SOCKETS_TRUE = @ENABLE_LOCAL_SOCKETS_TRUE@
+ERROR_CFLAGS = @ERROR_CFLAGS@
+EXAMPLESDIR = @EXAMPLESDIR@
+EXEEXT = @EXEEXT@
+FASTJAR = @FASTJAR@
+FIND = @FIND@
+FOUND_CACAO_FALSE = @FOUND_CACAO_FALSE@
+FOUND_CACAO_TRUE = @FOUND_CACAO_TRUE@
+FOUND_ECJ_FALSE = @FOUND_ECJ_FALSE@
+FOUND_ECJ_TRUE = @FOUND_ECJ_TRUE@
+FOUND_GCJX_FALSE = @FOUND_GCJX_FALSE@
+FOUND_GCJX_TRUE = @FOUND_GCJX_TRUE@
+FOUND_GCJ_FALSE = @FOUND_GCJ_FALSE@
+FOUND_GCJ_TRUE = @FOUND_GCJ_TRUE@
+FOUND_JIKES_FALSE = @FOUND_JIKES_FALSE@
+FOUND_JIKES_TRUE = @FOUND_JIKES_TRUE@
+FOUND_KJC_FALSE = @FOUND_KJC_FALSE@
+FOUND_KJC_TRUE = @FOUND_KJC_TRUE@
+FREETYPE2_CFLAGS = @FREETYPE2_CFLAGS@
+FREETYPE2_LIBS = @FREETYPE2_LIBS@
+GCJ = @GCJ@
+GCJX = @GCJX@
+GCONF_CFLAGS = @GCONF_CFLAGS@
+GCONF_LIBS = @GCONF_LIBS@
+GDK_CFLAGS = @GDK_CFLAGS@
+GDK_LIBS = @GDK_LIBS@
+GJDOC = @GJDOC@
+GLIB_CFLAGS = @GLIB_CFLAGS@
+GLIB_LIBS = @GLIB_LIBS@
+GTK_CFLAGS = @GTK_CFLAGS@
+GTK_LIBS = @GTK_LIBS@
+INIT_LOAD_LIBRARY = @INIT_LOAD_LIBRARY@
+INSTALL_CLASS_FILES_FALSE = @INSTALL_CLASS_FILES_FALSE@
+INSTALL_CLASS_FILES_TRUE = @INSTALL_CLASS_FILES_TRUE@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_GLIBJ_ZIP_FALSE = @INSTALL_GLIBJ_ZIP_FALSE@
+INSTALL_GLIBJ_ZIP_TRUE = @INSTALL_GLIBJ_ZIP_TRUE@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION = @JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION@
+JAY = @JAY@
+JAY_SKELETON = @JAY_SKELETON@
+JIKES = @JIKES@
+JIKESENCODING = @JIKESENCODING@
+JIKESWARNINGS = @JIKESWARNINGS@
+KJC = @KJC@
+LDFLAGS = @LDFLAGS@
+LIBDEBUG = @LIBDEBUG@
+LIBICONV = @LIBICONV@
+LIBMAGIC = @LIBMAGIC@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBVERSION = @LIBVERSION@
+LN_S = @LN_S@
+LTLIBICONV = @LTLIBICONV@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
+MAKEINFO = @MAKEINFO@
+MKDIR = @MKDIR@
+MOC = @MOC@
+MOZILLA_CFLAGS = @MOZILLA_CFLAGS@
+MOZILLA_LIBS = @MOZILLA_LIBS@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PANGOFT2_CFLAGS = @PANGOFT2_CFLAGS@
+PANGOFT2_LIBS = @PANGOFT2_LIBS@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PATH_TO_ESCHER = @PATH_TO_ESCHER@
+PATH_TO_GLIBJ_ZIP = @PATH_TO_GLIBJ_ZIP@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PLUGIN_DIR = @PLUGIN_DIR@
+QT_CFLAGS = @QT_CFLAGS@
+QT_LIBS = @QT_LIBS@
+RANLIB = @RANLIB@
+REGEN_PARSERS_FALSE = @REGEN_PARSERS_FALSE@
+REGEN_PARSERS_TRUE = @REGEN_PARSERS_TRUE@
+REMOVE = @REMOVE@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRICT_WARNING_CFLAGS = @STRICT_WARNING_CFLAGS@
+STRIP = @STRIP@
+USER_CLASSLIB = @USER_CLASSLIB@
+USER_JAVAH = @USER_JAVAH@
+USER_SPECIFIED_CLASSLIB_FALSE = @USER_SPECIFIED_CLASSLIB_FALSE@
+USER_SPECIFIED_CLASSLIB_TRUE = @USER_SPECIFIED_CLASSLIB_TRUE@
+USER_SPECIFIED_JAVAH_FALSE = @USER_SPECIFIED_JAVAH_FALSE@
+USER_SPECIFIED_JAVAH_TRUE = @USER_SPECIFIED_JAVAH_TRUE@
+USE_ESCHER_FALSE = @USE_ESCHER_FALSE@
+USE_ESCHER_TRUE = @USE_ESCHER_TRUE@
+USE_PREBUILT_GLIBJ_ZIP_FALSE = @USE_PREBUILT_GLIBJ_ZIP_FALSE@
+USE_PREBUILT_GLIBJ_ZIP_TRUE = @USE_PREBUILT_GLIBJ_ZIP_TRUE@
+VERSION = @VERSION@
+VM_BINARY = @VM_BINARY@
+WARNING_CFLAGS = @WARNING_CFLAGS@
+XML_CFLAGS = @XML_CFLAGS@
+XML_LIBS = @XML_LIBS@
+XSLT_CFLAGS = @XSLT_CFLAGS@
+XSLT_LIBS = @XSLT_LIBS@
+XTEST_LIBS = @XTEST_LIBS@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+ZIP = @ZIP@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+default_toolkit = @default_toolkit@
+exec_prefix = @exec_prefix@
+glibjdir = @glibjdir@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+multi_basedir = @multi_basedir@
+nativeexeclibdir = @nativeexeclibdir@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+toolexeclibdir = @toolexeclibdir@
+vm_classes = @vm_classes@
+nativeexeclib_LTLIBRARIES = libjavaio.la 
+libjavaio_la_SOURCES = java_io_VMFile.c \
+			java_io_VMObjectInputStream.c \
+			java_io_VMObjectStreamClass.c
+
+libjavaio_la_LIBADD = $(top_builddir)/native/jni/classpath/jcl.lo
+AM_LDFLAGS = @CLASSPATH_MODULE@
+AM_CPPFLAGS = @CLASSPATH_INCLUDES@
+AM_CFLAGS = @WARNING_CFLAGS@ @STRICT_WARNING_CFLAGS@ @ERROR_CFLAGS@
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  native/jni/java-io/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  native/jni/java-io/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-nativeexeclibLTLIBRARIES: $(nativeexeclib_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(nativeexeclibdir)" || $(mkdir_p) "$(DESTDIR)$(nativeexeclibdir)"
+	@list='$(nativeexeclib_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) --mode=install $(nativeexeclibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(nativeexeclibdir)/$$f'"; \
+	    $(LIBTOOL) --mode=install $(nativeexeclibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(nativeexeclibdir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-nativeexeclibLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@set -x; list='$(nativeexeclib_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(nativeexeclibdir)/$$p'"; \
+	  $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(nativeexeclibdir)/$$p"; \
+	done
+
+clean-nativeexeclibLTLIBRARIES:
+	-test -z "$(nativeexeclib_LTLIBRARIES)" || rm -f $(nativeexeclib_LTLIBRARIES)
+	@list='$(nativeexeclib_LTLIBRARIES)'; for p in $$list; do \
+	  dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+	  test "$$dir" != "$$p" || dir=.; \
+	  echo "rm -f \"$${dir}/so_locations\""; \
+	  rm -f "$${dir}/so_locations"; \
+	done
+libjavaio.la: $(libjavaio_la_OBJECTS) $(libjavaio_la_DEPENDENCIES) 
+	$(LINK) -rpath $(nativeexeclibdir) $(libjavaio_la_LDFLAGS) $(libjavaio_la_OBJECTS) $(libjavaio_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/java_io_VMFile.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/java_io_VMObjectInputStream.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/java_io_VMObjectStreamClass.Plo at am__quote@
+
+.c.o:
+ at am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+ at am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(COMPILE) -c $<
+
+.c.obj:
+ at am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+ at am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+ at am__fastdepCC_TRUE@	if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+ at am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+distclean-libtool:
+	-rm -f libtool
+uninstall-info-am:
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	    $$tags $$unique; \
+	fi
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$tags $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && cd $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+	list='$(DISTFILES)'; for file in $$list; do \
+	  case $$file in \
+	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+	  esac; \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+	    dir="/$$dir"; \
+	    $(mkdir_p) "$(distdir)$$dir"; \
+	  else \
+	    dir=''; \
+	  fi; \
+	  if test -d $$d/$$file; then \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES)
+installdirs:
+	for dir in "$(DESTDIR)$(nativeexeclibdir)"; do \
+	  test -z "$$dir" || $(mkdir_p) "$$dir"; \
+	done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-nativeexeclibLTLIBRARIES \
+	mostlyclean-am
+
+distclean: distclean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+	distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am: install-nativeexeclibLTLIBRARIES
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+	mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am uninstall-nativeexeclibLTLIBRARIES
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+	clean-libtool clean-nativeexeclibLTLIBRARIES ctags distclean \
+	distclean-compile distclean-generic distclean-libtool \
+	distclean-tags distdir dvi dvi-am html html-am info info-am \
+	install install-am install-data install-data-am install-exec \
+	install-exec-am install-info install-info-am install-man \
+	install-nativeexeclibLTLIBRARIES install-strip installcheck \
+	installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-compile \
+	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+	tags uninstall uninstall-am uninstall-info-am \
+	uninstall-nativeexeclibLTLIBRARIES
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-io/java_io_VMFile.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-io/java_io_VMFile.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-io/java_io_VMFile.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-io/java_io_VMFile.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,966 @@
+/* java_io_VMFile.c - Native methods for java.io.File class
+   Copyright (C) 1998, 2004, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+ 
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+/* do not move; needed here because of some macro definitions */
+#include <config.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <jni.h>
+#include <jcl.h>
+
+#include "target_native.h"
+#ifndef WITHOUT_FILESYSTEM
+#include "target_native_file.h"
+#endif
+#include "target_native_math_int.h"
+
+#include "java_io_VMFile.h"
+
+/*************************************************************************/
+
+/*
+ * Method to create an empty file.
+ *
+ * Class:     java_io_VMFile
+ * Method:    create
+ * Signature: (Ljava/lang/String;)Z
+ */
+
+JNIEXPORT jboolean JNICALL
+Java_java_io_VMFile_create (JNIEnv * env,
+			    jclass clazz __attribute__ ((__unused__)),
+			    jstring name)
+{
+#ifndef WITHOUT_FILESYSTEM
+  const char *filename;
+  int fd;
+  int result;
+
+  filename = JCL_jstring_to_cstring (env, name);
+  if (filename == NULL)
+    {
+      return (0);
+    }
+
+  TARGET_NATIVE_FILE_OPEN_CREATE (filename, fd, result);
+  if (result != TARGET_NATIVE_OK)
+    {
+      /* XXX ??? NYI */
+      if (errno != EEXIST)
+	JCL_ThrowException (env,
+			    "java/io/IOException",
+			    TARGET_NATIVE_LAST_ERROR_STRING ());
+      JCL_free_cstring (env, name, filename);
+      return (0);
+    }
+  TARGET_NATIVE_FILE_CLOSE (fd, result);
+
+  JCL_free_cstring (env, name, filename);
+  return (1);
+#else /* not WITHOUT_FILESYSTEM */
+  return (0);
+#endif /* not WITHOUT_FILESYSTEM */
+}
+
+/*************************************************************************/
+
+/*
+ * This method checks to see if we have read permission on a file.
+ *
+ * Class:     java_io_VMFile
+ * Method:    canRead
+ * Signature: (Ljava/lang/String;)Z
+ */
+
+JNIEXPORT jboolean JNICALL
+Java_java_io_VMFile_canRead (JNIEnv * env,
+			     jobject obj __attribute__ ((__unused__)),
+			     jstring name)
+{
+#ifndef WITHOUT_FILESYSTEM
+  const char *filename;
+  int fd;
+  int result;
+
+  /* Don't use the JCL convert function because it throws an exception
+     on failure */
+  filename = (*env)->GetStringUTFChars (env, name, 0);
+  if (filename == NULL)
+    {
+      return (0);
+    }
+
+  /* The lazy man's way out.  We actually do open the file for reading
+     briefly to verify it can be done */
+  TARGET_NATIVE_FILE_OPEN_READ (filename, fd, result);
+  (*env)->ReleaseStringUTFChars (env, name, filename);
+  if (result != TARGET_NATIVE_OK)
+    {
+      return (0);
+    }
+  TARGET_NATIVE_FILE_CLOSE (fd, result);
+
+  return (1);
+#else /* not WITHOUT_FILESYSTEM */
+  return (0);
+#endif /* not WITHOUT_FILESYSTEM */
+}
+
+/*************************************************************************/
+
+/*
+ * This method checks to see if we have write permission on a file.
+ *
+ * Class:     java_io_VMFile
+ * Method:    canWrite
+ * Signature: (Ljava/lang/String;)Z
+ */
+
+JNIEXPORT jboolean JNICALL
+Java_java_io_VMFile_canWrite (JNIEnv * env,
+			      jobject obj __attribute__ ((__unused__)),
+			      jstring name)
+{
+#ifndef WITHOUT_FILESYSTEM
+  const char *filename;
+  int fd;
+  int result;
+
+  /* Don't use the JCL convert function because it throws an exception
+     on failure */
+  filename = (*env)->GetStringUTFChars (env, name, 0);
+  if (filename == NULL)
+    {
+      return (0);
+    }
+
+  /* The lazy man's way out.  We actually do open the file for writing
+     briefly to verify it can be done */
+  TARGET_NATIVE_FILE_OPEN_READWRITE (filename, fd, result);
+  (*env)->ReleaseStringUTFChars (env, name, filename);
+  if (result != TARGET_NATIVE_OK)
+    {
+      return (0);
+    }
+  TARGET_NATIVE_FILE_CLOSE (fd, result);
+
+  return (1);
+#else /* not WITHOUT_FILESYSTEM */
+  return (0);
+#endif /* not WITHOUT_FILESYSTEM */
+}
+
+/*************************************************************************/
+
+/*
+ * This method makes a file read only.
+ *
+ * Class:     java_io_VMFile
+ * Method:    setReadOnly
+ * Signature: (Ljava/lang/String;)Z
+ */
+
+JNIEXPORT jboolean JNICALL
+Java_java_io_VMFile_setReadOnly (JNIEnv * env,
+				 jobject obj __attribute__ ((__unused__)),
+				 jstring name)
+{
+#ifndef WITHOUT_FILESYSTEM
+  const char *filename;
+  int result;
+
+  /* Don't use the JCL convert function because it throws an exception
+     on failure */
+  filename = (*env)->GetStringUTFChars (env, name, 0);
+  if (filename == NULL)
+    {
+      return (0);
+    }
+
+  TARGET_NATIVE_FILE_SET_MODE_READONLY (filename, result);
+  (*env)->ReleaseStringUTFChars (env, name, filename);
+
+  return ((result == TARGET_NATIVE_OK) ? 1 : 0);
+#else /* not WITHOUT_FILESYSTEM */
+  return (0);
+#endif /* not WITHOUT_FILESYSTEM */
+}
+
+/*************************************************************************/
+
+/*
+ * This method checks to see if a file exists.
+ *
+ * Class:     java_io_VMFile
+ * Method:    exists
+ * Signature: (Ljava/lang/String;)Z
+ */
+
+JNIEXPORT jboolean JNICALL
+Java_java_io_VMFile_exists (JNIEnv * env,
+			    jobject obj __attribute__ ((__unused__)),
+			    jstring name)
+{
+#ifndef WITHOUT_FILESYSTEM
+  const char *filename;
+  int result;
+
+  /* Don't use the JCL convert function because it throws an exception
+     on failure */
+  filename = (*env)->GetStringUTFChars (env, name, 0);
+  if (filename == NULL)
+    {
+      return (0);
+    }
+
+  TARGET_NATIVE_FILE_EXISTS (filename, result);
+  (*env)->ReleaseStringUTFChars (env, name, filename);
+
+  return ((result == TARGET_NATIVE_OK) ? 1 : 0);
+#else /* not WITHOUT_FILESYSTEM */
+  return (0);
+#endif /* not WITHOUT_FILESYSTEM */
+}
+
+/*************************************************************************/
+
+/*
+ * This method checks to see if a file is a "plain" file; that is, not
+ * a directory, pipe, etc.
+ *
+ * Class:     java_io_VMFile
+ * Method:    isFile
+ * Signature: (Ljava/lang/String;)Z
+ */
+
+JNIEXPORT jboolean JNICALL
+Java_java_io_VMFile_isFile (JNIEnv * env,
+			    jobject obj __attribute__ ((__unused__)),
+			    jstring name)
+{
+#ifndef WITHOUT_FILESYSTEM
+  const char *filename;
+  int result;
+
+  /* Don't use the JCL convert function because it throws an exception
+     on failure */
+  filename = (*env)->GetStringUTFChars (env, name, 0);
+  if (filename == NULL)
+    {
+      return (0);
+    }
+
+  TARGET_NATIVE_FILE_IS_FILE (filename, result);
+  (*env)->ReleaseStringUTFChars (env, name, filename);
+
+  return ((result == TARGET_NATIVE_OK) ? 1 : 0);
+#else /* not WITHOUT_FILESYSTEM */
+  return (0);
+#endif /* not WITHOUT_FILESYSTEM */
+}
+
+/*************************************************************************/
+
+/*
+ * This method checks to see if a file is a directory or not.
+ *
+ * Class:     java_io_VMFile
+ * Method:    isDirectory
+ * Signature: (Ljava/lang/String;)Z
+ */
+
+JNIEXPORT jboolean JNICALL
+Java_java_io_VMFile_isDirectory (JNIEnv * env,
+				 jobject obj __attribute__ ((__unused__)),
+				 jstring name)
+{
+#ifndef WITHOUT_FILESYSTEM
+  const char *filename;
+  int result;
+
+  /* Don't use the JCL convert function because it throws an exception
+     on failure */
+  filename = (*env)->GetStringUTFChars (env, name, 0);
+  if (filename == NULL)
+    {
+      return (0);
+    }
+
+  TARGET_NATIVE_FILE_IS_DIRECTORY (filename, result);
+  (*env)->ReleaseStringUTFChars (env, name, filename);
+
+  return ((result == TARGET_NATIVE_OK) ? 1 : 0);
+#else /* not WITHOUT_FILESYSTEM */
+  return (0);
+#endif /* not WITHOUT_FILESYSTEM */
+}
+
+/*************************************************************************/
+
+/*
+ * This method returns the length of the file.
+ *
+ * Class:     java_io_VMFile
+ * Method:    length
+ * Signature: (Ljava/lang/String;)J
+ */
+
+JNIEXPORT jlong JNICALL
+Java_java_io_VMFile_length (JNIEnv * env,
+			    jobject obj __attribute__ ((__unused__)),
+			    jstring name)
+{
+#ifndef WITHOUT_FILESYSTEM
+  const char *filename;
+  int tmpfd;
+  jlong length;
+  int result;
+
+  /* Don't use the JCL convert function because it throws an exception
+     on failure */
+  filename = (*env)->GetStringUTFChars (env, name, 0);
+  if (filename == NULL)
+    {
+      return (TARGET_NATIVE_MATH_INT_INT64_CONST_0);
+    }
+
+  /* open file for reading, get size and close file */
+  TARGET_NATIVE_FILE_OPEN_READ (filename, tmpfd, result);
+  if (result != TARGET_NATIVE_OK)
+    {
+      return (TARGET_NATIVE_MATH_INT_INT64_CONST_0);
+    }
+  TARGET_NATIVE_FILE_SIZE (tmpfd, length, result);
+  if (result != TARGET_NATIVE_OK)
+    {
+      TARGET_NATIVE_FILE_CLOSE (tmpfd, result);
+      return (TARGET_NATIVE_MATH_INT_INT64_CONST_0);
+    }
+  TARGET_NATIVE_FILE_CLOSE (tmpfd, result);
+  (*env)->ReleaseStringUTFChars (env, name, filename);
+
+  return ((result ==
+	   TARGET_NATIVE_OK) ? length : TARGET_NATIVE_MATH_INT_INT64_CONST_0);
+#else /* not WITHOUT_FILESYSTEM */
+  return (TARGET_NATIVE_MATH_INT_INT64_CONST_0);
+#endif /* not WITHOUT_FILESYSTEM */
+}
+
+/*************************************************************************/
+
+/*
+ * This method returns the modification date of the file.
+ *
+ * Class:     java_io_VMFile
+ * Method:    lastModified
+ * Signature: (Ljava/lang/String;)J
+ */
+
+JNIEXPORT jlong JNICALL
+Java_java_io_VMFile_lastModified (JNIEnv * env,
+				  jobject obj __attribute__ ((__unused__)),
+				  jstring name)
+{
+#ifndef WITHOUT_FILESYSTEM
+  const char *filename;
+  jlong mtime;
+  int result;
+
+  /* Don't use the JCL convert function because it throws an exception
+     on failure */
+  filename = (*env)->GetStringUTFChars (env, name, 0);
+  if (filename == NULL)
+    {
+      return (TARGET_NATIVE_MATH_INT_INT64_CONST_0);
+    }
+
+  TARGET_NATIVE_FILE_GET_LAST_MODIFIED (filename, mtime, result);
+  (*env)->ReleaseStringUTFChars (env, name, filename);
+
+  return ((result ==
+	   TARGET_NATIVE_OK) ? mtime : TARGET_NATIVE_MATH_INT_INT64_CONST_0);
+#else /* not WITHOUT_FILESYSTEM */
+  return (TARGET_NATIVE_MATH_INT_INT64_CONST_0);
+#endif /* not WITHOUT_FILESYSTEM */
+}
+
+/*************************************************************************/
+
+/*
+ * This method sets the modification date of the file.
+ *
+ * Class:     java_io_VMFile
+ * Method:    setLastModified
+ * Signature: (Ljava/lang/String;J)Z
+ */
+
+JNIEXPORT jboolean JNICALL
+Java_java_io_VMFile_setLastModified (JNIEnv * env,
+				     jobject obj __attribute__ ((__unused__)),
+				     jstring name, jlong newtime)
+{
+#ifndef WITHOUT_FILESYSTEM
+  const char *filename;
+  int result;
+
+  /* Don't use the JCL convert function because it throws an exception
+     on failure */
+  filename = (*env)->GetStringUTFChars (env, name, 0);
+  if (filename == NULL)
+    {
+      return (0);
+    }
+
+  TARGET_NATIVE_FILE_SET_LAST_MODIFIED (filename, newtime, result);
+  (*env)->ReleaseStringUTFChars (env, name, filename);
+
+  return ((result == TARGET_NATIVE_OK) ? 1 : 0);
+#else /* not WITHOUT_FILESYSTEM */
+  return (0);
+#endif /* not WITHOUT_FILESYSTEM */
+}
+
+/*************************************************************************/
+
+/*
+ * This method deletes a file (actually a name for a file - additional
+ * links could exist).
+ *
+ * Class:     java_io_VMFile
+ * Method:    delete
+ * Signature: (Ljava/lang/String;)Z
+ */
+
+JNIEXPORT jboolean JNICALL
+Java_java_io_VMFile_delete (JNIEnv * env,
+			    jobject obj __attribute__ ((__unused__)),
+			    jstring name)
+{
+#ifndef WITHOUT_FILESYSTEM
+  const char *filename;
+  int result;
+
+  /* Don't use the JCL convert function because it throws an exception
+     on failure */
+  filename = (*env)->GetStringUTFChars (env, name, 0);
+  if (filename == NULL)
+    {
+      return (0);
+    }
+
+  TARGET_NATIVE_FILE_DELETE (filename, result);
+  (*env)->ReleaseStringUTFChars (env, name, filename);
+
+  return ((result == TARGET_NATIVE_OK) ? 1 : 0);
+#else /* not WITHOUT_FILESYSTEM */
+  return (0);
+#endif /* not WITHOUT_FILESYSTEM */
+}
+
+/*************************************************************************/
+
+/*
+ * This method creates a directory.
+ *
+ * Class:     java_io_VMFile
+ * Method:    mkdir
+ * Signature: (Ljava/lang/String;)Z
+ */
+
+JNIEXPORT jboolean JNICALL
+Java_java_io_VMFile_mkdir (JNIEnv * env,
+			   jobject obj __attribute__ ((__unused__)),
+			   jstring name)
+{
+#ifndef WITHOUT_FILESYSTEM
+  const char *pathname;
+  int result;
+
+  /* Don't use the JCL convert function because it throws an exception
+     on failure */
+  pathname = (*env)->GetStringUTFChars (env, name, 0);
+  if (pathname == NULL)
+    {
+      return (0);
+    }
+
+  TARGET_NATIVE_FILE_MAKE_DIR (pathname, result);
+  (*env)->ReleaseStringUTFChars (env, name, pathname);
+
+  return ((result == TARGET_NATIVE_OK) ? 1 : 0);
+#else /* not WITHOUT_FILESYSTEM */
+  return (0);
+#endif /* not WITHOUT_FILESYSTEM */
+}
+
+/*************************************************************************/
+
+/*
+ * This method renames a (link to a) file.
+ *
+ * Class:     java_io_VMFile
+ * Method:    renameTo
+ * Signature: (Ljava/lang/String;Ljava/lang/String;)Z
+ */
+
+JNIEXPORT jboolean JNICALL
+Java_java_io_VMFile_renameTo (JNIEnv * env,
+			      jobject obj __attribute__ ((__unused__)),
+			      jstring t, jstring d)
+{
+#ifndef WITHOUT_FILESYSTEM
+  const char *old_filename, *new_filename;
+  int result;
+
+  /* Don't use the JCL convert function because it throws an exception
+     on failure */
+  old_filename = (*env)->GetStringUTFChars (env, t, 0);
+  if (old_filename == NULL)
+    {
+      return (0);
+    }
+
+  new_filename = (*env)->GetStringUTFChars (env, d, 0);
+  if (new_filename == NULL)
+    {
+      (*env)->ReleaseStringUTFChars (env, t, old_filename);
+      return (0);
+    }
+
+  TARGET_NATIVE_FILE_RENAME (old_filename, new_filename, result);
+  (*env)->ReleaseStringUTFChars (env, d, new_filename);
+  (*env)->ReleaseStringUTFChars (env, t, old_filename);
+
+  return ((result == TARGET_NATIVE_OK) ? 1 : 0);
+#else /* not WITHOUT_FILESYSTEM */
+  return (0);
+#endif /* not WITHOUT_FILESYSTEM */
+}
+
+/*************************************************************************/
+
+/*
+ * This method returns an array of String representing all the files
+ * in a directory except "." and "..".
+ *
+ * Class:     java_io_VMFile
+ * Method:    list
+ * Signature: (Ljava/lang/String;)[Ljava/lang/String;
+ */
+
+JNIEXPORT jobjectArray JNICALL
+Java_java_io_VMFile_list (JNIEnv * env, jobject obj
+			  __attribute__ ((__unused__)), jstring name)
+{
+#ifndef WITHOUT_FILESYSTEM
+  const int REALLOC_SIZE = 10;
+
+  const char *dirname;
+  int result;
+  char **filelist;
+  void *handle;
+  const char *filename;
+  unsigned long int filelist_count, max_filelist_count;
+  char **tmp_filelist;
+  jclass str_clazz;
+  jobjectArray filearray;
+  unsigned long int i;
+  jstring str;
+
+  /* Don't use the JCL convert function because it throws an exception
+     on failure */
+  dirname = (*env)->GetStringUTFChars (env, name, 0);
+  if (dirname == NULL)
+    {
+      return (0);
+    }
+
+  /* open directory for reading */
+  TARGET_NATIVE_FILE_OPEN_DIR (dirname, handle, result);
+
+  (*env)->ReleaseStringUTFChars (env, name, dirname);
+
+  if (result != TARGET_NATIVE_OK)
+    {
+      return (0);
+    }
+
+  /* allocate filelist */
+  filelist = (char **) JCL_malloc (env, sizeof (char *) * REALLOC_SIZE);
+  if (filelist == NULL)
+    {
+      TARGET_NATIVE_FILE_CLOSE_DIR (handle, result);
+      return (0);
+    }
+  filelist_count = 0;
+  max_filelist_count = REALLOC_SIZE;
+
+  /* read the files from the directory */
+  TARGET_NATIVE_FILE_READ_DIR (handle, filename, result);
+  while (result == TARGET_NATIVE_OK)
+    {
+      if ((strcmp (filename, ".") != 0) && (strcmp (filename, "..") != 0))
+	{
+	  /* allocate more memory if necessary */
+	  if (filelist_count >= max_filelist_count)
+	    {
+	      tmp_filelist = (char **) JCL_realloc (env,
+						    filelist,
+						    (max_filelist_count +
+						     REALLOC_SIZE) *
+						    sizeof (char *));
+	      if (tmp_filelist == NULL)
+		{
+		  for (i = 0; i < filelist_count; i++)
+		    {
+		      JCL_free (env, filelist[i]);
+		    }
+		  JCL_free (env, filelist);
+		  TARGET_NATIVE_FILE_CLOSE_DIR (handle, result);
+		  return (0);
+		}
+	      filelist = tmp_filelist;
+	      max_filelist_count += REALLOC_SIZE;
+	    }
+
+	  /* save entry in list (avoid strdup, because it is not ANSI C, thus difficult to port) */
+	  filelist[filelist_count] =
+	    (char *) JCL_malloc (env, strlen (filename) + 1);
+	  assert (filelist[filelist_count] != NULL);
+	  strcpy (filelist[filelist_count], filename);
+	  filelist_count++;
+	}
+
+      /* read next directory entry */
+      TARGET_NATIVE_FILE_READ_DIR (handle, filename, result);
+    }
+
+  /* close directory */
+  TARGET_NATIVE_FILE_CLOSE_DIR (handle, result);
+
+  /* put the list of files into a Java String array and return it */
+  str_clazz = (*env)->FindClass (env, "java/lang/String");
+  if (str_clazz == NULL)
+    {
+      for (i = 0; i < filelist_count; i++)
+	{
+	  JCL_free (env, filelist[i]);
+	}
+      JCL_free (env, filelist);
+      return (0);
+    }
+  filearray = (*env)->NewObjectArray (env, filelist_count, str_clazz, 0);
+  if (filearray == NULL)
+    {
+      for (i = 0; i < filelist_count; i++)
+	{
+	  JCL_free (env, filelist[i]);
+	}
+      JCL_free (env, filelist);
+      return (0);
+    }
+  for (i = 0; i < filelist_count; i++)
+    {
+      /* create new string */
+      str = (*env)->NewStringUTF (env, filelist[i]);
+      if (str == NULL)
+	{
+	  /* We don't clean up everything here, but if this failed,
+	     something serious happened anyway */
+	  for (i = 0; i < filelist_count; i++)
+	    {
+	      JCL_free (env, filelist[i]);
+	    }
+	  JCL_free (env, filelist);
+	  return (0);
+	}
+
+      /* save into array */
+      (*env)->SetObjectArrayElement (env, filearray, i, str);
+
+      /* delete local reference */
+      (*env)->DeleteLocalRef (env, str);
+    }
+
+  /* free resources */
+  for (i = 0; i < filelist_count; i++)
+    {
+      JCL_free (env, filelist[i]);
+    }
+  JCL_free (env, filelist);
+
+  return (filearray);
+#else /* not WITHOUT_FILESYSTEM */
+  return (0);
+#endif /* not WITHOUT_FILESYSTEM */
+}
+
+/*************************************************************************/
+
+/*
+ * These two methods are used to maintain dynamically allocated
+ * buffers for getCanonicalPath without the overhead of calling
+ * realloc every time a buffer is modified.  Buffers are sized
+ * at the smallest multiple of CHUNKSIZ that is greater than or
+ * equal to the desired length.  The default CHUNKSIZ is 256,
+ * longer than most paths, so in most cases a getCanonicalPath
+ * will require only one malloc per buffer.
+ */
+
+#define CHUNKLOG 8
+#define CHUNKSIZ (1 << CHUNKLOG)
+
+static int
+nextChunkSize (int size)
+{
+  return ((size >> CHUNKLOG) + ((size & (CHUNKSIZ - 1)) ? 1 : 0)) << CHUNKLOG;
+}
+
+static char *
+maybeGrowBuf (JNIEnv *env, char *buf, int *size, int required)
+{
+  if (required > *size)
+    {
+      *size = nextChunkSize (required);
+      buf = JCL_realloc (env, buf, *size);
+    }
+  return buf;
+}
+
+/*************************************************************************/
+
+/*
+ * This method converts a path to canonical form on GNU/Posix systems.
+ * This involves the removal of redundant separators, references to
+ * "." and "..", and symbolic links.
+ *
+ * The conversion proceeds on a component-by-component basis: symbolic
+ * links and references to ".."  are resolved as and when they occur.
+ * This means that if "/foo/bar" is a symbolic link to "/baz" then the
+ * canonical form of "/foo/bar/.." is "/" and not "/foo".
+ *
+ * In order to mimic the behaviour of proprietary JVMs, non-existant
+ * path components are allowed (a departure from the normal GNU system
+ * convention).  This means that if "/foo/bar" is a symbolic link to
+ * "/baz", the canonical form of "/non-existant-directory/../foo/bar"
+ * is "/baz".
+ *
+ * Class:     java_io_VMFile
+ * Method:    toCanonicalForm
+ * Signature: (Ljava/lang/String)Ljava/lang/String
+ */
+
+JNIEXPORT jstring JNICALL
+Java_java_io_VMFile_toCanonicalForm (JNIEnv *env,
+				     jclass class __attribute__ ((__unused__)),
+				     jstring jpath)
+{
+#ifndef WITHOUT_FILESYSTEM
+  const char *path;
+  char *src, *dst;
+  int srci, dsti;
+  int srcl, dstl;
+  int len;
+  int fschecks;
+#if defined (HAVE_LSTAT) && defined (HAVE_READLINK)
+  struct stat sb;
+#endif /* HAVE_LSTAT && HAVE_READLINK */
+
+  path = JCL_jstring_to_cstring (env, jpath);
+  if (path == NULL)
+    return NULL;
+
+  /* It is the caller's responsibility to ensure the path is absolute. */
+  if (path[0] == 0 || path[0] != '/')
+    {
+      JCL_free_cstring (env, jpath, path);
+      JCL_ThrowException (env, "java/lang/RuntimeException", "Not absolute");
+      return NULL;
+    }
+
+  len = strlen (path);
+  srcl = nextChunkSize (len + 1);
+  src = JCL_malloc (env, srcl);
+  if (src == NULL)
+    {
+      JCL_free_cstring (env, jpath, path);
+      return NULL;
+    }
+  strcpy (src, path);
+  JCL_free_cstring (env, jpath, path);
+  srci = 1;
+
+  dstl = nextChunkSize (2);  
+  dst = JCL_malloc (env, dstl);
+  if (dst == NULL)
+    {
+      JCL_free (env, src);
+      return NULL;
+    }
+  dst[0] = '/';
+  dsti = 1;
+
+  fschecks = JNI_TRUE;
+
+  while (src[srci] != '\0')
+    {
+      int tmpi, dsti_save;
+
+      /* Skip slashes. */
+      while (src[srci] == '/')
+	srci++;
+      tmpi = srci;
+      /* Find next slash. */
+      while (src[srci] != '/' && src[srci] != '\0')
+	srci++;
+      if (srci == tmpi)
+	/* We hit the end. */
+	break;
+      len = srci - tmpi;
+
+      /* Handle "." and "..". */
+      if (len == 1 && src[tmpi] == '.')
+	continue;
+      if (len == 2 && src[tmpi] == '.' && src[tmpi + 1] == '.')
+	{
+	  while (dsti > 1 && dst[dsti - 1] != '/')
+	    dsti--;
+	  if (dsti != 1)
+	    dsti--;
+	  /* Reenable filesystem checking if disabled, as we might
+	   * have reversed over whatever caused the problem before.
+	   * At least one proprietary JVM has inconsistencies because
+	   * it does not do this.
+	   */
+	  fschecks = JNI_TRUE;
+	  continue;
+	}
+
+      /* Handle real path components. */
+      dst = maybeGrowBuf (env,
+			  dst, &dstl, dsti + (dsti > 1 ? 1 : 0) + len + 1);
+      if (dst == NULL)
+	{
+	  JCL_free (env, src);
+	  return NULL;
+	}
+      dsti_save = dsti;
+      if (dsti > 1)
+	dst[dsti++] = '/';
+      strncpy (&dst[dsti], &src[tmpi], len);
+      dsti += len;
+      if (fschecks == JNI_FALSE)
+	continue;
+
+#if defined (HAVE_LSTAT) && defined (HAVE_READLINK)
+      dst[dsti] = '\0';
+      if (lstat (dst, &sb) == 0)
+	{
+	  if (S_ISLNK (sb.st_mode))
+	    {
+	      int tmpl = CHUNKSIZ;
+	      char *tmp = JCL_malloc (env, tmpl);
+	      if (tmp == NULL)
+		{
+		  JCL_free (env, src);
+		  JCL_free (env, dst);
+		  return NULL;
+		}
+
+	      while (1)
+		{
+		  tmpi = readlink (dst, tmp, tmpl);
+		  if (tmpi < 1)
+		    {
+		      JCL_free (env, src);
+		      JCL_free (env, dst);
+		      JCL_free (env, tmp);
+		      JCL_ThrowException (env, "java/io/IOException",
+					  "readlink failed");
+		      return NULL;
+		    }
+		  if (tmpi < tmpl)
+		    break;
+		  tmpl += CHUNKSIZ;
+		  tmp = JCL_realloc (env, tmp, tmpl);
+		}
+
+	      /* Prepend the link's path to src. */
+	      tmp = maybeGrowBuf (env,
+				  tmp, &tmpl, tmpi + strlen (&src[srci]) + 1);
+	      if (tmp == NULL)
+		{
+		  JCL_free (env, src);
+		  JCL_free (env, dst);
+		  return NULL;
+		}
+
+	      strcpy (&tmp[tmpi], &src[srci]);
+	      JCL_free (env, src);
+	      src = tmp;
+	      srcl = tmpl;
+	      srci = 0;
+
+	      /* Either replace or append dst depending on whether the
+	       * link is relative or absolute.
+	       */
+	      dsti = src[0] == '/' ? 1 : dsti_save;
+	    }
+	}
+      else
+	{
+	  /* Something doesn't exist, or we don't have permission to
+	   * read it, or a previous path component is a directory, or
+	   * a symlink is looped.  Whatever, we can't check the
+	   * filesystem any more.
+	   */
+	  fschecks = JNI_FALSE;
+	}
+#endif /* HAVE_LSTAT && HAVE_READLINK */
+    }
+  dst[dsti] = '\0';
+
+  jpath = (*env)->NewStringUTF (env, dst);
+  JCL_free (env, src);
+  JCL_free (env, dst);
+  return jpath;
+#else /* not WITHOUT_FILESYSTEM */
+  return NULL;
+#endif /* not WITHOUT_FILESYSTEM */
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-io/java_io_VMObjectInputStream.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-io/java_io_VMObjectInputStream.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-io/java_io_VMObjectInputStream.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-io/java_io_VMObjectInputStream.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,69 @@
+/* java_io_VMObjectInputStream.c -- Native methods for ObjectInputStream class
+   Copyright (C) 1998, 2004, 2005  Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+ 
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+/*  TODO: check exceptions */
+/*        comments */
+
+/* do not move; needed here because of some macro definitions */
+#include <config.h>
+
+#include <jni.h>
+#include <jcl.h>
+
+#include "java_io_VMObjectInputStream.h"
+
+/*
+ * Class:     java_io_VMObjectInputStream
+ * Method:    allocateObject
+ * Signature: (Ljava/lang/Class;)Ljava/lang/Object;
+ */
+JNIEXPORT jobject JNICALL
+Java_java_io_VMObjectInputStream_allocateObject (JNIEnv * env,
+                                               jclass clazz
+					       __attribute__((__unused__)),
+					       jclass target_clazz,
+					       jclass constr_clazz,
+					       jobject constructor)
+{
+  jobject obj = (*env)->AllocObject (env, target_clazz);
+  jmethodID id = (*env)->FromReflectedMethod (env, constructor);
+
+  (*env)->CallNonvirtualVoidMethod (env, obj, constr_clazz, id);
+
+  return obj;
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-io/java_io_VMObjectStreamClass.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-io/java_io_VMObjectStreamClass.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-io/java_io_VMObjectStreamClass.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-io/java_io_VMObjectStreamClass.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,381 @@
+/* java_io_VMObjectStreamClass.c -- Native methods for VMObjectStreamClass.java
+   Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+ 
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+#include <jni.h>
+#include <jcl.h>
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "java_io_VMObjectStreamClass.h"
+
+/*
+ * Class:     java_io_VMObjectOutputStream
+ * Method:    hasClassInitializer
+ * Signature: (Ljava/lang/Class;)Z
+ */
+JNIEXPORT jboolean JNICALL
+Java_java_io_VMObjectStreamClass_hasClassInitializer (JNIEnv * env,
+						      jclass vmosklass
+						      __attribute__ ((__unused__)), jclass klass)
+{
+  jmethodID mid = (*env)->GetStaticMethodID (env, klass, "<clinit>", "()V");
+  if (mid == NULL)
+    {
+      (*env)->ExceptionClear (env);
+      return JNI_FALSE;
+    }
+  return JNI_TRUE;
+}
+
+static void
+throwInternalError (JNIEnv * env)
+{
+  jclass internalErrorClass;
+  jthrowable previousException, newException;
+  jmethodID initException, getMessageID, initCauseID;
+  jstring message;
+
+  internalErrorClass = (*env)->FindClass (env, "java/lang/InternalError");
+  /** Just give up if this also fails. */
+  if (internalErrorClass == NULL)
+    return;
+
+  previousException = (*env)->ExceptionOccurred (env);
+
+  if (previousException == NULL)
+    {
+      (*env)->ThrowNew (env, internalErrorClass,
+			"Unknown error raised by the VM");
+      return;
+    }
+
+  initException = (*env)->GetMethodID
+    (env, internalErrorClass, "<init>", "(Ljava/lang/String;)V");
+  getMessageID = (*env)->GetMethodID
+    (env, (*env)->GetObjectClass (env, previousException),
+     "getMessage", "()Ljava/lang/String;");
+  initCauseID = (*env)->GetMethodID
+    (env, internalErrorClass, "initCause", "(Ljava/lang/Throwable;)V");
+
+  message = (*env)->CallObjectMethod (env, previousException, getMessageID);
+
+  newException = (*env)->NewObject (env, internalErrorClass, initException,
+				    message);
+  (*env)->CallVoidMethod (env, newException, initCauseID, previousException);
+
+  (*env)->ExceptionClear (env);
+  (*env)->Throw (env, newException);
+}
+
+static jfieldID
+getFieldReference (JNIEnv * env, jobject field, const char *type)
+{
+  jclass classClass;
+  jclass fieldClass;
+  jclass declaringClass;
+  jclass typeClass;
+  jfieldID fid;
+  const char *field_name;
+  const char *type_name;
+  int type_len;
+  jmethodID mid;
+  jstring name;
+  jstring tname;
+  int i;
+
+  fieldClass = (*env)->GetObjectClass (env, field);
+
+  mid =
+    (*env)->GetMethodID (env, fieldClass, "getName", "()Ljava/lang/String;");
+  if (mid == NULL || (*env)->ExceptionOccurred (env) != NULL)
+    {
+      throwInternalError (env);
+      return NULL;
+    }
+
+  name = (*env)->CallObjectMethod (env, field, mid);
+  field_name = (*env)->GetStringUTFChars (env, name, NULL);
+
+  mid = (*env)->GetMethodID (env, fieldClass,
+			     "getDeclaringClass", "()Ljava/lang/Class;");
+  if (mid == NULL || (*env)->ExceptionOccurred (env) != NULL)
+    {
+      throwInternalError (env);
+      return NULL;
+    }
+
+  declaringClass = (*env)->CallObjectMethod (env, field, mid);
+
+  /* Do we need to find out the exact type descriptor of the field? */
+  if (type == NULL)
+    {
+      char *the_type;
+
+      mid = (*env)->GetMethodID (env, fieldClass,
+				 "getType", "()Ljava/lang/Class;");
+
+      if (mid == NULL || (*env)->ExceptionOccurred (env) != NULL)
+	{
+	  throwInternalError (env);
+	  return NULL;
+	}
+
+      typeClass = (*env)->CallObjectMethod (env, field, mid);
+      classClass = (*env)->FindClass (env, "java/lang/Class");
+
+      mid = (*env)->GetMethodID (env, classClass,
+				 "getName", "()Ljava/lang/String;");
+
+      if (mid == NULL || (*env)->ExceptionOccurred (env) != NULL)
+	{
+	  throwInternalError (env);
+	  return NULL;
+	}
+
+      tname = (*env)->CallObjectMethod (env, typeClass, mid);
+      type_name = (*env)->GetStringUTFChars (env, tname, NULL);
+
+      /*
+       * If it isn't an array class then the actual field type descriptor
+       * starts with 'L', ends with ';' and has '/' instead of '.'.
+       */
+      type_len = strlen ((char *) type_name);
+      if (type_name[0] != '[')
+	{
+	  /* XXX - FIXME - should not use dynamic allocation in core lib. */
+	  the_type = (char *) malloc (type_len + 3);
+	  the_type[0] = 'L';
+	  the_type[type_len + 1] = ';';
+	  the_type[type_len + 2] = '\0';
+	  the_type++;
+	}
+      else
+	{
+	  /* XXX - FIXME - should not use dynamic allocation in core lib. */
+	  the_type = (char *) malloc (type_len + 1);
+	  the_type[type_len] = '\0';
+	}
+
+      for (i = 0; i < type_len; i++)
+	if (type_name[i] == '.')
+	  the_type[i] = '/';
+	else
+	  the_type[i] = type_name[i];
+
+      if (type_name[0] != '[')
+	the_type--;
+
+      (*env)->ReleaseStringUTFChars (env, tname, type_name);
+      fid = (*env)->GetFieldID (env, declaringClass, field_name, the_type);
+      free (the_type);
+    }
+  else
+    {
+      type_len = -1;
+      fid = (*env)->GetFieldID (env, declaringClass, field_name, type);
+    }
+
+  if (fid == NULL)
+    {
+      throwInternalError (env);
+      return NULL;
+    }
+  (*env)->ReleaseStringUTFChars (env, name, field_name);
+
+  return fid;
+}
+
+/*
+ * Class:     java_io_VMObjectOutputStream
+ * Method:    setBooleanNative
+ * Signature: (Ljava/lang/reflect/Field;Ljava/lang/Object;Z)V
+ */
+JNIEXPORT void JNICALL
+Java_java_io_VMObjectStreamClass_setBooleanNative (JNIEnv * env,
+						   jclass vmosklass
+						   __attribute__ ((__unused__)), jobject field, jobject object, jboolean value)
+{
+  jfieldID fid = getFieldReference (env, field, "Z");
+
+  if (fid != NULL)
+    (*env)->SetBooleanField (env, object, fid, value);
+}
+
+/*
+ * Class:     java_io_VMObjectOutputStream
+ * Method:    setCharNative
+ * Signature: (Ljava/lang/reflect/Field;Ljava/lang/Object;C)V
+ */
+JNIEXPORT void JNICALL
+Java_java_io_VMObjectStreamClass_setCharNative (JNIEnv * env,
+						jclass vmosklass
+						__attribute__ ((__unused__)),
+						jobject field,
+						jobject object, jchar value)
+{
+  jfieldID fid = getFieldReference (env, field, "C");
+
+  if (fid != NULL)
+    (*env)->SetCharField (env, object, fid, value);
+}
+
+/*
+ * Class:     java_io_VMObjectOutputStream
+ * Method:    setByteNative
+ * Signature: (Ljava/lang/reflect/Field;Ljava/lang/Object;B)V
+ */
+JNIEXPORT void JNICALL
+Java_java_io_VMObjectStreamClass_setByteNative (JNIEnv * env,
+						jclass vmosklass
+						__attribute__ ((__unused__)),
+						jobject field,
+						jobject object, jbyte value)
+{
+  jfieldID fid = getFieldReference (env, field, "B");
+
+  if (fid != NULL)
+    (*env)->SetByteField (env, object, fid, value);
+}
+
+
+/*
+ * Class:     java_io_VMObjectOutputStream
+ * Method:    setShortNative
+ * Signature: (Ljava/lang/reflect/Field;Ljava/lang/Object;S)V
+ */
+JNIEXPORT void JNICALL
+Java_java_io_VMObjectStreamClass_setShortNative (JNIEnv * env,
+						 jclass vmosklass
+						 __attribute__ ((__unused__)),
+						 jobject field,
+						 jobject object, jshort value)
+{
+  jfieldID fid = getFieldReference (env, field, "S");
+
+  if (fid != NULL)
+    (*env)->SetShortField (env, object, fid, value);
+}
+
+/*
+ * Class:     java_io_VMObjectOutputStream
+ * Method:    setIntNative
+ * Signature: (Ljava/lang/reflect/Field;Ljava/lang/Object;I)V
+ */
+JNIEXPORT void JNICALL
+Java_java_io_VMObjectStreamClass_setIntNative (JNIEnv * env,
+					       jclass vmosklass
+					       __attribute__ ((__unused__)),
+					       jobject field,
+					       jobject object, jint value)
+{
+  jfieldID fid = getFieldReference (env, field, "I");
+
+  if (fid != NULL)
+    (*env)->SetIntField (env, object, fid, value);
+}
+
+
+/*
+ * Class:     java_io_VMObjectOutputStream
+ * Method:    setLongNative
+ * Signature: (Ljava/lang/reflect/Field;Ljava/lang/Object;J)V
+ */
+JNIEXPORT void JNICALL
+Java_java_io_VMObjectStreamClass_setLongNative (JNIEnv * env,
+						jclass vmosklass
+						__attribute__ ((__unused__)),
+						jobject field,
+						jobject object, jlong value)
+{
+  jfieldID fid = getFieldReference (env, field, "J");
+
+  if (fid != NULL)
+    (*env)->SetLongField (env, object, fid, value);
+}
+
+
+/*
+ * Class:     java_io_VMObjectOutputStream
+ * Method:    setFloatNative
+ * Signature: (Ljava/lang/reflect/Field;Ljava/lang/Object;F)V
+ */
+JNIEXPORT void JNICALL
+Java_java_io_VMObjectStreamClass_setFloatNative (JNIEnv * env,
+						 jclass vmosklass
+						 __attribute__ ((__unused__)),
+						 jobject field,
+						 jobject object, jfloat value)
+{
+  jfieldID fid = getFieldReference (env, field, "F");
+
+  if (fid != NULL)
+    (*env)->SetFloatField (env, object, fid, value);
+}
+
+/*
+ * Class:     java_io_VMObjectOutputStream
+ * Method:    setDoubleNative
+ * Signature: (Ljava/lang/reflect/Field;Ljava/lang/Object;D)V
+ */
+JNIEXPORT void JNICALL
+Java_java_io_VMObjectStreamClass_setDoubleNative (JNIEnv * env,
+						  jclass vmosklass
+						  __attribute__ ((__unused__)), jobject field, jobject object, jdouble value)
+{
+  jfieldID fid = getFieldReference (env, field, "D");
+
+  if (fid != NULL)
+    (*env)->SetDoubleField (env, object, fid, value);
+}
+
+/*
+ * Class:     java_io_VMObjectOutputStream
+ * Method:    setObjectNative
+ * Signature: (Ljava/lang/reflect/Field;Ljava/lang/Object;Ljava/lang/Object;)V
+ */
+JNIEXPORT void JNICALL
+Java_java_io_VMObjectStreamClass_setObjectNative (JNIEnv * env,
+						  jclass vmosklass
+						  __attribute__ ((__unused__)), jobject field, jobject object, jobject value)
+{
+  jfieldID fid = getFieldReference (env, field, NULL);
+
+  if (fid != NULL)
+    (*env)->SetObjectField (env, object, fid, value);
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-lang/Makefile.am
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-lang/Makefile.am?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-lang/Makefile.am (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-lang/Makefile.am Thu Nov  8 16:56:19 2007
@@ -0,0 +1,16 @@
+nativeexeclib_LTLIBRARIES = libjavalang.la libjavalangreflect.la
+
+libjavalang_la_SOURCES = java_lang_VMSystem.c \
+			 java_lang_VMFloat.c \
+			 java_lang_VMDouble.c \
+			 java_lang_VMMath.c \
+			 java_lang_VMProcess.c
+
+libjavalang_la_LIBADD = $(wildcard $(top_builddir)/native/fdlibm/*.lo) \
+			$(top_builddir)/native/jni/classpath/jcl.lo
+
+libjavalangreflect_la_SOURCES = java_lang_reflect_VMArray.c
+
+AM_LDFLAGS = @CLASSPATH_MODULE@
+AM_CPPFLAGS = @CLASSPATH_INCLUDES@ -I$(top_srcdir)/native/fdlibm
+AM_CFLAGS = @WARNING_CFLAGS@ @STRICT_WARNING_CFLAGS@ @ERROR_CFLAGS@

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-lang/Makefile.in
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-lang/Makefile.in?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-lang/Makefile.in (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-lang/Makefile.in Thu Nov  8 16:56:19 2007
@@ -0,0 +1,614 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = native/jni/java-lang
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/../../config/depstand.m4 \
+	$(top_srcdir)/../../config/lead-dot.m4 \
+	$(top_srcdir)/../../config/multi.m4 \
+	$(top_srcdir)/../../libtool.m4 $(top_srcdir)/m4/acattribute.m4 \
+	$(top_srcdir)/m4/accross.m4 $(top_srcdir)/m4/acinclude.m4 \
+	$(top_srcdir)/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \
+	$(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
+	$(top_srcdir)/m4/pkg.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/include/config.h
+CONFIG_CLEAN_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+    *) f=$$p;; \
+  esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(nativeexeclibdir)"
+nativeexeclibLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(nativeexeclib_LTLIBRARIES)
+libjavalang_la_DEPENDENCIES = $(wildcard \
+	$(top_builddir)/native/fdlibm/*.lo) \
+	$(top_builddir)/native/jni/classpath/jcl.lo
+am_libjavalang_la_OBJECTS = java_lang_VMSystem.lo java_lang_VMFloat.lo \
+	java_lang_VMDouble.lo java_lang_VMMath.lo \
+	java_lang_VMProcess.lo
+libjavalang_la_OBJECTS = $(am_libjavalang_la_OBJECTS)
+libjavalangreflect_la_LIBADD =
+am_libjavalangreflect_la_OBJECTS = java_lang_reflect_VMArray.lo
+libjavalangreflect_la_OBJECTS = $(am_libjavalangreflect_la_OBJECTS)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \
+	$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+	$(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(libjavalang_la_SOURCES) $(libjavalangreflect_la_SOURCES)
+DIST_SOURCES = $(libjavalang_la_SOURCES) \
+	$(libjavalangreflect_la_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BUILD_CLASS_FILES_FALSE = @BUILD_CLASS_FILES_FALSE@
+BUILD_CLASS_FILES_TRUE = @BUILD_CLASS_FILES_TRUE@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CLASSPATH_CONVENIENCE = @CLASSPATH_CONVENIENCE@
+CLASSPATH_INCLUDES = @CLASSPATH_INCLUDES@
+CLASSPATH_MODULE = @CLASSPATH_MODULE@
+COLLECTIONS_PREFIX = @COLLECTIONS_PREFIX@
+CP = @CP@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CREATE_ALSA_LIBRARIES_FALSE = @CREATE_ALSA_LIBRARIES_FALSE@
+CREATE_ALSA_LIBRARIES_TRUE = @CREATE_ALSA_LIBRARIES_TRUE@
+CREATE_API_DOCS_FALSE = @CREATE_API_DOCS_FALSE@
+CREATE_API_DOCS_TRUE = @CREATE_API_DOCS_TRUE@
+CREATE_COLLECTIONS_FALSE = @CREATE_COLLECTIONS_FALSE@
+CREATE_COLLECTIONS_TRUE = @CREATE_COLLECTIONS_TRUE@
+CREATE_CORE_JNI_LIBRARIES_FALSE = @CREATE_CORE_JNI_LIBRARIES_FALSE@
+CREATE_CORE_JNI_LIBRARIES_TRUE = @CREATE_CORE_JNI_LIBRARIES_TRUE@
+CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
+CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
+CREATE_GCONF_PEER_LIBRARIES_FALSE = @CREATE_GCONF_PEER_LIBRARIES_FALSE@
+CREATE_GCONF_PEER_LIBRARIES_TRUE = @CREATE_GCONF_PEER_LIBRARIES_TRUE@
+CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
+CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
+CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
+CREATE_JNI_HEADERS_TRUE = @CREATE_JNI_HEADERS_TRUE@
+CREATE_JNI_LIBRARIES_FALSE = @CREATE_JNI_LIBRARIES_FALSE@
+CREATE_JNI_LIBRARIES_TRUE = @CREATE_JNI_LIBRARIES_TRUE@
+CREATE_PLUGIN_FALSE = @CREATE_PLUGIN_FALSE@
+CREATE_PLUGIN_TRUE = @CREATE_PLUGIN_TRUE@
+CREATE_QT_PEER_LIBRARIES_FALSE = @CREATE_QT_PEER_LIBRARIES_FALSE@
+CREATE_QT_PEER_LIBRARIES_TRUE = @CREATE_QT_PEER_LIBRARIES_TRUE@
+CREATE_WRAPPERS_FALSE = @CREATE_WRAPPERS_FALSE@
+CREATE_WRAPPERS_TRUE = @CREATE_WRAPPERS_TRUE@
+CREATE_XMLJ_LIBRARY_FALSE = @CREATE_XMLJ_LIBRARY_FALSE@
+CREATE_XMLJ_LIBRARY_TRUE = @CREATE_XMLJ_LIBRARY_TRUE@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DATE = @DATE@
+DEFAULT_PREFS_PEER = @DEFAULT_PREFS_PEER@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+ECJ = @ECJ@
+EGREP = @EGREP@
+ENABLE_LOCAL_SOCKETS_FALSE = @ENABLE_LOCAL_SOCKETS_FALSE@
+ENABLE_LOCAL_SOCKETS_TRUE = @ENABLE_LOCAL_SOCKETS_TRUE@
+ERROR_CFLAGS = @ERROR_CFLAGS@
+EXAMPLESDIR = @EXAMPLESDIR@
+EXEEXT = @EXEEXT@
+FASTJAR = @FASTJAR@
+FIND = @FIND@
+FOUND_CACAO_FALSE = @FOUND_CACAO_FALSE@
+FOUND_CACAO_TRUE = @FOUND_CACAO_TRUE@
+FOUND_ECJ_FALSE = @FOUND_ECJ_FALSE@
+FOUND_ECJ_TRUE = @FOUND_ECJ_TRUE@
+FOUND_GCJX_FALSE = @FOUND_GCJX_FALSE@
+FOUND_GCJX_TRUE = @FOUND_GCJX_TRUE@
+FOUND_GCJ_FALSE = @FOUND_GCJ_FALSE@
+FOUND_GCJ_TRUE = @FOUND_GCJ_TRUE@
+FOUND_JIKES_FALSE = @FOUND_JIKES_FALSE@
+FOUND_JIKES_TRUE = @FOUND_JIKES_TRUE@
+FOUND_KJC_FALSE = @FOUND_KJC_FALSE@
+FOUND_KJC_TRUE = @FOUND_KJC_TRUE@
+FREETYPE2_CFLAGS = @FREETYPE2_CFLAGS@
+FREETYPE2_LIBS = @FREETYPE2_LIBS@
+GCJ = @GCJ@
+GCJX = @GCJX@
+GCONF_CFLAGS = @GCONF_CFLAGS@
+GCONF_LIBS = @GCONF_LIBS@
+GDK_CFLAGS = @GDK_CFLAGS@
+GDK_LIBS = @GDK_LIBS@
+GJDOC = @GJDOC@
+GLIB_CFLAGS = @GLIB_CFLAGS@
+GLIB_LIBS = @GLIB_LIBS@
+GTK_CFLAGS = @GTK_CFLAGS@
+GTK_LIBS = @GTK_LIBS@
+INIT_LOAD_LIBRARY = @INIT_LOAD_LIBRARY@
+INSTALL_CLASS_FILES_FALSE = @INSTALL_CLASS_FILES_FALSE@
+INSTALL_CLASS_FILES_TRUE = @INSTALL_CLASS_FILES_TRUE@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_GLIBJ_ZIP_FALSE = @INSTALL_GLIBJ_ZIP_FALSE@
+INSTALL_GLIBJ_ZIP_TRUE = @INSTALL_GLIBJ_ZIP_TRUE@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION = @JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION@
+JAY = @JAY@
+JAY_SKELETON = @JAY_SKELETON@
+JIKES = @JIKES@
+JIKESENCODING = @JIKESENCODING@
+JIKESWARNINGS = @JIKESWARNINGS@
+KJC = @KJC@
+LDFLAGS = @LDFLAGS@
+LIBDEBUG = @LIBDEBUG@
+LIBICONV = @LIBICONV@
+LIBMAGIC = @LIBMAGIC@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBVERSION = @LIBVERSION@
+LN_S = @LN_S@
+LTLIBICONV = @LTLIBICONV@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
+MAKEINFO = @MAKEINFO@
+MKDIR = @MKDIR@
+MOC = @MOC@
+MOZILLA_CFLAGS = @MOZILLA_CFLAGS@
+MOZILLA_LIBS = @MOZILLA_LIBS@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PANGOFT2_CFLAGS = @PANGOFT2_CFLAGS@
+PANGOFT2_LIBS = @PANGOFT2_LIBS@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PATH_TO_ESCHER = @PATH_TO_ESCHER@
+PATH_TO_GLIBJ_ZIP = @PATH_TO_GLIBJ_ZIP@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PLUGIN_DIR = @PLUGIN_DIR@
+QT_CFLAGS = @QT_CFLAGS@
+QT_LIBS = @QT_LIBS@
+RANLIB = @RANLIB@
+REGEN_PARSERS_FALSE = @REGEN_PARSERS_FALSE@
+REGEN_PARSERS_TRUE = @REGEN_PARSERS_TRUE@
+REMOVE = @REMOVE@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRICT_WARNING_CFLAGS = @STRICT_WARNING_CFLAGS@
+STRIP = @STRIP@
+USER_CLASSLIB = @USER_CLASSLIB@
+USER_JAVAH = @USER_JAVAH@
+USER_SPECIFIED_CLASSLIB_FALSE = @USER_SPECIFIED_CLASSLIB_FALSE@
+USER_SPECIFIED_CLASSLIB_TRUE = @USER_SPECIFIED_CLASSLIB_TRUE@
+USER_SPECIFIED_JAVAH_FALSE = @USER_SPECIFIED_JAVAH_FALSE@
+USER_SPECIFIED_JAVAH_TRUE = @USER_SPECIFIED_JAVAH_TRUE@
+USE_ESCHER_FALSE = @USE_ESCHER_FALSE@
+USE_ESCHER_TRUE = @USE_ESCHER_TRUE@
+USE_PREBUILT_GLIBJ_ZIP_FALSE = @USE_PREBUILT_GLIBJ_ZIP_FALSE@
+USE_PREBUILT_GLIBJ_ZIP_TRUE = @USE_PREBUILT_GLIBJ_ZIP_TRUE@
+VERSION = @VERSION@
+VM_BINARY = @VM_BINARY@
+WARNING_CFLAGS = @WARNING_CFLAGS@
+XML_CFLAGS = @XML_CFLAGS@
+XML_LIBS = @XML_LIBS@
+XSLT_CFLAGS = @XSLT_CFLAGS@
+XSLT_LIBS = @XSLT_LIBS@
+XTEST_LIBS = @XTEST_LIBS@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+ZIP = @ZIP@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+default_toolkit = @default_toolkit@
+exec_prefix = @exec_prefix@
+glibjdir = @glibjdir@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+multi_basedir = @multi_basedir@
+nativeexeclibdir = @nativeexeclibdir@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+toolexeclibdir = @toolexeclibdir@
+vm_classes = @vm_classes@
+nativeexeclib_LTLIBRARIES = libjavalang.la libjavalangreflect.la
+libjavalang_la_SOURCES = java_lang_VMSystem.c \
+			 java_lang_VMFloat.c \
+			 java_lang_VMDouble.c \
+			 java_lang_VMMath.c \
+			 java_lang_VMProcess.c
+
+libjavalang_la_LIBADD = $(wildcard $(top_builddir)/native/fdlibm/*.lo) \
+			$(top_builddir)/native/jni/classpath/jcl.lo
+
+libjavalangreflect_la_SOURCES = java_lang_reflect_VMArray.c
+AM_LDFLAGS = @CLASSPATH_MODULE@
+AM_CPPFLAGS = @CLASSPATH_INCLUDES@ -I$(top_srcdir)/native/fdlibm
+AM_CFLAGS = @WARNING_CFLAGS@ @STRICT_WARNING_CFLAGS@ @ERROR_CFLAGS@
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  native/jni/java-lang/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  native/jni/java-lang/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-nativeexeclibLTLIBRARIES: $(nativeexeclib_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(nativeexeclibdir)" || $(mkdir_p) "$(DESTDIR)$(nativeexeclibdir)"
+	@list='$(nativeexeclib_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) --mode=install $(nativeexeclibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(nativeexeclibdir)/$$f'"; \
+	    $(LIBTOOL) --mode=install $(nativeexeclibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(nativeexeclibdir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-nativeexeclibLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@set -x; list='$(nativeexeclib_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(nativeexeclibdir)/$$p'"; \
+	  $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(nativeexeclibdir)/$$p"; \
+	done
+
+clean-nativeexeclibLTLIBRARIES:
+	-test -z "$(nativeexeclib_LTLIBRARIES)" || rm -f $(nativeexeclib_LTLIBRARIES)
+	@list='$(nativeexeclib_LTLIBRARIES)'; for p in $$list; do \
+	  dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+	  test "$$dir" != "$$p" || dir=.; \
+	  echo "rm -f \"$${dir}/so_locations\""; \
+	  rm -f "$${dir}/so_locations"; \
+	done
+libjavalang.la: $(libjavalang_la_OBJECTS) $(libjavalang_la_DEPENDENCIES) 
+	$(LINK) -rpath $(nativeexeclibdir) $(libjavalang_la_LDFLAGS) $(libjavalang_la_OBJECTS) $(libjavalang_la_LIBADD) $(LIBS)
+libjavalangreflect.la: $(libjavalangreflect_la_OBJECTS) $(libjavalangreflect_la_DEPENDENCIES) 
+	$(LINK) -rpath $(nativeexeclibdir) $(libjavalangreflect_la_LDFLAGS) $(libjavalangreflect_la_OBJECTS) $(libjavalangreflect_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/java_lang_VMDouble.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/java_lang_VMFloat.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/java_lang_VMMath.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/java_lang_VMProcess.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/java_lang_VMSystem.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/java_lang_reflect_VMArray.Plo at am__quote@
+
+.c.o:
+ at am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+ at am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(COMPILE) -c $<
+
+.c.obj:
+ at am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+ at am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+ at am__fastdepCC_TRUE@	if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+ at am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+distclean-libtool:
+	-rm -f libtool
+uninstall-info-am:
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	    $$tags $$unique; \
+	fi
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$tags $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && cd $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+	list='$(DISTFILES)'; for file in $$list; do \
+	  case $$file in \
+	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+	  esac; \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+	    dir="/$$dir"; \
+	    $(mkdir_p) "$(distdir)$$dir"; \
+	  else \
+	    dir=''; \
+	  fi; \
+	  if test -d $$d/$$file; then \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES)
+installdirs:
+	for dir in "$(DESTDIR)$(nativeexeclibdir)"; do \
+	  test -z "$$dir" || $(mkdir_p) "$$dir"; \
+	done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-nativeexeclibLTLIBRARIES \
+	mostlyclean-am
+
+distclean: distclean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+	distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am: install-nativeexeclibLTLIBRARIES
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+	mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am uninstall-nativeexeclibLTLIBRARIES
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+	clean-libtool clean-nativeexeclibLTLIBRARIES ctags distclean \
+	distclean-compile distclean-generic distclean-libtool \
+	distclean-tags distdir dvi dvi-am html html-am info info-am \
+	install install-am install-data install-data-am install-exec \
+	install-exec-am install-info install-info-am install-man \
+	install-nativeexeclibLTLIBRARIES install-strip installcheck \
+	installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-compile \
+	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+	tags uninstall uninstall-am uninstall-info-am \
+	uninstall-nativeexeclibLTLIBRARIES
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-lang/java_lang_VMDouble.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-lang/java_lang_VMDouble.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-lang/java_lang_VMDouble.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-lang/java_lang_VMDouble.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,401 @@
+/* VMDouble.c - java.lang.VMDouble native functions
+   Copyright (C) 1998, 1999, 2001, 2003, 2004, 2005, 2006
+   Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+ 
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+#include <config.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "mprec.h"
+#include "fdlibm.h"
+#include "jcl.h"
+
+#include "java_lang_VMDouble.h"
+
+static jclass clsDouble;
+static jmethodID isNaNID;
+static jdouble NEGATIVE_INFINITY;
+static jdouble POSITIVE_INFINITY;
+static jdouble NaN;
+
+/*
+ * Class:     java_lang_VMDouble
+ * Method:    initIDs
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL
+Java_java_lang_VMDouble_initIDs (JNIEnv * env, jclass cls __attribute__ ((__unused__)))
+{
+  jfieldID negInfID;
+  jfieldID posInfID;
+  jfieldID nanID;
+
+  clsDouble = (*env)->FindClass (env, "java/lang/Double");
+  if (clsDouble == NULL)
+    {
+      DBG ("unable to get class java.lang.Double\n") return;
+    }
+  clsDouble = (*env)->NewGlobalRef(env, clsDouble);
+  if (clsDouble == NULL)
+    {
+      DBG ("unable to register class java.lang.Double as global ref\n") return;
+    }
+  isNaNID = (*env)->GetStaticMethodID (env, clsDouble, "isNaN", "(D)Z");
+  if (isNaNID == NULL)
+    {
+      DBG ("unable to determine method id of isNaN\n") return;
+    }
+  negInfID = (*env)->GetStaticFieldID (env, clsDouble, "NEGATIVE_INFINITY", "D");
+  if (negInfID == NULL)
+    {
+      DBG ("unable to determine field id of NEGATIVE_INFINITY\n") return;
+    }
+  posInfID = (*env)->GetStaticFieldID (env, clsDouble, "POSITIVE_INFINITY", "D");
+  if (posInfID == NULL)
+    {
+      DBG ("unable to determine field id of POSITIVE_INFINITY\n") return;
+    }
+  nanID = (*env)->GetStaticFieldID (env, clsDouble, "NaN", "D");
+  if (posInfID == NULL)
+    {
+      DBG ("unable to determine field id of NaN\n") return;
+    }
+  POSITIVE_INFINITY = (*env)->GetStaticDoubleField (env, clsDouble, posInfID);
+  NEGATIVE_INFINITY = (*env)->GetStaticDoubleField (env, clsDouble, negInfID);
+  NaN = (*env)->GetStaticDoubleField (env, clsDouble, nanID);
+
+#ifdef DEBUG
+  fprintf (stderr, "java.lang.Double.initIDs() POSITIVE_INFINITY = %g\n",
+	   POSITIVE_INFINITY);
+  fprintf (stderr, "java.lang.Double.initIDs() NEGATIVE_INFINITY = %g\n",
+	   NEGATIVE_INFINITY);
+  fprintf (stderr, "java.lang.Double.initIDs() NaN = %g\n", NaN);
+#endif
+}
+
+/*
+ * Class:     java_lang_VMDouble
+ * Method:    doubleToLongBits
+ * Signature: (D)J
+ */
+JNIEXPORT jlong JNICALL
+Java_java_lang_VMDouble_doubleToLongBits
+  (JNIEnv * env __attribute__ ((__unused__)),
+   jclass cls __attribute__ ((__unused__)), jdouble doubleValue)
+{
+  jvalue val;
+  jlong e, f;
+  val.d = doubleValue;
+
+#if defined(__IEEE_BYTES_LITTLE_ENDIAN)
+  /* On little endian ARM processors when using FPA, word order of
+     doubles is still big endian. So take that into account here. When
+     using VFP, word order of doubles follows byte order. */
+
+#define SWAP_DOUBLE(a)    (((a) << 32) | (((a) >> 32) & 0x00000000ffffffff))
+
+  val.j = SWAP_DOUBLE(val.j);
+#endif
+
+  e = val.j & 0x7ff0000000000000LL;
+  f = val.j & 0x000fffffffffffffLL;
+
+  if (e == 0x7ff0000000000000LL && f != 0L)
+    val.j = 0x7ff8000000000000LL;
+
+  return val.j;
+}
+
+/*
+ * Class:     java_lang_VMDouble
+ * Method:    doubleToRawLongBits
+ * Signature: (D)J
+ */
+JNIEXPORT jlong JNICALL
+Java_java_lang_VMDouble_doubleToRawLongBits
+  (JNIEnv * env __attribute__ ((__unused__)),
+   jclass cls __attribute__ ((__unused__)), jdouble doubleValue)
+{
+  jvalue val;
+  val.d = doubleValue;
+
+#if defined(__IEEE_BYTES_LITTLE_ENDIAN)
+  val.j = SWAP_DOUBLE(val.j);
+#endif
+
+  return val.j;
+}
+
+/*
+ * Class:     java_lang_VMDouble
+ * Method:    longBitsToDouble
+ * Signature: (J)D
+ */
+JNIEXPORT jdouble JNICALL
+Java_java_lang_VMDouble_longBitsToDouble
+  (JNIEnv * env __attribute__ ((__unused__)),
+   jclass cls __attribute__ ((__unused__)), jlong longValue)
+{
+  jvalue val;
+  val.j = longValue;
+
+#if defined(__IEEE_BYTES_LITTLE_ENDIAN)
+  val.j = SWAP_DOUBLE(val.j);
+#endif
+
+  return val.d;
+}
+
+/*
+ * Class:     java_lang_VMDouble
+ * Method:    toString
+ * Signature: (DZ)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL
+Java_java_lang_VMDouble_toString
+  (JNIEnv * env, jclass cls __attribute__ ((__unused__)), jdouble value, jboolean isFloat)
+{
+  char buffer[50], result[50];
+  int decpt, sign;
+  char *s, *d;
+  int i;
+
+#ifdef DEBUG
+  fprintf (stderr, "java.lang.VMDouble.toString (%g)\n", value);
+#endif
+
+  if ((*env)->CallStaticBooleanMethod (env, clsDouble, isNaNID, value))
+    return (*env)->NewStringUTF (env, "NaN");
+
+  if (value == POSITIVE_INFINITY)
+    return (*env)->NewStringUTF (env, "Infinity");
+
+  if (value == NEGATIVE_INFINITY)
+    return (*env)->NewStringUTF (env, "-Infinity");
+
+  _dtoa (value, 0, 20, &decpt, &sign, NULL, buffer, (int) isFloat);
+
+  value = fabs (value);
+
+  s = buffer;
+  d = result;
+
+  if (sign)
+    *d++ = '-';
+
+  if ((value >= 1e-3 && value < 1e7) || (value == 0))
+    {
+      if (decpt <= 0)
+	*d++ = '0';
+      else
+	{
+	  for (i = 0; i < decpt; i++)
+	    if (*s)
+	      *d++ = *s++;
+	    else
+	      *d++ = '0';
+	}
+
+      *d++ = '.';
+
+      if (*s == 0)
+	{
+	  *d++ = '0';
+	  decpt++;
+	}
+
+      while (decpt++ < 0)
+	*d++ = '0';
+
+      while (*s)
+	*d++ = *s++;
+
+      *d = 0;
+
+      return (*env)->NewStringUTF (env, result);
+    }
+
+  *d++ = *s++;
+  decpt--;
+  *d++ = '.';
+
+  if (*s == 0)
+    *d++ = '0';
+
+  while (*s)
+    *d++ = *s++;
+
+  *d++ = 'E';
+
+  if (decpt < 0)
+    {
+      *d++ = '-';
+      decpt = -decpt;
+    }
+
+  {
+    char exp[4];
+    char *e = exp + sizeof exp;
+
+    *--e = 0;
+    do
+      {
+	*--e = '0' + decpt % 10;
+	decpt /= 10;
+      }
+    while (decpt > 0);
+
+    while (*e)
+      *d++ = *e++;
+  }
+
+  *d = 0;
+
+  return (*env)->NewStringUTF (env, result);
+}
+
+/*
+ * Class:     java_lang_VMDouble
+ * Method:    parseDouble
+ * Signature: (Ljava/lang/String;)D
+ */
+JNIEXPORT jdouble JNICALL
+Java_java_lang_VMDouble_parseDouble
+  (JNIEnv * env, jclass cls __attribute__ ((__unused__)), jstring str)
+{
+  jboolean isCopy;
+  const char *buf;
+  char *endptr;
+  jdouble val = 0.0;
+
+  if (str == NULL)
+    {
+      JCL_ThrowException (env, "java/lang/NullPointerException", "null");
+      return val;
+    }
+
+  buf = (char *) (*env)->GetStringUTFChars (env, str, &isCopy);
+  if (buf == NULL)
+    {
+      /* OutOfMemoryError already thrown */
+    }
+  else
+    {
+      const char *p = buf, *end, *last_non_ws, *temp;
+      int ok = 1;
+
+#ifdef DEBUG
+      fprintf (stderr, "java.lang.VMDouble.parseDouble (%s)\n", buf);
+#endif
+
+      /* Trim the buffer, similar to String.trim().  First the leading
+         characters.  */
+      while (*p && *p <= ' ')
+	++p;
+
+      /* Find the last non-whitespace character.  This method is safe
+         even with multi-byte UTF-8 characters.  */
+      end = p;
+      last_non_ws = NULL;
+      while (*end)
+	{
+	  if (*end > ' ')
+	    last_non_ws = end;
+	  ++end;
+	}
+
+      if (last_non_ws == NULL)
+	last_non_ws = p + strlen (p);
+      else
+	{
+	  /* Skip past the last non-whitespace character.  */
+	  ++last_non_ws;
+	}
+
+      /* Check for infinity and NaN */
+      temp = p;
+      if (temp[0] == '+' || temp[0] == '-')
+	temp++;
+      if (strncmp ("Infinity", temp, (size_t) 8) == 0)
+	{
+	  if (p[0] == '-')
+	    return NEGATIVE_INFINITY;
+	  return POSITIVE_INFINITY;
+	}
+      if (strncmp ("NaN", temp, (size_t) 3) == 0)
+	return NaN;
+
+      /* Skip a trailing `f' or `d'.  */
+      if (last_non_ws > p
+	  && (last_non_ws[-1] == 'f'
+	      || last_non_ws[-1] == 'F'
+	      || last_non_ws[-1] == 'd' || last_non_ws[-1] == 'D'))
+	--last_non_ws;
+
+      if (last_non_ws > p)
+	{
+	  struct _Jv_reent reent;
+	  memset (&reent, 0, sizeof reent);
+
+	  val = _strtod_r (&reent, p, &endptr);
+
+#ifdef DEBUG
+	  fprintf (stderr, "java.lang.VMDouble.parseDouble val = %g\n", val);
+	  fprintf (stderr, "java.lang.VMDouble.parseDouble %i != %i ???\n",
+		   endptr, last_non_ws);
+#endif
+	  if (endptr != last_non_ws)
+	    ok = 0;
+	}
+      else
+	ok = 0;
+
+      if (!ok)
+	{
+	  val = 0.0;
+	  JCL_ThrowException (env,
+			      "java/lang/NumberFormatException",
+			      "unable to parse double");
+	}
+
+      (*env)->ReleaseStringUTFChars (env, str, buf);
+    }
+
+  return val;
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-lang/java_lang_VMFloat.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-lang/java_lang_VMFloat.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-lang/java_lang_VMFloat.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-lang/java_lang_VMFloat.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,93 @@
+/* VMFloat.c - java.lang.VMFloat native functions
+   Copyright (C) 1998, 1999, 2003, 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+ 
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+#include <config.h>
+
+#include "java_lang_VMFloat.h"
+
+/*
+ * Class:     java_lang_VMFloat
+ * Method:    floatToIntBits
+ * Signature: (F)I
+ */
+JNIEXPORT jint JNICALL
+Java_java_lang_VMFloat_floatToIntBits
+  (JNIEnv * env __attribute__ ((__unused__)),
+   jclass cls __attribute__ ((__unused__)), jfloat value)
+{
+  jvalue u;
+  jint e, f;
+  u.f = value;
+  e = u.i & 0x7f800000;
+  f = u.i & 0x007fffff;
+
+  if (e == 0x7f800000 && f != 0)
+    u.i = 0x7fc00000;
+
+  return u.i;
+}
+
+/*
+ * Class:     java_lang_VMFloat
+ * Method:    floatToRawIntBits
+ * Signature: (F)I
+ */
+JNIEXPORT jint JNICALL
+Java_java_lang_VMFloat_floatToRawIntBits
+  (JNIEnv * env __attribute__ ((__unused__)),
+   jclass cls __attribute__ ((__unused__)), jfloat value)
+{
+  jvalue u;
+  u.f = value;
+  return u.i;
+}
+
+/*
+ * Class:     java_lang_VMFloat
+ * Method:    intBitsToFloat
+ * Signature: (I)F
+ */
+JNIEXPORT jfloat JNICALL
+Java_java_lang_VMFloat_intBitsToFloat
+  (JNIEnv * env __attribute__ ((__unused__)),
+   jclass cls __attribute__ ((__unused__)), jint bits)
+{
+  jvalue u;
+  u.i = bits;
+  return u.f;
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-lang/java_lang_VMMath.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-lang/java_lang_VMMath.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-lang/java_lang_VMMath.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-lang/java_lang_VMMath.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,225 @@
+/* VMMath.c - java.lang.VMMath native functions
+   Copyright (C) 1998, 1999, 2004, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+ 
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+#include <config.h>
+#include <java_lang_VMMath.h>
+#include <fdlibm.h>
+
+JNIEXPORT jdouble JNICALL
+Java_java_lang_VMMath_sin
+  (JNIEnv * env __attribute__ ((__unused__)),
+   jclass cls __attribute__ ((__unused__)), jdouble x)
+{
+  return sin (x);
+}
+
+JNIEXPORT jdouble JNICALL
+Java_java_lang_VMMath_cos
+  (JNIEnv * env __attribute__ ((__unused__)),
+   jclass cls __attribute__ ((__unused__)), jdouble x)
+{
+  return cos (x);
+}
+
+JNIEXPORT jdouble JNICALL
+Java_java_lang_VMMath_tan
+  (JNIEnv * env __attribute__ ((__unused__)),
+   jclass cls __attribute__ ((__unused__)), jdouble x)
+{
+  return tan (x);
+}
+
+JNIEXPORT jdouble JNICALL
+Java_java_lang_VMMath_asin
+  (JNIEnv * env __attribute__ ((__unused__)),
+   jclass cls __attribute__ ((__unused__)), jdouble x)
+{
+  return asin (x);
+}
+
+JNIEXPORT jdouble JNICALL
+Java_java_lang_VMMath_acos
+  (JNIEnv * env __attribute__ ((__unused__)),
+   jclass cls __attribute__ ((__unused__)), jdouble x)
+{
+  return acos (x);
+}
+
+JNIEXPORT jdouble JNICALL
+Java_java_lang_VMMath_atan
+  (JNIEnv * env __attribute__ ((__unused__)),
+   jclass cls __attribute__ ((__unused__)), jdouble x)
+{
+  return atan (x);
+}
+
+JNIEXPORT jdouble JNICALL
+Java_java_lang_VMMath_atan2
+  (JNIEnv * env __attribute__ ((__unused__)),
+   jclass cls __attribute__ ((__unused__)), jdouble y, jdouble x)
+{
+  return atan2 (y, x);
+}
+
+JNIEXPORT jdouble JNICALL
+Java_java_lang_VMMath_exp
+  (JNIEnv * env __attribute__ ((__unused__)),
+   jclass cls __attribute__ ((__unused__)), jdouble x)
+{
+  return exp (x);
+}
+
+JNIEXPORT jdouble JNICALL
+Java_java_lang_VMMath_log
+  (JNIEnv * env __attribute__ ((__unused__)),
+   jclass cls __attribute__ ((__unused__)), jdouble x)
+{
+  return log (x);
+}
+
+JNIEXPORT jdouble JNICALL
+Java_java_lang_VMMath_sqrt
+  (JNIEnv * env __attribute__ ((__unused__)),
+   jclass cls __attribute__ ((__unused__)), jdouble x)
+{
+  return sqrt (x);
+}
+
+JNIEXPORT jdouble JNICALL
+Java_java_lang_VMMath_pow
+  (JNIEnv * env __attribute__ ((__unused__)),
+   jclass cls __attribute__ ((__unused__)), jdouble x, jdouble y)
+{
+  return pow (x, y);
+}
+
+JNIEXPORT jdouble JNICALL
+Java_java_lang_VMMath_IEEEremainder
+  (JNIEnv * env __attribute__ ((__unused__)),
+   jclass cls __attribute__ ((__unused__)), jdouble x, jdouble y)
+{
+  return remainder (x, y);
+}
+
+JNIEXPORT jdouble JNICALL
+Java_java_lang_VMMath_ceil
+  (JNIEnv * env __attribute__ ((__unused__)),
+   jclass cls __attribute__ ((__unused__)), jdouble x)
+{
+  return ceil (x);
+}
+
+JNIEXPORT jdouble JNICALL
+Java_java_lang_VMMath_floor
+  (JNIEnv * env __attribute__ ((__unused__)),
+   jclass cls __attribute__ ((__unused__)), jdouble x)
+{
+  return floor (x);
+}
+
+JNIEXPORT jdouble JNICALL
+Java_java_lang_VMMath_rint
+  (JNIEnv * env __attribute__ ((__unused__)),
+   jclass cls __attribute__ ((__unused__)), jdouble x)
+{
+  return rint (x);
+}
+
+JNIEXPORT jdouble JNICALL
+Java_java_lang_VMMath_cbrt
+  (JNIEnv * env __attribute__ ((__unused__)),
+   jclass cls __attribute__ ((__unused__)), jdouble x)
+{
+  return cbrt (x);
+}
+
+JNIEXPORT jdouble JNICALL
+Java_java_lang_VMMath_cosh 
+  (JNIEnv * env __attribute__ ((__unused__)),
+   jclass cls __attribute__ ((__unused__)), jdouble x)
+{
+  return cosh (x);
+}
+
+JNIEXPORT jdouble JNICALL
+Java_java_lang_VMMath_expm1 
+  (JNIEnv * env __attribute__ ((__unused__)),
+   jclass cls __attribute__ ((__unused__)), jdouble x)
+{
+  return expm1 (x);
+}
+
+JNIEXPORT jdouble JNICALL
+Java_java_lang_VMMath_hypot 
+  (JNIEnv * env __attribute__ ((__unused__)),
+   jclass cls __attribute__ ((__unused__)), jdouble x, jdouble y)
+{
+  return hypot (x, y);
+}
+
+JNIEXPORT jdouble JNICALL
+Java_java_lang_VMMath_log10
+  (JNIEnv * env __attribute__ ((__unused__)),
+   jclass cls __attribute__ ((__unused__)), jdouble x)
+{
+  return log10 (x);
+}
+
+JNIEXPORT jdouble JNICALL
+Java_java_lang_VMMath_log1p 
+  (JNIEnv * env __attribute__ ((__unused__)),
+   jclass cls __attribute__ ((__unused__)), jdouble x)
+{
+  return log1p (x);
+}
+
+JNIEXPORT jdouble JNICALL
+Java_java_lang_VMMath_sinh 
+  (JNIEnv * env __attribute__ ((__unused__)),
+   jclass cls __attribute__ ((__unused__)), jdouble x)
+{
+  return sinh (x);
+}
+
+JNIEXPORT jdouble JNICALL
+Java_java_lang_VMMath_tanh 
+  (JNIEnv * env __attribute__ ((__unused__)),
+   jclass cls __attribute__ ((__unused__)), jdouble x)
+{
+  return tanh (x);
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-lang/java_lang_VMProcess.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-lang/java_lang_VMProcess.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-lang/java_lang_VMProcess.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-lang/java_lang_VMProcess.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,500 @@
+/* java_lang_VMProcess.c -- native code for java.lang.VMProcess
+   Copyright (C) 1998, 1999, 2000, 2002, 2004, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+ 
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#include <config.h>
+
+#include "java_lang_VMProcess.h"
+#include "gnu_java_nio_channels_FileChannelImpl.h"
+
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <signal.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+
+#include <jcl.h>
+
+#include "target_native.h"
+#include "target_native_misc.h"
+
+/* Internal functions */
+static char *copy_string (JNIEnv * env, jobject string);
+static char *copy_elem (JNIEnv * env, jobject stringArray, jint i);
+
+/*
+ * Internal helper function to copy a String in UTF-8 format.
+ */
+static char *
+copy_string (JNIEnv * env, jobject string)
+{
+  char errbuf[64];
+  const char *utf;
+  jclass clazz;
+  char *copy;
+
+  /* Check for null */
+  if (string == NULL)
+    {
+      clazz = (*env)->FindClass (env, "java/lang/NullPointerException");
+      if ((*env)->ExceptionOccurred (env))
+	return NULL;
+      (*env)->ThrowNew (env, clazz, NULL);
+      (*env)->DeleteLocalRef (env, clazz);
+      return NULL;
+    }
+
+  /* Extract UTF-8 */
+  utf = (*env)->GetStringUTFChars (env, string, NULL);
+  if ((*env)->ExceptionOccurred (env))
+    return NULL;
+
+  /* Copy it */
+  if ((copy = strdup (utf)) == NULL)
+    {
+      TARGET_NATIVE_MISC_FORMAT_STRING1 (errbuf, sizeof (errbuf),
+					 "strdup: %s", strerror (errno));
+      clazz = (*env)->FindClass (env, "java/lang/InternalError");
+      if ((*env)->ExceptionOccurred (env))
+	return NULL;
+      (*env)->ThrowNew (env, clazz, errbuf);
+      (*env)->DeleteLocalRef (env, clazz);
+    }
+
+  /* Done */
+  (*env)->ReleaseStringUTFChars (env, string, utf);
+  return copy;
+}
+
+/*
+ * Internal helper function to copy a String[] element in UTF-8 format.
+ */
+static char *
+copy_elem (JNIEnv * env, jobject stringArray, jint i)
+{
+  jobject elem;
+  char *rtn;
+
+  elem = (*env)->GetObjectArrayElement (env, stringArray, i);
+  if ((*env)->ExceptionOccurred (env))
+    return NULL;
+  if ((rtn = copy_string (env, elem)) == NULL)
+    return NULL;
+  (*env)->DeleteLocalRef (env, elem);
+  return rtn;
+}
+
+/*
+ * private final native void nativeSpawn(String[], String[], File)
+ *	throws java/io/IOException
+ */
+JNIEXPORT void JNICALL
+Java_java_lang_VMProcess_nativeSpawn (JNIEnv * env, jobject this,
+				      jobjectArray cmdArray,
+				      jobjectArray envArray, jobject dirFile,
+				      jboolean redirect)
+{
+  int fds[3][2] = { {-1, -1}, {-1, -1}, {-1, -1} };
+  jobject streams[3] = { NULL, NULL, NULL };
+  jobject dirString = NULL;
+  char **newEnviron = NULL;
+  jsize cmdArrayLen = 0;
+  jsize envArrayLen = 0;
+  char **strings = NULL;
+  int num_strings = 0;
+  char *dir = NULL;
+  pid_t pid = -1;
+  char errbuf[64];
+  jmethodID method;
+  jclass clazz;
+  int i;
+  int pipe_count = redirect ? 2 : 3;
+
+  /* Check for null */
+  if (cmdArray == NULL)
+    goto null_pointer_exception;
+
+  /* Invoke dirFile.getPath() */
+  if (dirFile != NULL)
+    {
+      clazz = (*env)->FindClass (env, "java/io/File");
+      if ((*env)->ExceptionOccurred (env))
+	return;
+      method = (*env)->GetMethodID (env,
+				    clazz, "getPath", "()Ljava/lang/String;");
+      if ((*env)->ExceptionOccurred (env))
+	return;
+      dirString = (*env)->CallObjectMethod (env, dirFile, method);
+      if ((*env)->ExceptionOccurred (env))
+	return;
+      (*env)->DeleteLocalRef (env, clazz);
+    }
+
+  /*
+   * Allocate array of C strings. We put all the C strings we need to
+   * handle the command parameters, the new environment, and the new
+   * directory into a single array for simplicity of (de)allocation.
+   */
+  cmdArrayLen = (*env)->GetArrayLength (env, cmdArray);
+  if (cmdArrayLen == 0)
+    goto null_pointer_exception;
+  if (envArray != NULL)
+    envArrayLen = (*env)->GetArrayLength (env, envArray);
+  if ((strings = malloc (((cmdArrayLen + 1)
+			  + (envArray != NULL ? envArrayLen + 1 : 0)
+			  + (dirString !=
+			     NULL ? 1 : 0)) * sizeof (*strings))) == NULL)
+    {
+      TARGET_NATIVE_MISC_FORMAT_STRING1 (errbuf,
+					 sizeof (errbuf), "malloc: %s",
+					 strerror (errno));
+      goto out_of_memory;
+    }
+
+  /* Extract C strings from the various String parameters */
+  for (i = 0; i < cmdArrayLen; i++)
+    {
+      if ((strings[num_strings++] = copy_elem (env, cmdArray, i)) == NULL)
+	goto done;
+    }
+  strings[num_strings++] = NULL;	/* terminate array with NULL */
+  if (envArray != NULL)
+    {
+      newEnviron = strings + num_strings;
+      for (i = 0; i < envArrayLen; i++)
+	{
+	  if ((strings[num_strings++] = copy_elem (env, envArray, i)) == NULL)
+	    goto done;
+	}
+      strings[num_strings++] = NULL;	/* terminate array with NULL */
+    }
+  if (dirString != NULL)
+    {
+      if ((dir = copy_string (env, dirString)) == NULL)
+	goto done;
+      strings[num_strings++] = dir;
+    }
+
+  /* Create inter-process pipes */
+  for (i = 0; i < pipe_count; i++)
+    {
+      if (pipe (fds[i]) == -1)
+	{
+	  TARGET_NATIVE_MISC_FORMAT_STRING1 (errbuf,
+					     sizeof (errbuf), "pipe: %s",
+					     strerror (errno));
+	  goto system_error;
+	}
+    }
+
+  /* Set close-on-exec flag for parent's ends of pipes */
+  (void) fcntl (fds[0][1], F_SETFD, 1);
+  (void) fcntl (fds[1][0], F_SETFD, 1);
+  if (pipe_count == 3)
+    (void) fcntl (fds[2][0], F_SETFD, 1);
+
+  /* Fork into parent and child processes */
+  if ((pid = fork ()) == (pid_t) - 1)
+    {
+      TARGET_NATIVE_MISC_FORMAT_STRING1 (errbuf,
+					 sizeof (errbuf), "fork: %s",
+					 strerror (errno));
+      goto system_error;
+    }
+
+  /* Child becomes the new process */
+  if (pid == 0)
+    {
+      char *const path = strings[0];
+
+      /* Move file descriptors to standard locations */
+      if (fds[0][0] != 0)
+	{
+	  if (dup2 (fds[0][0], 0) == -1)
+	    {
+	      fprintf (stderr, "dup2: %s", strerror (errno));
+	      exit (127);
+	    }
+	  close (fds[0][0]);
+	}
+      if (fds[1][1] != 1)
+	{
+	  if (dup2 (fds[1][1], 1) == -1)
+	    {
+	      fprintf (stderr, "dup2: %s", strerror (errno));
+	      exit (127);
+	    }
+	  close (fds[1][1]);
+	}
+      if (pipe_count == 2)
+	{
+	  /* Duplicate stdout to stderr.  */
+	  if (dup2 (1, 2) == -1)
+	    {
+	      fprintf (stderr, "dup2: %s", strerror (errno));
+	      exit (127);
+	    }
+	}
+      else if (fds[2][1] != 2)
+	{
+	  if (dup2 (fds[2][1], 2) == -1)
+	    {
+	      fprintf (stderr, "dup2: %s", strerror (errno));
+	      exit (127);
+	    }
+	  close (fds[2][1]);
+	}
+
+      /* Change into destination directory */
+      if (dir != NULL && chdir (dir) == -1)
+	{
+	  fprintf (stderr, "%s: %s", dir, strerror (errno));
+	  exit (127);
+	}
+
+      /* Make argv[0] last component of executable pathname */
+      /* XXX should use "file.separator" property here XXX */
+      for (i = strlen (path); i > 0 && path[i - 1] != '/'; i--);
+      strings[0] = path + i;
+
+      /* Set new environment */
+      if (newEnviron != NULL)
+	environ = newEnviron;
+
+      /* Execute new program (this will close the parent end of the pipes) */
+      execvp (path, strings);
+
+      /* Failed */
+      fprintf (stderr, "%s: %s", path, strerror (errno));
+      exit (127);
+    }
+
+  /* Create Input/OutputStream objects around parent file descriptors */
+  clazz = (*env)->FindClass (env, "gnu/java/nio/channels/FileChannelImpl");
+  if ((*env)->ExceptionOccurred (env))
+    goto done;
+  method = (*env)->GetMethodID (env, clazz, "<init>", "(II)V");
+  if ((*env)->ExceptionOccurred (env))
+    goto done;
+  for (i = 0; i < pipe_count; i++)
+    {
+      /* Mode is WRITE (2) for in and READ (1) for out and err. */
+      const int fd = fds[i][i == 0];
+      const int mode = ((i == 0)
+			? gnu_java_nio_channels_FileChannelImpl_WRITE
+			: gnu_java_nio_channels_FileChannelImpl_READ);
+      jclass sclazz;
+      jmethodID smethod;
+
+      jobject channel = (*env)->NewObject (env, clazz, method, fd, mode);
+      if ((*env)->ExceptionOccurred (env))
+	goto done;
+
+      if (mode == gnu_java_nio_channels_FileChannelImpl_WRITE)
+	sclazz = (*env)->FindClass (env, "java/io/FileOutputStream");
+      else
+	sclazz = (*env)->FindClass (env, "java/io/FileInputStream");
+      if ((*env)->ExceptionOccurred (env))
+	goto done;
+
+      smethod = (*env)->GetMethodID (env, sclazz, "<init>",
+				     "(Lgnu/java/nio/channels/FileChannelImpl;)V");
+      if ((*env)->ExceptionOccurred (env))
+	goto done;
+
+      streams[i] = (*env)->NewObject (env, sclazz, smethod, channel);
+      if ((*env)->ExceptionOccurred (env))
+	goto done;
+
+      (*env)->DeleteLocalRef (env, sclazz);
+    }
+  (*env)->DeleteLocalRef (env, clazz);
+
+  /* Invoke VMProcess.setProcessInfo() to update VMProcess object */
+  method = (*env)->GetMethodID (env,
+				(*env)->GetObjectClass (env, this),
+				"setProcessInfo",
+				"(Ljava/io/OutputStream;Ljava/io/InputStream;Ljava/io/InputStream;J)V");
+  if ((*env)->ExceptionOccurred (env))
+    goto done;
+  (*env)->CallVoidMethod (env, this, method,
+			  streams[0], streams[1], streams[2], (jlong) pid);
+  if ((*env)->ExceptionOccurred (env))
+    goto done;
+
+done:
+  /*
+   * We get here in both the success and failure cases in the
+   * parent process. Our goal is to clean up the mess we created.
+   */
+
+  /* Close child's ends of pipes */
+  for (i = 0; i < pipe_count; i++)
+    {
+      const int fd = fds[i][i != 0];
+
+      if (fd != -1)
+	close (fd);
+    }
+
+  /*
+   * Close parent's ends of pipes if Input/OutputStreams never got created.
+   * This can only happen in a failure case. If a Stream object
+   * was created for a file descriptor, we don't close it because it
+   * will get closed when the Stream object is finalized.
+   */
+  for (i = 0; i < pipe_count; i++)
+    {
+      const int fd = fds[i][i == 0];
+
+      if (fd != -1 && streams[i] == NULL)
+	close (fd);
+    }
+
+  /* Free C strings */
+  while (num_strings > 0)
+    free (strings[--num_strings]);
+  free (strings);
+
+  /* Done */
+  return;
+
+null_pointer_exception:
+  clazz = (*env)->FindClass (env, "java/lang/NullPointerException");
+  if ((*env)->ExceptionOccurred (env))
+    goto done;
+  (*env)->ThrowNew (env, clazz, NULL);
+  (*env)->DeleteLocalRef (env, clazz);
+  goto done;
+
+out_of_memory:
+  clazz = (*env)->FindClass (env, "java/lang/InternalError");
+  if ((*env)->ExceptionOccurred (env))
+    goto done;
+  (*env)->ThrowNew (env, clazz, errbuf);
+  (*env)->DeleteLocalRef (env, clazz);
+  goto done;
+
+system_error:
+  clazz = (*env)->FindClass (env, "java/io/IOException");
+  if ((*env)->ExceptionOccurred (env))
+    goto done;
+  (*env)->ThrowNew (env, clazz, errbuf);
+  (*env)->DeleteLocalRef (env, clazz);
+  goto done;
+}
+
+/*
+ * private static final native boolean nativeReap()
+ */
+JNIEXPORT jboolean JNICALL
+Java_java_lang_VMProcess_nativeReap (JNIEnv * env, jclass clazz)
+{
+  char ebuf[64];
+  jfieldID field;
+  jint status;
+  pid_t pid;
+
+  /* Try to reap a child process, but don't block */
+  if ((pid = waitpid ((pid_t) - 1, &status, WNOHANG)) == 0)
+    return JNI_FALSE;
+
+  /* Check result from waitpid() */
+  if (pid == (pid_t) - 1)
+    {
+      if (errno == ECHILD || errno == EINTR)
+	return JNI_FALSE;
+      TARGET_NATIVE_MISC_FORMAT_STRING2 (ebuf,
+					 sizeof (ebuf), "waitpid(%ld): %s",
+					 (long) pid, strerror (errno));
+      clazz = (*env)->FindClass (env, "java/lang/InternalError");
+      if ((*env)->ExceptionOccurred (env))
+	return JNI_FALSE;
+      (*env)->ThrowNew (env, clazz, ebuf);
+      (*env)->DeleteLocalRef (env, clazz);
+      return JNI_FALSE;
+    }
+
+  /* Get exit code; for signal termination return negative signal value XXX */
+  if (WIFEXITED (status))
+    status = (jint) (jbyte) WEXITSTATUS (status);
+  else if (WIFSIGNALED (status))
+    status = -(jint) WTERMSIG (status);
+  else
+    return JNI_FALSE;		/* process merely stopped; ignore */
+
+  /* Return process pid and exit status */
+  field = (*env)->GetStaticFieldID (env, clazz, "reapedPid", "J");
+  if ((*env)->ExceptionOccurred (env))
+    return JNI_FALSE;
+  (*env)->SetStaticLongField (env, clazz, field, (jlong) pid);
+  if ((*env)->ExceptionOccurred (env))
+    return JNI_FALSE;
+  field = (*env)->GetStaticFieldID (env, clazz, "reapedExitValue", "I");
+  if ((*env)->ExceptionOccurred (env))
+    return JNI_FALSE;
+  (*env)->SetStaticIntField (env, clazz, field, status);
+  if ((*env)->ExceptionOccurred (env))
+    return JNI_FALSE;
+
+  /* Done */
+  return JNI_TRUE;
+}
+
+/*
+ * private static final native void nativeKill(long)
+ */
+JNIEXPORT void JNICALL
+Java_java_lang_VMProcess_nativeKill (JNIEnv * env, jclass clazz, jlong pid)
+{
+  char ebuf[64];
+
+  if (kill ((pid_t) pid, SIGKILL) == -1)
+    {
+      TARGET_NATIVE_MISC_FORMAT_STRING2 (ebuf,
+					 sizeof (ebuf), "kill(%ld): %s",
+					 (long) pid, strerror (errno));
+      clazz = (*env)->FindClass (env, "java/lang/InternalError");
+      if ((*env)->ExceptionOccurred (env))
+	return;
+      (*env)->ThrowNew (env, clazz, ebuf);
+      (*env)->DeleteLocalRef (env, clazz);
+    }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-lang/java_lang_VMSystem.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-lang/java_lang_VMSystem.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-lang/java_lang_VMSystem.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-lang/java_lang_VMSystem.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,189 @@
+/* System.c -- native code for java.lang.System
+   Copyright (C) 1998, 1999, 2000, 2002, 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+ 
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#include "java_lang_VMSystem.h"
+
+#include <jcl.h>
+
+#include <sys/time.h>
+#include <stdlib.h>
+
+/*
+ * Class:     java_lang_VMSystem
+ * Method:    setIn0
+ * Signature: (Ljava/io/InputStream;)V
+ */
+JNIEXPORT void JNICALL
+Java_java_lang_VMSystem_setIn (JNIEnv * env,
+			       jclass thisClass __attribute__ ((__unused__)),
+			       jobject obj)
+{
+  jclass cls;
+  jfieldID field;
+
+  cls = JCL_FindClass (env, "java/lang/System");
+  if (!cls)
+    return;
+
+  field = (*env)->GetStaticFieldID (env, cls, "in", "Ljava/io/InputStream;");
+  if (!field)
+    return;
+  (*env)->SetStaticObjectField (env, cls, field, obj);
+}
+
+/*
+ * Class:     java_lang_VMSystem
+ * Method:    setOut0
+ * Signature: (Ljava/io/PrintStream;)V
+ */
+JNIEXPORT void JNICALL
+Java_java_lang_VMSystem_setOut (JNIEnv * env,
+				jclass thisClass __attribute__ ((__unused__)),
+				jobject obj)
+{
+  jclass cls;
+  jfieldID field;
+
+  cls = JCL_FindClass (env, "java/lang/System");
+  if (!cls)
+    return;
+
+  field = (*env)->GetStaticFieldID (env, cls, "out", "Ljava/io/PrintStream;");
+  if (!field)
+    return;
+  (*env)->SetStaticObjectField (env, cls, field, obj);
+}
+
+/*
+ * Class:     java_lang_VMSystem
+ * Method:    setErr0
+ * Signature: (Ljava/io/PrintStream;)V
+ */
+JNIEXPORT void JNICALL
+Java_java_lang_VMSystem_setErr (JNIEnv * env,
+				jclass thisClass __attribute__ ((__unused__)),
+				jobject obj)
+{
+  jclass cls;
+  jfieldID field;
+
+  cls = JCL_FindClass (env, "java/lang/System");
+  if (!cls)
+    return;
+
+  field = (*env)->GetStaticFieldID (env, cls, "err", "Ljava/io/PrintStream;");
+  if (!field)
+    return;
+  (*env)->SetStaticObjectField (env, cls, field, obj);
+}
+
+/*
+ * Class:     java_lang_VMSystem
+ * Method:    nanoTime
+ * Signature: ()J
+ */
+JNIEXPORT jlong JNICALL
+Java_java_lang_VMSystem_nanoTime
+  (JNIEnv * env __attribute__ ((__unused__)),
+   jclass thisClass __attribute__ ((__unused__)))
+{
+  /* Note: this implementation copied directly from Japhar's, by Chris Toshok. */
+  jlong result;
+  struct timeval tp;
+
+  if (gettimeofday (&tp, NULL) == -1)
+    (*env)->FatalError (env, "gettimeofday call failed.");
+
+  result = (jlong) tp.tv_sec;
+  result *= (jlong)1000000L;
+  result += (jlong)tp.tv_usec;
+  result *= (jlong)1000;
+
+  return result;
+}
+
+JNIEXPORT jstring JNICALL
+Java_java_lang_VMSystem_getenv (JNIEnv * env,
+				jclass klass __attribute__ ((__unused__)),
+				jstring jname)
+{
+  const char *cname;
+  const char *envname;
+
+  cname = JCL_jstring_to_cstring (env, jname);
+  if (cname == NULL)
+    return NULL;
+
+  envname = getenv (cname);
+  if (envname == NULL)
+    return NULL;
+
+  JCL_free_cstring (env, jname, cname);
+  return (*env)->NewStringUTF (env, envname);
+}
+
+JNIEXPORT jobject JNICALL
+Java_java_lang_VMSystem_environ (JNIEnv *env,
+				jclass klass __attribute__((__unused__)))
+{
+  char **env_pointer;
+  jobject variables;
+  jclass list_class;
+  jmethodID list_constructor;
+  jmethodID add;
+
+  list_class = (*env)->FindClass(env, "java/util/LinkedList");
+  if (list_class == NULL)
+    return NULL;
+  list_constructor = (*env)->GetMethodID(env, list_class, "<init>", "()V");
+  if (list_constructor == NULL)
+    return NULL;
+  variables = (*env)->NewObject(env, list_class, list_constructor);
+  if (variables == NULL)
+    return NULL;
+  add = (*env)->GetMethodID(env, list_class, "add", "(Ljava/lang/Object;)Z");
+  if (add == NULL)
+    return NULL;
+  env_pointer = environ;
+  while (*env_pointer != NULL)
+    {
+      jstring string = (*env)->NewStringUTF(env, *env_pointer);      
+      (*env)->CallBooleanMethod(env, variables, add, string);
+      ++env_pointer;
+    }
+  return variables;
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-lang/java_lang_reflect_VMArray.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-lang/java_lang_reflect_VMArray.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-lang/java_lang_reflect_VMArray.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-lang/java_lang_reflect_VMArray.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,62 @@
+/* java.lang.reflect.Array native functions
+   Copyright (C) 1998, 2004  Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+ 
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+/*
+ * java.lang.reflect.Array native functions.
+ * Author: John Keiser
+ * Version: 1.1.0
+ * Date: 2 Jun 1998
+ */
+
+#include <config.h>
+#include <stddef.h>
+
+#include "java_lang_reflect_VMArray.h"
+
+/*
+ * Class:     java_lang_reflect_Array
+ * Method:    createObjectArray
+ * Signature: (Ljava/lang/Class;I)Ljava/lang/Object;
+ */
+JNIEXPORT jobject JNICALL
+Java_java_lang_reflect_VMArray_createObjectArray
+  (JNIEnv * env,
+   jclass thisClass __attribute__ ((__unused__)),
+   jclass arrayType, jint arrayLength)
+{
+  return (jobject) (*env)->NewObjectArray (env, arrayLength, arrayType, NULL);
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-net/Makefile.am
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-net/Makefile.am?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-net/Makefile.am (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-net/Makefile.am Thu Nov  8 16:56:19 2007
@@ -0,0 +1,24 @@
+nativeexeclib_LTLIBRARIES = libjavanet.la
+
+if ENABLE_LOCAL_SOCKETS
+local_sources = gnu_java_net_local_LocalSocketImpl.c \
+		local.c \
+		local.h
+else
+local_sources = gnu_java_net_local_LocalSocketImpl.c
+endif
+
+libjavanet_la_SOURCES = javanet.c \
+			javanet.h \
+			java_net_VMInetAddress.c \
+			java_net_VMNetworkInterface.c \
+			java_net_VMURLConnection.c \
+			gnu_java_net_VMPlainDatagramSocketImpl.c \
+                        gnu_java_net_VMPlainSocketImpl.c \
+			$(local_sources)
+
+libjavanet_la_LIBADD = $(top_builddir)/native/jni/classpath/jcl.lo $(LIBMAGIC)
+
+AM_LDFLAGS = @CLASSPATH_MODULE@
+AM_CPPFLAGS = @CLASSPATH_INCLUDES@
+AM_CFLAGS = @WARNING_CFLAGS@ @STRICT_WARNING_CFLAGS@ @ERROR_CFLAGS@





More information about the llvm-commits mailing list