1 ==============================================================================
4 ______________________________________________________________________________
7 If you're new to XWT, you should read the documentation in the order
12 Start here. Includes a map of all other documentation and a
13 description of the directory strucure
15 - The XWT home page [http://www.xwt.org/]
17 - The XWT tutorial [http://www.xwt.org/tutorial.html]
19 Gentle introduction to what XWT is, and how to write
20 .xwt's. Good for anybody who wants to write XWT applications.
22 - The XWT reference [http://www.xwt.org/reference.html]
24 Precise, technical spec of exactly how XWT works. Assumes
25 familiarity with XWT (ie, you've read the tutorial). This is the
26 authoritative source for how an XWT engine should
29 - Javadoc [http://www.xwt.org/javadoc/]
31 The org.xwt.* packages are all documented with javadoc. You
32 should start by reading the package summary for org.xwt.Main,
33 and work your way around from there.
35 - Javasrc [http://www.xwt.org/javasrc]
37 Javasrc generates a syntax-colored and hyperlinked html copy of
41 ______________________________________________________________________________
46 COPYING - copyright information for all files in this distro
47 TM - trademark information for XWT
48 ant - a unix shell script to launch ant
49 bin/ - all binary stuff generated by ant builds
50 build.xml - ANT build file
52 lib/ - any third-party binary stuff needed during the build process
53 javago - a copy of the javago post-compilation bytecode inliner
54 ant.jar - the Jakarta project's ANT build tool, including Sun's XML parser
55 netscape.jar - minimal set of classes required for compiling against Netcape's Applet interfaces
56 msjvm.jar - minimal set of classes required for compiling against Microsoft's Applet interfaces
57 signtool - the Netscape Object Signing tool, for signing applets
58 signcode.exe - the Microsoft ActiveX Signing tool, for signing ActiveX controls
59 guidgen.exe - the Microsoft GUID generator, for generating OLE clsid's
60 cabarc.exe - the Microsoft CAB file generator, for creating .cab archives
61 javasrc.jar - javasrc, a tool for generating hyperlinked, syntax-colored html from java code
63 src/ - all java source files and xwt sources go here
64 jazz/ - jazzlib, which XWT currently uses since libgcj's java.util.zip.* is broken
67 bouncycastle/ - the BouncyCastle Crypto Library
68 gimp/tigert/ - some icons used in XWT Mail, by Tigert Labs
69 mozilla/ - a copy of Rhino, the Mozilla JavaScript interpreter
71 xwt/ - the source code for the XWT engine
72 demo/ - the XWT widget sampler
74 fonts/ - some XWF fonts
76 plat/ - platform abstraction classes for XWT
77 tasks/ - source code for some ANT tasks used in the XWT build process
78 themes/ - some XWT themes
79 util/ - some helper classes
81 xwt/standard/ - the XWT standard library
85 ______________________________________________________________________________
88 *** XWT now requires JDK 1.4 or later to build ***
90 To build, make sure your $JAVA_HOME points to jdk1.4 or later, and type
92 ./ant -Dplat=<platform> <targetname>
94 The name of any class in org.xwt.plat is a valid <platform>; here is a
95 list as of 20-Mar-2002:
97 Win32 - Windows 95 / NT4 or later
98 Java12 - Any Java 1.2+ compliant JVM
102 build - builds a binary for the selected platform
104 The following targets do not require that you specify a platform:
106 compile - compiles all .java's to .class'es
107 clean - empties bin/ and compiled binaries in dist/
110 ______________________________________________________________________________
113 - If you only want to build the JVM version of XWT, delete these three
116 xwt/src/org/xwt/plat/Win32.java
117 xwt/src/org/xwt/plat/POSIX.java
118 xwt/src/org/xwt/plat/GCJ.java
120 This will allow XWT to build correctly *without* gcc 3.1. Otherwise,
121 you must compile and install gcc 3.1.
124 - The Win32 native version of XWT can ONLY be built with the very
125 latest pre-release of GCC 3.1. You can follow the steps below to
126 create a cross-compiler from linux to Win32.
128 If the steps below fail, try adding "-D 20-Mar-2002" to the cvs
129 checkout line; 20-Mar-2002 was the last date on which the compiler
130 was known to work. Please don't do this unless you have attempted
131 without it, however, since it puts additional strain on the gcc cvs
134 There are also two patches at the end of this file which can be
135 applied to the branch -- the first fixes an inet_addr() bug on
136 Win32, the second enables stack traces.
138 # create an install area
140 export PREFIX=/usr/local/gcc
141 export CC=/usr/bin/gcc
144 export PATH=$PATH:$PREFIX/bin
146 sudo mkdir $PREFIX/i686-pc-mingw32/
148 wget http://telia.dl.sourceforge.net/sourceforge/mingw/MinGW-1.1.tar.gz
149 sudo tar -C $PREFIX/i686-pc-mingw32/ -xvzf MinGW-1.1.tar.gz
151 wget ftp://ftp.gnu.org/gnu/binutils/binutils-2.11.2.tar.gz
152 tar xzvf binutils-2.11.2.tar.gz
154 ./configure --target=i686-pc-mingw32 --prefix=$PREFIX
159 cvs -d :pserver:anoncvs@subversions.gnu.org:/cvsroot/gcc co -rgcc-3_1-branch gcc
164 --target=i686-pc-mingw32 \
165 --host=i686-pc-linux-gnu \
166 --enable-languages=c,c++,java \
168 --with-as=$PREFIX/i686-pc-mingw32/bin/as \
169 --with-ld=$PREFIX/i686-pc-mingw32/bin/ld \
173 --enable-gc-type=boehm \
175 --enable-threads=win32 \
176 --disable-hash-synchronization \
177 --disable-interpreter \
178 --enable-sjlj-exceptions
183 - The Linux native version is still experimental. You should configure
188 --enable-languages=c,c++,java \
191 --enable-threads=posix \
192 --enable-hash-synchronization \
194 --disable-interpreter
197 ______________________________________________________________________________
200 ** THIS DOESN'T WORK YET **
202 Ant takes a long time to start up, mainly because it has to load a
203 JVM. If you compile ant to native code using GCJ, it will load much
204 more quickly. So far, this only works on Linux.
208 jar xvf ~/xwt/lib/ant.jar
209 for A in `find * -name \*.properties -or -name \*.txt -or -name \*.mf`
210 do gcj -c --resource $A $A -o $A.o
212 CLASSPATH= gcj --main=org.apache.tools.ant.Main \
213 `find . -name \*.class -or -name \*.o` -o ant
217 ______________________________________________________________________________
220 Index: java/net/natInetAddress.cc
221 ===================================================================
222 RCS file: /cvs/gcc/gcc/libjava/java/net/natInetAddress.cc,v
223 retrieving revision 1.18.18.1
224 diff -u -r1.18.18.1 natInetAddress.cc
225 --- java/net/natInetAddress.cc 4 Mar 2002 20:02:19 -0000 1.18.18.1
226 +++ java/net/natInetAddress.cc 27 May 2002 22:54:40 -0000
231 +#include <platform.h>
235 Index: include/win32.h
236 ===================================================================
237 RCS file: /cvs/gcc/gcc/libjava/include/win32.h,v
238 retrieving revision 1.3.8.5
239 diff -u -r1.3.8.5 win32.h
240 --- include/win32.h 24 Apr 2002 01:04:45 -0000 1.3.8.5
241 +++ include/win32.h 27 May 2002 22:54:40 -0000
243 ARRAY and return the exact number of values stored. */
244 extern int backtrace (void **__array, int __size);
246 +// configure cannot correctly detect inet_addr due to Win32's
247 +// oddball header naming scheme
248 +#define HAVE_INET_ADDR
250 #endif /* __JV_WIN32_H__ */
254 ______________________________________________________________________________
255 Throwable.printStackTrace() patch
258 ===================================================================
259 RCS file: /cvs/gcc/gcc/libjava/java/lang/Class.h,v
260 retrieving revision 1.43
261 diff -u -r1.43 Class.h
262 --- Class.h 21 Dec 2001 19:47:50 -0000 1.43
263 +++ Class.h 24 Apr 2002 03:06:14 -0000
265 friend void _Jv_LayoutVTableMethods (jclass klass);
266 friend void _Jv_SetVTableEntries (jclass, _Jv_VTable *);
267 friend void _Jv_MakeVTable (jclass);
268 + friend JArray<java::lang::reflect::Method*>* _Jv_GetAllMethods();
270 // Return array class corresponding to element type KLASS, creating it if
272 Index: ClassLoader.java
273 ===================================================================
274 RCS file: /cvs/gcc/gcc/libjava/java/lang/ClassLoader.java,v
275 retrieving revision 1.16
276 diff -u -r1.16 ClassLoader.java
277 --- ClassLoader.java 7 Dec 2001 23:34:12 -0000 1.16
278 +++ ClassLoader.java 24 Apr 2002 03:06:14 -0000
280 // Default to returning null. Derived classes implement this.
284 + static native java.lang.reflect.Method[] getAllMethods();
285 + static native long[] getAllMethodAddrs();
288 Index: Throwable.java
289 ===================================================================
290 RCS file: /cvs/gcc/gcc/libjava/java/lang/Throwable.java,v
291 retrieving revision 1.10
292 diff -u -r1.10 Throwable.java
293 --- Throwable.java 24 Feb 2001 03:52:49 -0000 1.10
294 +++ Throwable.java 24 Apr 2002 03:06:14 -0000
295 @@ -123,21 +123,64 @@
296 printStackTrace (writer);
299 + private native static long longFromStackTraceBytes(byte[] stackTrace, int i);
301 public void printStackTrace (PrintWriter wr)
305 - CPlusPlusDemangler cPlusPlusFilter = new CPlusPlusDemangler (wr);
306 - PrintWriter writer = new PrintWriter (cPlusPlusFilter);
307 - printRawStackTrace (writer);
309 - if (cPlusPlusFilter.written == 0) // The demangler has failed...
310 - printRawStackTrace (wr);
313 + CPlusPlusDemangler cPlusPlusFilter = new CPlusPlusDemangler (wr);
314 + PrintWriter writer = new PrintWriter (cPlusPlusFilter);
315 + printRawStackTrace (writer);
317 + if (cPlusPlusFilter.written > 0) return;
319 + catch (Exception e1)
323 + wr.println(toString());
324 + if (stackTrace == null) {
328 - catch (Exception e1)
330 - printRawStackTrace (wr);
332 + long[] allAddrs = ClassLoader.getAllMethodAddrs();
333 + java.lang.reflect.Method[] meths = ClassLoader.getAllMethods();
335 + // FIXME: assumes little endian
336 + for(int i=0; i<stackTrace.length; i++) {
337 + long addr = longFromStackTraceBytes(stackTrace, i);
338 + if (addr == 0) break;
340 + int whichMethod = -1;
341 + for(int j=0; j<allAddrs.length; j++) {
342 + if (allAddrs[j] <= addr &&
343 + (whichMethod == -1 || allAddrs[whichMethod] < allAddrs[j])) {
348 + if (whichMethod == -1) {
349 + wr.println("[" + Long.toString(addr, 16) + "] " + "??");
353 + if (meths[whichMethod].getDeclaringClass().getName().equals("gnu.gcj.runtime.FirstThread") &&
354 + meths[whichMethod].getName().equals("call_main"))
357 + wr.println(" [" + Long.toString(addr, 16) + "] " +
358 + meths[whichMethod].getDeclaringClass().getName() + "." +
359 + meths[whichMethod].getName() + "() " +
360 + "+" + (addr - allAddrs[whichMethod])
363 + if (java.lang.Thread.class.isAssignableFrom(meths[whichMethod].getDeclaringClass()) &&
364 + meths[whichMethod].getName().equals("run"))
371 Index: natClassLoader.cc
372 ===================================================================
373 RCS file: /cvs/gcc/gcc/libjava/java/lang/natClassLoader.cc,v
374 retrieving revision 1.47.8.1
375 diff -u -r1.47.8.1 natClassLoader.cc
376 --- natClassLoader.cc 2 Apr 2002 22:19:55 -0000 1.47.8.1
377 +++ natClassLoader.cc 24 Apr 2002 03:06:14 -0000
379 #include <java/lang/StringBuffer.h>
380 #include <java/io/Serializable.h>
381 #include <java/lang/Cloneable.h>
382 +#include <java/lang/reflect/Method.h>
384 +#include<java/lang/reflect/Constructor.h>
385 +#include<gcj/method.h>
387 // FIXME: remove these.
388 #define CloneableClass java::lang::Cloneable::class$
390 static jclass loaded_classes[HASH_LEN];
392 // This is the root of a linked list of classes
394 +JArray<java::lang::reflect::Method*>*
395 +java::lang::ClassLoader::getAllMethods()
397 + return _Jv_GetAllMethods();
401 +java::lang::ClassLoader::getAllMethodAddrs()
403 + JArray<java::lang::reflect::Method*>* arr = _Jv_GetAllMethods();
404 + java::lang::reflect::Method** el = (java::lang::reflect::Method**)elements(arr);
405 + JArray<jlong>* ret = JvNewLongArray(arr->length);
406 + jlong* retel = (jlong*)elements(ret);
407 + for(int i=0; i<arr->length; i++)
408 + retel[i] = (jlong)((unsigned int)(_Jv_FromReflectedMethod (el[i])->ncode));
412 +JArray<java::lang::reflect::Method*>*
415 + int numMethods = 0;
417 + for(int i=0; i<HASH_LEN; i++)
418 + for(jclass c = loaded_classes[i]; c; c = c->next)
419 + numMethods += c->getDeclaredMethods()->length;
421 + JArray<java::lang::reflect::Method*>* ret =
422 + (JArray<java::lang::reflect::Method*>*)
423 + JvNewObjectArray(numMethods, &java::lang::reflect::Method::class$, NULL);
425 + java::lang::reflect::Method** el = (java::lang::reflect::Method**)elements(ret);
427 + for(int i=0; i<HASH_LEN; i++)
428 + for(jclass c = loaded_classes[i]; c; c = c->next) {
429 + JArray<java::lang::reflect::Method*>* methods = c->getDeclaredMethods();
430 + jint len = methods->length;
431 + java::lang::reflect::Method** meths = (java::lang::reflect::Method**)elements(methods);
432 + for(int j=0; j<len; j++) el[--numMethods] = meths[j];
440 Index: natThrowable.cc
441 ===================================================================
442 RCS file: /cvs/gcc/gcc/libjava/java/lang/natThrowable.cc,v
443 retrieving revision 1.11
444 diff -u -r1.11 natThrowable.cc
445 --- natThrowable.cc 7 Feb 2002 19:26:06 -0000 1.11
446 +++ natThrowable.cc 24 Apr 2002 03:06:14 -0000
451 +#include <platform.h>
453 #ifdef HAVE_EXECINFO_H
454 #include <execinfo.h>
456 #endif /* HAVE_BACKTRACE */
460 +// Returns the i^th call address in the stackTrace member, or 0 if i
461 +// is beyond the end of the trace. This has to be done in C++ because
462 +// the addresses in stackTrace are the same width as the platform's
463 +// pointers (which is unknown to Java code), and stackTrace is a
464 +// byte[] using the platform's endianness (which is unknown to Java
467 +java::lang::Throwable::longFromStackTraceBytes(jbyteArray stackArr, jint i)
469 + if (i * sizeof(void*) > stackArr->length) return 0;
470 + unsigned int* stack = (unsigned int*)elements(stackArr);
471 + return (jlong)stack[i];