libjava/classpath/ChangeLog.gcj:

2007-05-31  Matthias Klose  <doko@ubuntu.com>

        * javax/management/NotificationBroadcasterSupport.java
        (getNotificationInfo): Add cast.
        * native/jni/qt-peer/Makefile.am (AM_CXXFLAGS): Add libstdc++ include
        directories.
        * native/jni/qt-peer/Makefile.in: Regenerate.

libjava/ChangeLog:

2007-06-03  Matthias Klose  <doko@ubuntu.com>

        * java/io/natFileWin32.cc (setFilePermissions): New (stub only).
        _access: Handle EXEC query, stub only.

2007-06-03  Matthias Klose  <doko@ubuntu.com>

        Merged from classpath:
        * gnu/java/nio/SelectorProviderImpl.java: Whitespace merge.
        * java/lang/System.java(inheritedChannel): New.
        * java/lang/Character.java: Remove stray`;'.
        * java/net/MulticastSocket.java: Merged.
        * java/text/DateFormatSymbols.java(getInstance): New, comment updates.
        * java/text/Collator.java(getInstance): Merged.
        * java/util/Calendar.java: New attributes ALL_STYLES, SHORT, LONG.
        getDisplayName, getDisplayNames: New.
        * java/util/logging/Logger.java: Merged.
        * Regenerate .class and .h files.

2007-06-03  Matthias Klose  <doko@ubuntu.com>

        * java/io/File.java: Merge with classpath-0.95, new method
        setFilePermissions, new attribute EXEC.
        * java/io/natFilePosix.cc (setFilePermissions): New.
        _access: Handle EXEC query.
        * classpath/lib/java/io/File.class, java/io/File.h: Regenerate.

2007-06-03  Matthias Klose  <doko@ubuntu.com>

        Imported GNU Classpath 0.95.

        * classpath/Makefile.in,
        classpath/native/jni/midi-dssi/Makefile.in,
        classpath/native/jni/classpath/Makefile.in,
        classpath/native/jni/Makefile.in,
        classpath/native/jni/gconf-peer/Makefile.in,
        classpath/native/jni/java-io/Makefile.in,
        classpath/native/jni/native-lib/Makefile.in,
        classpath/native/jni/java-util/Makefile.in,
        classpath/native/jni/midi-alsa/Makefile.in,
        classpath/native/jni/java-lang/Makefile.in,
        classpath/native/jni/java-nio/Makefile.in,
        classpath/native/jni/java-net/Makefile.in,
        classpath/native/jni/xmlj/Makefile.in,
        classpath/native/jni/qt-peer/Makefile.in,
        classpath/native/jni/gtk-peer/Makefile.in,
        classpath/native/Makefile.in, classpath/native/jawt/Makefile.in,
        classpath/native/fdlibm/Makefile.in,
        classpath/native/plugin/Makefile.in,
        classpath/resource/Makefile.in, classpath/scripts/Makefile.in,
        classpath/tools/Makefile.in, classpath/doc/Makefile.in,
        classpath/doc/api/Makefile.in, classpath/lib/Makefile.in,
        classpath/external/Makefile.in, classpath/external/jsr166/Makefile.in,
        classpath/external/sax/Makefile.in,
        classpath/external/w3c_dom/Makefile.in,
        classpath/external/relaxngDatatype/Makefile.in,
        classpath/include/Makefile.in,
        classpath/examples/Makefile.in: Regenerate.
        * classpath/config.guess, classpath/config.sub,
        classpath/ltmain.sh : Update.
        * classpath/configure, classpath/depcomp, classpath/missing,
        classpath/aclocal.m4, classpath/install-sh: Regenerate.

        * gnu/classpath/Configuration.java (CLASSPATH_VERSION): Now 0.95.
        * sources.am: Regenerate.
        * Makefile.in: Regenerate.

        * Update the .class files and generated CNI header files, add new
        .class and generated CNI header files.
        * Remove generated files for removed java source files:
        classpath/gnu/java/net/BASE64.java,
        classpath/gnu/java/security/util/Base64.java,
        classpath/gnu/java/awt/peer/gtk/GThreadMutex.java,
        classpath/gnu/java/awt/peer/gtk/GThreadNativeMethodRunner.java,
        classpath/gnu/java/awt/font/autofit/Scaler.java,
        classpath/gnu/classpath/jdwp/util/Value.java,
        classpath/gnu/javax/net/ssl/Base64.java.
        * Remove empty directories.

        * Makefile.am(nat_source_files): Add natVMOperatingSystemMXBeanImpl.cc.
        * java/lang/Class.java(setAccessible): Merge from classpath.
        * java/util/Locale.java: Remove.
        * gnu/java/lang/management/VMOperatingSystemMXBeanImpl.java,
        gnu/java/lang/management/natVMOperatingSystemMXBeanImpl.cc: New.
        * gcj/javaprims.h: Update class declarations.
        * scripts/classes.pl: Update usage.
        * HACKING: Mention to build all peers.

From-SVN: r125302
This commit is contained in:
Matthias Klose 2007-06-03 23:18:43 +00:00
parent af333b9a7f
commit e1bea0c068
2951 changed files with 80982 additions and 68583 deletions

View file

@ -1,3 +1,91 @@
2007-06-03 Matthias Klose <doko@ubuntu.com>
* java/io/natFileWin32.cc (setFilePermissions): New (stub only).
_access: Handle EXEC query, stub only.
2007-06-03 Matthias Klose <doko@ubuntu.com>
Merged from classpath:
* gnu/java/nio/SelectorProviderImpl.java: Whitespace merge.
* java/lang/System.java(inheritedChannel): New.
* java/lang/Character.java: Remove stray`;'.
* java/net/MulticastSocket.java: Merged.
* java/text/DateFormatSymbols.java(getInstance): New, comment updates.
* java/text/Collator.java(getInstance): Merged.
* java/util/Calendar.java: New attributes ALL_STYLES, SHORT, LONG.
getDisplayName, getDisplayNames: New.
* java/util/logging/Logger.java: Merged.
* Regenerate .class and .h files.
2007-06-03 Matthias Klose <doko@ubuntu.com>
* java/io/File.java: Merge with classpath-0.95, new method
setFilePermissions, new attribute EXEC.
* java/io/natFilePosix.cc (setFilePermissions): New.
_access: Handle EXEC query.
* classpath/lib/java/io/File.class, java/io/File.h: Regenerate.
2007-06-03 Matthias Klose <doko@ubuntu.com>
Imported GNU Classpath 0.95.
* classpath/Makefile.in,
classpath/native/jni/midi-dssi/Makefile.in,
classpath/native/jni/classpath/Makefile.in,
classpath/native/jni/Makefile.in,
classpath/native/jni/gconf-peer/Makefile.in,
classpath/native/jni/java-io/Makefile.in,
classpath/native/jni/native-lib/Makefile.in,
classpath/native/jni/java-util/Makefile.in,
classpath/native/jni/midi-alsa/Makefile.in,
classpath/native/jni/java-lang/Makefile.in,
classpath/native/jni/java-nio/Makefile.in,
classpath/native/jni/java-net/Makefile.in,
classpath/native/jni/xmlj/Makefile.in,
classpath/native/jni/qt-peer/Makefile.in,
classpath/native/jni/gtk-peer/Makefile.in,
classpath/native/Makefile.in, classpath/native/jawt/Makefile.in,
classpath/native/fdlibm/Makefile.in,
classpath/native/plugin/Makefile.in,
classpath/resource/Makefile.in, classpath/scripts/Makefile.in,
classpath/tools/Makefile.in, classpath/doc/Makefile.in,
classpath/doc/api/Makefile.in, classpath/lib/Makefile.in,
classpath/external/Makefile.in, classpath/external/jsr166/Makefile.in,
classpath/external/sax/Makefile.in,
classpath/external/w3c_dom/Makefile.in,
classpath/external/relaxngDatatype/Makefile.in,
classpath/include/Makefile.in,
classpath/examples/Makefile.in: Regenerate.
* classpath/config.guess, classpath/config.sub,
classpath/ltmain.sh : Update.
* classpath/configure, classpath/depcomp, classpath/missing,
classpath/aclocal.m4, classpath/install-sh: Regenerate.
* gnu/classpath/Configuration.java (CLASSPATH_VERSION): Now 0.95.
* sources.am: Regenerate.
* Makefile.in: Regenerate.
* Update the .class files and generated CNI header files, add new
.class and generated CNI header files.
* Remove generated files for removed java source files:
classpath/gnu/java/net/BASE64.java,
classpath/gnu/java/security/util/Base64.java,
classpath/gnu/java/awt/peer/gtk/GThreadMutex.java,
classpath/gnu/java/awt/peer/gtk/GThreadNativeMethodRunner.java,
classpath/gnu/java/awt/font/autofit/Scaler.java,
classpath/gnu/classpath/jdwp/util/Value.java,
classpath/gnu/javax/net/ssl/Base64.java.
* Remove empty directories.
* Makefile.am(nat_source_files): Add natVMOperatingSystemMXBeanImpl.cc.
* java/lang/Class.java(setAccessible): Merge from classpath.
* java/util/Locale.java: Remove.
* gnu/java/lang/management/VMOperatingSystemMXBeanImpl.java,
gnu/java/lang/management/natVMOperatingSystemMXBeanImpl.cc: New.
* gcj/javaprims.h: Update class declarations.
* scripts/classes.pl: Update usage.
* HACKING: Mention to build all peers.
2007-06-02 Paolo Bonzini <bonzini@gnu.org>
* configure: Regenerate.

View file

@ -89,6 +89,8 @@ To import a new release:
scripts/makemake.tcl > sources.am
automake
- Build, fix, till everything works.
Be sure to build all peers (--enable-java-awt=gtk,xlib,qt
--enable-gconf-peer)
Be sure to update gnu/classpath/Configuration.java to reflect
the new version
Possibly update the gcj/javaprims.h file with scripts/classes.pl

View file

@ -864,6 +864,7 @@ gnu/java/lang/management/natVMGarbageCollectorMXBeanImpl.cc \
gnu/java/lang/management/natVMMemoryMXBeanImpl.cc \
gnu/java/lang/management/natVMMemoryManagerMXBeanImpl.cc \
gnu/java/lang/management/natVMMemoryPoolMXBeanImpl.cc \
gnu/java/lang/management/natVMOperatingSystemMXBeanImpl.cc \
gnu/java/lang/management/natVMRuntimeMXBeanImpl.cc \
gnu/java/lang/management/natVMThreadMXBeanImpl.cc \
gnu/java/net/natPlainDatagramSocketImpl.cc \

View file

@ -244,11 +244,12 @@ am__DEPENDENCIES_1 = gnu/awt.lo gnu/awt/j2d.lo gnu/classpath.lo \
java/rmi/activation.lo java/rmi/dgc.lo java/rmi/registry.lo \
java/rmi/server.lo java/security.lo java/security/acl.lo \
java/security/cert.lo java/security/interfaces.lo \
java/security/spec.lo java/sql.lo java/text.lo java/util.lo \
java/util/concurrent.lo java/util/concurrent/atomic.lo \
java/util/concurrent/locks.lo java/util/jar.lo \
java/util/logging.lo java/util/prefs.lo java/util/regex.lo \
java/util/zip.lo javax/accessibility.lo javax/crypto.lo \
java/security/spec.lo java/sql.lo java/text.lo \
java/text/spi.lo java/util.lo java/util/concurrent.lo \
java/util/concurrent/atomic.lo java/util/concurrent/locks.lo \
java/util/jar.lo java/util/logging.lo java/util/prefs.lo \
java/util/regex.lo java/util/spi.lo java/util/zip.lo \
javax/accessibility.lo javax/activity.lo javax/crypto.lo \
javax/crypto/interfaces.lo javax/crypto/spec.lo \
javax/management.lo javax/management/loading.lo \
javax/management/openmbean.lo javax/naming.lo \
@ -314,6 +315,7 @@ am__libgcj_la_SOURCES_DIST = prims.cc jni.cc jvmti.cc exception.cc \
gnu/java/lang/management/natVMMemoryMXBeanImpl.cc \
gnu/java/lang/management/natVMMemoryManagerMXBeanImpl.cc \
gnu/java/lang/management/natVMMemoryPoolMXBeanImpl.cc \
gnu/java/lang/management/natVMOperatingSystemMXBeanImpl.cc \
gnu/java/lang/management/natVMRuntimeMXBeanImpl.cc \
gnu/java/lang/management/natVMThreadMXBeanImpl.cc \
gnu/java/net/natPlainDatagramSocketImpl.cc \
@ -376,6 +378,7 @@ am__objects_2 = gnu/classpath/jdwp/natVMFrame.lo \
gnu/java/lang/management/natVMMemoryMXBeanImpl.lo \
gnu/java/lang/management/natVMMemoryManagerMXBeanImpl.lo \
gnu/java/lang/management/natVMMemoryPoolMXBeanImpl.lo \
gnu/java/lang/management/natVMOperatingSystemMXBeanImpl.lo \
gnu/java/lang/management/natVMRuntimeMXBeanImpl.lo \
gnu/java/lang/management/natVMThreadMXBeanImpl.lo \
gnu/java/net/natPlainDatagramSocketImpl.lo \
@ -1152,6 +1155,7 @@ gnu_awt_xlib_header_files = $(patsubst %.java,%.h,$(gnu_awt_xlib_source_files))
gnu_classpath_source_files = \
gnu/classpath/Configuration.java \
classpath/gnu/classpath/NotImplementedException.java \
classpath/gnu/classpath/Pair.java \
classpath/gnu/classpath/Pointer.java \
classpath/gnu/classpath/Pointer32.java \
classpath/gnu/classpath/Pointer64.java \
@ -1294,7 +1298,6 @@ classpath/gnu/classpath/jdwp/util/MethodResult.java \
classpath/gnu/classpath/jdwp/util/MonitorInfo.java \
classpath/gnu/classpath/jdwp/util/NullObject.java \
classpath/gnu/classpath/jdwp/util/Signature.java \
classpath/gnu/classpath/jdwp/util/Value.java \
classpath/gnu/classpath/jdwp/util/VariableTable.java
gnu_classpath_jdwp_util_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(gnu_classpath_jdwp_util_source_files)))
@ -1412,6 +1415,7 @@ classpath/gnu/java/awt/AWTUtilities.java \
classpath/gnu/java/awt/BitMaskExtent.java \
classpath/gnu/java/awt/BitwiseXORComposite.java \
classpath/gnu/java/awt/Buffers.java \
classpath/gnu/java/awt/ClasspathGraphicsEnvironment.java \
classpath/gnu/java/awt/ClasspathToolkit.java \
classpath/gnu/java/awt/ComponentDataBlitOp.java \
classpath/gnu/java/awt/ComponentReshapeEvent.java \
@ -1453,22 +1457,27 @@ classpath/gnu/java/awt/font/GNUGlyphVector.java
gnu_java_awt_font_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(gnu_java_awt_font_source_files)))
gnu_java_awt_font_autofit_source_files = \
classpath/gnu/java/awt/font/autofit/AutoHinter.java \
classpath/gnu/java/awt/font/autofit/AxisHints.java \
classpath/gnu/java/awt/font/autofit/Constants.java \
classpath/gnu/java/awt/font/autofit/Edge.java \
classpath/gnu/java/awt/font/autofit/GlyphHints.java \
classpath/gnu/java/awt/font/autofit/HintScaler.java \
classpath/gnu/java/awt/font/autofit/Latin.java \
classpath/gnu/java/awt/font/autofit/LatinAxis.java \
classpath/gnu/java/awt/font/autofit/LatinBlue.java \
classpath/gnu/java/awt/font/autofit/LatinMetrics.java \
classpath/gnu/java/awt/font/autofit/Scaler.java \
classpath/gnu/java/awt/font/autofit/Script.java \
classpath/gnu/java/awt/font/autofit/ScriptMetrics.java \
classpath/gnu/java/awt/font/autofit/Segment.java \
classpath/gnu/java/awt/font/autofit/Utils.java \
classpath/gnu/java/awt/font/autofit/Width.java
gnu_java_awt_font_autofit_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(gnu_java_awt_font_autofit_source_files)))
gnu_java_awt_font_opentype_source_files = \
classpath/gnu/java/awt/font/opentype/CharGlyphMap.java \
classpath/gnu/java/awt/font/opentype/GlyphNamer.java \
classpath/gnu/java/awt/font/opentype/Hinter.java \
classpath/gnu/java/awt/font/opentype/MacResourceFork.java \
classpath/gnu/java/awt/font/opentype/NameDecoder.java \
classpath/gnu/java/awt/font/opentype/OpenTypeFont.java \
@ -1481,6 +1490,7 @@ classpath/gnu/java/awt/font/opentype/truetype/Fixed.java \
classpath/gnu/java/awt/font/opentype/truetype/GlyphLoader.java \
classpath/gnu/java/awt/font/opentype/truetype/GlyphLocator.java \
classpath/gnu/java/awt/font/opentype/truetype/GlyphMeasurer.java \
classpath/gnu/java/awt/font/opentype/truetype/Point.java \
classpath/gnu/java/awt/font/opentype/truetype/TrueTypeScaler.java \
classpath/gnu/java/awt/font/opentype/truetype/VirtualMachine.java \
classpath/gnu/java/awt/font/opentype/truetype/Zone.java \
@ -1494,6 +1504,7 @@ classpath/gnu/java/awt/image/XBMDecoder.java
gnu_java_awt_image_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(gnu_java_awt_image_source_files)))
gnu_java_awt_java2d_source_files = \
classpath/gnu/java/awt/java2d/AbstractGraphics2D.java \
classpath/gnu/java/awt/java2d/ActiveEdges.java \
classpath/gnu/java/awt/java2d/AlphaCompositeContext.java \
classpath/gnu/java/awt/java2d/CubicSegment.java \
classpath/gnu/java/awt/java2d/ImagePaint.java \
@ -1502,15 +1513,20 @@ classpath/gnu/java/awt/java2d/PolyEdge.java \
classpath/gnu/java/awt/java2d/PolyEdgeComparator.java \
classpath/gnu/java/awt/java2d/QuadSegment.java \
classpath/gnu/java/awt/java2d/RasterGraphics.java \
classpath/gnu/java/awt/java2d/Scanline.java \
classpath/gnu/java/awt/java2d/ScanlineConverter.java \
classpath/gnu/java/awt/java2d/Segment.java \
classpath/gnu/java/awt/java2d/ShapeCache.java \
classpath/gnu/java/awt/java2d/TexturePaintContext.java
gnu_java_awt_java2d_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(gnu_java_awt_java2d_source_files)))
gnu_java_awt_peer_source_files = \
classpath/gnu/java/awt/peer/ClasspathDesktopPeer.java \
classpath/gnu/java/awt/peer/ClasspathFontPeer.java \
classpath/gnu/java/awt/peer/EmbeddedWindowPeer.java \
classpath/gnu/java/awt/peer/GLightweightPeer.java \
classpath/gnu/java/awt/peer/GnomeDesktopPeer.java \
classpath/gnu/java/awt/peer/KDEDesktopPeer.java \
classpath/gnu/java/awt/peer/NativeEventLoopRunningEvent.java
gnu_java_awt_peer_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(gnu_java_awt_peer_source_files)))
@ -1523,8 +1539,6 @@ classpath/gnu/java/awt/peer/gtk/CairoSurfaceGraphics.java \
classpath/gnu/java/awt/peer/gtk/ComponentGraphics.java \
classpath/gnu/java/awt/peer/gtk/ComponentGraphicsCopy.java \
classpath/gnu/java/awt/peer/gtk/FreetypeGlyphVector.java \
classpath/gnu/java/awt/peer/gtk/GThreadMutex.java \
classpath/gnu/java/awt/peer/gtk/GThreadNativeMethodRunner.java \
classpath/gnu/java/awt/peer/gtk/GdkFontPeer.java \
classpath/gnu/java/awt/peer/gtk/GdkGraphicsConfiguration.java \
classpath/gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java \
@ -1782,6 +1796,7 @@ gnu/java/lang/management/VMGarbageCollectorMXBeanImpl.java \
gnu/java/lang/management/VMMemoryMXBeanImpl.java \
gnu/java/lang/management/VMMemoryManagerMXBeanImpl.java \
gnu/java/lang/management/VMMemoryPoolMXBeanImpl.java \
gnu/java/lang/management/VMOperatingSystemMXBeanImpl.java \
gnu/java/lang/management/VMRuntimeMXBeanImpl.java \
gnu/java/lang/management/VMThreadMXBeanImpl.java
@ -1940,11 +1955,11 @@ gnu/java/locale/LocaleInformation_zh_TW.java
gnu_java_locale_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(gnu_java_locale_source_files)))
gnu_java_math_source_files = \
classpath/gnu/java/math/Fixed.java \
classpath/gnu/java/math/MPN.java
gnu_java_math_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(gnu_java_math_source_files)))
gnu_java_net_source_files = \
classpath/gnu/java/net/BASE64.java \
classpath/gnu/java/net/CRLFInputStream.java \
classpath/gnu/java/net/CRLFOutputStream.java \
classpath/gnu/java/net/DefaultContentHandlerFactory.java \
@ -2371,7 +2386,6 @@ classpath/gnu/java/security/sig/rsa/RSASignatureFactory.java
gnu_java_security_sig_rsa_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(gnu_java_security_sig_rsa_source_files)))
gnu_java_security_util_source_files = \
classpath/gnu/java/security/util/Base64.java \
classpath/gnu/java/security/util/ByteArray.java \
classpath/gnu/java/security/util/ByteBufferOutputStream.java \
classpath/gnu/java/security/util/DerUtil.java \
@ -2405,9 +2419,12 @@ classpath/gnu/java/security/x509/ext/CRLNumber.java \
classpath/gnu/java/security/x509/ext/CertificatePolicies.java \
classpath/gnu/java/security/x509/ext/ExtendedKeyUsage.java \
classpath/gnu/java/security/x509/ext/Extension.java \
classpath/gnu/java/security/x509/ext/GeneralName.java \
classpath/gnu/java/security/x509/ext/GeneralNames.java \
classpath/gnu/java/security/x509/ext/GeneralSubtree.java \
classpath/gnu/java/security/x509/ext/IssuerAlternativeNames.java \
classpath/gnu/java/security/x509/ext/KeyUsage.java \
classpath/gnu/java/security/x509/ext/NameConstraints.java \
classpath/gnu/java/security/x509/ext/PolicyConstraint.java \
classpath/gnu/java/security/x509/ext/PolicyMappings.java \
classpath/gnu/java/security/x509/ext/PrivateKeyUsagePeriod.java \
@ -2429,6 +2446,7 @@ classpath/gnu/java/text/WordBreakIterator.java
gnu_java_text_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(gnu_java_text_source_files)))
gnu_java_util_source_files = \
classpath/gnu/java/util/Base64.java \
classpath/gnu/java/util/DoubleEnumeration.java \
classpath/gnu/java/util/EmptyEnumeration.java \
classpath/gnu/java/util/WeakIdentityHashMap.java \
@ -2914,7 +2932,8 @@ classpath/gnu/javax/imageio/png/PNGTime.java
gnu_javax_imageio_png_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(gnu_javax_imageio_png_source_files)))
gnu_javax_management_source_files = \
classpath/gnu/javax/management/ListenerData.java \
classpath/gnu/javax/management/Server.java
classpath/gnu/javax/management/Server.java \
classpath/gnu/javax/management/Translator.java
gnu_javax_naming_giop_source_files = \
classpath/gnu/javax/naming/giop/ContextContinuation.java \
@ -2946,7 +2965,6 @@ classpath/gnu/javax/naming/jndi/url/rmi/rmiURLContextFactory.java
gnu_javax_naming_jndi_url_rmi_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(gnu_javax_naming_jndi_url_rmi_source_files)))
gnu_javax_net_ssl_source_files = \
classpath/gnu/javax/net/ssl/AbstractSessionContext.java \
classpath/gnu/javax/net/ssl/Base64.java \
classpath/gnu/javax/net/ssl/EntropySource.java \
classpath/gnu/javax/net/ssl/NullManagerParameters.java \
classpath/gnu/javax/net/ssl/PreSharedKeyManager.java \
@ -3754,6 +3772,7 @@ classpath/java/awt/ContainerOrderFocusTraversalPolicy.java \
classpath/java/awt/Cursor.java \
classpath/java/awt/DefaultFocusTraversalPolicy.java \
classpath/java/awt/DefaultKeyboardFocusManager.java \
classpath/java/awt/Desktop.java \
classpath/java/awt/Dialog.java \
classpath/java/awt/Dimension.java \
classpath/java/awt/DisplayMode.java \
@ -4059,6 +4078,7 @@ classpath/java/awt/peer/CheckboxPeer.java \
classpath/java/awt/peer/ChoicePeer.java \
classpath/java/awt/peer/ComponentPeer.java \
classpath/java/awt/peer/ContainerPeer.java \
classpath/java/awt/peer/DesktopPeer.java \
classpath/java/awt/peer/DialogPeer.java \
classpath/java/awt/peer/FileDialogPeer.java \
classpath/java/awt/peer/FontPeer.java \
@ -4101,6 +4121,7 @@ classpath/java/beans/AppletInitializer.java \
classpath/java/beans/BeanDescriptor.java \
classpath/java/beans/BeanInfo.java \
classpath/java/beans/Beans.java \
classpath/java/beans/ConstructorProperties.java \
classpath/java/beans/Customizer.java \
classpath/java/beans/DefaultPersistenceDelegate.java \
classpath/java/beans/DesignMode.java \
@ -4367,6 +4388,7 @@ java_lang_management_source_files = \
classpath/java/lang/management/ClassLoadingMXBean.java \
classpath/java/lang/management/CompilationMXBean.java \
classpath/java/lang/management/GarbageCollectorMXBean.java \
classpath/java/lang/management/LockInfo.java \
classpath/java/lang/management/ManagementFactory.java \
classpath/java/lang/management/ManagementPermission.java \
classpath/java/lang/management/MemoryMXBean.java \
@ -4375,6 +4397,7 @@ classpath/java/lang/management/MemoryNotificationInfo.java \
classpath/java/lang/management/MemoryPoolMXBean.java \
classpath/java/lang/management/MemoryType.java \
classpath/java/lang/management/MemoryUsage.java \
classpath/java/lang/management/MonitorInfo.java \
classpath/java/lang/management/OperatingSystemMXBean.java \
classpath/java/lang/management/RuntimeMXBean.java \
classpath/java/lang/management/ThreadInfo.java \
@ -4878,6 +4901,15 @@ classpath/java/text/SimpleDateFormat.java \
classpath/java/text/StringCharacterIterator.java
java_text_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(java_text_source_files)))
java_text_spi_source_files = \
classpath/java/text/spi/BreakIteratorProvider.java \
classpath/java/text/spi/CollatorProvider.java \
classpath/java/text/spi/DateFormatProvider.java \
classpath/java/text/spi/DateFormatSymbolsProvider.java \
classpath/java/text/spi/DecimalFormatSymbolsProvider.java \
classpath/java/text/spi/NumberFormatProvider.java
java_text_spi_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(java_text_spi_source_files)))
java_util_source_files = \
classpath/java/util/AbstractCollection.java \
classpath/java/util/AbstractList.java \
@ -4931,7 +4963,7 @@ classpath/java/util/LinkedList.java \
classpath/java/util/List.java \
classpath/java/util/ListIterator.java \
classpath/java/util/ListResourceBundle.java \
java/util/Locale.java \
classpath/java/util/Locale.java \
classpath/java/util/Map.java \
classpath/java/util/MissingFormatArgumentException.java \
classpath/java/util/MissingFormatWidthException.java \
@ -4950,6 +4982,8 @@ classpath/external/jsr166/java/util/Queue.java \
classpath/java/util/Random.java \
classpath/java/util/RandomAccess.java \
classpath/java/util/ResourceBundle.java \
classpath/java/util/ServiceConfigurationError.java \
classpath/java/util/ServiceLoader.java \
classpath/java/util/Set.java \
classpath/java/util/SimpleTimeZone.java \
classpath/java/util/SortedMap.java \
@ -5093,6 +5127,13 @@ classpath/java/util/regex/Pattern.java \
classpath/java/util/regex/PatternSyntaxException.java
java_util_regex_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(java_util_regex_source_files)))
java_util_spi_source_files = \
classpath/java/util/spi/CurrencyNameProvider.java \
classpath/java/util/spi/LocaleNameProvider.java \
classpath/java/util/spi/LocaleServiceProvider.java \
classpath/java/util/spi/TimeZoneNameProvider.java
java_util_spi_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(java_util_spi_source_files)))
java_util_zip_source_files = \
classpath/java/util/zip/Adler32.java \
classpath/java/util/zip/CRC32.java \
@ -5144,6 +5185,12 @@ classpath/javax/accessibility/AccessibleTextSequence.java \
classpath/javax/accessibility/AccessibleValue.java
javax_accessibility_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(javax_accessibility_source_files)))
javax_activity_source_files = \
classpath/javax/activity/ActivityCompletedException.java \
classpath/javax/activity/ActivityRequiredException.java \
classpath/javax/activity/InvalidActivityException.java
javax_activity_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(javax_activity_source_files)))
javax_crypto_source_files = \
classpath/javax/crypto/BadPaddingException.java \
classpath/javax/crypto/Cipher.java \
@ -5245,11 +5292,18 @@ classpath/javax/imageio/stream/MemoryCacheImageOutputStream.java
javax_management_source_files = \
classpath/javax/management/Attribute.java \
classpath/javax/management/AttributeChangeNotification.java \
classpath/javax/management/AttributeChangeNotificationFilter.java \
classpath/javax/management/AttributeList.java \
classpath/javax/management/AttributeNotFoundException.java \
classpath/javax/management/AttributeValueExp.java \
classpath/javax/management/BadAttributeValueExpException.java \
classpath/javax/management/BadBinaryOpValueExpException.java \
classpath/javax/management/BadStringOperationException.java \
classpath/javax/management/DefaultLoaderRepository.java \
classpath/javax/management/Descriptor.java \
classpath/javax/management/DescriptorAccess.java \
classpath/javax/management/DescriptorRead.java \
classpath/javax/management/DynamicMBean.java \
classpath/javax/management/InstanceAlreadyExistsException.java \
classpath/javax/management/InstanceNotFoundException.java \
@ -5258,6 +5312,7 @@ classpath/javax/management/InvalidApplicationException.java \
classpath/javax/management/InvalidAttributeValueException.java \
classpath/javax/management/JMException.java \
classpath/javax/management/JMRuntimeException.java \
classpath/javax/management/JMX.java \
classpath/javax/management/ListenerNotFoundException.java \
classpath/javax/management/MBeanAttributeInfo.java \
classpath/javax/management/MBeanConstructorInfo.java \
@ -5276,19 +5331,26 @@ classpath/javax/management/MBeanServerConnection.java \
classpath/javax/management/MBeanServerDelegate.java \
classpath/javax/management/MBeanServerDelegateMBean.java \
classpath/javax/management/MBeanServerFactory.java \
classpath/javax/management/MBeanServerInvocationHandler.java \
classpath/javax/management/MBeanServerNotification.java \
classpath/javax/management/MBeanServerPermission.java \
classpath/javax/management/MBeanTrustPermission.java \
classpath/javax/management/MXBean.java \
classpath/javax/management/MalformedObjectNameException.java \
classpath/javax/management/NotCompliantMBeanException.java \
classpath/javax/management/Notification.java \
classpath/javax/management/NotificationBroadcaster.java \
classpath/javax/management/NotificationBroadcasterSupport.java \
classpath/javax/management/NotificationEmitter.java \
classpath/javax/management/NotificationFilter.java \
classpath/javax/management/NotificationFilterSupport.java \
classpath/javax/management/NotificationListener.java \
classpath/javax/management/ObjectInstance.java \
classpath/javax/management/ObjectName.java \
classpath/javax/management/OperationsException.java \
classpath/javax/management/PersistentMBean.java \
classpath/javax/management/Query.java \
classpath/javax/management/QueryEval.java \
classpath/javax/management/QueryExp.java \
classpath/javax/management/ReflectionException.java \
classpath/javax/management/RuntimeErrorException.java \
@ -5296,6 +5358,7 @@ classpath/javax/management/RuntimeMBeanException.java \
classpath/javax/management/RuntimeOperationsException.java \
classpath/javax/management/ServiceNotFoundException.java \
classpath/javax/management/StandardMBean.java \
classpath/javax/management/StringValueExp.java \
classpath/javax/management/ValueExp.java
javax_management_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(javax_management_source_files)))
@ -5306,6 +5369,7 @@ javax_management_loading_header_files = $(patsubst classpath/%,%,$(patsubst %.ja
javax_management_openmbean_source_files = \
classpath/javax/management/openmbean/ArrayType.java \
classpath/javax/management/openmbean/CompositeData.java \
classpath/javax/management/openmbean/CompositeDataInvocationHandler.java \
classpath/javax/management/openmbean/CompositeDataSupport.java \
classpath/javax/management/openmbean/CompositeType.java \
classpath/javax/management/openmbean/InvalidKeyException.java \
@ -7423,6 +7487,7 @@ all_packages_source_files = \
java/security/spec.list \
java/sql.list \
java/text.list \
java/text/spi.list \
java/util.list \
java/util/concurrent.list \
java/util/concurrent/atomic.list \
@ -7431,8 +7496,10 @@ all_packages_source_files = \
java/util/logging.list \
java/util/prefs.list \
java/util/regex.list \
java/util/spi.list \
java/util/zip.list \
javax/accessibility.list \
javax/activity.list \
javax/crypto.list \
javax/crypto/interfaces.list \
javax/crypto/spec.list \
@ -7670,6 +7737,7 @@ ordinary_header_files = \
$(java_security_spec_header_files) \
$(java_sql_header_files) \
$(java_text_header_files) \
$(java_text_spi_header_files) \
$(java_util_header_files) \
$(java_util_concurrent_header_files) \
$(java_util_concurrent_atomic_header_files) \
@ -7678,8 +7746,10 @@ ordinary_header_files = \
$(java_util_logging_header_files) \
$(java_util_prefs_header_files) \
$(java_util_regex_header_files) \
$(java_util_spi_header_files) \
$(java_util_zip_header_files) \
$(javax_accessibility_header_files) \
$(javax_activity_header_files) \
$(javax_crypto_header_files) \
$(javax_crypto_interfaces_header_files) \
$(javax_crypto_spec_header_files) \
@ -7794,6 +7864,7 @@ property_files = \
classpath/resource/org/ietf/jgss/MessagesBundle.properties \
classpath/resource/sun/rmi/rmic/messages.properties \
classpath/resource/com/sun/tools/javac/messages.properties \
classpath/resource/META-INF/services/java.util.prefs.PreferencesFactory \
classpath/resource/META-INF/services/java.util.prefs.PreferencesFactory.in \
classpath/resource/META-INF/services/javax.sound.midi.spi.MidiDeviceProvider \
classpath/resource/META-INF/services/javax.sound.midi.spi.MidiFileReader \
@ -8002,6 +8073,7 @@ gnu/java/lang/management/natVMGarbageCollectorMXBeanImpl.cc \
gnu/java/lang/management/natVMMemoryMXBeanImpl.cc \
gnu/java/lang/management/natVMMemoryManagerMXBeanImpl.cc \
gnu/java/lang/management/natVMMemoryPoolMXBeanImpl.cc \
gnu/java/lang/management/natVMOperatingSystemMXBeanImpl.cc \
gnu/java/lang/management/natVMRuntimeMXBeanImpl.cc \
gnu/java/lang/management/natVMThreadMXBeanImpl.cc \
gnu/java/net/natPlainDatagramSocketImpl.cc \
@ -8443,6 +8515,9 @@ gnu/java/lang/management/natVMMemoryManagerMXBeanImpl.lo: \
gnu/java/lang/management/natVMMemoryPoolMXBeanImpl.lo: \
gnu/java/lang/management/$(am__dirstamp) \
gnu/java/lang/management/$(DEPDIR)/$(am__dirstamp)
gnu/java/lang/management/natVMOperatingSystemMXBeanImpl.lo: \
gnu/java/lang/management/$(am__dirstamp) \
gnu/java/lang/management/$(DEPDIR)/$(am__dirstamp)
gnu/java/lang/management/natVMRuntimeMXBeanImpl.lo: \
gnu/java/lang/management/$(am__dirstamp) \
gnu/java/lang/management/$(DEPDIR)/$(am__dirstamp)
@ -8930,6 +9005,8 @@ mostlyclean-compile:
-rm -f gnu/java/lang/management/natVMMemoryManagerMXBeanImpl.lo
-rm -f gnu/java/lang/management/natVMMemoryPoolMXBeanImpl.$(OBJEXT)
-rm -f gnu/java/lang/management/natVMMemoryPoolMXBeanImpl.lo
-rm -f gnu/java/lang/management/natVMOperatingSystemMXBeanImpl.$(OBJEXT)
-rm -f gnu/java/lang/management/natVMOperatingSystemMXBeanImpl.lo
-rm -f gnu/java/lang/management/natVMRuntimeMXBeanImpl.$(OBJEXT)
-rm -f gnu/java/lang/management/natVMRuntimeMXBeanImpl.lo
-rm -f gnu/java/lang/management/natVMThreadMXBeanImpl.$(OBJEXT)
@ -9115,6 +9192,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/lang/management/$(DEPDIR)/natVMMemoryMXBeanImpl.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/lang/management/$(DEPDIR)/natVMMemoryManagerMXBeanImpl.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/lang/management/$(DEPDIR)/natVMMemoryPoolMXBeanImpl.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/lang/management/$(DEPDIR)/natVMOperatingSystemMXBeanImpl.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/lang/management/$(DEPDIR)/natVMRuntimeMXBeanImpl.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/lang/management/$(DEPDIR)/natVMThreadMXBeanImpl.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/net/$(DEPDIR)/natPlainDatagramSocketImpl.Plo@am__quote@
@ -11254,6 +11332,12 @@ java/text.list: $(java_text_source_files)
-include java/text.deps
java/text/spi.list: $(java_text_spi_source_files)
@$(mkinstalldirs) $(dir $@)
echo $(srcdir)/classpath/lib/java/text/spi/*.class > java/text/spi.list
-include java/text/spi.deps
java/util.list: $(java_util_source_files)
@$(mkinstalldirs) $(dir $@)
echo $(srcdir)/classpath/lib/java/util/*.class > java/util.list
@ -11302,6 +11386,12 @@ java/util/regex.list: $(java_util_regex_source_files)
-include java/util/regex.deps
java/util/spi.list: $(java_util_spi_source_files)
@$(mkinstalldirs) $(dir $@)
echo $(srcdir)/classpath/lib/java/util/spi/*.class > java/util/spi.list
-include java/util/spi.deps
java/util/zip.list: $(java_util_zip_source_files)
@$(mkinstalldirs) $(dir $@)
echo $(srcdir)/classpath/lib/java/util/zip/*.class > java/util/zip.list
@ -11314,6 +11404,12 @@ javax/accessibility.list: $(javax_accessibility_source_files)
-include javax/accessibility.deps
javax/activity.list: $(javax_activity_source_files)
@$(mkinstalldirs) $(dir $@)
echo $(srcdir)/classpath/lib/javax/activity/*.class > javax/activity.list
-include javax/activity.deps
javax/crypto.list: $(javax_crypto_source_files)
@$(mkinstalldirs) $(dir $@)
echo $(srcdir)/classpath/lib/javax/crypto/*.class > javax/crypto.list

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,3 +1,11 @@
2007-05-31 Matthias Klose <doko@ubuntu.com>
* javax/management/NotificationBroadcasterSupport.java
(getNotificationInfo): Add cast.
* native/jni/qt-peer/Makefile.am (AM_CXXFLAGS): Add libstdc++ include
directories.
* native/jni/qt-peer/Makefile.in: Regenerate.
2007-05-30 H.J. Lu <hongjiu.lu@intel.com>
PR libjava/32098

View file

@ -50,6 +50,11 @@ Suggested Software
- gdk-pixbuf
- XTest Extension (libXtst) for GdkRobot support in java.awt.
- There is a bug in earlier versions of at-spi, atk, and gail, which are
used for GNOME accessibility. Prior to version 1.18.0 of these packages,
gtk graphical applications should be run without accessibility (clear the
GTK_MODULES environment variable).
For building gcjwebplugin you'll need the Mozilla plugin
support headers and libraries.

View file

@ -358,3 +358,39 @@ the following notice:
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
* m4/ax_func_which_gethostbyname_r.m4
Copyright © 2005 Caolan McNamara <caolan@skynet.ie>
Copyright © 2005 Daniel Richard G. <skunk@iskunk.org>
This program 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 of the License, or
(at your option) any later version.
This program 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 this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
USA.
As a special exception, the respective Autoconf Macro's copyright
owner gives unlimited permission to copy, distribute and modify the
configure scripts that are the output of Autoconf when processing the
Macro. You need not follow the terms of the GNU General Public License
when using or distributing such scripts, even though portions of the
text of the Macro appear in them. The GNU General Public License
(GPL) does govern all other use of the material that constitutes the
Autoconf Macro.
This special exception to the GPL applies to versions of the
Autoconf Macro released by the Autoconf Macro Archive. When you make
and distribute a modified version of the Autoconf Macro, you may
extend this special exception to the GPL to apply to your modified
version as well.

View file

@ -10,7 +10,7 @@ ACLOCAL_AMFLAGS = -I m4 -I ../.. -I ../../config
native: lib
EXTRA_DIST = HACKING BUGS THANKYOU mauve-classpath LICENSE \
ChangeLog-2003 ChangeLog-2004 ChangeLog-2005 \
ChangeLog-2003 ChangeLog-2004 ChangeLog-2005 ChangeLog-2006 \
ChangeLog.gnujaxp.1 ChangeLog.gnujaxp.2 ChangeLog.libxmlj \
autogen.sh

View file

@ -66,6 +66,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../../config/depstand.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/ax_func_which_gethostbyname_r.m4 \
$(top_srcdir)/m4/gcc_attribute.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 \
@ -117,6 +118,8 @@ AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BUILD_CLASS_FILES_FALSE = @BUILD_CLASS_FILES_FALSE@
BUILD_CLASS_FILES_TRUE = @BUILD_CLASS_FILES_TRUE@
CAIRO_CFLAGS = @CAIRO_CFLAGS@
CAIRO_LIBS = @CAIRO_LIBS@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
@ -181,10 +184,10 @@ 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_JAVAC_FALSE = @FOUND_JAVAC_FALSE@
FOUND_JAVAC_TRUE = @FOUND_JAVAC_TRUE@
FOUND_JIKES_FALSE = @FOUND_JIKES_FALSE@
FOUND_JIKES_TRUE = @FOUND_JIKES_TRUE@
FOUND_KJC_FALSE = @FOUND_KJC_FALSE@
@ -192,7 +195,6 @@ 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@
@ -214,6 +216,7 @@ INSTALL_GLIBJ_ZIP_TRUE = @INSTALL_GLIBJ_ZIP_TRUE@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
JAVAC = @JAVAC@
JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION = @JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION@
JAVA_MAINTAINER_MODE_FALSE = @JAVA_MAINTAINER_MODE_FALSE@
JAVA_MAINTAINER_MODE_TRUE = @JAVA_MAINTAINER_MODE_TRUE@
@ -353,7 +356,7 @@ SUBDIRS = lib doc external include native resource scripts tools $(EXAMPLESDIR)
DIST_SUBDIRS = lib doc external include native resource scripts tools examples
ACLOCAL_AMFLAGS = -I m4 -I ../.. -I ../../config
EXTRA_DIST = HACKING BUGS THANKYOU mauve-classpath LICENSE \
ChangeLog-2003 ChangeLog-2004 ChangeLog-2005 \
ChangeLog-2003 ChangeLog-2004 ChangeLog-2005 ChangeLog-2006 \
ChangeLog.gnujaxp.1 ChangeLog.gnujaxp.2 ChangeLog.libxmlj \
autogen.sh

View file

@ -1,9 +1,51 @@
New in release 0.94 (UNRELEASED)
* The ASM library is now included. A separate copy is no longer needed.
New in release 0.95 (Apr 23, 2007)
* Full merge of 1.5 generics work.
* Added 1.6 java.util.ServiceLoader support.
* The ASM library is now included. A separate copy is no longer
needed. gjavah works out of the box now.
* The setReadTimeout and getReadTimeout methods have been added to
java.net.URLConnection. They are now fully implemented for http URLs.
java.net.URLConnection. They are now fully implemented for http URLs.
* The java.lang.management implementation now includes the new features
added in 1.6
* java.util.TimeZone now reads time zone information from the system
zoneinfo files (see also runtime interface changes below).
* The collection classes have been updated to support all the 1.6
additions.
* java.util.spi 1.6 package has been added and is used in java.text.
* Bootstrappable with OpenJDK javac compiler
(use configure --with-javac).
* Large speedups (and locking behaviour updated) in Graphics2D cairo
and freetype support.
* Better detection of browser plugin mechanism for mozilla, iceweasel,
firefox on various platforms.
* Inclusion of generic javadoc classes in tools.zip to support more
javadoc processing tools.
* Added documentation for command lines options for the included GNU
Classpath Tools gjar, gjavah, gnative2ascii, gorbd, grmid,
grmiregistry, gserialver and gtnameserv.
Runtime interface changes:
* gnu.java.lang.management.VMThreadMXBeanImpl has gained three new
optional native methods to allow the 1.6 version of the threading
bean to be supported. One (getMonitorInfo) fills in information
about object monitor locks held by a thread and is only required
if the monitoring of object monitor locks is supported by the VM.
The other two (findDeadlockedThreads and getLockInfo) are related
to ownable synchronizers (part of the java.util.concurrent suite)
and only required if monitoring of locks relating to these is
supported by the VM.
* java.util.VMTimeZone and java.util.TimeZone have been refactored
to simplify the reference implementation. VMTimeZone.readtzFile()
and VMTimeZone.skipFully() have been removed, and a new method
VMTimeZone.readSysconfigClockFile() has been introduced.
* VMs need to set the system property "gnu.java.util.zoneinfo.dir"
to point to the directory where zoneinfo files live. In libgcj
this is set to the value of the TZDATA environment variable, or
"/usr/share/zoneinfo" if this is not set.
* VMFile has been extended to support new 1.6 methods (canExecute,
setReadable, setWritable, setExecutable).
New in release 0.93 (Dec 8, 2006)

File diff suppressed because it is too large Load diff

View file

@ -38,17 +38,14 @@ have_autoconf=false
if autoconf --version < /dev/null > /dev/null 2>&1 ; then
autoconf_version=`autoconf --version | sed 's/^[^0-9]*\([0-9.][0-9.]*\).*/\1/'`
case $autoconf_version in
2.59*)
have_autoconf=true
;;
2.60*)
2.59* | 2.6[0-9]* )
have_autoconf=true
;;
esac
fi
if $have_autoconf ; then : ; else
echo
echo "You must have autoconf 2.59 or 2.60 installed for $PROJECT."
echo "You must have autoconf 2.59 or later installed for $PROJECT."
echo "Install the appropriate package for your distribution,"
echo "or get the source tarball at http://ftp.gnu.org/gnu/autoconf/"
DIE=1
@ -65,14 +62,14 @@ elif automake --version < /dev/null > /dev/null 2>&1 ; then
ACLOCAL=aclocal
automake_version=`automake --version | sed 's/^[^0-9]*\([0-9.][0-9.]*\).*/\1/'`
case $automake_version in
1.9*)
1.9* | 1.10*)
have_automake=true
;;
esac
fi
if $have_automake ; then : ; else
echo
echo "You must have automake 1.9 installed to compile $PROJECT."
echo "You must have automake 1.9 or 1.10 installed to compile $PROJECT."
echo "Install the appropriate package for your distribution,"
echo "or get the source tarball at http://ftp.gnu.org/gnu/automake/"
DIE=1

File diff suppressed because it is too large Load diff

View file

@ -1,9 +1,10 @@
#! /bin/sh
# Configuration validation subroutine script.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
# 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
# Inc.
timestamp='2003-06-18'
timestamp='2006-12-08'
# This file is (in principle) common to ALL GNU software.
# The presence of a machine in this file suggests that SOME GNU software
@ -21,14 +22,15 @@ timestamp='2003-06-18'
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
# 02110-1301, USA.
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# Please send patches to <config-patches@gnu.org>. Submit a context
# diff and a properly formatted ChangeLog entry.
#
@ -70,7 +72,7 @@ Report bugs and patches to <config-patches@gnu.org>."
version="\
GNU config.sub ($timestamp)
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
@ -83,11 +85,11 @@ Try \`$me --help' for more information."
while test $# -gt 0 ; do
case $1 in
--time-stamp | --time* | -t )
echo "$timestamp" ; exit 0 ;;
echo "$timestamp" ; exit ;;
--version | -v )
echo "$version" ; exit 0 ;;
echo "$version" ; exit ;;
--help | --h* | -h )
echo "$usage"; exit 0 ;;
echo "$usage"; exit ;;
-- ) # Stop option processing
shift; break ;;
- ) # Use stdin as input.
@ -99,7 +101,7 @@ while test $# -gt 0 ; do
*local*)
# First pass through any local machine types.
echo $1
exit 0;;
exit ;;
* )
break ;;
@ -118,7 +120,9 @@ esac
# Here we must recognize all the valid KERNEL-OS combinations.
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
case $maybe_os in
nto-qnx* | linux-gnu* | freebsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*)
nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
storm-chaos* | os2-emx* | rtmk-nova*)
os=-$maybe_os
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
;;
@ -144,7 +148,7 @@ case $os in
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
-apple | -axis)
-apple | -axis | -knuth | -cray)
os=
basic_machine=$1
;;
@ -169,6 +173,10 @@ case $os in
-hiux*)
os=-hiuxwe2
;;
-sco6)
os=-sco5v6
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-sco5)
os=-sco3.2v5
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
@ -185,6 +193,10 @@ case $os in
# Don't forget version if it is 3.2v4 or newer.
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-sco5v6*)
# Don't forget version if it is 3.2v4 or newer.
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-sco*)
os=-sco3.2v2
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
@ -228,14 +240,18 @@ case $basic_machine in
| a29k \
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
| am33_2.0 \
| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
| bfin \
| c4x | clipper \
| d10v | d30v | dlx | dsp16xx \
| fr30 | frv \
| fido | fr30 | frv \
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
| i370 | i860 | i960 | ia64 \
| ip2k \
| m32r | m68000 | m68k | m88k | mcore \
| ip2k | iq2000 \
| m32c | m32r | m32rle | m68000 | m68k | m88k \
| maxq | mb | microblaze | mcore \
| mep \
| mips | mipsbe | mipseb | mipsel | mipsle \
| mips16 \
| mips64 | mips64el \
@ -244,28 +260,33 @@ case $basic_machine in
| mips64vr4100 | mips64vr4100el \
| mips64vr4300 | mips64vr4300el \
| mips64vr5000 | mips64vr5000el \
| mips64vr5900 | mips64vr5900el \
| mipsisa32 | mipsisa32el \
| mipsisa32r2 | mipsisa32r2el \
| mipsisa64 | mipsisa64el \
| mipsisa64r2 | mipsisa64r2el \
| mipsisa64sb1 | mipsisa64sb1el \
| mipsisa64sr71k | mipsisa64sr71kel \
| mipstx39 | mipstx39el \
| mn10200 | mn10300 \
| mt \
| msp430 \
| nios | nios2 \
| ns16k | ns32k \
| openrisc | or32 \
| or32 \
| pdp10 | pdp11 | pj | pjl \
| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
| pyramid \
| s390 | s390x \
| sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
| score \
| sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
| sh64 | sh64le \
| sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv8 | sparcv9 | sparcv9b \
| strongarm \
| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
| spu | strongarm \
| tahoe | thumb | tic4x | tic80 | tron \
| v850 | v850e \
| we32k \
| x86 | xscale | xstormy16 | xtensa \
| x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
| z8k)
basic_machine=$basic_machine-unknown
;;
@ -276,6 +297,9 @@ case $basic_machine in
;;
m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
;;
ms1)
basic_machine=mt-unknown
;;
# We use `pc' rather than `unknown'
# because (1) that's what they normally are, and
@ -295,21 +319,22 @@ case $basic_machine in
| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \
| avr-* \
| bs2000-* \
| avr-* | avr32-* \
| bfin-* | bs2000-* \
| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
| clipper-* | cydra-* \
| clipper-* | craynv-* | cydra-* \
| d10v-* | d30v-* | dlx-* \
| elxsi-* \
| f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
| h8300-* | h8500-* \
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
| i*86-* | i860-* | i960-* | ia64-* \
| ip2k-* \
| m32r-* \
| ip2k-* | iq2000-* \
| m32c-* | m32r-* | m32rle-* \
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
| m88110-* | m88k-* | mcore-* \
| m88110-* | m88k-* | maxq-* | mcore-* \
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
| mep-* \
| mips16-* \
| mips64-* | mips64el-* \
| mips64vr-* | mips64vrel-* \
@ -317,31 +342,36 @@ case $basic_machine in
| mips64vr4100-* | mips64vr4100el-* \
| mips64vr4300-* | mips64vr4300el-* \
| mips64vr5000-* | mips64vr5000el-* \
| mips64vr5900-* | mips64vr5900el-* \
| mipsisa32-* | mipsisa32el-* \
| mipsisa32r2-* | mipsisa32r2el-* \
| mipsisa64-* | mipsisa64el-* \
| mipsisa64r2-* | mipsisa64r2el-* \
| mipsisa64sb1-* | mipsisa64sb1el-* \
| mipsisa64sr71k-* | mipsisa64sr71kel-* \
| mipstx39-* | mipstx39el-* \
| mmix-* \
| mt-* \
| msp430-* \
| none-* | np1-* | nv1-* | ns16k-* | ns32k-* \
| nios-* | nios2-* \
| none-* | np1-* | ns16k-* | ns32k-* \
| orion-* \
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
| pyramid-* \
| romp-* | rs6000-* \
| s390-* | s390x-* \
| sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \
| sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
| sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \
| sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
| sparclite-* \
| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
| tahoe-* | thumb-* \
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
| tron-* \
| v850-* | v850e-* | vax-* \
| we32k-* \
| x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \
| xtensa-* \
| x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
| xstormy16-* | xtensa-* \
| ymp-* \
| z8k-*)
;;
@ -361,6 +391,9 @@ case $basic_machine in
basic_machine=a29k-amd
os=-udi
;;
abacus)
basic_machine=abacus-unknown
;;
adobe68k)
basic_machine=m68010-adobe
os=-scout
@ -378,6 +411,9 @@ case $basic_machine in
amd64)
basic_machine=x86_64-pc
;;
amd64-*)
basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
amdahl)
basic_machine=580-amdahl
os=-sysv
@ -437,12 +473,27 @@ case $basic_machine in
basic_machine=j90-cray
os=-unicos
;;
craynv)
basic_machine=craynv-cray
os=-unicosmp
;;
cr16c)
basic_machine=cr16c-unknown
os=-elf
;;
crds | unos)
basic_machine=m68k-crds
;;
crisv32 | crisv32-* | etraxfs*)
basic_machine=crisv32-axis
;;
cris | cris-* | etrax*)
basic_machine=cris-axis
;;
crx)
basic_machine=crx-unknown
os=-elf
;;
da30 | da30-*)
basic_machine=m68k-da30
;;
@ -465,6 +516,10 @@ case $basic_machine in
basic_machine=m88k-motorola
os=-sysv3
;;
djgpp)
basic_machine=i586-pc
os=-msdosdjgpp
;;
dpx20 | dpx20-*)
basic_machine=rs6000-bull
os=-bosx
@ -643,10 +698,6 @@ case $basic_machine in
mips3*)
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
;;
mmix*)
basic_machine=mmix-knuth
os=-mmixware
;;
monitor)
basic_machine=m68k-rom68k
os=-coff
@ -659,6 +710,9 @@ case $basic_machine in
basic_machine=i386-pc
os=-msdos
;;
ms1-*)
basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
;;
mvs)
basic_machine=i370-ibm
os=-mvs
@ -727,10 +781,6 @@ case $basic_machine in
np1)
basic_machine=np1-gould
;;
nv1)
basic_machine=nv1-cray
os=-unicosmp
;;
nsr-tandem)
basic_machine=nsr-tandem
;;
@ -738,9 +788,12 @@ case $basic_machine in
basic_machine=hppa1.1-oki
os=-proelf
;;
or32 | or32-*)
openrisc | openrisc-*)
basic_machine=or32-unknown
os=-coff
;;
os400)
basic_machine=powerpc-ibm
os=-os400
;;
OSE68000 | ose68000)
basic_machine=m68000-ericsson
@ -767,6 +820,12 @@ case $basic_machine in
pc532 | pc532-*)
basic_machine=ns32k-pc532
;;
pc98)
basic_machine=i386-pc
;;
pc98-*)
basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
pentium | p5 | k5 | k6 | nexgen | viac3)
basic_machine=i586-pc
;;
@ -823,6 +882,10 @@ case $basic_machine in
basic_machine=i586-unknown
os=-pw32
;;
rdos)
basic_machine=i386-pc
os=-rdos
;;
rom68k)
basic_machine=m68k-rom68k
os=-coff
@ -833,6 +896,12 @@ case $basic_machine in
rtpc | rtpc-*)
basic_machine=romp-ibm
;;
s390 | s390-*)
basic_machine=s390-ibm
;;
s390x | s390x-*)
basic_machine=s390x-ibm
;;
sa29200)
basic_machine=a29k-amd
os=-udi
@ -843,6 +912,10 @@ case $basic_machine in
sb1el)
basic_machine=mipsisa64sb1el-unknown
;;
sde)
basic_machine=mipsisa32-sde
os=-elf
;;
sei)
basic_machine=mips-sei
os=-seiux
@ -854,6 +927,9 @@ case $basic_machine in
basic_machine=sh-hitachi
os=-hms
;;
sh5el)
basic_machine=sh5le-unknown
;;
sh64)
basic_machine=sh64-unknown
;;
@ -956,6 +1032,10 @@ case $basic_machine in
tower | tower-32)
basic_machine=m68k-ncr
;;
tpf)
basic_machine=s390x-ibm
os=-tpf
;;
udi29k)
basic_machine=a29k-amd
os=-udi
@ -999,6 +1079,10 @@ case $basic_machine in
basic_machine=hppa1.1-winbond
os=-proelf
;;
xbox)
basic_machine=i686-pc
os=-mingw32
;;
xps | xps100)
basic_machine=xps100-honeywell
;;
@ -1029,6 +1113,9 @@ case $basic_machine in
romp)
basic_machine=romp-ibm
;;
mmix)
basic_machine=mmix-knuth
;;
rs6000)
basic_machine=rs6000-ibm
;;
@ -1045,13 +1132,10 @@ case $basic_machine in
we32k)
basic_machine=we32k-att
;;
sh3 | sh4 | sh[34]eb | sh[1234]le | sh[23]ele)
sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele)
basic_machine=sh-unknown
;;
sh64)
basic_machine=sh64-unknown
;;
sparc | sparcv8 | sparcv9 | sparcv9b)
sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
basic_machine=sparc-sun
;;
cydra)
@ -1124,19 +1208,23 @@ case $os in
| -aos* \
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
| -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
| -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
| -openbsd* | -solidbsd* \
| -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
| -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
| -chorusos* | -chorusrdb* \
| -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
| -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \
| -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
| -uxpv* | -beos* | -mpeix* | -udk* \
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
| -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
| -powermax* | -dnix* | -nx6 | -nx7 | -sei*)
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
| -skyos* | -haiku* | -rdos* | -toppers*)
# Remember, each alternative MUST END IN *, to match a version number.
;;
-qnx*)
@ -1154,12 +1242,15 @@ case $os in
os=`echo $os | sed -e 's|nto|nto-qnx|'`
;;
-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
| -windows* | -osx | -abug | -netware* | -os9* | -beos* \
| -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
| -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
;;
-mac*)
os=`echo $os | sed -e 's|mac|macos|'`
;;
-linux-dietlibc)
os=-linux-dietlibc
;;
-linux*)
os=`echo $os | sed -e 's|linux|linux-gnu|'`
;;
@ -1172,6 +1263,9 @@ case $os in
-opened*)
os=-openedition
;;
-os400*)
os=-os400
;;
-wince*)
os=-wince
;;
@ -1193,6 +1287,9 @@ case $os in
-atheos*)
os=-atheos
;;
-syllable*)
os=-syllable
;;
-386bsd)
os=-bsd
;;
@ -1215,6 +1312,9 @@ case $os in
-sinix*)
os=-sysv4
;;
-tpf*)
os=-tpf
;;
-triton*)
os=-sysv3
;;
@ -1251,6 +1351,9 @@ case $os in
-kaos*)
os=-kaos
;;
-zvmoe)
os=-zvmoe
;;
-none)
;;
*)
@ -1273,6 +1376,12 @@ else
# system, and we'll never get to this point.
case $basic_machine in
score-*)
os=-elf
;;
spu-*)
os=-elf
;;
*-acorn)
os=-riscix1.2
;;
@ -1282,8 +1391,8 @@ case $basic_machine in
arm*-semi)
os=-aout
;;
c4x-* | tic4x-*)
os=-coff
c4x-* | tic4x-*)
os=-coff
;;
# This must come before the *-dec entry.
pdp10-*)
@ -1328,9 +1437,15 @@ case $basic_machine in
*-be)
os=-beos
;;
*-haiku)
os=-haiku
;;
*-ibm)
os=-aix
;;
*-knuth)
os=-mmixware
;;
*-wec)
os=-proelf
;;
@ -1463,9 +1578,15 @@ case $basic_machine in
-mvs* | -opened*)
vendor=ibm
;;
-os400*)
vendor=ibm
;;
-ptx*)
vendor=sequent
;;
-tpf*)
vendor=ibm
;;
-vxsim* | -vxworks* | -windiss*)
vendor=wrs
;;
@ -1490,7 +1611,7 @@ case $basic_machine in
esac
echo $basic_machine$os
exit 0
exit
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)

File diff suppressed because it is too large Load diff

View file

@ -6,7 +6,7 @@ dnl -----------------------------------------------------------
dnl define([AC_CACHE_LOAD], )dnl
dnl define([AC_CACHE_SAVE], )dnl
AC_INIT([GNU Classpath],[0.94-pre],[classpath@gnu.org],[classpath])
AC_INIT([GNU Classpath],[0.95],[classpath@gnu.org],[classpath])
AC_CONFIG_SRCDIR(java/lang/System.java)
dnl GCJ LOCAL
@ -72,7 +72,7 @@ CLASSPATH_CONVENIENCE="-no-undefined"
AC_SUBST(CLASSPATH_CONVENIENCE)
AC_PREREQ(2.59)
AM_INIT_AUTOMAKE([1.9.0 gnu std-options tar-ustar])
AM_INIT_AUTOMAKE([1.9.0 gnu std-options tar-ustar -Wno-portability])
AC_CONFIG_HEADERS([include/config.h])
AC_PREFIX_DEFAULT(/usr/local/classpath)
@ -360,6 +360,7 @@ AC_DISABLE_STATIC
AC_PROG_LIBTOOL
dnl AC_PROG_AWK
AC_PROG_CC
AM_PROG_CC_C_O
AC_PROG_CPP
AC_PROG_CXX
@ -427,7 +428,7 @@ if test "x${COMPILE_JNI}" = xyes; then
lstat readlink \
inet_aton inet_addr inet_pton \
getifaddrs kqueue kevent epoll_create \
readdir_r ])
readdir_r getloadavg])
LIBMAGIC=
AC_CHECK_LIB(magic, magic_open, LIBMAGIC=-lmagic)
@ -467,7 +468,9 @@ if test "x${COMPILE_JNI}" = xyes; then
[AC_MSG_RESULT(no)])])])
AC_C_CONST
AC_C_INLINE
AC_C_ATTRIBUTE
AX_FUNC_WHICH_GETHOSTBYNAME_R
dnl See if we HAVE_ICONV, how ICONV_CONST is set and LTLIBICONV
AM_ICONV
@ -521,6 +524,7 @@ if test "x${COMPILE_JNI}" = xyes; then
PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.8 gthread-2.0 >= 2.2 gdk-pixbuf-2.0)
PKG_CHECK_MODULES(FREETYPE2, freetype2)
PKG_CHECK_MODULES(PANGOFT2, pangoft2)
PKG_CHECK_MODULES(CAIRO, cairo >= 1.1.8)
dnl Check if we can link against the XRender library and set
dnl HAVE_XRENDER accordingly.
AC_CHECK_LIB([Xrender], [XRenderQueryExtension],
@ -546,7 +550,7 @@ if test "x${COMPILE_JNI}" = xyes; then
dnl gconf-peer
if test "x${COMPILE_GCONF_PEER}" = xyes; then
PKG_CHECK_MODULES(GCONF, gconf-2.0 >= 2.11.2)
PKG_CHECK_MODULES(GCONF, gconf-2.0 >= 2.6.0)
AC_SUBST(GCONF_CFLAGS)
AC_SUBST(GCONF_LIBS)
dnl we also need gdk for locking
@ -649,12 +653,22 @@ if test "x${COMPILE_JNI}" = xyes; then
if test "x${MOZILLA_FOUND}" = xno; then
PKG_CHECK_MODULES(MOZILLA, seamonkey-plugin seamonkey-xpcom, [MOZILLA_FOUND=yes], [MOZILLA_FOUND=no])
fi
if test "x${MOZILLA_FOUND}" = xno; then
PKG_CHECK_MODULES(MOZILLA, iceape-plugin iceape-xpcom, [MOZILLA_FOUND=yes], [MOZILLA_FOUND=no])
fi
if test "x${MOZILLA_FOUND}" = xno; then
AC_MSG_ERROR([Couldn't find plugin support headers and libraries, try --disable-plugin])
fi
PKG_CHECK_MODULES(GLIB, glib-2.0)
PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.8 gthread-2.0 >= 2.2 gdk-pixbuf-2.0)
AC_SUBST(MOZILLA_CFLAGS)
AC_SUBST(MOZILLA_LIBS)
AC_SUBST(GLIB_CFLAGS)
AC_SUBST(GLIB_LIBS)
AC_SUBST(GTK_CFLAGS)
AC_SUBST(GTK_LIBS)
AC_SUBST(PLUGIN_DIR, $HOME/.mozilla/plugins/)
fi

View file

@ -1,7 +1,10 @@
#! /bin/sh
# depcomp - compile a program generating dependencies as side-effects
# Copyright 1999, 2000 Free Software Foundation, Inc.
scriptversion=2006-10-15.18
# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006 Free Software
# Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -25,22 +28,45 @@
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
case $1 in
'')
echo "$0: No command. Try \`$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
cat <<\EOF
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
Run PROGRAMS ARGS to compile a file, generating dependencies
as side-effects.
Environment variables:
depmode Dependency tracking mode.
source Source file read by `PROGRAMS ARGS'.
object Object file output by `PROGRAMS ARGS'.
DEPDIR directory where to store dependencies.
depfile Dependency file to output.
tmpdepfile Temporary file to use when outputing dependencies.
libtool Whether libtool is used (yes/no).
Report bugs to <bug-automake@gnu.org>.
EOF
exit $?
;;
-v | --v*)
echo "depcomp $scriptversion"
exit $?
;;
esac
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
echo "depcomp: Variables source, object and depmode must be set" 1>&2
exit 1
fi
# `libtool' can also be set to `yes' or `no'.
if test -z "$depfile"; then
base=`echo "$object" | sed -e 's,^.*/,,' -e 's,\.\([^.]*\)$,.P\1,'`
dir=`echo "$object" | sed 's,/.*$,/,'`
if test "$dir" = "$object"; then
dir=
fi
# FIXME: should be _deps on DOS.
depfile="$dir.deps/$base"
fi
# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
depfile=${depfile-`echo "$object" |
sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
rm -f "$tmpdepfile"
@ -66,7 +92,20 @@ gcc3)
## gcc 3 implements dependency tracking that does exactly what
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
## it if -MD -MP comes after the -MF stuff. Hmm.
"$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
## Unfortunately, FreeBSD c89 acceptance of flags depends upon
## the command line argument order; so add the flags where they
## appear in depend2.am. Note that the slowdown incurred here
## affects only configure: in makefiles, %FASTDEP% shortcuts this.
for arg
do
case $arg in
-c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
*) set fnord "$@" "$arg" ;;
esac
shift # fnord
shift # $arg
done
"$@"
stat=$?
if test $stat -eq 0; then :
else
@ -172,19 +211,25 @@ sgi)
aix)
# The C for AIX Compiler uses -M and outputs the dependencies
# in a .u file. This file always lives in the current directory.
# Also, the AIX compiler puts `$object:' at the start of each line;
# $object doesn't have directory information.
stripped=`echo "$object" | sed -e 's,^.*/,,' -e 's/\(.*\)\..*$/\1/'`
# in a .u file. In older versions, this file always lives in the
# current directory. Also, the AIX compiler puts `$object:' at the
# start of each line; $object doesn't have directory information.
# Version 6 uses the directory in both cases.
stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'`
tmpdepfile="$stripped.u"
outname="$stripped.o"
if test "$libtool" = yes; then
"$@" -Wc,-M
else
"$@" -M
fi
stat=$?
if test -f "$tmpdepfile"; then :
else
stripped=`echo "$stripped" | sed 's,^.*/,,'`
tmpdepfile="$stripped.u"
fi
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
@ -192,6 +237,7 @@ aix)
fi
if test -f "$tmpdepfile"; then
outname="$stripped.o"
# Each line is of the form `foo.o: dependent.h'.
# Do two passes, one to just change these to
# `$object: dependent.h' and one to simply `dependent.h:'.
@ -206,6 +252,84 @@ aix)
rm -f "$tmpdepfile"
;;
icc)
# Intel's C compiler understands `-MD -MF file'. However on
# icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
# ICC 7.0 will fill foo.d with something like
# foo.o: sub/foo.c
# foo.o: sub/foo.h
# which is wrong. We want:
# sub/foo.o: sub/foo.c
# sub/foo.o: sub/foo.h
# sub/foo.c:
# sub/foo.h:
# ICC 7.1 will output
# foo.o: sub/foo.c sub/foo.h
# and will wrap long lines using \ :
# foo.o: sub/foo.c ... \
# sub/foo.h ... \
# ...
"$@" -MD -MF "$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
# Each line is of the form `foo.o: dependent.h',
# or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
# Do two passes, one to just change these to
# `$object: dependent.h' and one to simply `dependent.h:'.
sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
# Some versions of the HPUX 10.20 sed can't process this invocation
# correctly. Breaking it into two sed invocations is a workaround.
sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
hp2)
# The "hp" stanza above does not work with aCC (C++) and HP's ia64
# compilers, which have integrated preprocessors. The correct option
# to use with these is +Maked; it writes dependencies to a file named
# 'foo.d', which lands next to the object file, wherever that
# happens to be.
# Much of this is similar to the tru64 case; see comments there.
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
test "x$dir" = "x$object" && dir=
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
if test "$libtool" = yes; then
tmpdepfile1=$dir$base.d
tmpdepfile2=$dir.libs/$base.d
"$@" -Wc,+Maked
else
tmpdepfile1=$dir$base.d
tmpdepfile2=$dir$base.d
"$@" +Maked
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile1" "$tmpdepfile2"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
do
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
# Add `dependent.h:' lines.
sed -ne '2,${; s/^ *//; s/ \\*$//; s/$/:/; p;}' "$tmpdepfile" >> "$depfile"
else
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile" "$tmpdepfile2"
;;
tru64)
# The Tru64 compiler uses -MD to generate dependencies as a side
# effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
@ -217,31 +341,47 @@ tru64)
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
if test "$libtool" = yes; then
tmpdepfile1="$dir.libs/$base.lo.d"
tmpdepfile2="$dir.libs/$base.d"
# With Tru64 cc, shared objects can also be used to make a
# static library. This mechanism is used in libtool 1.4 series to
# handle both shared and static libraries in a single compilation.
# With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
#
# With libtool 1.5 this exception was removed, and libtool now
# generates 2 separate objects for the 2 libraries. These two
# compilations output dependencies in $dir.libs/$base.o.d and
# in $dir$base.o.d. We have to check for both files, because
# one of the two compilations can be disabled. We should prefer
# $dir$base.o.d over $dir.libs/$base.o.d because the latter is
# automatically cleaned when .libs/ is deleted, while ignoring
# the former would cause a distcleancheck panic.
tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4
tmpdepfile2=$dir$base.o.d # libtool 1.5
tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5
tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504
"$@" -Wc,-MD
else
tmpdepfile1="$dir$base.o.d"
tmpdepfile2="$dir$base.d"
tmpdepfile1=$dir$base.o.d
tmpdepfile2=$dir$base.d
tmpdepfile3=$dir$base.d
tmpdepfile4=$dir$base.d
"$@" -MD
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile1" "$tmpdepfile2"
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
exit $stat
fi
if test -f "$tmpdepfile1"; then
tmpdepfile="$tmpdepfile1"
else
tmpdepfile="$tmpdepfile2"
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
do
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
# That's a space and a tab in the [].
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
# That's a tab and a space in the [].
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
else
echo "#dummy" > "$depfile"
fi
@ -254,7 +394,7 @@ tru64)
dashmstdout)
# Important note: in order to support this mode, a compiler *must*
# always write the proprocessed file to stdout, regardless of -o.
# always write the preprocessed file to stdout, regardless of -o.
"$@" || exit $?
# Remove the call to Libtool.
@ -265,9 +405,7 @@ dashmstdout)
shift
fi
# Remove `-o $object'. We will use -o /dev/null later,
# however we can't do the remplacement now because
# `-o $object' might simply not be used
# Remove `-o $object'.
IFS=" "
for arg
do
@ -287,7 +425,11 @@ dashmstdout)
done
test -z "$dashmflag" && dashmflag=-M
"$@" -o /dev/null $dashmflag | sed 's:^[^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
# Require at least two characters before searching for `:'
# in the target name. This is to cope with DOS-style filenames:
# a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
"$@" $dashmflag |
sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
tr ' ' '
@ -306,6 +448,13 @@ dashXmstdout)
makedepend)
"$@" || exit $?
# Remove any Libtool call
if test "$libtool" = yes; then
while test $1 != '--mode=compile'; do
shift
done
shift
fi
# X makedepend
shift
cleared=no
@ -318,7 +467,9 @@ makedepend)
case "$arg" in
-D*|-I*)
set fnord "$@" "$arg"; shift ;;
-*)
# Strip any option that makedepend may not understand. Remove
# the object too, otherwise makedepend will parse it as a source file.
-*|$object)
;;
*)
set fnord "$@" "$arg"; shift ;;
@ -339,7 +490,7 @@ makedepend)
cpp)
# Important note: in order to support this mode, a compiler *must*
# always write the proprocessed file to stdout.
# always write the preprocessed file to stdout.
"$@" || exit $?
# Remove the call to Libtool.
@ -370,7 +521,8 @@ cpp)
done
"$@" -E |
sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
-e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
sed '$ s: \\$::' > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
@ -381,7 +533,7 @@ cpp)
msvisualcpp)
# Important note: in order to support this mode, a compiler *must*
# always write the proprocessed file to stdout, regardless of -o,
# always write the preprocessed file to stdout, regardless of -o,
# because we must use -o when running libtool.
"$@" || exit $?
IFS=" "
@ -421,3 +573,12 @@ none)
esac
exit 0
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# End:

View file

@ -1,21 +1,19 @@
SUBDIRS = api
EXTRA_DIST = README.jaxp $(man_MANS)
EXTRA_DIST = README.jaxp texi2pod.pl $(man_MANS)
## GCJ LOCAL: we don't want to install all of Classpath's info files.
## info_TEXINFOS = cp-hacking.texinfo cp-vmintegration.texinfo cp-tools.texinfo
TEXINFO_TEX = ../../gcc/doc/include/texinfo.tex
info_TEXINFOS = cp-tools.texinfo
cp_tools_TEXINFOS = gcc-vers.texi
%.dvi : %.texinfo
.texinfo.dvi:
texi2dvi $<
%.ps : %.dvi
.dvi.ps:
dvips -o $@ $<
docs: cp-hacking.ps cp-vmintegration.ps cp-tools.ps
install-data-local: install-info
docs: cp-hacking.ps cp-vmintegration.ps cp-tools.ps $(TOOLS_MANFILES)
man_MANS = $(TOOLS_MANFILES)
TOOLS_MANFILES = \
@ -32,23 +30,11 @@ TOOLS_MANFILES = \
gserialver.1 \
gtnameserv.1
BASEVER = $(top_srcdir)/../../gcc/BASE-VER
DEVPHASE = $(top_srcdir)/../../gcc/DEV-PHASE
POD2MAN = pod2man --center="GNU" --release="gcc-$(shell cat $(BASEVER))"
TEXI2POD = perl $(top_srcdir)/../../contrib/texi2pod.pl
POD2MAN = pod2man --center="GNU" --release="$(VERSION)"
TEXI2POD = perl $(srcdir)/texi2pod.pl
STAMP = echo timestamp >
# gcc-vers.texi is generated from the version files.
gcc-vers.texi: $(BASEVER) $(DEVPHASE)
(echo "@set version-GCC $(shell cat $(BASEVER))"; \
if [ "$(shell cat $(DEVPHASE))" = "experimental" ]; \
then echo "@set DEVELOPMENT"; \
else echo "@clear DEVELOPMENT"; \
fi) > $@T
mv -f $@T $@
%.1: %.pod
.pod.1:
$(STAMP) $@
-($(POD2MAN) --section=1 $< > $(@).T$$$$ && \
mv -f $(@).T$$$$ $@) || \

View file

@ -37,23 +37,27 @@ build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
subdir = doc
DIST_COMMON = $(cp_tools_TEXINFOS) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in texinfo.tex
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in texinfo.tex
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)/../../config/no-executables.m4 \
$(top_srcdir)/../../libtool.m4 $(top_srcdir)/m4/acattribute.m4 \
$(top_srcdir)/m4/accross.m4 $(top_srcdir)/m4/acinclude.m4 \
$(top_srcdir)/../../libtool.m4 \
$(top_srcdir)/../../ltoptions.m4 \
$(top_srcdir)/../../ltsugar.m4 \
$(top_srcdir)/../../ltversion.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/ax_func_which_gethostbyname_r.m4 \
$(top_srcdir)/m4/gcc_attribute.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
mkinstalldirs = $(SHELL) $(top_srcdir)/../../mkinstalldirs
CONFIG_HEADER = $(top_builddir)/include/config.h
CONFIG_CLEAN_FILES =
SOURCES =
@ -88,12 +92,15 @@ ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BUILD_CLASS_FILES_FALSE = @BUILD_CLASS_FILES_FALSE@
BUILD_CLASS_FILES_TRUE = @BUILD_CLASS_FILES_TRUE@
CAIRO_CFLAGS = @CAIRO_CFLAGS@
CAIRO_LIBS = @CAIRO_LIBS@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
@ -139,6 +146,7 @@ DATE = @DATE@
DEFAULT_PREFS_PEER = @DEFAULT_PREFS_PEER@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
@ -151,15 +159,16 @@ ERROR_CFLAGS = @ERROR_CFLAGS@
EXAMPLESDIR = @EXAMPLESDIR@
EXEEXT = @EXEEXT@
FASTJAR = @FASTJAR@
FGREP = @FGREP@
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_JAVAC_FALSE = @FOUND_JAVAC_FALSE@
FOUND_JAVAC_TRUE = @FOUND_JAVAC_TRUE@
FOUND_JIKES_FALSE = @FOUND_JIKES_FALSE@
FOUND_JIKES_TRUE = @FOUND_JIKES_TRUE@
FOUND_KJC_FALSE = @FOUND_KJC_FALSE@
@ -167,7 +176,6 @@ 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@
@ -177,6 +185,7 @@ GENINSRC_TRUE = @GENINSRC_TRUE@
GJDOC = @GJDOC@
GLIB_CFLAGS = @GLIB_CFLAGS@
GLIB_LIBS = @GLIB_LIBS@
GREP = @GREP@
GTK_CFLAGS = @GTK_CFLAGS@
GTK_LIBS = @GTK_LIBS@
INIT_LOAD_LIBRARY = @INIT_LOAD_LIBRARY@
@ -188,6 +197,7 @@ INSTALL_GLIBJ_ZIP_TRUE = @INSTALL_GLIBJ_ZIP_TRUE@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
JAVAC = @JAVAC@
JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION = @JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION@
JAVA_MAINTAINER_MODE_FALSE = @JAVA_MAINTAINER_MODE_FALSE@
JAVA_MAINTAINER_MODE_TRUE = @JAVA_MAINTAINER_MODE_TRUE@
@ -197,6 +207,7 @@ JIKES = @JIKES@
JIKESENCODING = @JIKESENCODING@
JIKESWARNINGS = @JIKESWARNINGS@
KJC = @KJC@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBDEBUG = @LIBDEBUG@
LIBICONV = @LIBICONV@
@ -216,6 +227,7 @@ MKDIR = @MKDIR@
MOC = @MOC@
MOZILLA_CFLAGS = @MOZILLA_CFLAGS@
MOZILLA_LIBS = @MOZILLA_LIBS@
NM = @NM@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@ -237,6 +249,7 @@ RANLIB = @RANLIB@
REGEN_PARSERS_FALSE = @REGEN_PARSERS_FALSE@
REGEN_PARSERS_TRUE = @REGEN_PARSERS_TRUE@
REMOVE = @REMOVE@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRICT_WARNING_CFLAGS = @STRICT_WARNING_CFLAGS@
@ -264,8 +277,10 @@ X_EXTRA_LIBS = @X_EXTRA_LIBS@
X_LIBS = @X_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
ZIP = @ZIP@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
@ -298,6 +313,7 @@ install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
lt_ECHO = @lt_ECHO@
mandir = @mandir@
mkdir_p = @mkdir_p@
multi_basedir = @multi_basedir@
@ -316,10 +332,9 @@ target_vendor = @target_vendor@
toolexeclibdir = @toolexeclibdir@
vm_classes = @vm_classes@
SUBDIRS = api
EXTRA_DIST = README.jaxp $(man_MANS)
EXTRA_DIST = README.jaxp texi2pod.pl $(man_MANS)
TEXINFO_TEX = ../../gcc/doc/include/texinfo.tex
info_TEXINFOS = cp-tools.texinfo
cp_tools_TEXINFOS = gcc-vers.texi
man_MANS = $(TOOLS_MANFILES)
TOOLS_MANFILES = \
gappletviewer.1 \
@ -335,10 +350,8 @@ TOOLS_MANFILES = \
gserialver.1 \
gtnameserv.1
BASEVER = $(top_srcdir)/../../gcc/BASE-VER
DEVPHASE = $(top_srcdir)/../../gcc/DEV-PHASE
POD2MAN = pod2man --center="GNU" --release="gcc-$(shell cat $(BASEVER))"
TEXI2POD = perl $(top_srcdir)/../../contrib/texi2pod.pl
POD2MAN = pod2man --center="GNU" --release="$(VERSION)"
TEXI2POD = perl $(srcdir)/texi2pod.pl
STAMP = echo timestamp >
@GENINSRC_FALSE@STAMP_GENINSRC =
@ -365,7 +378,7 @@ MAINTAINERCLEANFILES = \
all: all-recursive
.SUFFIXES:
.SUFFIXES: .dvi .ps
.SUFFIXES: .1 .dvi .pod .ps .texinfo
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
@ -405,7 +418,7 @@ clean-libtool:
distclean-libtool:
-rm -f libtool
cp-tools.info: cp-tools.texinfo $(cp_tools_TEXINFOS)
cp-tools.info: cp-tools.texinfo
restore=: && backupdir="$(am__leading_dot)am$$$$" && \
rm -rf $$backupdir && mkdir $$backupdir && \
if ($(MAKEINFO) --version) >/dev/null 2>&1; then \
@ -423,17 +436,17 @@ cp-tools.info: cp-tools.texinfo $(cp_tools_TEXINFOS)
fi; \
rm -rf $$backupdir; exit $$rc
cp-tools.dvi: cp-tools.texinfo $(cp_tools_TEXINFOS)
cp-tools.dvi: cp-tools.texinfo
TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \
MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir)' \
$(TEXI2DVI) -o $@ `test -f 'cp-tools.texinfo' || echo '$(srcdir)/'`cp-tools.texinfo
cp-tools.pdf: cp-tools.texinfo $(cp_tools_TEXINFOS)
cp-tools.pdf: cp-tools.texinfo
TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \
MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir)' \
$(TEXI2PDF) -o $@ `test -f 'cp-tools.texinfo' || echo '$(srcdir)/'`cp-tools.texinfo
cp-tools.html: cp-tools.texinfo $(cp_tools_TEXINFOS)
cp-tools.html: cp-tools.texinfo
rm -rf $(@:.html=.htp)
if $(MAKEINFOHTML) $(AM_MAKEINFOHTMLFLAGS) $(MAKEINFOFLAGS) -I $(srcdir) \
-o $(@:.html=.htp) `test -f 'cp-tools.texinfo' || echo '$(srcdir)/'`cp-tools.texinfo; \
@ -446,9 +459,6 @@ cp-tools.html: cp-tools.texinfo $(cp_tools_TEXINFOS)
rm -rf $(@:.html=); else rm -Rf $(@:.html=.htp) $@; fi; \
exit 1; \
fi
.dvi.ps:
TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \
$(DVIPS) -o $@ $<
uninstall-info-am:
@$(PRE_UNINSTALL)
@ -778,7 +788,7 @@ info: info-recursive
info-am: $(INFO_DEPS)
install-data-am: install-data-local install-info-am install-man
install-data-am: install-info-am install-man
install-exec-am:
@ -847,36 +857,26 @@ uninstall-man: uninstall-man1
ctags ctags-recursive dist-info 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-data-local install-exec \
install-exec-am install-info install-info-am install-man \
install-man1 install-strip installcheck installcheck-am \
installdirs installdirs-am maintainer-clean \
maintainer-clean-aminfo maintainer-clean-generic \
maintainer-clean-recursive mostlyclean mostlyclean-aminfo \
mostlyclean-generic mostlyclean-libtool mostlyclean-recursive \
pdf pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \
uninstall-info-am uninstall-man uninstall-man1
install-data install-data-am install-exec install-exec-am \
install-info install-info-am install-man install-man1 \
install-strip installcheck installcheck-am installdirs \
installdirs-am maintainer-clean maintainer-clean-aminfo \
maintainer-clean-generic maintainer-clean-recursive \
mostlyclean mostlyclean-aminfo mostlyclean-generic \
mostlyclean-libtool mostlyclean-recursive pdf pdf-am ps ps-am \
tags tags-recursive uninstall uninstall-am uninstall-info-am \
uninstall-man uninstall-man1
%.dvi : %.texinfo
.texinfo.dvi:
texi2dvi $<
%.ps : %.dvi
.dvi.ps:
dvips -o $@ $<
docs: cp-hacking.ps cp-vmintegration.ps cp-tools.ps
install-data-local: install-info
docs: cp-hacking.ps cp-vmintegration.ps cp-tools.ps $(TOOLS_MANFILES)
# gcc-vers.texi is generated from the version files.
gcc-vers.texi: $(BASEVER) $(DEVPHASE)
(echo "@set version-GCC $(shell cat $(BASEVER))"; \
if [ "$(shell cat $(DEVPHASE))" = "experimental" ]; \
then echo "@set DEVELOPMENT"; \
else echo "@clear DEVELOPMENT"; \
fi) > $@T
mv -f $@T $@
%.1: %.pod
.pod.1:
$(STAMP) $@
-($(POD2MAN) --section=1 $< > $(@).T$$$$ && \
mv -f $(@).T$$$$ $@) || \

View file

@ -44,16 +44,21 @@ am__aclocal_m4_deps = $(top_srcdir)/../../config/depstand.m4 \
$(top_srcdir)/../../config/lead-dot.m4 \
$(top_srcdir)/../../config/multi.m4 \
$(top_srcdir)/../../config/no-executables.m4 \
$(top_srcdir)/../../libtool.m4 $(top_srcdir)/m4/acattribute.m4 \
$(top_srcdir)/m4/accross.m4 $(top_srcdir)/m4/acinclude.m4 \
$(top_srcdir)/../../libtool.m4 \
$(top_srcdir)/../../ltoptions.m4 \
$(top_srcdir)/../../ltsugar.m4 \
$(top_srcdir)/../../ltversion.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/ax_func_which_gethostbyname_r.m4 \
$(top_srcdir)/m4/gcc_attribute.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
mkinstalldirs = $(SHELL) $(top_srcdir)/../../mkinstalldirs
CONFIG_HEADER = $(top_builddir)/include/config.h
CONFIG_CLEAN_FILES =
SOURCES =
@ -64,12 +69,15 @@ ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BUILD_CLASS_FILES_FALSE = @BUILD_CLASS_FILES_FALSE@
BUILD_CLASS_FILES_TRUE = @BUILD_CLASS_FILES_TRUE@
CAIRO_CFLAGS = @CAIRO_CFLAGS@
CAIRO_LIBS = @CAIRO_LIBS@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
@ -115,6 +123,7 @@ DATE = @DATE@
DEFAULT_PREFS_PEER = @DEFAULT_PREFS_PEER@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
@ -127,15 +136,16 @@ ERROR_CFLAGS = @ERROR_CFLAGS@
EXAMPLESDIR = @EXAMPLESDIR@
EXEEXT = @EXEEXT@
FASTJAR = @FASTJAR@
FGREP = @FGREP@
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_JAVAC_FALSE = @FOUND_JAVAC_FALSE@
FOUND_JAVAC_TRUE = @FOUND_JAVAC_TRUE@
FOUND_JIKES_FALSE = @FOUND_JIKES_FALSE@
FOUND_JIKES_TRUE = @FOUND_JIKES_TRUE@
FOUND_KJC_FALSE = @FOUND_KJC_FALSE@
@ -143,7 +153,6 @@ 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@
@ -153,6 +162,7 @@ GENINSRC_TRUE = @GENINSRC_TRUE@
GJDOC = @GJDOC@
GLIB_CFLAGS = @GLIB_CFLAGS@
GLIB_LIBS = @GLIB_LIBS@
GREP = @GREP@
GTK_CFLAGS = @GTK_CFLAGS@
GTK_LIBS = @GTK_LIBS@
INIT_LOAD_LIBRARY = @INIT_LOAD_LIBRARY@
@ -164,6 +174,7 @@ INSTALL_GLIBJ_ZIP_TRUE = @INSTALL_GLIBJ_ZIP_TRUE@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
JAVAC = @JAVAC@
JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION = @JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION@
JAVA_MAINTAINER_MODE_FALSE = @JAVA_MAINTAINER_MODE_FALSE@
JAVA_MAINTAINER_MODE_TRUE = @JAVA_MAINTAINER_MODE_TRUE@
@ -173,6 +184,7 @@ JIKES = @JIKES@
JIKESENCODING = @JIKESENCODING@
JIKESWARNINGS = @JIKESWARNINGS@
KJC = @KJC@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBDEBUG = @LIBDEBUG@
LIBICONV = @LIBICONV@
@ -192,6 +204,7 @@ MKDIR = @MKDIR@
MOC = @MOC@
MOZILLA_CFLAGS = @MOZILLA_CFLAGS@
MOZILLA_LIBS = @MOZILLA_LIBS@
NM = @NM@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@ -213,6 +226,7 @@ RANLIB = @RANLIB@
REGEN_PARSERS_FALSE = @REGEN_PARSERS_FALSE@
REGEN_PARSERS_TRUE = @REGEN_PARSERS_TRUE@
REMOVE = @REMOVE@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRICT_WARNING_CFLAGS = @STRICT_WARNING_CFLAGS@
@ -240,8 +254,10 @@ X_EXTRA_LIBS = @X_EXTRA_LIBS@
X_LIBS = @X_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
ZIP = @ZIP@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
@ -274,6 +290,7 @@ install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
lt_ECHO = @lt_ECHO@
mandir = @mandir@
mkdir_p = @mkdir_p@
multi_basedir = @multi_basedir@

View file

@ -1,7 +1,7 @@
\input texinfo @c -*-texinfo-*-
@c %**start of header
@setfilename hacking.info
@setfilename cp-hacking.info
@settitle GNU Classpath Hacker's Guide
@c %**end of header
@ -11,7 +11,7 @@
This file contains important information you will need to know if you
are going to hack on the GNU Classpath project code.
Copyright (C) 1998,1999,2000,2001,2002,2003,2004, 2005 Free Software Foundation, Inc.
Copyright (C) 1998,1999,2000,2001,2002,2003,2004,2005,2007 Free Software Foundation, Inc.
@ifnotplaintext
@dircategory GNU Libraries
@ -65,6 +65,9 @@ and compilers for the java programming language.
* Volunteering:: So you want to help out
* Project Goals:: Goals of the GNU Classpath project
* Needed Tools and Libraries:: A list of programs and libraries you will need
* Installation:: Installation instructions
* Building and running with the X AWT peers:: Building and running with the X AWT peers
* Misc. Notes:: Miscellaneous notes
* Programming Standards:: Standards to use when writing code
* Hacking Code:: Working on code, Working with others
* Programming Goals:: What to consider when writing code
@ -324,7 +327,7 @@ that way. But finishing, polishing up, documenting, testing and
debugging current functionality is of higher priority then adding new
functionality.
@node Needed Tools and Libraries, Programming Standards, Project Goals, Top
@node Needed Tools and Libraries, Installation, Project Goals, Top
@comment node-name, next, previous, up
@chapter Needed Tools and Libraries
@ -338,15 +341,19 @@ needed when working directly on the CVS version.
@itemize @bullet
@item
GCC 3.3+
GNU make 3.80+
@item
GCC 2.95+
@item
Eclipse Compiler for Java 3.1+
@item
CVS 1.11+
@item
automake 1.7+
automake 1.9+
@item
autoconf 2.59+
@item
libtool 1.4.2+
libtool 1.5+
@item
GNU m4 1.4
@item
@ -356,35 +363,50 @@ texinfo 4.2+
All of these tools are available from
@uref{ftp://gnudist.gnu.org/pub/gnu/,gnudist.gnu.org} via anonymous
ftp, except CVS which is available from
@uref{http://www.cvshome.org/,www.cvshome.org}. They are fully
documented with texinfo manuals. Texinfo can be browsed with the
Emacs editor, or with the text editor of your choice, or transformed
into nicely printable Postscript.
@uref{http://www.cvshome.org/,www.cvshome.org} and the Eclipse
Compiler for Java, which is available from
@uref{http://www.eclipse.org/jdt/core,www.eclipse.org/jdt/core}.
Except for the Eclipse Compiler for Java, they are fully documented
with texinfo manuals. Texinfo can be browsed with the Emacs editor,
or with the text editor of your choice, or transformed into nicely
printable Postscript.
Here is a brief description of the purpose of those tools.
@table @b
@item make
GNU make ("gmake") is required for building Classpath.
@item GCC
The GNU Compiler Collection. This contains a C compiler (gcc) for
compiling the native C code and a compiler for the java programming
language (gcj). You will need at least gcj version 3.3 or higher. If
that version is not available for your platform you can try the
@uref{http://www.jikes.org/, jikes compiler}. We try to keep all code
compilable with both gcj and jikes at all times.
language (gcj). You will need at least gcc version 2.95 or higher
in order to compile the native code. There is currently no
released version of gcj that can compile the Java 1.5 programming
language used by GNU Classpath.
@item ecj
The Eclipse Compiler for Java. This is a compiler for the Java 1.5
programming language. It translates source code to bytecode. The
Eclipse Foundation makes ``ecj.jar'' available as the JDT Core Batch
Compiler download.
@item CVS
A version control system that maintains a centralized Internet
repository of all code in the Classpath system.
@item automake
This tool automatically creates Makefile.in files from Makefile.am
files. The Makefile.in is turned into a Makefile by autoconf. Why
use this? Because it automatically generates every makefile target
you would ever want (clean, install, dist, etc) in full compliance
with the GNU coding standards. It also simplifies Makefile creation
in a number of ways that cannot be described here. Read the docs for
more info.
This tool automatically creates @file{Makefile.in} files from
@file{Makefile.am} files. The @file{Makefile.in} is turned into a
@file{Makefile} by @command{autoconf}.
Why use this? Because it automatically generates every makefile
target you would ever want (@option{clean}, @option{install},
@option{dist}, etc) in full compliance with the GNU coding standards.
It also simplifies Makefile creation in a number of ways that cannot
be described here. Read the docs for more info.
@item autoconf
Automatically configures a package for the platform on which it is
@ -414,12 +436,29 @@ is revised, you need revise only that one document.
@end table
For any build environment involving native libraries, recent
versions of @command{autoconf}, @command{automake}, and @command{libtool}
are required if changes are made that require rebuilding @file{configure},
@file{Makefile.in}, @file{aclocal.m4}, or @file{config.h.in}.
When working from CVS you can run those tools by executing
@command{autogen.sh} in the source directory.
For building the Java bytecode (.class files), you can select
which compiler should be employed using @option{--with-javac} or
@option{--with-ecj} as argument to @command{configure};
the present default is @command{ecj}.
Instead of @command{ecj}, you can also use @command{javac}, which is
available at
@uref{https://openjdk.dev.java.net/compiler, openjdk.dev.java.net/compiler}.
For compiling the native AWT libraries you need to have the following
libraries installed:
libraries installed (unless @option{--disable-gtk-peer} is used as an argument
to @command{configure}):
@table @b
@item GTK+ 2.2.x
@item GTK+ 2.8.x
@uref{http://www.gtk.org/,GTK+} is a multi-platform toolkit for
creating graphical user interfaces. It is used as the basis of the
GNU desktop project GNOME.
@ -427,8 +466,125 @@ GNU desktop project GNOME.
@item gdk-pixbuf
@uref{http://www.gnome.org/start/,gdk-pixbuf} is a GNOME library for
representing images.
@item XTest
@uref{http://www.x.org,www.x.org} hosts the XTest Extension (libXtst).
It is necessary for GdkRobot support in java.awt.
@end table
There is a bug in earlier versions of at-spi, atk, and gail, which are
used for GNOME accessibility. Prior to version 1.18.0 of these packages,
gtk graphical applications should be run without accessibility (clear the
GTK_MODULES environment variable).
For building the Qt AWT peer JNI native libraries you have to
specify @option{--enable-qt-peer} and need the following library:
@table @b
@item Qt
@uref{http://www.trolltech.com/products/qt,Qt} version 4.0.1 or higher.
The Qt library is a cros-platform graphics toolkit.
@end table
Please note that at the moment most operating systems do not
ship Qt version 4.0.1 by default. We recommend using GNU Classpath' Qt
support only for its developers and bug reporters. See
@uref{http://developer.classpath.org/mediation/ClasspathShowcase, the wiki}
for details on how to get it to work.
For building the X AWT peers you have to specify where to find the
Escher library on your system using the @option{--with-escher=ABS.PATH} option.
You will need the following library:
@table @b
@item Escher
@uref{http://escher.sourceforge.net,Escher} version 0.2.3 or higher.
The Escher library is an implementation of X protocol and associated
libraries written in the Java programming language.
@end table
For building the ALSA midi provider code you will need
the following library:
@table @b
@item ALSA
@uref{http://www.alsa-project.org,ALSA} libraries.
The ALSA project provides sound device drivers and associated
libraries for the Linux kernel.
@end table
Building the ALSA midi provider code can be disabled by passing
@option{--disable-alsa} to @command{configure}.
For building the DSSI midi synthesizer provider code you will
need the following libraries:
@table @b
@item DSSI
@uref{http://dssi.sourceforge.net,DSSI} library for audio
processing plugins.
@item liblo
@uref{http://plugin.org.uk/liblo/,liblo}, the Lightweight OSC
implementation.
@item LADSPA
@uref{http://www.ladspa.org,LADSPA}, the Linux Audio Developer's
Simple Plugin API.
@item JACK
@uref{http://jackit.sourceforge.net,JACK}, a low latency audio
server.
@item libsndfile
@uref{http://www.mega-nerd.com/libsndfile/,libsndfile}, an audio
file I/O library.
@item fluidsynth
@uref{http://www.fluidsynth.org/,fluidsynth}, a real-time SoundFont
2 based soft-synth.
@end table
The GConf-based backend for java.util.prefs needs the following
library headers:
@table @b
@item GConf
@uref{http://www.gnome.org/projects/gconf/,GConf} version 2.11.2
(or higher). GConf is used for storing dektop and application
configuration settings in GNOME.
@end table
For building @command{gcjwebplugin} you'll need the Mozilla plugin
support headers and libraries, which are available at
@uref{http://www.mozilla.org,www.mozilla.org}.
For enabling the com.sun.tools.javac support in tools.zip you
will a need jar file containing the Eclipse Java Compiler.
Otherwise com.sun.tools.javac will not be included in @file{tools.zip}.
For building the xmlj JAXP implementation (disabled by default,
use @command{configure --enable-xmlj}) you need the following libraries:
@table @b
@item libxml2
@uref{http://www.xmlsoft.org/,libxml2} version 2.6.8 or higher.
The libxml2 library is the XML C library for the Gnome desktop.
@item libxslt
@uref{http://www.xmlsoft.org/XSLT/,libxslt} version 1.1.11 or higher.
The libxslt library if the XSLT C library for the Gnome desktop.
@end table
GNU Classpath comes with a couple of libraries included in the source
that are not part of GNU Classpath proper, but that have been included
@ -457,8 +613,167 @@ java.lang.StrictMath.
@end table
@node Installation, Building and running with the X AWT peers, Needed Tools and Libraries, Top
@comment node-name, next, previous, up
@chapter Installation instructions
@node Programming Standards, Hacking Code, Needed Tools and Libraries, Top
This package was designed to use the GNU standard for configuration
and makefiles. To build and install do the following:
@enumerate
@item Configuration
Run the @command{configure} script to configure the package. There are
various options you might want to pass to @command{configure} to control how the
package is built. Consider the following options, @command{configure --help}
gives a complete list.
@table @option
@item --enable-java
compile Java source (default=@option{yes}).
@item --enable-jni
compile JNI source (default=@option{yes}).
@item --enable-gtk-peer
compile GTK native peers (default=@option{yes}).
@item --enable-qt-peer
compile Qt4 native peers (default=@option{no}).
@item --enable-default-toolkit
fully qualified class name of default AWT toolkit (default=@option{no}).
@item --enable-xmlj
compile native libxml/xslt library (default=@option{no}).
@item --enable-load-library
enable to use JNI native methods (default=@option{yes}).
@item --enable-local-sockets
enable build of local Unix sockets.
@item --with-glibj
define what to install @option{(zip|flat|both|none)} (default=@option{zip}).
@item --with-escher=/path/to/escher
enable build of the X/Escher peers, with
the escher library at @file{/path/to/escher}, either
in the form of a JAR file, or a directory
containing the .class files of Escher.
@item --enable-Werror
whether to compile C code with @option{-Werror} which turns
any compiler warning into a compilation failure
(default=@option{no}).
@item --with-gjdoc
generate documentation using @command{gjdoc} (default=@option{no}).
@item --with-jay
Regenerate the parsers with @command{jay}, must be given the
path to the @command{jay} executable
@item --with-glibj-zip=ABS.PATH
use prebuilt glibj.zip class library
@item --with-ecj-jar=ABS.PATH
specify jar file containing the Eclipse Java Compiler
@end table
For more flags run @command{configure --help}.
@item Building
Type @command{gmake} to build the package. There is no longer a
dependency problem and we aim to keep it that way.
@item Installation
Type @command{gmake install} to install everything. This may require
being the superuser. The default install path is /usr/local/classpath
you may change it by giving @command{configure} the
@option{--prefix=<path>} option.
@end enumerate
Report bugs to @email{classpath@@gnu.org} or much better to the
GNU Classpath bug tracker at
@uref{http://savannah.gnu.org/support/?func=addsupport&group=classpath,Savannah}.
Happy Hacking!
Once installed, GNU Classpath is ready to be used by any VM that supports
using the official version of GNU Classpath. Simply ensure that
@file{/usr/local/classpath/share/classpath} is in your @env{CLASSPATH} environment
variable. You'll also have to set your @env{LD_LIBRARY_PATH}
variable (or similar system configuration) to include the Classpath
native libraries in @file{/usr/local/classpath/lib/classpath}.
*NOTE* All example paths assume the default prefix is used with @command{configure}.
If you don't know what this means then the examples are correct.
@example
LD_LIBRARY_PATH=/usr/local/classpath/lib/classpath
CLASSPATH=/usr/local/classpath/share/classpath/glibj.zip:.
export LD_LIBRARY_PATH CLASSPATH
@end example
More information about the VMs that use GNU Classpath can be found in the
@file{README} file.
@node Building and running with the X AWT peers, Misc. Notes, Installation, Top
@comment node-name, next, previous, up
@chapter Building and running with the X AWT peers
In order build the X peers you need the Escher library version 0.2.3
from @uref{http://escher.sourceforge.net,escher.sourceforge.net}.
Unpack (and optionally build) the
Escher library following the instructions in the downloaded
package. Enable the build of the X peers by passing
@option{--with-escher=/path/to/escher} to @command{configure} where @file{/path/to/escher}
either points to a directory structure or JAR file containing the
Escher classes. For Unix systems it is preferable to also build local
socket support by passing @option{--enable-local-sockets}, which accelerates
the network communication to the X server significantly.
In this release you have to enable the X peers at runtime by
setting the system property awt.toolkit=gnu.java.awt.peer.x.XToolkit
by passing @option{-Dawt.toolkit=gnu.java.awt.peer.x.XToolkit} to the @command{java}
command when running an application.
@node Misc. Notes, Programming Standards, Building and running with the X AWT peers, Top
@comment node-name, next, previous, up
@chapter Misc. Notes
Compilation is accomplished using a compiler's @@file syntax. For our
part, we avoid placing make style dependencies as rules upon the
compilation of a particular class file and leave this up to the Java
compiler instead.
The @option{--enable-maintainer-mode} option to @command{configure} currently does very
little and shouldn't be used by ordinary developers or users anyway.
On Windows machines, the native libraries do not currently build, but
the Java bytecode library will. Gcj trunk is beginning to work under
Cygwin.
@node Programming Standards, Hacking Code, Misc. Notes, Top
@comment node-name, next, previous, up
@chapter Programming Standards

View file

@ -1,7 +1,7 @@
\input texinfo @c -*-texinfo-*-
@c %**start of header
@setfilename vmintegration.info
@setfilename cp-vmintegration.info
@settitle GNU Classpath VM Integration Guide
@c %**end of header
@ -12,7 +12,7 @@ This file contains important information you will need to know if you
are going to write an interface between GNU Classpath and a Virtual
Machine.
Copyright (C) 1998-2002, 2004, 2005, 2006 Free Software Foundation, Inc.
Copyright (C) 1998-2002, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
@ifnotplaintext
@dircategory GNU Libraries
@ -1376,6 +1376,12 @@ time used by all threads.
@item @code{gnu.java.lang.management.ThreadContentionSupport} --
This property should be present if the VM supports thread contention
monitoring.
@item @code{gnu.java.lang.management.MonitorUsageMonitoringSupport} --
This property should be present if the VM supports the monitoring
of object monitor usage.
@item @code{gnu.java.lang.management.OwnableSynchronizerUsageMonitoringSupport} --
This property should be present if the VM supports the monitoring
of ownable synchronizer usage.
@end itemize
In addition, the property
@ -1386,11 +1392,18 @@ is enabled at startup.
The methods are as follows:
@itemize @bullet
@item @code{(findDeadlockedThreads())} -- This should return
an array of thread identifiers which match threads involved in
deadlock cycles (where each thread is waiting to obtain a lock
held by one of the others) on object monitors or ownable
synchronizers. This is specified as a native method in the
reference implementation, and is optional. It is only called
when the VM supports ownable synchronizer monitoring.
@item @code{(findMonitorDeadlockedThreads())} -- This should return
an array of thread identifiers which match threads involved in
deadlock cycles (where each thread is waiting to obtain a lock
held by one of the others). This is specified as a native method
in the reference implementation.
held by one of the others) on object monitors. This is specified
as a native method in the reference implementation.
@item @code{(getAllThreads())} -- This should return an array of
all live threads and set the @code{filled} variable to the number
found. A default implementation is provided.
@ -1408,6 +1421,16 @@ supporting time monitoring.
@item @code{(getDaemonThreadCount())} -- This should return the number
of live daemon threads. A default implementation is provided, based
on @code{getAllThreads()}.
@item @code{(getLockInfo(ThreadInfo))} -- This is an optional native
method called when the VM supports ownable synchronizer usage monitoring
and the user has requested information for a particular thread. The
supplied @code{ThreadInfo} object should be filled out with an
array of @code{LockInfo} objects, providing details on each lock.
@item @code{(getMonitorInfo(ThreadInfo))} -- This is an optional native
method called when the VM supports object monitor usage monitoring
and the user has requested information for a particular thread. The
supplied @code{ThreadInfo} object should be filled out with an
array of @code{MonitorInfo} objects, providing details on each lock.
@item @code{(getPeakThreadCount())} -- The VM should maintain a record
of the peak number of live threads, and return it when this method is
called. This is specified as a native method in the reference

478
libjava/classpath/doc/texi2pod.pl Executable file
View file

@ -0,0 +1,478 @@
#! /usr/bin/perl -w
# Copyright (C) 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
# This file is part of GCC.
# GCC 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.
# GCC 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 GCC; see the file COPYING. If not, write to
# the Free Software Foundation, 51 Franklin Street, Fifth Floor,
# Boston MA 02110-1301, USA.
# This does trivial (and I mean _trivial_) conversion of Texinfo
# markup to Perl POD format. It's intended to be used to extract
# something suitable for a manpage from a Texinfo document.
$output = 0;
$skipping = 0;
%sects = ();
$section = "";
@icstack = ();
@endwstack = ();
@skstack = ();
@instack = ();
$shift = "";
%defs = ();
$fnno = 1;
$inf = "";
$ibase = "";
@ipath = ();
while ($_ = shift) {
if (/^-D(.*)$/) {
if ($1 ne "") {
$flag = $1;
} else {
$flag = shift;
}
$value = "";
($flag, $value) = ($flag =~ /^([^=]+)(?:=(.+))?/);
die "no flag specified for -D\n"
unless $flag ne "";
die "flags may only contain letters, digits, hyphens, dashes and underscores\n"
unless $flag =~ /^[a-zA-Z0-9_-]+$/;
$defs{$flag} = $value;
} elsif (/^-I(.*)$/) {
if ($1 ne "") {
$flag = $1;
} else {
$flag = shift;
}
push (@ipath, $flag);
} elsif (/^-/) {
usage();
} else {
$in = $_, next unless defined $in;
$out = $_, next unless defined $out;
usage();
}
}
if (defined $in) {
$inf = gensym();
open($inf, "<$in") or die "opening \"$in\": $!\n";
$ibase = $1 if $in =~ m|^(.+)/[^/]+$|;
} else {
$inf = \*STDIN;
}
if (defined $out) {
open(STDOUT, ">$out") or die "opening \"$out\": $!\n";
}
while(defined $inf) {
while(<$inf>) {
# Certain commands are discarded without further processing.
/^\@(?:
[a-z]+index # @*index: useful only in complete manual
|need # @need: useful only in printed manual
|(?:end\s+)?group # @group .. @end group: ditto
|page # @page: ditto
|node # @node: useful only in .info file
|(?:end\s+)?ifnottex # @ifnottex .. @end ifnottex: use contents
)\b/x and next;
chomp;
# Look for filename and title markers.
/^\@setfilename\s+([^.]+)/ and $fn = $1, next;
/^\@settitle\s+([^.]+)/ and $tl = postprocess($1), next;
# Identify a man title but keep only the one we are interested in.
/^\@c\s+man\s+title\s+([A-Za-z0-9-]+)\s+(.+)/ and do {
if (exists $defs{$1}) {
$fn = $1;
$tl = postprocess($2);
}
next;
};
# Look for blocks surrounded by @c man begin SECTION ... @c man end.
# This really oughta be @ifman ... @end ifman and the like, but such
# would require rev'ing all other Texinfo translators.
/^\@c\s+man\s+begin\s+([A-Z]+)\s+([A-Za-z0-9-]+)/ and do {
$output = 1 if exists $defs{$2};
$sect = $1;
next;
};
/^\@c\s+man\s+begin\s+([A-Z]+)/ and $sect = $1, $output = 1, next;
/^\@c\s+man\s+end/ and do {
$sects{$sect} = "" unless exists $sects{$sect};
$sects{$sect} .= postprocess($section);
$section = "";
$output = 0;
next;
};
# handle variables
/^\@set\s+([a-zA-Z0-9_-]+)\s*(.*)$/ and do {
$defs{$1} = $2;
next;
};
/^\@clear\s+([a-zA-Z0-9_-]+)/ and do {
delete $defs{$1};
next;
};
next unless $output;
# Discard comments. (Can't do it above, because then we'd never see
# @c man lines.)
/^\@c\b/ and next;
# End-block handler goes up here because it needs to operate even
# if we are skipping.
/^\@end\s+([a-z]+)/ and do {
# Ignore @end foo, where foo is not an operation which may
# cause us to skip, if we are presently skipping.
my $ended = $1;
next if $skipping && $ended !~ /^(?:ifset|ifclear|ignore|menu|iftex|copying)$/;
die "\@end $ended without \@$ended at line $.\n" unless defined $endw;
die "\@$endw ended by \@end $ended at line $.\n" unless $ended eq $endw;
$endw = pop @endwstack;
if ($ended =~ /^(?:ifset|ifclear|ignore|menu|iftex)$/) {
$skipping = pop @skstack;
next;
} elsif ($ended =~ /^(?:example|smallexample|display)$/) {
$shift = "";
$_ = ""; # need a paragraph break
} elsif ($ended =~ /^(?:itemize|enumerate|[fv]?table)$/) {
$_ = "\n=back\n";
$ic = pop @icstack;
} elsif ($ended eq "multitable") {
$_ = "\n=back\n";
} else {
die "unknown command \@end $ended at line $.\n";
}
};
# We must handle commands which can cause skipping even while we
# are skipping, otherwise we will not process nested conditionals
# correctly.
/^\@ifset\s+([a-zA-Z0-9_-]+)/ and do {
push @endwstack, $endw;
push @skstack, $skipping;
$endw = "ifset";
$skipping = 1 unless exists $defs{$1};
next;
};
/^\@ifclear\s+([a-zA-Z0-9_-]+)/ and do {
push @endwstack, $endw;
push @skstack, $skipping;
$endw = "ifclear";
$skipping = 1 if exists $defs{$1};
next;
};
/^\@(ignore|menu|iftex|copying)\b/ and do {
push @endwstack, $endw;
push @skstack, $skipping;
$endw = $1;
$skipping = 1;
next;
};
next if $skipping;
# Character entities. First the ones that can be replaced by raw text
# or discarded outright:
s/\@copyright\{\}/(c)/g;
s/\@dots\{\}/.../g;
s/\@enddots\{\}/..../g;
s/\@([.!? ])/$1/g;
s/\@[:-]//g;
s/\@bullet(?:\{\})?/*/g;
s/\@TeX\{\}/TeX/g;
s/\@pounds\{\}/\#/g;
s/\@minus(?:\{\})?/-/g;
s/\\,/,/g;
# Now the ones that have to be replaced by special escapes
# (which will be turned back into text by unmunge())
s/&/&amp;/g;
s/\@\{/&lbrace;/g;
s/\@\}/&rbrace;/g;
s/\@\@/&at;/g;
# Inside a verbatim block, handle @var specially.
if ($shift ne "") {
s/\@var\{([^\}]*)\}/<$1>/g;
}
# POD doesn't interpret E<> inside a verbatim block.
if ($shift eq "") {
s/</&lt;/g;
s/>/&gt;/g;
} else {
s/</&LT;/g;
s/>/&GT;/g;
}
# Single line command handlers.
/^\@include\s+(.+)$/ and do {
push @instack, $inf;
$inf = gensym();
$file = postprocess($1);
# Try cwd and $ibase, then explicit -I paths.
$done = 0;
foreach $path ("", $ibase, @ipath) {
$mypath = $file;
$mypath = $path . "/" . $mypath if ($path ne "");
open($inf, "<" . $mypath) and ($done = 1, last);
}
die "cannot find $file" if !$done;
next;
};
/^\@(?:section|unnumbered|unnumberedsec|center)\s+(.+)$/
and $_ = "\n=head2 $1\n";
/^\@subsection\s+(.+)$/
and $_ = "\n=head3 $1\n";
/^\@subsubsection\s+(.+)$/
and $_ = "\n=head4 $1\n";
# Block command handlers:
/^\@itemize(?:\s+(\@[a-z]+|\*|-))?/ and do {
push @endwstack, $endw;
push @icstack, $ic;
if (defined $1) {
$ic = $1;
} else {
$ic = '@bullet';
}
$_ = "\n=over 4\n";
$endw = "itemize";
};
/^\@enumerate(?:\s+([a-zA-Z0-9]+))?/ and do {
push @endwstack, $endw;
push @icstack, $ic;
if (defined $1) {
$ic = $1 . ".";
} else {
$ic = "1.";
}
$_ = "\n=over 4\n";
$endw = "enumerate";
};
/^\@multitable\s.*/ and do {
push @endwstack, $endw;
$endw = "multitable";
$_ = "\n=over 4\n";
};
/^\@([fv]?table)\s+(\@[a-z]+)/ and do {
push @endwstack, $endw;
push @icstack, $ic;
$endw = $1;
$ic = $2;
$ic =~ s/\@(?:samp|strong|key|gcctabopt|env)/B/;
$ic =~ s/\@(?:code|kbd)/C/;
$ic =~ s/\@(?:dfn|var|emph|cite|i)/I/;
$ic =~ s/\@(?:file)/F/;
$_ = "\n=over 4\n";
};
/^\@((?:small)?example|display)/ and do {
push @endwstack, $endw;
$endw = $1;
$shift = "\t";
$_ = ""; # need a paragraph break
};
/^\@item\s+(.*\S)\s*$/ and $endw eq "multitable" and do {
@columns = ();
for $column (split (/\s*\@tab\s*/, $1)) {
# @strong{...} is used a @headitem work-alike
$column =~ s/^\@strong{(.*)}$/$1/;
push @columns, $column;
}
$_ = "\n=item ".join (" : ", @columns)."\n";
};
/^\@itemx?\s*(.+)?$/ and do {
if (defined $1) {
# Entity escapes prevent munging by the <> processing below.
$_ = "\n=item $ic\&LT;$1\&GT;\n";
} else {
$_ = "\n=item $ic\n";
$ic =~ y/A-Ya-y/B-Zb-z/;
$ic =~ s/(\d+)/$1 + 1/eg;
}
};
$section .= $shift.$_."\n";
}
# End of current file.
close($inf);
$inf = pop @instack;
}
die "No filename or title\n" unless defined $fn && defined $tl;
$sects{NAME} = "$fn \- $tl\n";
$sects{FOOTNOTES} .= "=back\n" if exists $sects{FOOTNOTES};
for $sect (qw(NAME SYNOPSIS DESCRIPTION OPTIONS ENVIRONMENT FILES
BUGS NOTES FOOTNOTES SEEALSO AUTHOR COPYRIGHT)) {
if(exists $sects{$sect}) {
$head = $sect;
$head =~ s/SEEALSO/SEE ALSO/;
print "=head1 $head\n\n";
print scalar unmunge ($sects{$sect});
print "\n";
}
}
sub usage
{
die "usage: $0 [-D toggle...] [infile [outfile]]\n";
}
sub postprocess
{
local $_ = $_[0];
# @value{foo} is replaced by whatever 'foo' is defined as.
while (m/(\@value\{([a-zA-Z0-9_-]+)\})/g) {
if (! exists $defs{$2}) {
print STDERR "Option $2 not defined\n";
s/\Q$1\E//;
} else {
$value = $defs{$2};
s/\Q$1\E/$value/;
}
}
# Formatting commands.
# Temporary escape for @r.
s/\@r\{([^\}]*)\}/R<$1>/g;
s/\@(?:dfn|var|emph|cite|i)\{([^\}]*)\}/I<$1>/g;
s/\@(?:code|kbd)\{([^\}]*)\}/C<$1>/g;
s/\@(?:gccoptlist|samp|strong|key|option|env|command|b)\{([^\}]*)\}/B<$1>/g;
s/\@sc\{([^\}]*)\}/\U$1/g;
s/\@file\{([^\}]*)\}/F<$1>/g;
s/\@w\{([^\}]*)\}/S<$1>/g;
s/\@(?:dmn|math)\{([^\}]*)\}/$1/g;
# keep references of the form @ref{...}, print them bold
s/\@(?:ref)\{([^\}]*)\}/B<$1>/g;
# Change double single quotes to double quotes.
s/''/"/g;
s/``/"/g;
# Cross references are thrown away, as are @noindent and @refill.
# (@noindent is impossible in .pod, and @refill is unnecessary.)
# @* is also impossible in .pod; we discard it and any newline that
# follows it. Similarly, our macro @gol must be discarded.
s/\(?\@xref\{(?:[^\}]*)\}(?:[^.<]|(?:<[^<>]*>))*\.\)?//g;
s/\s+\(\@pxref\{(?:[^\}]*)\}\)//g;
s/;\s+\@pxref\{(?:[^\}]*)\}//g;
s/\@noindent\s*//g;
s/\@refill//g;
s/\@gol//g;
s/\@\*\s*\n?//g;
# Anchors are thrown away
s/\@anchor\{(?:[^\}]*)\}//g;
# @uref can take one, two, or three arguments, with different
# semantics each time. @url and @email are just like @uref with
# one argument, for our purposes.
s/\@(?:uref|url|email)\{([^\},]*)\}/&lt;B<$1>&gt;/g;
s/\@uref\{([^\},]*),([^\},]*)\}/$2 (C<$1>)/g;
s/\@uref\{([^\},]*),([^\},]*),([^\},]*)\}/$3/g;
# Un-escape <> at this point.
s/&LT;/</g;
s/&GT;/>/g;
# Now un-nest all B<>, I<>, R<>. Theoretically we could have
# indefinitely deep nesting; in practice, one level suffices.
1 while s/([BIR])<([^<>]*)([BIR])<([^<>]*)>/$1<$2>$3<$4>$1</g;
# Replace R<...> with bare ...; eliminate empty markup, B<>;
# shift white space at the ends of [BI]<...> expressions outside
# the expression.
s/R<([^<>]*)>/$1/g;
s/[BI]<>//g;
s/([BI])<(\s+)([^>]+)>/$2$1<$3>/g;
s/([BI])<([^>]+?)(\s+)>/$1<$2>$3/g;
# Extract footnotes. This has to be done after all other
# processing because otherwise the regexp will choke on formatting
# inside @footnote.
while (/\@footnote/g) {
s/\@footnote\{([^\}]+)\}/[$fnno]/;
add_footnote($1, $fnno);
$fnno++;
}
return $_;
}
sub unmunge
{
# Replace escaped symbols with their equivalents.
local $_ = $_[0];
s/&lt;/E<lt>/g;
s/&gt;/E<gt>/g;
s/&lbrace;/\{/g;
s/&rbrace;/\}/g;
s/&at;/\@/g;
s/&amp;/&/g;
return $_;
}
sub add_footnote
{
unless (exists $sects{FOOTNOTES}) {
$sects{FOOTNOTES} = "\n=over 4\n\n";
}
$sects{FOOTNOTES} .= "=item $fnno.\n\n"; $fnno++;
$sects{FOOTNOTES} .= $_[0];
$sects{FOOTNOTES} .= "\n\n";
}
# stolen from Symbol.pm
{
my $genseq = 0;
sub gensym
{
my $name = "GEN" . $genseq++;
my $ref = \*{$name};
delete $::{$name};
return $ref;
}
}

File diff suppressed because it is too large Load diff

View file

@ -8,16 +8,16 @@ GLIBJ_CLASSPATH='$(top_builddir)/lib':'$(top_builddir)/lib/glibj.zip':'$(top_bui
#if FOUND_JIKES
#JCOMPILER = $(JIKES) -bootclasspath '' -extdirs '' -sourcepath '' --classpath $(top_builddir)/lib:.
#else
if FOUND_GCJX
JCOMPILER = $(GCJX) -encoding UTF-8 -bootclasspath '' -sourcepath '' -classpath $(GLIBJ_CLASSPATH):.
else
if FOUND_ECJ
JCOMPILER = $(ECJ) -1.5 -encoding UTF-8 -bootclasspath $(GLIBJ_CLASSPATH) -classpath .
JCOMPILER = $(ECJ) -1.5 -encoding UTF-8 -warn:-deprecation,serial,typeHiding,unchecked,unused,varargsCast -bootclasspath $(GLIBJ_CLASSPATH) -classpath .
else
if FOUND_JAVAC
JCOMPILER = $(JAVAC) -encoding UTF-8 -bootclasspath $(GLIBJ_CLASSPATH) -classpath .
else
error dunno how to setup the JCOMPILER and compile
#endif
#endif
endif
#endif
#endif
endif
# All our example java source files
@ -35,6 +35,7 @@ BUILT_SOURCES = $(EXAMPLE_ZIP)
# the png icons we use in some of the examples.
EXAMPLE_ICONS = $(srcdir)/gnu/classpath/examples/icons/*.png
EXAMPLE_ICONS += $(srcdir)/gnu/classpath/examples/icons/*.gif
# the html pages we use in the swing demo example.
EXAMPLE_HTML = $(srcdir)/gnu/classpath/examples/swing/*.html

View file

@ -45,16 +45,21 @@ am__aclocal_m4_deps = $(top_srcdir)/../../config/depstand.m4 \
$(top_srcdir)/../../config/lead-dot.m4 \
$(top_srcdir)/../../config/multi.m4 \
$(top_srcdir)/../../config/no-executables.m4 \
$(top_srcdir)/../../libtool.m4 $(top_srcdir)/m4/acattribute.m4 \
$(top_srcdir)/m4/accross.m4 $(top_srcdir)/m4/acinclude.m4 \
$(top_srcdir)/../../libtool.m4 \
$(top_srcdir)/../../ltoptions.m4 \
$(top_srcdir)/../../ltsugar.m4 \
$(top_srcdir)/../../ltversion.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/ax_func_which_gethostbyname_r.m4 \
$(top_srcdir)/m4/gcc_attribute.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
mkinstalldirs = $(SHELL) $(top_srcdir)/../../mkinstalldirs
CONFIG_HEADER = $(top_builddir)/include/config.h
CONFIG_CLEAN_FILES = Makefile.jawt Makefile.java2d
SOURCES =
@ -73,12 +78,15 @@ ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BUILD_CLASS_FILES_FALSE = @BUILD_CLASS_FILES_FALSE@
BUILD_CLASS_FILES_TRUE = @BUILD_CLASS_FILES_TRUE@
CAIRO_CFLAGS = @CAIRO_CFLAGS@
CAIRO_LIBS = @CAIRO_LIBS@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
@ -124,6 +132,7 @@ DATE = @DATE@
DEFAULT_PREFS_PEER = @DEFAULT_PREFS_PEER@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
@ -136,15 +145,16 @@ ERROR_CFLAGS = @ERROR_CFLAGS@
EXAMPLESDIR = @EXAMPLESDIR@
EXEEXT = @EXEEXT@
FASTJAR = @FASTJAR@
FGREP = @FGREP@
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_JAVAC_FALSE = @FOUND_JAVAC_FALSE@
FOUND_JAVAC_TRUE = @FOUND_JAVAC_TRUE@
FOUND_JIKES_FALSE = @FOUND_JIKES_FALSE@
FOUND_JIKES_TRUE = @FOUND_JIKES_TRUE@
FOUND_KJC_FALSE = @FOUND_KJC_FALSE@
@ -152,7 +162,6 @@ 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@
@ -162,6 +171,7 @@ GENINSRC_TRUE = @GENINSRC_TRUE@
GJDOC = @GJDOC@
GLIB_CFLAGS = @GLIB_CFLAGS@
GLIB_LIBS = @GLIB_LIBS@
GREP = @GREP@
GTK_CFLAGS = @GTK_CFLAGS@
GTK_LIBS = @GTK_LIBS@
INIT_LOAD_LIBRARY = @INIT_LOAD_LIBRARY@
@ -173,6 +183,7 @@ INSTALL_GLIBJ_ZIP_TRUE = @INSTALL_GLIBJ_ZIP_TRUE@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
JAVAC = @JAVAC@
JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION = @JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION@
JAVA_MAINTAINER_MODE_FALSE = @JAVA_MAINTAINER_MODE_FALSE@
JAVA_MAINTAINER_MODE_TRUE = @JAVA_MAINTAINER_MODE_TRUE@
@ -182,6 +193,7 @@ JIKES = @JIKES@
JIKESENCODING = @JIKESENCODING@
JIKESWARNINGS = @JIKESWARNINGS@
KJC = @KJC@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBDEBUG = @LIBDEBUG@
LIBICONV = @LIBICONV@
@ -201,6 +213,7 @@ MKDIR = @MKDIR@
MOC = @MOC@
MOZILLA_CFLAGS = @MOZILLA_CFLAGS@
MOZILLA_LIBS = @MOZILLA_LIBS@
NM = @NM@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@ -222,6 +235,7 @@ RANLIB = @RANLIB@
REGEN_PARSERS_FALSE = @REGEN_PARSERS_FALSE@
REGEN_PARSERS_TRUE = @REGEN_PARSERS_TRUE@
REMOVE = @REMOVE@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRICT_WARNING_CFLAGS = @STRICT_WARNING_CFLAGS@
@ -249,8 +263,10 @@ X_EXTRA_LIBS = @X_EXTRA_LIBS@
X_LIBS = @X_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
ZIP = @ZIP@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
@ -283,6 +299,7 @@ install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
lt_ECHO = @lt_ECHO@
mandir = @mandir@
mkdir_p = @mkdir_p@
multi_basedir = @multi_basedir@
@ -301,7 +318,7 @@ target_vendor = @target_vendor@
toolexeclibdir = @toolexeclibdir@
vm_classes = @vm_classes@
GLIBJ_CLASSPATH = '$(top_builddir)/lib':'$(top_builddir)/lib/glibj.zip':'$(top_builddir)/tools/tools.zip'
@FOUND_ECJ_TRUE@@FOUND_GCJX_FALSE@JCOMPILER = $(ECJ) -1.5 -encoding UTF-8 -bootclasspath $(GLIBJ_CLASSPATH) -classpath .
@FOUND_ECJ_FALSE@@FOUND_JAVAC_TRUE@JCOMPILER = $(JAVAC) -encoding UTF-8 -bootclasspath $(GLIBJ_CLASSPATH) -classpath .
# Setup the compiler to use the GNU Classpath library we just build
#if FOUND_GCJ
@ -310,7 +327,7 @@ GLIBJ_CLASSPATH = '$(top_builddir)/lib':'$(top_builddir)/lib/glibj.zip':'$(top_b
#if FOUND_JIKES
#JCOMPILER = $(JIKES) -bootclasspath '' -extdirs '' -sourcepath '' --classpath $(top_builddir)/lib:.
#else
@FOUND_GCJX_TRUE@JCOMPILER = $(GCJX) -encoding UTF-8 -bootclasspath '' -sourcepath '' -classpath $(GLIBJ_CLASSPATH):.
@FOUND_ECJ_TRUE@JCOMPILER = $(ECJ) -1.5 -encoding UTF-8 -warn:-deprecation,serial,typeHiding,unchecked,unused,varargsCast -bootclasspath $(GLIBJ_CLASSPATH) -classpath .
#endif
#endif
@ -328,7 +345,8 @@ EXAMPLE_ZIP = examples.zip
BUILT_SOURCES = $(EXAMPLE_ZIP)
# the png icons we use in some of the examples.
EXAMPLE_ICONS = $(srcdir)/gnu/classpath/examples/icons/*.png
EXAMPLE_ICONS = $(srcdir)/gnu/classpath/examples/icons/*.png \
$(srcdir)/gnu/classpath/examples/icons/*.gif
# the html pages we use in the swing demo example.
EXAMPLE_HTML = $(srcdir)/gnu/classpath/examples/swing/*.html
@ -540,7 +558,7 @@ uninstall-am: uninstall-exampleDATA uninstall-info-am uninstall-local
uninstall uninstall-am uninstall-exampleDATA uninstall-info-am \
uninstall-local
@FOUND_ECJ_FALSE@@FOUND_GCJX_FALSE@error dunno how to setup the JCOMPILER and compile
@FOUND_ECJ_FALSE@@FOUND_JAVAC_FALSE@error dunno how to setup the JCOMPILER and compile
# Make sure all sources and icons are also installed so users can use them.
# (Be careful to strip off the srcdir part of the path when installing.)

View file

@ -100,8 +100,8 @@ public class AicasGraphicsBenchmark extends Panel
public AicasGraphicsBenchmark()
{
pngTestImage = loadImage("aicas.png");
gifTestImage = loadImage("palme.gif");
pngTestImage = loadImage("../icons/aicas.png");
gifTestImage = loadImage("../icons/palme.gif");
setLayout(new BorderLayout());
testLabel = new Label();

View file

@ -0,0 +1,377 @@
/* Demo.java -- Shows examples of AWT components
Copyright (C) 1998, 1999, 2002, 2004, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath examples.
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. */
package gnu.classpath.examples.awt;
import gnu.java.awt.font.*;
import gnu.java.awt.font.opentype.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.font.*;
import java.io.*;
import java.nio.*;
import java.nio.channels.*;
import java.text.*;
import javax.swing.BoxLayout;
import javax.swing.JCheckBox;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
import javax.swing.JSpinner;
import javax.swing.JTextField;
import javax.swing.border.TitledBorder;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
public class HintingDemo extends JFrame {
FontDelegate font;
GNUGlyphVector glyph;
GlyphPreview glyphPreview;
HintPanel hintPanel;
StringViewer stringViewer;
Chooser chooser;
char character;
Options options;
boolean antiAlias;
int flags;
class StringViewer extends JPanel
implements ActionListener
{
JTextField input;
GNUGlyphVector gv;
Viewer viewer;
StringViewer()
{
setLayout(new GridLayout(0, 1));
setBorder(new TitledBorder("Use this field to render complete strings"));
input = new JTextField();
input.addActionListener(this);
add(input);
viewer = new Viewer();
add(viewer);
}
public void actionPerformed(ActionEvent event)
{
refresh();
}
void refresh()
{
gv = (GNUGlyphVector)
font.createGlyphVector(new Font("Dialog", 0, 12),
new FontRenderContext(null, false, false),
new StringCharacterIterator(input.getText()));
viewer.repaint();
}
class Viewer extends JPanel
{
protected void paintComponent(Graphics g)
{
if (gv != null && g instanceof Graphics2D)
{
Graphics2D g2d = (Graphics2D) g;
if (antiAlias)
{
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
}
else
{
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_OFF);
}
g2d.clearRect(0, 0, getWidth(), getHeight());
g2d.setColor(Color.BLACK);
Shape outline = gv.getOutline(0, 0,
flags | FontDelegate.FLAG_FITTED);
g2d.translate(20, Math.floor(outline.getBounds2D().getHeight()) + 2);
g2d.fill(outline);
}
}
}
}
class HintPanel extends JPanel
{
HintPanel()
{
setBorder(new TitledBorder("Detailed glyph view"));
}
protected void paintComponent(Graphics g)
{
if (glyph != null && g instanceof Graphics2D)
{
Graphics2D g2d = (Graphics2D) g.create();
Insets i = getInsets();
g2d.clearRect(i.left, i.top, getWidth() - i.left - i.right,
getHeight() - i.top - i.bottom);
g2d.setColor(Color.GRAY);
for (int x = 20; x < getWidth(); x += 20)
{
g2d.drawLine(x, i.top, x, getHeight() - i.top - i.bottom);
}
for (int y = 20; y < getHeight(); y += 20)
{
g2d.drawLine(i.left, y, getWidth() - i.left - i.right, y);
}
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_OFF);
g2d.translate(40, 300);
g2d.scale(20., 20.);
g2d.setStroke(new BasicStroke((float) (1/20.)));
g2d.setColor(Color.RED);
g2d.draw(glyph.getOutline(0, 0, flags & ~FontDelegate.FLAG_FITTED));
g2d.setColor(Color.GREEN);
g2d.draw(glyph.getOutline(0, 0, flags | FontDelegate.FLAG_FITTED));
}
}
}
class GlyphPreview extends JPanel
{
protected void paintComponent(Graphics g)
{
if (glyph != null && g instanceof Graphics2D)
{
Graphics2D g2d = (Graphics2D) g;
if (antiAlias)
{
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
}
else
{
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_OFF);
}
g2d.clearRect(0, 0, getWidth(), getHeight());
g2d.setColor(Color.BLACK);
Shape outline = glyph.getOutline(0, 0,
flags | FontDelegate.FLAG_FITTED);
g2d.translate(20, outline.getBounds2D().getHeight() + 2);
g2d.fill(outline);
}
}
}
HintingDemo()
{
File file = new File("/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType/DejaVuSerif.ttf");
loadFont(file);
setLayout(new BorderLayout());
chooser = new Chooser();
add(chooser, BorderLayout.NORTH);
hintPanel = new HintPanel();
character = 'A';
add(hintPanel);
options = new Options();
add(options, BorderLayout.EAST);
stringViewer = new StringViewer();
add(stringViewer, BorderLayout.SOUTH);
refresh();
JMenuBar mb = new JMenuBar();
setJMenuBar(mb);
JMenu fileMenu = new JMenu("File");
mb.add(fileMenu);
JMenuItem loadFont = new JMenuItem("Load font");
loadFont.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent ev)
{
JFileChooser fc = new JFileChooser()
{
public boolean accept(File f)
{
return f.isDirectory() || f.getName().endsWith(".ttf");
}
};
int status = fc.showOpenDialog(HintingDemo.this);
if (status == JFileChooser.APPROVE_OPTION)
{
File file = fc.getSelectedFile();
loadFont(file);
}
}
});
fileMenu.add(loadFont);
}
void refresh()
{
if (chooser != null)
chooser.refresh();
if (glyphPreview != null)
glyphPreview.repaint();
if (hintPanel != null)
hintPanel.repaint();
if (stringViewer != null)
stringViewer.refresh();
}
class Options extends JPanel
implements ActionListener
{
JCheckBox antiAliasOpt;
JCheckBox hintHorizontalOpt;
JCheckBox hintVerticalOpt;
JCheckBox hintEdgeOpt;
JCheckBox hintStrongOpt;
JCheckBox hintWeakOpt;
Options()
{
setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
setBorder(new TitledBorder("Hinting options"));
antiAliasOpt = new JCheckBox("Antialias");
antiAliasOpt.setSelected(true);
antiAliasOpt.addActionListener(this);
add(antiAliasOpt);
hintHorizontalOpt = new JCheckBox("Hint horizontal");
hintHorizontalOpt.setSelected(true);
hintHorizontalOpt.addActionListener(this);
add(hintHorizontalOpt);
hintVerticalOpt = new JCheckBox("Hint vertical");
hintVerticalOpt.setSelected(true);
hintVerticalOpt.addActionListener(this);
add(hintVerticalOpt);
hintEdgeOpt = new JCheckBox("Hint edge points");
hintEdgeOpt.setSelected(true);
hintEdgeOpt.addActionListener(this);
add(hintEdgeOpt);
hintStrongOpt = new JCheckBox("Hint strong points");
hintStrongOpt.setSelected(true);
hintStrongOpt.addActionListener(this);
add(hintStrongOpt);
hintWeakOpt = new JCheckBox("Hint weak points");
hintWeakOpt.setSelected(true);
hintWeakOpt.addActionListener(this);
add(hintWeakOpt);
sync();
}
void sync()
{
antiAlias = antiAliasOpt.isSelected();
if (hintHorizontalOpt.isSelected())
flags &= ~FontDelegate.FLAG_NO_HINT_HORIZONTAL;
else
flags |= FontDelegate.FLAG_NO_HINT_HORIZONTAL;
if (hintVerticalOpt.isSelected())
flags &= ~FontDelegate.FLAG_NO_HINT_VERTICAL;
else
flags |= FontDelegate.FLAG_NO_HINT_VERTICAL;
if (hintEdgeOpt.isSelected())
flags &= ~FontDelegate.FLAG_NO_HINT_EDGE_POINTS;
else
flags |= FontDelegate.FLAG_NO_HINT_EDGE_POINTS;
if (hintStrongOpt.isSelected())
flags &= ~FontDelegate.FLAG_NO_HINT_STRONG_POINTS;
else
flags |= FontDelegate.FLAG_NO_HINT_STRONG_POINTS;
if (hintWeakOpt.isSelected())
flags &= ~FontDelegate.FLAG_NO_HINT_WEAK_POINTS;
else
flags |= FontDelegate.FLAG_NO_HINT_WEAK_POINTS;
refresh();
}
public void actionPerformed(ActionEvent event)
{
sync();
}
}
class Chooser extends JPanel
{
JSpinner spin;
Chooser()
{
setLayout(new GridLayout(1, 0));
setBorder(new TitledBorder("Choose and preview the character to render"));
spin = new JSpinner();
spin.addChangeListener(new ChangeListener()
{
public void stateChanged(ChangeEvent event)
{
int val = ((Integer) spin.getValue()).intValue();
setGlyph((char) val);
}
});
add(spin);
glyphPreview = new GlyphPreview();
add(glyphPreview);
}
void refresh()
{
spin.setValue(new Integer(character));
repaint();
}
}
private void loadFont(File file)
{
try
{
RandomAccessFile raf = new RandomAccessFile(file, "r");
FileChannel chan = raf.getChannel();
ByteBuffer buf = chan.map(FileChannel.MapMode.READ_ONLY, 0, raf.length());
FontDelegate[] fonts = OpenTypeFontFactory.createFonts(buf);
font = fonts[0];
setGlyph(character);
refresh();
}
catch (Exception ex)
{
ex.printStackTrace();
}
}
void setGlyph(char ch)
{
character = ch;
glyph = (GNUGlyphVector)
font.createGlyphVector(new Font("Dialog", 0, 12),
new FontRenderContext(null, false, false),
new StringCharacterIterator(new String(new char[]{ch})));
refresh();
}
public static void main(String[] args) {
HintingDemo f = new HintingDemo();
f.setSize(500, 500);
f.setVisible(true);
}
}

View file

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

View file

Before

Width:  |  Height:  |  Size: 502 B

After

Width:  |  Height:  |  Size: 502 B

View file

@ -174,8 +174,8 @@ public class J2dBenchmark
public String init()
{
boolean loadError = false;
pngTestImage = loadImage("aicas.png");
gifTestImage = loadImage("palme.gif");
pngTestImage = loadImage("../icons/aicas.png");
gifTestImage = loadImage("../icons/palme.gif");
if (texture != null)
{

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 502 B

View file

@ -33,5 +33,6 @@ public class TestOS
System.out.println("OS Version: " + osBean.getVersion());
System.out.println("Architecture: " + osBean.getArch());
System.out.println("Processors: " + osBean.getAvailableProcessors());
System.out.println("System Load Average: " + osBean.getSystemLoadAverage());
}
}

View file

@ -1,19 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<launchConfiguration type="org.eclipse.cdt.launch.localCLaunch">
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_ID" value="org.eclipse.cdt.debug.mi.core.CDebugger"/>
<stringAttribute key="org.eclipse.cdt.launch.protocol" value="mi"/>
<booleanAttribute key="org.eclipse.cdt.debug.mi.core.STOP_ON_SOLIB_EVENTS" value="false"/>
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_START_MODE" value="run"/>
<listAttribute key="org.eclipse.cdt.debug.mi.core.SOLIB_PATH"/>
<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
<booleanAttribute key="org.eclipse.cdt.launch.ENABLE_REGISTER_BOOKKEEPING" value="false"/>
<booleanAttribute key="org.eclipse.cdt.debug.mi.core.AUTO_SOLIB" value="true"/>
<booleanAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN" value="true"/>
<booleanAttribute key="org.eclipse.cdt.launch.use_terminal" value="true"/>
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="jamvm"/>
<booleanAttribute key="org.eclipse.cdt.launch.ENABLE_VARIABLE_BOOKKEEPING" value="false"/>
<stringAttribute key="org.eclipse.cdt.debug.mi.core.DEBUG_NAME" value="gdb"/>
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="src/jamvm"/>
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_ARGUMENTS" value="-Dswing.defaultlaf=javax.swing.plaf.metal.MetalLookAndFeel gnu.classpath.examples.swing.Demo"/>
<stringAttribute key="org.eclipse.cdt.debug.mi.core.GDB_INIT" value=""/>
</launchConfiguration>

View file

@ -183,7 +183,7 @@ public class NavigationFilterDemo
return pos;
case SwingConstants.WEST:
// Calculate the next word start.
newpos = Utilities.getWordStart(text, newpos);;
newpos = Utilities.getWordStart(text, newpos);
// If that means that the caret will not move, return
// the start of the previous word.

View file

@ -43,16 +43,21 @@ am__aclocal_m4_deps = $(top_srcdir)/../../config/depstand.m4 \
$(top_srcdir)/../../config/lead-dot.m4 \
$(top_srcdir)/../../config/multi.m4 \
$(top_srcdir)/../../config/no-executables.m4 \
$(top_srcdir)/../../libtool.m4 $(top_srcdir)/m4/acattribute.m4 \
$(top_srcdir)/m4/accross.m4 $(top_srcdir)/m4/acinclude.m4 \
$(top_srcdir)/../../libtool.m4 \
$(top_srcdir)/../../ltoptions.m4 \
$(top_srcdir)/../../ltsugar.m4 \
$(top_srcdir)/../../ltversion.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/ax_func_which_gethostbyname_r.m4 \
$(top_srcdir)/m4/gcc_attribute.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
mkinstalldirs = $(SHELL) $(top_srcdir)/../../mkinstalldirs
CONFIG_HEADER = $(top_builddir)/include/config.h
CONFIG_CLEAN_FILES =
SOURCES =
@ -71,12 +76,15 @@ ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BUILD_CLASS_FILES_FALSE = @BUILD_CLASS_FILES_FALSE@
BUILD_CLASS_FILES_TRUE = @BUILD_CLASS_FILES_TRUE@
CAIRO_CFLAGS = @CAIRO_CFLAGS@
CAIRO_LIBS = @CAIRO_LIBS@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
@ -122,6 +130,7 @@ DATE = @DATE@
DEFAULT_PREFS_PEER = @DEFAULT_PREFS_PEER@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
@ -134,15 +143,16 @@ ERROR_CFLAGS = @ERROR_CFLAGS@
EXAMPLESDIR = @EXAMPLESDIR@
EXEEXT = @EXEEXT@
FASTJAR = @FASTJAR@
FGREP = @FGREP@
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_JAVAC_FALSE = @FOUND_JAVAC_FALSE@
FOUND_JAVAC_TRUE = @FOUND_JAVAC_TRUE@
FOUND_JIKES_FALSE = @FOUND_JIKES_FALSE@
FOUND_JIKES_TRUE = @FOUND_JIKES_TRUE@
FOUND_KJC_FALSE = @FOUND_KJC_FALSE@
@ -150,7 +160,6 @@ 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@
@ -160,6 +169,7 @@ GENINSRC_TRUE = @GENINSRC_TRUE@
GJDOC = @GJDOC@
GLIB_CFLAGS = @GLIB_CFLAGS@
GLIB_LIBS = @GLIB_LIBS@
GREP = @GREP@
GTK_CFLAGS = @GTK_CFLAGS@
GTK_LIBS = @GTK_LIBS@
INIT_LOAD_LIBRARY = @INIT_LOAD_LIBRARY@
@ -171,6 +181,7 @@ INSTALL_GLIBJ_ZIP_TRUE = @INSTALL_GLIBJ_ZIP_TRUE@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
JAVAC = @JAVAC@
JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION = @JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION@
JAVA_MAINTAINER_MODE_FALSE = @JAVA_MAINTAINER_MODE_FALSE@
JAVA_MAINTAINER_MODE_TRUE = @JAVA_MAINTAINER_MODE_TRUE@
@ -180,6 +191,7 @@ JIKES = @JIKES@
JIKESENCODING = @JIKESENCODING@
JIKESWARNINGS = @JIKESWARNINGS@
KJC = @KJC@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBDEBUG = @LIBDEBUG@
LIBICONV = @LIBICONV@
@ -199,6 +211,7 @@ MKDIR = @MKDIR@
MOC = @MOC@
MOZILLA_CFLAGS = @MOZILLA_CFLAGS@
MOZILLA_LIBS = @MOZILLA_LIBS@
NM = @NM@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@ -220,6 +233,7 @@ RANLIB = @RANLIB@
REGEN_PARSERS_FALSE = @REGEN_PARSERS_FALSE@
REGEN_PARSERS_TRUE = @REGEN_PARSERS_TRUE@
REMOVE = @REMOVE@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRICT_WARNING_CFLAGS = @STRICT_WARNING_CFLAGS@
@ -247,8 +261,10 @@ X_EXTRA_LIBS = @X_EXTRA_LIBS@
X_LIBS = @X_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
ZIP = @ZIP@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
@ -281,6 +297,7 @@ install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
lt_ECHO = @lt_ECHO@
mandir = @mandir@
mkdir_p = @mkdir_p@
multi_basedir = @multi_basedir@

View file

@ -43,16 +43,21 @@ am__aclocal_m4_deps = $(top_srcdir)/../../config/depstand.m4 \
$(top_srcdir)/../../config/lead-dot.m4 \
$(top_srcdir)/../../config/multi.m4 \
$(top_srcdir)/../../config/no-executables.m4 \
$(top_srcdir)/../../libtool.m4 $(top_srcdir)/m4/acattribute.m4 \
$(top_srcdir)/m4/accross.m4 $(top_srcdir)/m4/acinclude.m4 \
$(top_srcdir)/../../libtool.m4 \
$(top_srcdir)/../../ltoptions.m4 \
$(top_srcdir)/../../ltsugar.m4 \
$(top_srcdir)/../../ltversion.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/ax_func_which_gethostbyname_r.m4 \
$(top_srcdir)/m4/gcc_attribute.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
mkinstalldirs = $(SHELL) $(top_srcdir)/../../mkinstalldirs
CONFIG_HEADER = $(top_builddir)/include/config.h
CONFIG_CLEAN_FILES =
SOURCES =
@ -62,12 +67,15 @@ ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BUILD_CLASS_FILES_FALSE = @BUILD_CLASS_FILES_FALSE@
BUILD_CLASS_FILES_TRUE = @BUILD_CLASS_FILES_TRUE@
CAIRO_CFLAGS = @CAIRO_CFLAGS@
CAIRO_LIBS = @CAIRO_LIBS@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
@ -113,6 +121,7 @@ DATE = @DATE@
DEFAULT_PREFS_PEER = @DEFAULT_PREFS_PEER@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
@ -125,15 +134,16 @@ ERROR_CFLAGS = @ERROR_CFLAGS@
EXAMPLESDIR = @EXAMPLESDIR@
EXEEXT = @EXEEXT@
FASTJAR = @FASTJAR@
FGREP = @FGREP@
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_JAVAC_FALSE = @FOUND_JAVAC_FALSE@
FOUND_JAVAC_TRUE = @FOUND_JAVAC_TRUE@
FOUND_JIKES_FALSE = @FOUND_JIKES_FALSE@
FOUND_JIKES_TRUE = @FOUND_JIKES_TRUE@
FOUND_KJC_FALSE = @FOUND_KJC_FALSE@
@ -141,7 +151,6 @@ 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@
@ -151,6 +160,7 @@ GENINSRC_TRUE = @GENINSRC_TRUE@
GJDOC = @GJDOC@
GLIB_CFLAGS = @GLIB_CFLAGS@
GLIB_LIBS = @GLIB_LIBS@
GREP = @GREP@
GTK_CFLAGS = @GTK_CFLAGS@
GTK_LIBS = @GTK_LIBS@
INIT_LOAD_LIBRARY = @INIT_LOAD_LIBRARY@
@ -162,6 +172,7 @@ INSTALL_GLIBJ_ZIP_TRUE = @INSTALL_GLIBJ_ZIP_TRUE@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
JAVAC = @JAVAC@
JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION = @JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION@
JAVA_MAINTAINER_MODE_FALSE = @JAVA_MAINTAINER_MODE_FALSE@
JAVA_MAINTAINER_MODE_TRUE = @JAVA_MAINTAINER_MODE_TRUE@
@ -171,6 +182,7 @@ JIKES = @JIKES@
JIKESENCODING = @JIKESENCODING@
JIKESWARNINGS = @JIKESWARNINGS@
KJC = @KJC@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBDEBUG = @LIBDEBUG@
LIBICONV = @LIBICONV@
@ -190,6 +202,7 @@ MKDIR = @MKDIR@
MOC = @MOC@
MOZILLA_CFLAGS = @MOZILLA_CFLAGS@
MOZILLA_LIBS = @MOZILLA_LIBS@
NM = @NM@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@ -211,6 +224,7 @@ RANLIB = @RANLIB@
REGEN_PARSERS_FALSE = @REGEN_PARSERS_FALSE@
REGEN_PARSERS_TRUE = @REGEN_PARSERS_TRUE@
REMOVE = @REMOVE@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRICT_WARNING_CFLAGS = @STRICT_WARNING_CFLAGS@
@ -238,8 +252,10 @@ X_EXTRA_LIBS = @X_EXTRA_LIBS@
X_LIBS = @X_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
ZIP = @ZIP@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
@ -272,6 +288,7 @@ install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
lt_ECHO = @lt_ECHO@
mandir = @mandir@
mkdir_p = @mkdir_p@
multi_basedir = @multi_basedir@

View file

@ -866,7 +866,7 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V>
if (n != null) {
Node<K,V> f = n.next;
if (n != b.next) // inconsistent read
break;;
break;
Object v = n.value;
if (v == null) { // n is deleted
n.helpDelete(b, f);

View file

@ -1,158 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html> <head>
<title>Atomics</title>
</head>
<body>
A small toolkit of classes that support lock-free thread-safe
programming on single variables. In essence, the classes in this
package extend the notion of <tt>volatile</tt> values, fields, and
array elements to those that also provide an atomic conditional update
operation of the form:
<pre>
boolean compareAndSet(expectedValue, updateValue);
</pre>
<p> This method (which varies in argument types across different
classes) atomically sets a variable to the <tt>updateValue</tt> if it
currently holds the <tt>expectedValue</tt>, reporting <tt>true</tt> on
success. The classes in this package also contain methods to get and
unconditionally set values, as well as a weaker conditional atomic
update operation <tt>weakCompareAndSet</tt> desribed below.
<p> The specifications of these methods enable implementations to
employ efficient machine-level atomic instructions that are available
on contemporary processors. However on some platforms, support may
entail some form of internal locking. Thus the methods are not
strictly guaranteed to be non-blocking --
a thread may block transiently before performing the operation.
<p> Instances of classes {@link
java.util.concurrent.atomic.AtomicBoolean}, {@link
java.util.concurrent.atomic.AtomicInteger}, {@link
java.util.concurrent.atomic.AtomicLong}, and {@link
java.util.concurrent.atomic.AtomicReference} each provide access and
updates to a single variable of the corresponding type. Each class
also provides appropriate utility methods for that type. For example,
classes <tt>AtomicLong</tt> and <tt>AtomicInteger</tt> provide atomic
increment methods. One application is to generate sequence numbers,
as in:
<pre>
class Sequencer {
private AtomicLong sequenceNumber = new AtomicLong(0);
public long next() { return sequenceNumber.getAndIncrement(); }
}
</pre>
<p>The memory effects for accesses and updates of atomics generally
follow the rules for volatiles, as stated in <a
href="http://java.sun.com/docs/books/jls/"> The Java Language
Specification, Third Edition (17.4 Memory Model)</a>:
<ul>
<li> <tt>get</tt> has the memory effects of reading a
<tt>volatile</tt> variable.
<li> <tt>set</tt> has the memory effects of writing (assigning) a
<tt>volatile</tt> variable.
<li> <tt>lazySet</tt> has the memory effects of writing (assigning)
a <tt>volatile</tt> variable except that it permits reorderings with
subsequent (but not previous) memory actions that do not themselves
impose reordering constraints with ordinary non-<tt>volatile</tt>
writes. Among other usage contexts, <tt>lazySet</tt> may apply when
nulling out, for the sake of garbage collection, a reference that is
never accessed again.
<li><tt>weakCompareAndSet</tt> atomically reads and conditionally
writes a variable but does <em>not</em>
create any happens-before orderings, so provides no guarantees
with respect to previous or subsequent reads and writes of any
variables other than the target of the <tt>weakCompareAndSet</tt>.
<li> <tt>compareAndSet</tt>
and all other read-and-update operations such as <tt>getAndIncrement</tt>
have the memory effects of both reading and
writing <tt>volatile</tt> variables.
</ul>
<p>In addition to classes representing single values, this package
contains <em>Updater</em> classes that can be used to obtain
<tt>compareAndSet</tt> operations on any selected <tt>volatile</tt>
field of any selected class. {@link
java.util.concurrent.atomic.AtomicReferenceFieldUpdater}, {@link
java.util.concurrent.atomic.AtomicIntegerFieldUpdater}, and {@link
java.util.concurrent.atomic.AtomicLongFieldUpdater} are
reflection-based utilities that provide access to the associated field
types. These are mainly of use in atomic data structures in which
several <tt>volatile</tt> fields of the same node (for example, the
links of a tree node) are independently subject to atomic
updates. These classes enable greater flexibility in how and when to
use atomic updates, at the expense of more awkward reflection-based
setup, less convenient usage, and weaker guarantees.
<p>The {@link java.util.concurrent.atomic.AtomicIntegerArray}, {@link
java.util.concurrent.atomic.AtomicLongArray}, and {@link
java.util.concurrent.atomic.AtomicReferenceArray} classes further
extend atomic operation support to arrays of these types. These
classes are also notable in providing <tt>volatile</tt> access
semantics for their array elements, which is not supported for
ordinary arrays.
<p>The atomic classes also support method <tt>weakCompareAndSet</tt>,
which has limited applicability. On some platforms, the weak version
may be more efficient than <tt>compareAndSet</tt> in the normal case,
but differs in that any given invocation of <tt>weakCompareAndSet</tt>
method may return <tt>false</tt> spuriously (that is, for no apparent
reason). A <tt>false</tt> return means only that the operation may be
retried if desired, relying on the guarantee that repeated invocation
when the variable holds <tt>expectedValue</tt> and no other thread is
also attempting to set the variable will eventually succeed. (Such
spurious failures may for example be due to memory contention effects
that are unrelated to whether the expected and current values are
equal.) Additionally <tt>weakCompareAndSet</tt> does not provide
ordering guarantees that are usually needed for synchronization
control. However, the method may be useful for updating counters and
statistics when such updates are unrelated to the other happens-before
orderings of a program. When a thread sees an update to an atomic
variable caused by a <tt>weakCompareAndSet</tt>, it does not
necessarily see updates to any <em>other</em> variables that occurred
before the <tt>weakCompareAndSet</tt>. This may be acceptable when
for example updating performance statistics, but rarely otherwise.
<p> The {@link java.util.concurrent.atomic.AtomicMarkableReference}
class associates a single boolean with a reference. For example, this
bit might be used inside a data structure to mean that the object
being referenced has logically been deleted. The {@link
java.util.concurrent.atomic.AtomicStampedReference} class associates
an integer value with a reference. This may be used for example, to
represent version numbers corresponding to series of updates.
<p> Atomic classes are designed primarily as building blocks for
implementing non-blocking data structures and related infrastructure
classes. The <tt>compareAndSet</tt> method is not a general
replacement for locking. It applies only when critical updates for an
object are confined to a <em>single</em> variable.
<p> Atomic classes are not general purpose replacements for
<tt>java.lang.Integer</tt> and related classes. They do <em>not</em>
define methods such as <tt>hashCode</tt> and
<tt>compareTo</tt>. (Because atomic variables are expected to be
mutated, they are poor choices for hash table keys.) Additionally,
classes are provided only for those types that are commonly useful in
intended applications. For example, there is no atomic class for
representing <tt>byte</tt>. In those infrequent cases where you would
like to do so, you can use an <tt>AtomicInteger</tt> to hold
<tt>byte</tt> values, and cast appropriately. You can also hold floats
using <tt>Float.floatToIntBits</tt> and <tt>Float.intBitstoFloat</tt>
conversions, and doubles using <tt>Double.doubleToLongBits</tt> and
<tt>Double.longBitsToDouble</tt> conversions.
@since 1.5
</body> </html>

View file

@ -1,50 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html> <head>
<title>Locks</title>
</head>
<body>
Interfaces and classes providing a framework for locking and waiting
for conditions that is distinct from built-in synchronization and
monitors. The framework permits much greater flexibility in the use of
locks and conditions, at the expense of more awkward syntax.
<p> The {@link java.util.concurrent.locks.Lock} interface supports
locking disciplines that differ in semantics (reentrant, fair, etc),
and that can be used in non-block-structured contexts including
hand-over-hand and lock reordering algorithms. The main implementation
is {@link java.util.concurrent.locks.ReentrantLock}.
<p> The {@link java.util.concurrent.locks.ReadWriteLock} interface
similarly defines locks that may be shared among readers but are
exclusive to writers. Only a single implementation, {@link
java.util.concurrent.locks.ReentrantReadWriteLock}, is provided, since
it covers most standard usage contexts. But programmers may create
their own implementations to cover nonstandard requirements.
<p> The {@link java.util.concurrent.locks.Condition} interface
describes condition variables that may be associated with Locks.
These are similar in usage to the implicit monitors accessed using
<tt>Object.wait</tt>, but offer extended capabilities. In particular,
multiple <tt>Condition</tt> objects may be associated with a single
<tt>Lock</tt>. To avoid compatibility issues, the names of
<tt>Condition</tt> methods are different than the corresponding
<tt>Object</tt> versions.
<p> The {@link java.util.concurrent.locks.AbstractQueuedSynchronizer}
class serves as a useful superclass for defining locks and other
synchronizers that rely on queuing blocked threads. The {@link
java.util.concurrent.locks.AbstractQueuedLongSynchronizer} class
provides the same functionality but extends support to 64 bits of
synchronization state. Both extend class {@link
java.util.concurrent.locks.AbstractOwnableSynchronizer}, a simple
class that helps record the thread currently holding exclusive
synchronization. The {@link java.util.concurrent.locks.LockSupport}
class provides lower-level blocking and unblocking support that is
useful for those developers implementing their own customized lock
classes.
@since 1.5
</body> </html>

View file

@ -1,222 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html> <head>
<title>Concurrency Utilities</title>
</head>
<body>
<p> Utility classes commonly useful in concurrent programming. This
package includes a few small standardized extensible frameworks, as
well as some classes that provide useful functionality and are
otherwise tedious or difficult to implement. Here are brief
descriptions of the main components. See also the <tt>locks</tt> and
<tt>atomic</tt> packages.
<h2>Executors</h2>
<b>Interfaces.</b> {@link java.util.concurrent.Executor} is a simple
standardized interface for defining custom thread-like subsystems,
including thread pools, asynchronous IO, and lightweight task
frameworks. Depending on which concrete Executor class is being used,
tasks may execute in a newly created thread, an existing
task-execution thread, or the thread calling <tt>execute()</tt>, and
may execute sequentially or concurrently. {@link
java.util.concurrent.ExecutorService} provides a more complete
asynchronous task execution framework. An ExecutorService manages
queuing and scheduling of tasks, and allows controlled shutdown. The
{@link java.util.concurrent.ScheduledExecutorService} subinterface
and associated interfaces add support for delayed and periodic task execution.
ExecutorServices provide methods arranging asynchronous execution of
any function expressed as {@link java.util.concurrent.Callable}, the
result-bearing analog of {@link java.lang.Runnable}. A {@link
java.util.concurrent.Future} returns the results of a function, allows
determination of whether execution has completed, and provides a means to
cancel execution. A {@link java.util.concurrent.RunnableFuture} is
a Future that possesses a <tt>run</tt> method that upon execution,
sets its results.
<p>
<b>Implementations.</b> Classes {@link
java.util.concurrent.ThreadPoolExecutor} and {@link
java.util.concurrent.ScheduledThreadPoolExecutor} provide tunable,
flexible thread pools. The {@link java.util.concurrent.Executors}
class provides factory methods for the most common kinds and
configurations of Executors, as well as a few utility methods for
using them. Other utilities based on Executors include the concrete
class {@link java.util.concurrent.FutureTask} providing a common
extensible implementation of Futures, and {@link
java.util.concurrent.ExecutorCompletionService}, that assists in
coordinating the processing of groups of asynchronous tasks.
<h2>Queues</h2>
The java.util.concurrent {@link
java.util.concurrent.ConcurrentLinkedQueue} class supplies an
efficient scalable thread-safe non-blocking FIFO queue. Five
implementations in java.util.concurrent support the extended {@link
java.util.concurrent.BlockingQueue} interface, that defines blocking
versions of put and take: {@link
java.util.concurrent.LinkedBlockingQueue}, {@link
java.util.concurrent.ArrayBlockingQueue}, {@link
java.util.concurrent.SynchronousQueue}, {@link
java.util.concurrent.PriorityBlockingQueue}, and {@link
java.util.concurrent.DelayQueue}. The different classes cover the most
common usage contexts for producer-consumer, messaging, parallel
tasking, and related concurrent designs. The {@link
java.util.concurrent.BlockingDeque} interface extends
<tt>BlockingQueue</tt> to support both FIFO and LIFO (stack-based)
operations. Class {@link java.util.concurrent.LinkedBlockingDeque}
provides an implementation.
<h2>Timing</h2>
The {@link java.util.concurrent.TimeUnit} class provides multiple
granularities (including nanoseconds) for specifying and controlling
time-out based operations. Most classes in the package contain
operations based on time-outs in addition to indefinite waits. In all
cases that time-outs are used, the time-out specifies the minimum time
that the method should wait before indicating that it
timed-out. Implementations make a &quot;best effort&quot; to detect
time-outs as soon as possible after they occur. However, an indefinite
amount of time may elapse between a time-out being detected and a
thread actually executing again after that time-out. All methods
that accept timeout parameters treat values less than or equal to
zero to mean not to wait at all. To wait "forever", you can use
a value of <tt>Long.MAX_VALUE</tt>.
<h2>Synchronizers</h2>
Four classes aid common special-purpose synchronization idioms.
{@link java.util.concurrent.Semaphore} is a classic concurrency tool.
{@link java.util.concurrent.CountDownLatch} is a very simple yet very
common utility for blocking until a given number of signals, events,
or conditions hold. A {@link java.util.concurrent.CyclicBarrier} is a
resettable multiway synchronization point useful in some styles of
parallel programming. An {@link java.util.concurrent.Exchanger} allows
two threads to exchange objects at a rendezvous point, and is useful
in several pipeline designs.
<h2>Concurrent Collections</h2>
Besides Queues, this package supplies Collection implementations
designed for use in multithreaded contexts:
{@link java.util.concurrent.ConcurrentHashMap},
{@link java.util.concurrent.ConcurrentSkipListMap},
{@link java.util.concurrent.ConcurrentSkipListSet},
{@link java.util.concurrent.CopyOnWriteArrayList}, and
{@link java.util.concurrent.CopyOnWriteArraySet}.
When many threads are expected to access a given collection,
a <tt>ConcurrentHashMap</tt> is normally preferable to
a synchronized <tt>HashMap</tt>, and a
<tt>ConcurrentSkipListMap</tt> is normally preferable
to a synchronized <tt>TreeMap</tt>. A
<tt>CopyOnWriteArrayList</tt> is preferable to
a synchronized <tt>ArrayList</tt> when the expected number of reads
and traversals greatly outnumber the number of updates to a list.
<p>The "Concurrent" prefix used with some classes in this package is a
shorthand indicating several differences from similar "synchronized"
classes. For example <tt>java.util.Hashtable</tt> and
<tt>Collections.synchronizedMap(new HashMap())</tt> are
synchronized. But {@link java.util.concurrent.ConcurrentHashMap} is
"concurrent". A concurrent collection is thread-safe, but not
governed by a single exclusion lock. In the particular case of
ConcurrentHashMap, it safely permits any number of concurrent reads as
well as a tunable number of concurrent writes. "Synchronized" classes
can be useful when you need to prevent all access to a collection via
a single lock, at the expense of poorer scalability. In other cases in
which multiple threads are expected to access a common collection,
"concurrent" versions are normally preferable. And unsynchronized
collections are preferable when either collections are unshared, or
are accessible only when holding other locks.
<p> Most concurrent Collection implementations (including most Queues)
also differ from the usual java.util conventions in that their Iterators
provide <em>weakly consistent</em> rather than fast-fail traversal. A
weakly consistent iterator is thread-safe, but does not necessarily
freeze the collection while iterating, so it may (or may not) reflect
any updates since the iterator was created.
<a name="MemoryVisibility">
<h2> Memory Consistency Properties </h2>
<a href="http://java.sun.com/docs/books/jls/third_edition/html/memory.html">
Chapter 17 of the Java Language Specification</a> defines the
<i>happens-before</i> relation on memory operations such as reads and
writes of shared variables. The results of a write by one thread are
guaranteed to be visible to a read by another thread only if the write
operation <i>happens-before</i> the read operation. The
{@code synchronized} and {@code volatile} constructs, as well as the
{@code Thread.start()} and {@code Thread.join()} methods, can form
<i>happens-before</i> relationships. In particular:
<ul>
<li>Each action in a thread <i>happens-before</i> every action in that
thread that comes later in the program's order.
<li>An unlock ({@code synchronized} block or method exit) of a
monitor <i>happens-before</i> every subsequent lock ({@code synchronized}
block or method entry) of that same monitor. And because
the <i>happens-before</i> relation is transitive, all actions
of a thread prior to unlocking <i>happen-before</i> all actions
subsequent to any thread locking that monitor.
<li>A write to a {@code volatile} field <i>happens-before</i> every
subsequent read of that same field. Writes and reads of
{@code volatile} fields have similar memory consistency effects
as entering and exiting monitors, but do <em>not</em> entail
mutual exclusion locking.
<li>A call to {@code start} on a thread <i>happens-before</i> any action in the
started thread.
<li>All actions in a thread <i>happen-before</i> any other thread
successfully returns from a {@code join} on that thread.
</ul>
The methods of all classes in {@code java.util.concurrent} and its
subpackages extend these guarantees to higher-level
synchronization. In particular:
<ul>
<li>Actions in a thread prior to placing an object into any concurrent
collection <i>happen-before</i> actions subsequent to the access or
removal of that element from the collection in another thread.
<li>Actions in a thread prior to the submission of a {@code Runnable}
to an {@code Executor} <i>happen-before</i> its execution begins.
Similarly for {@code Callables} submitted to an {@code ExecutorService}.
<li>Actions taken by the asynchronous computation represented by a
{@code Future} <i>happen-before</i> actions subsequent to the
retrieval of the result via {@code Future.get()} in another thread.
<li>Actions prior to "releasing" synchronizer methods such as
{@code Lock.unlock}, {@code Semaphore.release}, and
{@code CountDownLatch.countDown} <i>happen-before</i> actions
subsequent to a successful "acquiring" method such as
{@code Lock.lock}, {@code Semaphore.acquire},
{@code Condition.await}, and {@code CountDownLatch.await} on the
same synchronizer object in another thread.
<li>For each pair of threads that successfully exchange objects via
an {@code Exchanger}, actions prior to the {@code exchange()}
in each thread <i>happen-before</i> those subsequent to the
corresponding {@code exchange()} in another thread.
<li>Actions prior to calling {@code CyclicBarrier.await}
<i>happen-before</i> actions performed by the barrier action, and
actions performed by the barrier action <i>happen-before</i> actions
subsequent to a successful return from the corresponding {@code await}
in other threads.
</ul>
@since 1.5
</body> </html>

View file

@ -43,16 +43,21 @@ am__aclocal_m4_deps = $(top_srcdir)/../../config/depstand.m4 \
$(top_srcdir)/../../config/lead-dot.m4 \
$(top_srcdir)/../../config/multi.m4 \
$(top_srcdir)/../../config/no-executables.m4 \
$(top_srcdir)/../../libtool.m4 $(top_srcdir)/m4/acattribute.m4 \
$(top_srcdir)/m4/accross.m4 $(top_srcdir)/m4/acinclude.m4 \
$(top_srcdir)/../../libtool.m4 \
$(top_srcdir)/../../ltoptions.m4 \
$(top_srcdir)/../../ltsugar.m4 \
$(top_srcdir)/../../ltversion.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/ax_func_which_gethostbyname_r.m4 \
$(top_srcdir)/m4/gcc_attribute.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
mkinstalldirs = $(SHELL) $(top_srcdir)/../../mkinstalldirs
CONFIG_HEADER = $(top_builddir)/include/config.h
CONFIG_CLEAN_FILES =
SOURCES =
@ -62,12 +67,15 @@ ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BUILD_CLASS_FILES_FALSE = @BUILD_CLASS_FILES_FALSE@
BUILD_CLASS_FILES_TRUE = @BUILD_CLASS_FILES_TRUE@
CAIRO_CFLAGS = @CAIRO_CFLAGS@
CAIRO_LIBS = @CAIRO_LIBS@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
@ -113,6 +121,7 @@ DATE = @DATE@
DEFAULT_PREFS_PEER = @DEFAULT_PREFS_PEER@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
@ -125,15 +134,16 @@ ERROR_CFLAGS = @ERROR_CFLAGS@
EXAMPLESDIR = @EXAMPLESDIR@
EXEEXT = @EXEEXT@
FASTJAR = @FASTJAR@
FGREP = @FGREP@
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_JAVAC_FALSE = @FOUND_JAVAC_FALSE@
FOUND_JAVAC_TRUE = @FOUND_JAVAC_TRUE@
FOUND_JIKES_FALSE = @FOUND_JIKES_FALSE@
FOUND_JIKES_TRUE = @FOUND_JIKES_TRUE@
FOUND_KJC_FALSE = @FOUND_KJC_FALSE@
@ -141,7 +151,6 @@ 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@
@ -151,6 +160,7 @@ GENINSRC_TRUE = @GENINSRC_TRUE@
GJDOC = @GJDOC@
GLIB_CFLAGS = @GLIB_CFLAGS@
GLIB_LIBS = @GLIB_LIBS@
GREP = @GREP@
GTK_CFLAGS = @GTK_CFLAGS@
GTK_LIBS = @GTK_LIBS@
INIT_LOAD_LIBRARY = @INIT_LOAD_LIBRARY@
@ -162,6 +172,7 @@ INSTALL_GLIBJ_ZIP_TRUE = @INSTALL_GLIBJ_ZIP_TRUE@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
JAVAC = @JAVAC@
JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION = @JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION@
JAVA_MAINTAINER_MODE_FALSE = @JAVA_MAINTAINER_MODE_FALSE@
JAVA_MAINTAINER_MODE_TRUE = @JAVA_MAINTAINER_MODE_TRUE@
@ -171,6 +182,7 @@ JIKES = @JIKES@
JIKESENCODING = @JIKESENCODING@
JIKESWARNINGS = @JIKESWARNINGS@
KJC = @KJC@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBDEBUG = @LIBDEBUG@
LIBICONV = @LIBICONV@
@ -190,6 +202,7 @@ MKDIR = @MKDIR@
MOC = @MOC@
MOZILLA_CFLAGS = @MOZILLA_CFLAGS@
MOZILLA_LIBS = @MOZILLA_LIBS@
NM = @NM@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@ -211,6 +224,7 @@ RANLIB = @RANLIB@
REGEN_PARSERS_FALSE = @REGEN_PARSERS_FALSE@
REGEN_PARSERS_TRUE = @REGEN_PARSERS_TRUE@
REMOVE = @REMOVE@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRICT_WARNING_CFLAGS = @STRICT_WARNING_CFLAGS@
@ -238,8 +252,10 @@ X_EXTRA_LIBS = @X_EXTRA_LIBS@
X_LIBS = @X_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
ZIP = @ZIP@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
@ -272,6 +288,7 @@ install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
lt_ECHO = @lt_ECHO@
mandir = @mandir@
mkdir_p = @mkdir_p@
multi_basedir = @multi_basedir@

View file

@ -43,16 +43,21 @@ am__aclocal_m4_deps = $(top_srcdir)/../../config/depstand.m4 \
$(top_srcdir)/../../config/lead-dot.m4 \
$(top_srcdir)/../../config/multi.m4 \
$(top_srcdir)/../../config/no-executables.m4 \
$(top_srcdir)/../../libtool.m4 $(top_srcdir)/m4/acattribute.m4 \
$(top_srcdir)/m4/accross.m4 $(top_srcdir)/m4/acinclude.m4 \
$(top_srcdir)/../../libtool.m4 \
$(top_srcdir)/../../ltoptions.m4 \
$(top_srcdir)/../../ltsugar.m4 \
$(top_srcdir)/../../ltversion.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/ax_func_which_gethostbyname_r.m4 \
$(top_srcdir)/m4/gcc_attribute.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
mkinstalldirs = $(SHELL) $(top_srcdir)/../../mkinstalldirs
CONFIG_HEADER = $(top_builddir)/include/config.h
CONFIG_CLEAN_FILES =
SOURCES =
@ -62,12 +67,15 @@ ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BUILD_CLASS_FILES_FALSE = @BUILD_CLASS_FILES_FALSE@
BUILD_CLASS_FILES_TRUE = @BUILD_CLASS_FILES_TRUE@
CAIRO_CFLAGS = @CAIRO_CFLAGS@
CAIRO_LIBS = @CAIRO_LIBS@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
@ -113,6 +121,7 @@ DATE = @DATE@
DEFAULT_PREFS_PEER = @DEFAULT_PREFS_PEER@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
@ -125,15 +134,16 @@ ERROR_CFLAGS = @ERROR_CFLAGS@
EXAMPLESDIR = @EXAMPLESDIR@
EXEEXT = @EXEEXT@
FASTJAR = @FASTJAR@
FGREP = @FGREP@
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_JAVAC_FALSE = @FOUND_JAVAC_FALSE@
FOUND_JAVAC_TRUE = @FOUND_JAVAC_TRUE@
FOUND_JIKES_FALSE = @FOUND_JIKES_FALSE@
FOUND_JIKES_TRUE = @FOUND_JIKES_TRUE@
FOUND_KJC_FALSE = @FOUND_KJC_FALSE@
@ -141,7 +151,6 @@ 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@
@ -151,6 +160,7 @@ GENINSRC_TRUE = @GENINSRC_TRUE@
GJDOC = @GJDOC@
GLIB_CFLAGS = @GLIB_CFLAGS@
GLIB_LIBS = @GLIB_LIBS@
GREP = @GREP@
GTK_CFLAGS = @GTK_CFLAGS@
GTK_LIBS = @GTK_LIBS@
INIT_LOAD_LIBRARY = @INIT_LOAD_LIBRARY@
@ -162,6 +172,7 @@ INSTALL_GLIBJ_ZIP_TRUE = @INSTALL_GLIBJ_ZIP_TRUE@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
JAVAC = @JAVAC@
JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION = @JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION@
JAVA_MAINTAINER_MODE_FALSE = @JAVA_MAINTAINER_MODE_FALSE@
JAVA_MAINTAINER_MODE_TRUE = @JAVA_MAINTAINER_MODE_TRUE@
@ -171,6 +182,7 @@ JIKES = @JIKES@
JIKESENCODING = @JIKESENCODING@
JIKESWARNINGS = @JIKESWARNINGS@
KJC = @KJC@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBDEBUG = @LIBDEBUG@
LIBICONV = @LIBICONV@
@ -190,6 +202,7 @@ MKDIR = @MKDIR@
MOC = @MOC@
MOZILLA_CFLAGS = @MOZILLA_CFLAGS@
MOZILLA_LIBS = @MOZILLA_LIBS@
NM = @NM@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@ -211,6 +224,7 @@ RANLIB = @RANLIB@
REGEN_PARSERS_FALSE = @REGEN_PARSERS_FALSE@
REGEN_PARSERS_TRUE = @REGEN_PARSERS_TRUE@
REMOVE = @REMOVE@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRICT_WARNING_CFLAGS = @STRICT_WARNING_CFLAGS@
@ -238,8 +252,10 @@ X_EXTRA_LIBS = @X_EXTRA_LIBS@
X_LIBS = @X_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
ZIP = @ZIP@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
@ -272,6 +288,7 @@ install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
lt_ECHO = @lt_ECHO@
mandir = @mandir@
mkdir_p = @mkdir_p@
multi_basedir = @multi_basedir@

View file

@ -1,106 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
<title>W3C IPR SOFTWARE NOTICE</title>
<style type="text/css">
<!--
html, body { background: #fff; color: #000; } /* body for Windows IE3 */
-->
</style>
</head>
<body>
<h1>
W3C IPR SOFTWARE NOTICE
</h1>
<h3>
Copyright &copy; 2002 <a href="http://www.w3.org/">World Wide Web
Consortium</a>, (<a href="http://www.lcs.mit.edu/">Massachusetts
Institute of Technology</a>, <a href="http://www.inria.fr/">Institut
National de Recherche en Informatique et en Automatique</a>, <a
href="http://www.keio.ac.jp/">Keio University</a>). All Rights
Reserved.
</h3>
<p>
The DOM bindings are published under the W3C Software Copyright Notice
and License. The software license requires "Notice of any changes or
modifications to the W3C files, including the date changes were made."
Consequently, modified versions of the DOM bindings must document that
they do not conform to the W3C standard; in the case of the IDL
definitions, the pragma prefix can no longer be 'w3c.org'; in the case of
the Java language binding, the package names can no longer be in the
'org.w3c' package.
</p>
<p>
<b>Note:</b> The original version of the W3C Software Copyright Notice
and License could be found at <a
href='http://www.w3.org/Consortium/Legal/copyright-software-19980720'>http://www.w3.org/Consortium/Legal/copyright-software-19980720</a>
</p>
<h3>
Copyright &copy; 1994-2002 <a href="http://www.w3.org/">World Wide Web
Consortium</a>, (<a href="http://www.lcs.mit.edu/">Massachusetts
Institute of Technology</a>, <a href="http://www.inria.fr/">Institut
National de Recherche en Informatique et en Automatique</a>, <a
href="http://www.keio.ac.jp/">Keio University</a>). All Rights
Reserved. http://www.w3.org/Consortium/Legal/
</h3>
<p>
This W3C work (including software, documents, or other related items) is
being provided by the copyright holders under the following license. By
obtaining, using and/or copying this work, you (the licensee) agree that
you have read, understood, and will comply with the following terms and
conditions:
</p>
<p>
Permission to use, copy, and modify this software and its documentation,
with or without modification,&nbsp; for any purpose and without fee or
royalty is hereby granted, provided that you include the following on ALL
copies of the software and documentation or portions thereof, including
modifications, that you make:
</p>
<ol>
<li>
The full text of this NOTICE in a location viewable to users of the
redistributed or derivative work.
</li>
<li>
Any pre-existing intellectual property disclaimers, notices, or terms
and conditions. If none exist, a short notice of the following form
(hypertext is preferred, text is permitted) should be used within the
body of any redistributed or derivative code: "Copyright &copy;
[$date-of-software] <a href="http://www.w3.org/">World Wide Web
Consortium</a>, (<a href="http://www.lcs.mit.edu/">Massachusetts
Institute of Technology</a>, <a href="http://www.inria.fr/">Institut
National de Recherche en Informatique et en Automatique</a>, <a
href="http://www.keio.ac.jp/">Keio University</a>). All Rights
Reserved. http://www.w3.org/Consortium/Legal/"
</li>
<li>
Notice of any changes or modifications to the W3C files, including the
date changes were made. (We recommend you provide URIs to the location
from which the code is derived.)
</li>
</ol>
<p>
THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT
HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY OR FITNESS
FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE OR
DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS,
TRADEMARKS OR OTHER RIGHTS.
</p>
<p>
COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR
DOCUMENTATION.
</p>
<p>
The name and trademarks of copyright holders may NOT be used in
advertising or publicity pertaining to the software without specific,
written prior permission. Title to copyright in this software and any
associated documentation will at all times remain with copyright
holders.
</p>
</body>
</html>

View file

@ -43,16 +43,21 @@ am__aclocal_m4_deps = $(top_srcdir)/../../config/depstand.m4 \
$(top_srcdir)/../../config/lead-dot.m4 \
$(top_srcdir)/../../config/multi.m4 \
$(top_srcdir)/../../config/no-executables.m4 \
$(top_srcdir)/../../libtool.m4 $(top_srcdir)/m4/acattribute.m4 \
$(top_srcdir)/m4/accross.m4 $(top_srcdir)/m4/acinclude.m4 \
$(top_srcdir)/../../libtool.m4 \
$(top_srcdir)/../../ltoptions.m4 \
$(top_srcdir)/../../ltsugar.m4 \
$(top_srcdir)/../../ltversion.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/ax_func_which_gethostbyname_r.m4 \
$(top_srcdir)/m4/gcc_attribute.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
mkinstalldirs = $(SHELL) $(top_srcdir)/../../mkinstalldirs
CONFIG_HEADER = $(top_builddir)/include/config.h
CONFIG_CLEAN_FILES =
SOURCES =
@ -62,12 +67,15 @@ ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BUILD_CLASS_FILES_FALSE = @BUILD_CLASS_FILES_FALSE@
BUILD_CLASS_FILES_TRUE = @BUILD_CLASS_FILES_TRUE@
CAIRO_CFLAGS = @CAIRO_CFLAGS@
CAIRO_LIBS = @CAIRO_LIBS@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
@ -113,6 +121,7 @@ DATE = @DATE@
DEFAULT_PREFS_PEER = @DEFAULT_PREFS_PEER@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
@ -125,15 +134,16 @@ ERROR_CFLAGS = @ERROR_CFLAGS@
EXAMPLESDIR = @EXAMPLESDIR@
EXEEXT = @EXEEXT@
FASTJAR = @FASTJAR@
FGREP = @FGREP@
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_JAVAC_FALSE = @FOUND_JAVAC_FALSE@
FOUND_JAVAC_TRUE = @FOUND_JAVAC_TRUE@
FOUND_JIKES_FALSE = @FOUND_JIKES_FALSE@
FOUND_JIKES_TRUE = @FOUND_JIKES_TRUE@
FOUND_KJC_FALSE = @FOUND_KJC_FALSE@
@ -141,7 +151,6 @@ 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@
@ -151,6 +160,7 @@ GENINSRC_TRUE = @GENINSRC_TRUE@
GJDOC = @GJDOC@
GLIB_CFLAGS = @GLIB_CFLAGS@
GLIB_LIBS = @GLIB_LIBS@
GREP = @GREP@
GTK_CFLAGS = @GTK_CFLAGS@
GTK_LIBS = @GTK_LIBS@
INIT_LOAD_LIBRARY = @INIT_LOAD_LIBRARY@
@ -162,6 +172,7 @@ INSTALL_GLIBJ_ZIP_TRUE = @INSTALL_GLIBJ_ZIP_TRUE@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
JAVAC = @JAVAC@
JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION = @JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION@
JAVA_MAINTAINER_MODE_FALSE = @JAVA_MAINTAINER_MODE_FALSE@
JAVA_MAINTAINER_MODE_TRUE = @JAVA_MAINTAINER_MODE_TRUE@
@ -171,6 +182,7 @@ JIKES = @JIKES@
JIKESENCODING = @JIKESENCODING@
JIKESWARNINGS = @JIKESWARNINGS@
KJC = @KJC@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBDEBUG = @LIBDEBUG@
LIBICONV = @LIBICONV@
@ -190,6 +202,7 @@ MKDIR = @MKDIR@
MOC = @MOC@
MOZILLA_CFLAGS = @MOZILLA_CFLAGS@
MOZILLA_LIBS = @MOZILLA_LIBS@
NM = @NM@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@ -211,6 +224,7 @@ RANLIB = @RANLIB@
REGEN_PARSERS_FALSE = @REGEN_PARSERS_FALSE@
REGEN_PARSERS_TRUE = @REGEN_PARSERS_TRUE@
REMOVE = @REMOVE@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRICT_WARNING_CFLAGS = @STRICT_WARNING_CFLAGS@
@ -238,8 +252,10 @@ X_EXTRA_LIBS = @X_EXTRA_LIBS@
X_LIBS = @X_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
ZIP = @ZIP@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
@ -272,6 +288,7 @@ install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
lt_ECHO = @lt_ECHO@
mandir = @mandir@
mkdir_p = @mkdir_p@
multi_basedir = @multi_basedir@

View file

@ -172,7 +172,6 @@ public class gnuDynValue extends RecordAny implements DynValue,
else
return super.current_member_kind();
}
;
/** @inheritDoc */
public String current_member_name() throws TypeMismatch, InvalidValue
@ -182,7 +181,6 @@ public class gnuDynValue extends RecordAny implements DynValue,
else
return super.current_member_name();
}
;
/** @inheritDoc */
public NameDynAnyPair[] get_members_as_dyn_any() throws InvalidValue
@ -191,7 +189,6 @@ public class gnuDynValue extends RecordAny implements DynValue,
throw new InvalidValue(ISNULL);
return super.gnu_get_members_as_dyn_any();
}
;
/** @inheritDoc */
public NameValuePair[] get_members() throws InvalidValue
@ -201,7 +198,6 @@ public class gnuDynValue extends RecordAny implements DynValue,
else
return super.gnu_get_members();
}
;
/** @inheritDoc */
public void set_members_as_dyn_any(NameDynAnyPair[] value)
@ -210,7 +206,6 @@ public class gnuDynValue extends RecordAny implements DynValue,
super.set_members_as_dyn_any(value);
isNull = false;
}
;
/** @inheritDoc */
public void set_members(NameValuePair[] value)
@ -219,7 +214,6 @@ public class gnuDynValue extends RecordAny implements DynValue,
super.set_members(value);
isNull = false;
}
;
/** @inheritDoc */
public boolean is_null()

View file

@ -1348,7 +1348,6 @@ public class gnuPOA
{
return name;
}
;
/**
* Return the parent of this POA.

View file

@ -0,0 +1,126 @@
/* Pair.java -- A heterogenous pair of objects.
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. */
package gnu.classpath;
/**
* A container for a pair of heterogenous objects.
*
* @author Andrew John Hughes (gnu_andrew@member.fsf.org)
*/
public class Pair<A,B>
{
/**
* The left-hand side of the pair.
*/
private A left;
/**
* The right-hand side of the pair.
*/
private B right;
/**
* Constructs a new pair using the given left and
* right values.
*
* @param left the left-hand side of the pair.
* @param right the right-hand side of the pair.
*/
public Pair(A left, B right)
{
this.left = left;
this.right = right;
}
/**
* Returns the left-hand side of the pair.
*
* @return the left-hand value.
*/
public A getLeft()
{
return left;
}
/**
* Returns the right-hand side of the pair.
*
* @return the right-hand value.
*/
public B getRight()
{
return right;
}
/**
* Returns true if the specified object is also a
* pair with equivalent left and right values.
*
* @param obj the object to compare.
* @return true if the two are equal.
*/
public boolean equals(Object obj)
{
if (obj instanceof Pair)
{
Pair<A,B> p = (Pair<A,B>) obj;
A lp = p.getLeft();
B rp = p.getRight();
return (lp == null ? left == null : lp.equals(left)) &&
(rp == null ? right == null : rp.equals(right));
}
return false;
}
/**
* Returns a hashcode for the pair, created by the
* summation of the hashcodes of the left and right
* hand values.
*
* @return a hashcode for the pair.
*/
public int hashCode()
{
return (left == null ? 0 : left.hashCode())
+ (right == null ? 0 : right.hashCode());
}
}

View file

@ -49,6 +49,7 @@ import java.util.Collections;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.NoSuchElementException;
import java.util.ServiceConfigurationError;
import java.util.logging.Level;
import java.util.logging.LogRecord;
import java.util.logging.Logger;
@ -176,7 +177,6 @@ public final class ServiceFactory
*/
private static final Logger LOGGER = Logger.getLogger("gnu.classpath");
/**
* Declared private in order to prevent constructing instances of
* this utility class.
@ -224,6 +224,51 @@ public final class ServiceFactory
*/
public static Iterator lookupProviders(Class spi,
ClassLoader loader)
{
return lookupProviders(spi, loader, false);
}
/**
* Finds service providers that are implementing the specified
* Service Provider Interface.
*
* <p><b>On-demand loading:</b> Loading and initializing service
* providers is delayed as much as possible. The rationale is that
* typical clients will iterate through the set of installed service
* providers until one is found that matches some criteria (like
* supported formats, or quality of service). In such scenarios, it
* might make sense to install only the frequently needed service
* providers on the local machine. More exotic providers can be put
* onto a server; the server will only be contacted when no suitable
* service could be found locally.
*
* <p><b>Security considerations:</b> Any loaded service providers
* are loaded through the specified ClassLoader, or the system
* ClassLoader if <code>classLoader</code> is
* <code>null</code>. When <code>lookupProviders</code> is called,
* the current {@link AccessControlContext} gets recorded. This
* captured security context will determine the permissions when
* services get loaded via the <code>next()</code> method of the
* returned <code>Iterator</code>.
*
* @param spi the service provider interface which must be
* implemented by any loaded service providers.
*
* @param loader the class loader that will be used to load the
* service providers, or <code>null</code> for the system class
* loader. For using the context class loader, see {@link
* #lookupProviders(Class)}.
* @param error true if a {@link ServiceConfigurationError}
* should be thrown when an error occurs, rather
* than it merely being logged.
* @return an iterator over instances of <code>spi</code>.
*
* @throws IllegalArgumentException if <code>spi</code> is
* <code>null</code>.
*/
public static Iterator lookupProviders(Class spi,
ClassLoader loader,
boolean error)
{
String resourceName;
Enumeration urls;
@ -246,10 +291,14 @@ public final class ServiceFactory
* does not return anything (no providers installed).
*/
log(Level.WARNING, "cannot access {0}", resourceName, ioex);
return Collections.EMPTY_LIST.iterator();
if (error)
throw new ServiceConfigurationError("Failed to access + " +
resourceName, ioex);
else
return Collections.EMPTY_LIST.iterator();
}
return new ServiceIterator(spi, urls, loader,
return new ServiceIterator(spi, urls, loader, error,
AccessController.getContext());
}
@ -342,6 +391,11 @@ public final class ServiceFactory
*/
private Object nextProvider;
/**
* True if a {@link ServiceConfigurationError} should be thrown
* when an error occurs, instead of it merely being logged.
*/
private boolean error;
/**
* Constructs an Iterator that loads and initializes services on
@ -359,16 +413,21 @@ public final class ServiceFactory
* @param loader the ClassLoader that gets used for loading
* service providers.
*
* @param error true if a {@link ServiceConfigurationError}
* should be thrown when an error occurs, rather
* than it merely being logged.
*
* @param securityContext the security context to use when loading
* and initializing service providers.
*/
ServiceIterator(Class spi, Enumeration urls, ClassLoader loader,
AccessControlContext securityContext)
boolean error, AccessControlContext securityContext)
{
this.spi = spi;
this.urls = urls;
this.loader = loader;
this.securityContext = securityContext;
this.error = error;
this.nextProvider = loadNextServiceProvider();
}
@ -426,6 +485,9 @@ public final class ServiceFactory
log(Level.WARNING, "IOException upon reading {0}", currentURL,
readProblem);
line = null;
if (error)
throw new ServiceConfigurationError("Error reading " +
currentURL, readProblem);
}
/* When we are at the end of one list of services,
@ -477,6 +539,13 @@ public final class ServiceFactory
log(Level.WARNING, msg,
new Object[] { line, spi.getName(), currentURL },
ex);
if (error)
throw new ServiceConfigurationError("Cannot load service "+
"provider class " +
line + " specified by "+
"\"META-INF/services/"+
spi.getName() + "\" in "+
currentURL, ex);
continue;
}
}
@ -497,6 +566,9 @@ public final class ServiceFactory
catch (Exception ex)
{
log(Level.WARNING, "cannot close {0}", currentURL, ex);
if (error)
throw new ServiceConfigurationError("Cannot close " +
currentURL, ex);
}
reader = null;
currentURL = null;
@ -515,6 +587,9 @@ public final class ServiceFactory
catch (Exception ex)
{
log(Level.WARNING, "cannot open {0}", currentURL, ex);
if (error)
throw new ServiceConfigurationError("Cannot open " +
currentURL, ex);
}
}
while (reader == null);

View file

@ -1,5 +1,5 @@
/* VariableTable.java -- A class representing a Variable Table for a method
Copyright (C) 2005 Free Software Foundation
Copyright (C) 2005, 2007 Free Software Foundation
This file is part of GNU Classpath.

View file

@ -1,4 +1,4 @@
/* ArrayValue.java -- JDWP wrapper class for an Object value
/* ObjectValue.java -- JDWP wrapper class for an Object value
Copyright (C) 2007 Free Software Foundation
This file is part of GNU Classpath.

View file

@ -1,5 +1,5 @@
/* AWTUtilities.java -- Common utility methods for AWT and Swing.
Copyright (C) 2005 Free Software Foundation, Inc.
Copyright (C) 2005, 2007 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@ -47,6 +47,7 @@ import java.awt.Point;
import java.awt.Rectangle;
import java.awt.Toolkit;
import java.awt.Window;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.util.AbstractSequentialList;
import java.util.List;
@ -694,4 +695,204 @@ public class AWTUtilities
{
return java.awt.EventQueue.isDispatchThread();
}
/**
* Returns whether the specified key code is valid.
*/
public static boolean isValidKey(int keyCode)
{
switch (keyCode)
{
case KeyEvent.VK_ENTER:
case KeyEvent.VK_BACK_SPACE:
case KeyEvent.VK_TAB:
case KeyEvent.VK_CANCEL:
case KeyEvent.VK_CLEAR:
case KeyEvent.VK_SHIFT:
case KeyEvent.VK_CONTROL:
case KeyEvent.VK_ALT:
case KeyEvent.VK_PAUSE:
case KeyEvent.VK_CAPS_LOCK:
case KeyEvent.VK_ESCAPE:
case KeyEvent.VK_SPACE:
case KeyEvent.VK_PAGE_UP:
case KeyEvent.VK_PAGE_DOWN:
case KeyEvent.VK_END:
case KeyEvent.VK_HOME:
case KeyEvent.VK_LEFT:
case KeyEvent.VK_UP:
case KeyEvent.VK_RIGHT:
case KeyEvent.VK_DOWN:
case KeyEvent.VK_COMMA:
case KeyEvent.VK_MINUS:
case KeyEvent.VK_PERIOD:
case KeyEvent.VK_SLASH:
case KeyEvent.VK_0:
case KeyEvent.VK_1:
case KeyEvent.VK_2:
case KeyEvent.VK_3:
case KeyEvent.VK_4:
case KeyEvent.VK_5:
case KeyEvent.VK_6:
case KeyEvent.VK_7:
case KeyEvent.VK_8:
case KeyEvent.VK_9:
case KeyEvent.VK_SEMICOLON:
case KeyEvent.VK_EQUALS:
case KeyEvent.VK_A:
case KeyEvent.VK_B:
case KeyEvent.VK_C:
case KeyEvent.VK_D:
case KeyEvent.VK_E:
case KeyEvent.VK_F:
case KeyEvent.VK_G:
case KeyEvent.VK_H:
case KeyEvent.VK_I:
case KeyEvent.VK_J:
case KeyEvent.VK_K:
case KeyEvent.VK_L:
case KeyEvent.VK_M:
case KeyEvent.VK_N:
case KeyEvent.VK_O:
case KeyEvent.VK_P:
case KeyEvent.VK_Q:
case KeyEvent.VK_R:
case KeyEvent.VK_S:
case KeyEvent.VK_T:
case KeyEvent.VK_U:
case KeyEvent.VK_V:
case KeyEvent.VK_W:
case KeyEvent.VK_X:
case KeyEvent.VK_Y:
case KeyEvent.VK_Z:
case KeyEvent.VK_OPEN_BRACKET:
case KeyEvent.VK_BACK_SLASH:
case KeyEvent.VK_CLOSE_BRACKET:
case KeyEvent.VK_NUMPAD0:
case KeyEvent.VK_NUMPAD1:
case KeyEvent.VK_NUMPAD2:
case KeyEvent.VK_NUMPAD3:
case KeyEvent.VK_NUMPAD4:
case KeyEvent.VK_NUMPAD5:
case KeyEvent.VK_NUMPAD6:
case KeyEvent.VK_NUMPAD7:
case KeyEvent.VK_NUMPAD8:
case KeyEvent.VK_NUMPAD9:
case KeyEvent.VK_MULTIPLY:
case KeyEvent.VK_ADD:
case KeyEvent.VK_SEPARATOR:
case KeyEvent.VK_SUBTRACT:
case KeyEvent.VK_DECIMAL:
case KeyEvent.VK_DIVIDE:
case KeyEvent.VK_DELETE:
case KeyEvent.VK_NUM_LOCK:
case KeyEvent.VK_SCROLL_LOCK:
case KeyEvent.VK_F1:
case KeyEvent.VK_F2:
case KeyEvent.VK_F3:
case KeyEvent.VK_F4:
case KeyEvent.VK_F5:
case KeyEvent.VK_F6:
case KeyEvent.VK_F7:
case KeyEvent.VK_F8:
case KeyEvent.VK_F9:
case KeyEvent.VK_F10:
case KeyEvent.VK_F11:
case KeyEvent.VK_F12:
case KeyEvent.VK_F13:
case KeyEvent.VK_F14:
case KeyEvent.VK_F15:
case KeyEvent.VK_F16:
case KeyEvent.VK_F17:
case KeyEvent.VK_F18:
case KeyEvent.VK_F19:
case KeyEvent.VK_F20:
case KeyEvent.VK_F21:
case KeyEvent.VK_F22:
case KeyEvent.VK_F23:
case KeyEvent.VK_F24:
case KeyEvent.VK_PRINTSCREEN:
case KeyEvent.VK_INSERT:
case KeyEvent.VK_HELP:
case KeyEvent.VK_META:
case KeyEvent.VK_BACK_QUOTE:
case KeyEvent.VK_QUOTE:
case KeyEvent.VK_KP_UP:
case KeyEvent.VK_KP_DOWN:
case KeyEvent.VK_KP_LEFT:
case KeyEvent.VK_KP_RIGHT:
case KeyEvent.VK_DEAD_GRAVE:
case KeyEvent.VK_DEAD_ACUTE:
case KeyEvent.VK_DEAD_CIRCUMFLEX:
case KeyEvent.VK_DEAD_TILDE:
case KeyEvent.VK_DEAD_MACRON:
case KeyEvent.VK_DEAD_BREVE:
case KeyEvent.VK_DEAD_ABOVEDOT:
case KeyEvent.VK_DEAD_DIAERESIS:
case KeyEvent.VK_DEAD_ABOVERING:
case KeyEvent.VK_DEAD_DOUBLEACUTE:
case KeyEvent.VK_DEAD_CARON:
case KeyEvent.VK_DEAD_CEDILLA:
case KeyEvent.VK_DEAD_OGONEK:
case KeyEvent.VK_DEAD_IOTA:
case KeyEvent.VK_DEAD_VOICED_SOUND:
case KeyEvent.VK_DEAD_SEMIVOICED_SOUND:
case KeyEvent.VK_AMPERSAND:
case KeyEvent.VK_ASTERISK:
case KeyEvent.VK_QUOTEDBL:
case KeyEvent.VK_LESS:
case KeyEvent.VK_GREATER:
case KeyEvent.VK_BRACELEFT:
case KeyEvent.VK_BRACERIGHT:
case KeyEvent.VK_AT:
case KeyEvent.VK_COLON:
case KeyEvent.VK_CIRCUMFLEX:
case KeyEvent.VK_DOLLAR:
case KeyEvent.VK_EURO_SIGN:
case KeyEvent.VK_EXCLAMATION_MARK:
case KeyEvent.VK_INVERTED_EXCLAMATION_MARK:
case KeyEvent.VK_LEFT_PARENTHESIS:
case KeyEvent.VK_NUMBER_SIGN:
case KeyEvent.VK_PLUS:
case KeyEvent.VK_RIGHT_PARENTHESIS:
case KeyEvent.VK_UNDERSCORE:
case KeyEvent.VK_FINAL:
case KeyEvent.VK_CONVERT:
case KeyEvent.VK_NONCONVERT:
case KeyEvent.VK_ACCEPT:
case KeyEvent.VK_MODECHANGE:
case KeyEvent.VK_KANA:
case KeyEvent.VK_KANJI:
case KeyEvent.VK_ALPHANUMERIC:
case KeyEvent.VK_KATAKANA:
case KeyEvent.VK_HIRAGANA:
case KeyEvent.VK_FULL_WIDTH:
case KeyEvent.VK_HALF_WIDTH:
case KeyEvent.VK_ROMAN_CHARACTERS:
case KeyEvent.VK_ALL_CANDIDATES:
case KeyEvent.VK_PREVIOUS_CANDIDATE:
case KeyEvent.VK_CODE_INPUT:
case KeyEvent.VK_JAPANESE_KATAKANA:
case KeyEvent.VK_JAPANESE_HIRAGANA:
case KeyEvent.VK_JAPANESE_ROMAN:
case KeyEvent.VK_KANA_LOCK:
case KeyEvent.VK_INPUT_METHOD_ON_OFF:
case KeyEvent.VK_CUT:
case KeyEvent.VK_COPY:
case KeyEvent.VK_PASTE:
case KeyEvent.VK_UNDO:
case KeyEvent.VK_AGAIN:
case KeyEvent.VK_FIND:
case KeyEvent.VK_PROPS:
case KeyEvent.VK_STOP:
case KeyEvent.VK_COMPOSE:
case KeyEvent.VK_ALT_GRAPH:
case KeyEvent.VK_BEGIN:
case KeyEvent.VK_CONTEXT_MENU:
case KeyEvent.VK_WINDOWS:
return true;
default:
return false;
}
}
}

View file

@ -1,5 +1,5 @@
/* Native implementation of functions in GThreadNativeMethodRunner
Copyright (C) 2004 Free Software Foundation, Inc.
/* ClasspathGraphicsEnvironment.java
Copyright (C) 2007 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@ -35,36 +35,33 @@ 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. */
package gnu.java.awt;
#include "gnu_java_awt_peer_gtk_GThreadNativeMethodRunner.h"
#include "gthread-jni.h"
import java.awt.GraphicsEnvironment;
import java.awt.image.ColorModel;
import java.awt.image.SampleModel;
import java.awt.image.WritableRaster;
/*
* Class: GThreadNativeMethodRunner
* Method: nativeRun
* Signature: (J)V
*
* Purpose: Run the C function whose function pointer is
*
/**
* This class extends the GraphicsEnvironment API with some Classpath-specific
* methods, in order to provide optimized graphics handling.
*
* @author Francis Kung <fkung@redhat.com>
*/
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GThreadNativeMethodRunner_nativeRun
(JNIEnv *env __attribute__((unused)),
jobject lcl_obj __attribute__((unused)),
jlong funcAddr, jlong funcArg)
public abstract class ClasspathGraphicsEnvironment
extends GraphicsEnvironment
{
/* 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. */
/**
* Returns an appropriate Raster that can efficiently back a
* BufferedImage with the given ColorModel and SampleModel.
*
* @param cm The color model.
* @param sm The samepl model.
* @return An appropriate WritableRaster, or null if acceleration/optimization
* is not available for the given colour model / sample model.
*/
public WritableRaster createRaster(ColorModel cm, SampleModel sm)
{
return null;
}
}
/* Local Variables: */
/* c-file-style: "gnu" */
/* End: */

View file

@ -38,36 +38,28 @@ exception statement from your version. */
package gnu.java.awt;
import gnu.java.awt.EmbeddedWindow;
import gnu.java.awt.peer.ClasspathDesktopPeer;
import gnu.java.awt.peer.ClasspathFontPeer;
import gnu.java.awt.peer.EmbeddedWindowPeer;
import gnu.java.security.action.SetAccessibleAction;
import java.awt.AWTException;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.DisplayMode;
import java.awt.Desktop;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.FontFormatException;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import java.awt.Image;
import java.awt.Point;
import java.awt.HeadlessException;
import java.awt.Toolkit;
import java.awt.font.FontRenderContext;
import java.awt.image.ColorModel;
import java.awt.image.ImageProducer;
import java.awt.font.TextAttribute;
import java.awt.peer.DesktopPeer;
import java.awt.peer.RobotPeer;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.net.MalformedURLException;
import java.net.URL;
import java.text.AttributedString;
import java.util.HashMap;
import java.util.Map;
import java.security.AccessController;
import java.util.Map;
import javax.imageio.spi.IIORegistry;
@ -118,7 +110,8 @@ public abstract class ClasspathToolkit
* this font peer should have, such as size, weight, family name, or
* transformation.
*/
public abstract ClasspathFontPeer getClasspathFontPeer (String name, Map attrs);
public abstract ClasspathFontPeer getClasspathFontPeer (String name,
Map<?,?> attrs);
/**
* Creates a {@link Font}, in a platform-specific manner.
@ -137,9 +130,8 @@ public abstract class ClasspathToolkit
try
{
Constructor fontConstructor = Font.class.getDeclaredConstructor
(new Class[] { String.class, Map.class });
AccessController.doPrivileged
(new SetAccessibleAction(fontConstructor));
(new Class[] { String.class, Map.class });
AccessController.doPrivileged(new SetAccessibleAction(fontConstructor));
f = (Font) fontConstructor.newInstance(new Object[] { name, attrs });
}
catch (IllegalAccessException e)
@ -224,5 +216,18 @@ public abstract class ClasspathToolkit
{
return -1;
}
/* (non-Javadoc)
* @see java.awt.Toolkit#createDesktopPeer(java.awt.Desktop)
*/
protected DesktopPeer createDesktopPeer(Desktop target)
throws HeadlessException
{
if (GraphicsEnvironment.isHeadless())
throw new HeadlessException();
return ClasspathDesktopPeer.getDesktop();
}
}

View file

@ -61,6 +61,13 @@ import java.util.Locale;
*/
public interface FontDelegate
{
public static final int FLAG_FITTED = 1 << 0;
public static final int FLAG_NO_HINT_HORIZONTAL = 1 << 1;
public static final int FLAG_NO_HINT_VERTICAL = 1 << 2;
public static final int FLAG_NO_HINT_EDGE_POINTS = 1 << 3;
public static final int FLAG_NO_HINT_STRONG_POINTS = 1 << 4;
public static final int FLAG_NO_HINT_WEAK_POINTS = 1 << 5;
/**
* Returns the full name of this font face in the specified
* locale, for example <i>&#x201c;Univers Light&#x201d;</i>.
@ -221,7 +228,8 @@ public interface FontDelegate
float pointSize,
AffineTransform transform,
boolean antialias,
boolean fractionalMetrics);
boolean fractionalMetrics,
int type);
/**

View file

@ -164,7 +164,9 @@ public class GNUGlyphVector
renderContext.usesFractionalMetrics(),
/* horizontal */ true,
advance);
pos[p] = x += advance.x;
// FIXME: We shouldn't round here, but instead hint the metrics
// correctly.
pos[p] = x += Math.round(advance.x);
pos[p + 1] = y += advance.y;
}
valid = true;
@ -284,6 +286,22 @@ public class GNUGlyphVector
return outline;
}
public Shape getOutline(float x, float y, int type)
{
validate();
GeneralPath outline = new GeneralPath();
int len = glyphs.length;
for (int i = 0; i < len; i++)
{
GeneralPath p = new GeneralPath(getGlyphOutline(i, type));
outline.append(p, false);
}
AffineTransform t = new AffineTransform();
t.translate(x, y);
outline.transform(t);
return outline;
}
/**
* Determines the shape of the specified glyph.
@ -309,7 +327,8 @@ public class GNUGlyphVector
path = fontDelegate.getGlyphOutline(glyphs[glyphIndex], fontSize, tx,
renderContext.isAntiAliased(),
renderContext.usesFractionalMetrics());
renderContext.usesFractionalMetrics(),
FontDelegate.FLAG_FITTED);
tx = new AffineTransform();
tx.translate(pos[glyphIndex * 2], pos[glyphIndex * 2 + 1]);
@ -317,6 +336,32 @@ public class GNUGlyphVector
return path;
}
public Shape getGlyphOutline(int glyphIndex, int type)
{
AffineTransform tx, glyphTx;
GeneralPath path;
validate();
if ((transforms != null)
&& ((glyphTx = transforms[glyphIndex]) != null))
{
tx = new AffineTransform(transform);
tx.concatenate(glyphTx);
}
else
tx = transform;
path = fontDelegate.getGlyphOutline(glyphs[glyphIndex], fontSize, tx,
renderContext.isAntiAliased(),
renderContext.usesFractionalMetrics(),
type);
tx = new AffineTransform();
tx.translate(pos[glyphIndex * 2], pos[glyphIndex * 2 + 1]);
path.transform(tx);
return path;
}
/**
* Determines the position of the specified glyph, or the

View file

@ -0,0 +1,83 @@
/* AutoHinter.java -- The entry point into the hinter implementation.
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. */
package gnu.java.awt.font.autofit;
import gnu.java.awt.font.opentype.Hinter;
import gnu.java.awt.font.opentype.OpenTypeFont;
import gnu.java.awt.font.opentype.truetype.Fixed;
import gnu.java.awt.font.opentype.truetype.Zone;
/**
* The public interface to the automatic gridfitter.
*/
public class AutoHinter
implements Hinter
{
Latin latinScript;
LatinMetrics metrics;
GlyphHints hints;
HintScaler scaler = new HintScaler();
public void init(OpenTypeFont font)
{
// TODO: Should support other scripts too.
latinScript = new Latin();
metrics = new LatinMetrics(font);
latinScript.initMetrics(metrics, font);
scaler.face = font;
}
public void applyHints(Zone outline)
{
if (hints == null)
hints = new GlyphHints();
scaler.xScale = Fixed.valueOf16(outline.scaleX * 64);
scaler.yScale = Fixed.valueOf16(outline.scaleY * 64);
latinScript.scaleMetrics(metrics, scaler);
latinScript.applyHints(hints, outline, metrics);
}
public void setFlags(int flags)
{
if (hints == null)
hints = new GlyphHints();
hints.flags = flags;
}
}

View file

@ -1,4 +1,4 @@
/* AxisHints.java -- FIXME: briefly describe file purpose
/* AxisHints.java -- Hints specific to an axis
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@ -42,4 +42,71 @@ class AxisHints
{
Segment[] segments;
int majorDir;
int numSegments;
int numEdges;
Edge[] edges;
AxisHints()
{
segments = new Segment[4];
edges = new Edge[4];
}
Segment newSegment()
{
if (numSegments >= segments.length)
{
// Grow array.
int newMax = segments.length;
newMax += (newMax >> 2) + 4; // From FreeType.
Segment[] newSegs = new Segment[newMax];
System.arraycopy(segments, 0, newSegs, 0, numSegments);
segments = newSegs;
}
Segment seg = new Segment();
segments[numSegments] = seg;
numSegments++;
return seg;
}
public Edge newEdge(int pos)
{
if (numEdges >= edges.length)
{
// Grow array.
int newMax = edges.length;
newMax += (newMax >> 2) + 4; // From FreeType.
Edge[] newEdges = new Edge[newMax];
System.arraycopy(edges, 0, newEdges, 0, numEdges);
edges = newEdges;
}
int edgeIndex = numEdges;
Edge edge = edges[edgeIndex] = new Edge();
while (edgeIndex > 0 && edges[edgeIndex - 1].fpos > pos)
{
edges[edgeIndex] = edges[edgeIndex - 1];
edgeIndex--;
}
edges[edgeIndex] = edge;
numEdges++;
edge.fpos = pos;
return edge;
}
int getEdgeIndex(Edge edge2)
{
int idx = -1;
for (int i = 0; i < numEdges; i++)
{
if (edges[i] == edge2)
{
idx = i;
break;
}
}
return idx;
}
}

View file

@ -58,4 +58,29 @@ interface Constants
* The number of dimensions.
*/
static final int DIMENSION_MAX = 2;
/**
* Indicates a vector with no specific direction.
*/
static final int DIR_NONE = 0;
/**
* Right direction.
*/
static final int DIR_RIGHT = 1;
/**
* Left direction.
*/
static final int DIR_LEFT = -1;
/**
* Up direction.
*/
static final int DIR_UP = 2;
/**
* Down direction.
*/
static final int DIR_DOWN = -2;
}

View file

@ -0,0 +1,80 @@
/* Edge.java -- An edge of segments
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. */
package gnu.java.awt.font.autofit;
class Edge
{
int fpos;
Segment first;
Segment last;
int opos;
Edge link;
Edge serif;
int flags;
int dir;
Width blueEdge;
int pos;
int scale;
public String toString()
{
StringBuilder s = new StringBuilder();
s.append("[Edge] id");
s.append(hashCode());
s.append(", fpos: ");
s.append(fpos);
s.append(", opos: ");
s.append(opos);
s.append(", pos: ");
s.append(pos);
s.append(", dir: ");
s.append(dir);
s.append(", serif: ");
s.append(serif != null ? serif.hashCode() : "null");
s.append(", link: ");
s.append(link != null ? link.hashCode() : "null");
s.append(", flags: " + flags);
s.append(", blue: " + blueEdge);
s.append(", first: ");
s.append(first == null ? "null" : first.hashCode());
s.append(", last: ");
s.append(last == null ? "null" : last.hashCode());
return s.toString();
}
}

View file

@ -38,12 +38,16 @@ exception statement from your version. */
package gnu.java.awt.font.autofit;
import gnu.java.awt.font.FontDelegate;
import gnu.java.awt.font.opentype.truetype.Fixed;
import gnu.java.awt.font.opentype.truetype.Point;
import gnu.java.awt.font.opentype.truetype.Zone;
/**
* The data and methods used for the actual hinting process.
*/
class GlyphHints
implements Constants
{
int xScale;
@ -53,23 +57,584 @@ class GlyphHints
AxisHints[] axis;
void rescale(ScriptMetrics metrics)
Point[] points;
int numPoints;
int maxPoints;
Point[] contours;
int numContours;
int maxContours;
ScriptMetrics metrics;
int flags;
GlyphHints()
{
// TODO: Implement.
axis = new AxisHints[Constants.DIMENSION_MAX];
axis[Constants.DIMENSION_VERT] = new AxisHints();
axis[Constants.DIMENSION_HORZ] = new AxisHints();
xScale = Fixed.ONE;
yScale = Fixed.ONE;
}
void rescale(ScriptMetrics m)
{
metrics = m;
// TODO: Copy scalerFlags.
}
void reload(Zone outline)
{
// TODO: Implement.
numPoints = 0;
numContours = 0;
axis[0].numSegments = 0;
axis[0].numEdges = 0;
axis[1].numSegments = 0;
axis[1].numEdges = 0;
// Create/reallocate the contours array.
int newMax = outline.getNumContours();
if (newMax > maxContours || contours == null)
{
newMax = (newMax + 3) & ~3; // Taken from afhints.c .
Point[] newContours = new Point[newMax];
if (contours != null)
{
System.arraycopy(contours, 0, newContours, 0, maxContours);
}
contours = newContours;
maxContours = newMax;
}
// Create/reallocate the points array.
newMax = outline.getSize() + 2;
if (newMax > maxPoints || points == null)
{
newMax = (newMax + 2 + 7) & ~7; // Taken from afhints.c .
Point[] newPoints = new Point[newMax];
if (points != null)
{
System.arraycopy(points, 0, newPoints, 0, maxPoints);
}
points = newPoints;
maxPoints = newMax;
}
numPoints = outline.getSize() - 4; // 4 phantom points.
numContours = outline.getNumContours();
// Set major direction. We don't handle Type 1 fonts yet.
axis[DIMENSION_HORZ].majorDir = DIR_UP;
axis[DIMENSION_VERT].majorDir = DIR_LEFT;
// TODO: Freetype seems to scale and translate the glyph at that point.
// I suppose that this is not really needed.
// The scales are scaling from font units to 1/64 device pixels.
xScale = Fixed.valueOf16(outline.scaleX * 64);
yScale = Fixed.valueOf16(outline.scaleY * 64);
// FIXME: What is that xDelta and yDelta used for?
System.arraycopy(outline.getPoints(), 0, points, 0, numPoints);
// Setup prev and next and contours array.
// TODO: Probably cache this.
contours = new Point[numContours];
Point currentContour = points[0];
for (int i = 0, cIndex = 0; i < numPoints; i++)
{
// Start new contour when the last point has been a contour end.
if (outline.isContourEnd(i))
{
// Connect the contour end point to the start point.
points[i].setNext(currentContour);
currentContour.setPrev(points[i]);
contours[cIndex] = currentContour;
cIndex++;
currentContour = i < numPoints - 1 ? points[i + 1] : null;
}
else
{
// Connect the current and the previous point.
points[i].setNext(points[i + 1]);
points[i + 1].setPrev(points[i]);
}
}
// Compute directions of in and out vectors of all points as well
// as the weak point flag.
for (int i = 0; i < numPoints; i++)
{
// Compute in and out dir.
Point p = points[i];
Point prev = p.getPrev();
int inX = p.getOrigX() - prev.getOrigX();
int inY = p.getOrigY() - prev.getOrigY();
p.setInDir(Utils.computeDirection(inX, inY));
Point next = p.getNext();
int outX = next.getOrigX() - p.getOrigX();
int outY = next.getOrigY() - p.getOrigY();
p.setOutDir(Utils.computeDirection(outX, outY));
if (p.isControlPoint())
{
setWeakPoint(p);
}
else if (p.getOutDir() == p.getInDir())
{
if (p.getOutDir() != DIR_NONE)
setWeakPoint(p);
else
{
int angleIn = Utils.atan(inY, inX);
int angleOut = Utils.atan(outY, outX);
int delta = Utils.angleDiff(angleIn, angleOut);
if (delta < 2 && delta > -2)
setWeakPoint(p);
}
}
else if (p.getInDir() == - p.getOutDir())
{
setWeakPoint(p);
}
}
computeInflectionPoints();
}
void computeSegments(int dim)
private void setWeakPoint(Point p)
{
// TODO: Implement.
p.setFlags((byte) (p.getFlags() | Point.FLAG_WEAK_INTERPOLATION));
}
void linkSegments(int dim)
/**
* Computes the inflection points for a glyph.
*/
private void computeInflectionPoints()
{
// TODO: Implement.
// Do each contour separately.
contours : for (int c = 0; c < contours.length; c++)
{
Point point = contours[c];
Point first = point;
Point start = point;
Point end = point;
do
{
end = end.getNext();
if (end == first)
continue contours;
} while (end.getOrigX() == first.getOrigX()
&& end.getOrigY() == first.getOrigY());
// Extend segment start whenever possible.
Point before = start;
int angleIn;
int angleSeg = Utils.atan(end.getOrigX() - start.getOrigX(),
end.getOrigY() - start.getOrigY());
do
{
do
{
start = before;
before = before.getPrev();
if (before == first)
continue contours;
} while (before.getOrigX() == start.getOrigX()
&& before.getOrigY() == start.getOrigY());
angleIn = Utils.atan(start.getOrigX() - before.getOrigX(),
start.getOrigY() - before.getOrigY());
} while (angleIn == angleSeg);
first = start;
int diffIn = Utils.angleDiff(angleIn, angleSeg);
// Now, process all segments in the contour.
Point after;
boolean finished = false;
int angleOut, diffOut;
do
{
// First, extend the current segment's end whenever possible.
after = end;
do
{
do
{
end = after;
after = after.getNext();
if (after == first)
finished = true;
} while (end.getOrigX() == after.getOrigX()
&& end.getOrigY() == after.getOrigY());
angleOut = Utils.atan(after.getOrigX() - end.getOrigX(),
after.getOrigY() - end.getOrigY());
} while (angleOut == angleSeg);
diffOut = Utils.angleDiff(angleSeg, angleOut);
if ((diffIn ^ diffOut) < 0)
{
// diffIn and diffOut have different signs, we have
// inflection points here.
do
{
start.addFlags(Point.FLAG_INFLECTION);
start = start.getNext();
} while (start != end);
start.addFlags(Point.FLAG_INFLECTION);
}
start = end;
end = after;
angleSeg = angleOut;
diffIn = diffOut;
} while (! finished);
}
}
boolean doHorizontal()
{
return (flags & FontDelegate.FLAG_NO_HINT_HORIZONTAL) == 0;
}
boolean doVertical()
{
return (flags & FontDelegate.FLAG_NO_HINT_VERTICAL) == 0;
}
void alignWeakPoints(int dim)
{
short touchFlag;
Point point;
// PASS 1 : Move segments to edge positions.
if (dim == DIMENSION_HORZ)
{
touchFlag = Point.FLAG_DONE_X;
for (int p = 0; p < numPoints; p++)
{
point = points[p];
point.setU(point.getX());
point.setV(point.getScaledX());
}
}
else
{
touchFlag = Point.FLAG_DONE_Y;
for (int p = 0; p < numPoints; p++)
{
point = points[p];
point.setU(point.getY());
point.setV(point.getScaledY());
}
}
point = points[0];
for (int c = 0; c < numContours; c++)
{
point = contours[c];
int idx = getPointIndex(point);
Point endPoint = point.getPrev();
int endIdx = getPointIndex(endPoint);
int firstIdx = idx;
while (idx <= endIdx
&& (point.getFlags() & touchFlag) == 0)
{
idx++;
point = points[idx];
}
if (idx <= endIdx)
{
int firstTouched = idx;
int curTouched = idx;
idx++;
point = points[idx];
while (idx <= endIdx)
{
if ((point.getFlags() & touchFlag) != 0)
{
// We found two successive touch points. We interpolate
// all contour points between them.
iupInterp(curTouched + 1, idx - 1, curTouched, idx);
curTouched = idx;
}
idx++;
point = points[idx];
}
if (curTouched == firstTouched)
{
// This is a special case: Only one point was touched in the
// contour. We thus simply shift the whole contour.
iupShift(firstIdx, endIdx, curTouched);
}
else
{
// Now interpolate after the last touched point to the end
// of the contour.
iupInterp(curTouched + 1, endIdx, curTouched, firstTouched);
// If the first contour point isn't touched, interpolate
// from the contour start to the first touched point.
if (firstTouched > 0)
{
iupInterp(firstIdx, firstTouched - 1, curTouched,
firstTouched);
}
}
}
}
// Now store the values back.
if (dim == DIMENSION_HORZ)
{
for (int p = 0; p < numPoints; p++)
{
point = points[p];
point.setX(point.getU());
}
}
else
{
for (int p = 0; p < numPoints; p++)
{
point = points[p];
point.setY(point.getU());
}
}
}
private void iupShift(int p1, int p2, int ref)
{
int delta = points[ref].getU() - points[ref].getV();
for (int p = p1; p < ref; p++)
{
points[p].setU(points[p].getV() + delta);
}
for (int p = ref + 1; p <= p2; p++)
{
points[p].setU(points[p].getV() + delta);
}
}
private void iupInterp(int p1, int p2, int ref1, int ref2)
{
int v1 = points[ref1].getV();
int v2 = points[ref2].getV();
int d1 = points[ref1].getU() - v1;
int d2 = points[ref2].getU() - v2;
if (p1 > p2)
return;
if (v1 == v2)
{
for (int p = p1; p <= p2; p++)
{
int u = points[p].getV();
if (u <= v1)
u += d1;
else
u += d2;
points[p].setU(u);
}
}
else if (v1 < v2)
{
for (int p = p1; p <= p2; p++)
{
int u = points[p].getV();
if (u <= v1)
u += d1;
else if (u >= v2)
u += d2;
else
{
u = points[ref1].getU() + Utils.mulDiv(u - v1,
points[ref2].getU()
- points[ref1].getU(),
v2 - v1);
}
points[p].setU(u);
}
}
else
{
for (int p = p1; p <= p2; p++)
{
int u = points[p].getV();
if (u <= v2)
u += d2;
else if (u >= v1)
u += d1;
else
{
u = points[ref1].getU() + Utils.mulDiv(u - v1,
points[ref2].getU()
- points[ref1].getU(),
v2 - v1);
}
points[p].setU(u);
}
}
}
void alignStrongPoints(int dim)
{
AxisHints ax = axis[dim];
Edge[] edges = ax.edges;
int numEdges = ax.numEdges;
short touchFlag;
if (dim == DIMENSION_HORZ)
touchFlag = Point.FLAG_DONE_X;
else
touchFlag = Point.FLAG_DONE_Y;
if (numEdges > 0)
{
for (int p = 0; p < numPoints; p++)
{
Point point = points[p];
if ((point.getFlags() & touchFlag) != 0)
continue;
// If this point is a candidate for weak interpolation, we
// interpolate it after all strong points have been processed.
if ((point.getFlags() & Point.FLAG_WEAK_INTERPOLATION) != 0
&& (point.getFlags() & Point.FLAG_INFLECTION) == 0)
continue;
int u, ou, fu, delta;
if (dim == DIMENSION_VERT)
{
u = point.getOrigY();
ou = point.getScaledY();
}
else
{
u = point.getOrigX();
ou = point.getScaledX();
}
fu = u;
// Is the point before the first edge?
Edge edge = edges[0];
// Inversed vertical dimension.
delta = edge.fpos - u;
if (delta >= 0)
{
u = edge.pos - (edge.opos - ou);
storePoint(point, u, dim, touchFlag);
}
else
{
// Is the point after the last edge?
edge = edges[numEdges - 1];
delta = u - edge.fpos;
if (delta >= 0)
{
u = edge.pos + (ou - edge.opos);
storePoint(point, u, dim, touchFlag);
}
else
{
// Find enclosing edges.
int min = 0;
int max = numEdges;
int mid, fpos;
boolean found = false;
while (min < max)
{
mid = (max + min) / 2;
edge = edges[mid];
fpos = edge.fpos;
if (u < fpos)
max = mid;
else if (u > fpos)
min = mid + 1;
else
{
// Directly on the edge.
u = edge.pos;
storePoint(point, u, dim, touchFlag);
found = true;
break;
}
}
if (! found)
{
Edge before = edges[min - 1];
Edge after = edges[min];
if (before.scale == 0)
{
before.scale = Fixed.div16(after.pos - before.pos,
after.fpos - before.fpos);
}
u = before.pos + Fixed.mul16(fu - before.fpos,
before.scale);
}
storePoint(point, u, dim, touchFlag);
}
}
}
}
}
private void storePoint(Point p, int u, int dim, short touchFlag)
{
if (dim == DIMENSION_HORZ)
p.setX(u);
else
p.setY(u);
p.addFlags(touchFlag);
}
void alignEdgePoints(int dim)
{
AxisHints ax = axis[dim];
Edge[] edges = ax.edges;
int numEdges = ax.numEdges;
for (int e = 0; e < numEdges; e++)
{
Edge edge = edges[e];
Segment seg = edge.first;
do
{
Point point = seg.first;
while (true)
{
if (dim == DIMENSION_HORZ)
{
point.setX(edge.pos);
point.addFlags(Point.FLAG_DONE_X);
}
else
{
point.setY(edge.pos);
point.addFlags(Point.FLAG_DONE_Y);
}
if (point == seg.last)
break;
point = point.getNext();
}
seg = seg.edgeNext;
} while (seg != edge.first);
}
}
private int getPointIndex(Point p)
{
int idx = -1;
for (int i = 0; i < numPoints; i++)
{
if (p == points[i])
{
idx = i;
break;
}
}
return idx;
}
public boolean doAlignEdgePoints()
{
return (flags & FontDelegate.FLAG_NO_HINT_EDGE_POINTS) == 0;
}
public boolean doAlignStrongPoints()
{
return (flags & FontDelegate.FLAG_NO_HINT_STRONG_POINTS) == 0;
}
public boolean doAlignWeakPoints()
{
return (flags & FontDelegate.FLAG_NO_HINT_WEAK_POINTS) == 0;
}
}

View file

@ -40,7 +40,7 @@ package gnu.java.awt.font.autofit;
import gnu.java.awt.font.opentype.OpenTypeFont;
class Scaler
class HintScaler
{
int xScale;
@ -48,5 +48,6 @@ class Scaler
int yScale;
int yDelta;
OpenTypeFont face;
int renderMode;
}

File diff suppressed because it is too large Load diff

View file

@ -49,5 +49,14 @@ class LatinAxis
int widthCount;
Width[] widths;
float edgeDistanceTreshold;
int edgeDistanceTreshold;
LatinBlue[] blues;
int blueCount;
int orgDelta;
int orgScale;
LatinAxis()
{
widths = new Width[Latin.MAX_WIDTHS];
blues = new LatinBlue[Latin.BLUE_MAX];
}
}

View file

@ -0,0 +1,59 @@
/* LatinBlue.java -- FIXME: briefly describe file purpose
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. */
package gnu.java.awt.font.autofit;
public class LatinBlue
{
static final int FLAG_BLUE_ACTIVE = 1 << 0;
static final int FLAG_TOP = 1 << 1;
static final int FLAG_ADJUSTMENT = 1 << 2;
Width ref;
Width shoot;
int flags;
public String toString()
{
StringBuilder s = new StringBuilder();
s.append("[BlueZone]");
s.append(" ref: ");
s.append(ref.org);
s.append(", shoot: ");
s.append(shoot.org);
return s.toString();
}
}

View file

@ -38,6 +38,8 @@ exception statement from your version. */
package gnu.java.awt.font.autofit;
import gnu.java.awt.font.opentype.OpenTypeFont;
/**
* Latin specific metrics data.
*/
@ -48,4 +50,17 @@ class LatinMetrics
LatinAxis[] axis;
int unitsPerEm;
LatinMetrics()
{
super();
axis = new LatinAxis[Constants.DIMENSION_MAX];
axis[Constants.DIMENSION_HORZ] = new LatinAxis();
axis[Constants.DIMENSION_VERT] = new LatinAxis();
}
LatinMetrics(OpenTypeFont face)
{
this();
unitsPerEm = face.unitsPerEm;
}
}

View file

@ -39,6 +39,7 @@ exception statement from your version. */
package gnu.java.awt.font.autofit;
import gnu.java.awt.font.opentype.OpenTypeFont;
import gnu.java.awt.font.opentype.truetype.Zone;
/**
* Defines script specific methods for the auto fitter.
@ -51,12 +52,11 @@ interface Script
*/
void initMetrics(ScriptMetrics metrics, OpenTypeFont face);
void scaleMetrics(ScriptMetrics metrics/* , scaler, map this */);
void scaleMetrics(ScriptMetrics metrics , HintScaler scaler);
void doneMetrics(ScriptMetrics metrics);
void initHints(GlyphHints hints, ScriptMetrics metrics);
void applyHints(GlyphHints hints, /* some outline object, */
ScriptMetrics metrics);
void applyHints(GlyphHints hints, Zone outline, ScriptMetrics metrics);
}

View file

@ -45,5 +45,9 @@ class ScriptMetrics
{
Script script;
Scaler scaler;
HintScaler scaler;
ScriptMetrics()
{
scaler = new HintScaler();
}
}

View file

@ -38,10 +38,58 @@ exception statement from your version. */
package gnu.java.awt.font.autofit;
import gnu.java.awt.font.opentype.truetype.Point;
class Segment
{
static final int FLAG_EDGE_NORMAL = 0;
static final int FLAG_EDGE_ROUND = 1;
static final int FLAG_EDGE_SERIF = 2;
static final int FLAG_EDGE_DONE = 4;
int dir;
int flags;
Segment link;
int index;
Segment serif;
int numLinked;
int pos;
Point first;
Point last;
Point contour;
int minPos;
int maxPos;
int score;
int len;
Segment edgeNext;
Edge edge;
public String toString()
{
StringBuilder s = new StringBuilder();
s.append("[Segment] id: ");
s.append(hashCode());
s.append(", len:");
s.append(len);
s.append(", round: ");
s.append(((flags & FLAG_EDGE_ROUND) != 0));
s.append(", dir: ");
s.append(dir);
s.append(", pos: ");
s.append(pos);
s.append(", minPos: ");
s.append(minPos);
s.append(", maxPos: ");
s.append(maxPos);
s.append(", first: ");
s.append(first);
s.append(", last: ");
s.append(last);
s.append(", contour: ");
s.append(contour);
s.append(", link: ");
s.append(link == null ? "null" : link.hashCode());
s.append(", serif: ");
s.append(serif == null ? "null" : serif.hashCode());
return s.toString();
}
}

View file

@ -0,0 +1,255 @@
/* Utils.java -- A collection of utility functions for the autofitter
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. */
package gnu.java.awt.font.autofit;
import gnu.java.awt.font.opentype.truetype.Fixed;
/**
* A collection of utility methods used all around the auto fitter.
*/
class Utils
implements Constants
{
private static final int ATAN_BITS = 8;
private static final byte[] ATAN = new byte[]
{
0, 0, 1, 1, 1, 2, 2, 2,
3, 3, 3, 3, 4, 4, 4, 5,
5, 5, 6, 6, 6, 7, 7, 7,
8, 8, 8, 9, 9, 9, 10, 10,
10, 10, 11, 11, 11, 12, 12, 12,
13, 13, 13, 14, 14, 14, 14, 15,
15, 15, 16, 16, 16, 17, 17, 17,
18, 18, 18, 18, 19, 19, 19, 20,
20, 20, 21, 21, 21, 21, 22, 22,
22, 23, 23, 23, 24, 24, 24, 24,
25, 25, 25, 26, 26, 26, 26, 27,
27, 27, 28, 28, 28, 28, 29, 29,
29, 30, 30, 30, 30, 31, 31, 31,
31, 32, 32, 32, 33, 33, 33, 33,
34, 34, 34, 34, 35, 35, 35, 35,
36, 36, 36, 36, 37, 37, 37, 38,
38, 38, 38, 39, 39, 39, 39, 40,
40, 40, 40, 41, 41, 41, 41, 42,
42, 42, 42, 42, 43, 43, 43, 43,
44, 44, 44, 44, 45, 45, 45, 45,
46, 46, 46, 46, 46, 47, 47, 47,
47, 48, 48, 48, 48, 48, 49, 49,
49, 49, 50, 50, 50, 50, 50, 51,
51, 51, 51, 51, 52, 52, 52, 52,
52, 53, 53, 53, 53, 53, 54, 54,
54, 54, 54, 55, 55, 55, 55, 55,
56, 56, 56, 56, 56, 57, 57, 57,
57, 57, 57, 58, 58, 58, 58, 58,
59, 59, 59, 59, 59, 59, 60, 60,
60, 60, 60, 61, 61, 61, 61, 61,
61, 62, 62, 62, 62, 62, 62, 63,
63, 63, 63, 63, 63, 64, 64, 64
};
private static final int ANGLE_PI = 256;
private static final int ANGLE_PI2 = ANGLE_PI / 2;
private static final int ANGLE_PI4 = ANGLE_PI / 4;
private static final int ANGLE_2PI = ANGLE_PI * 2;
/**
* Computes the direction constant for the specified vector. The vector is
* given as differential value already.
*
* @param dx the x vector
* @param dy the y vector
*
* @return the direction of that vector, or DIR_NONE, if that vector is not
* approximating against one of the major axises
*/
static int computeDirection(int dx, int dy)
{
int dir = DIR_NONE;
if (dx < 0)
{
if (dy < 0)
{
if (-dx * 12 < -dy)
dir = DIR_UP;
else if (-dy * 12 < -dx)
dir = DIR_LEFT;
}
else // dy >= 0 .
{
if (-dx * 12 < dy)
dir = DIR_DOWN;
else if (dy * 12 < -dx)
dir = DIR_LEFT;
}
}
else // dx >= 0 .
{
if (dy < 0)
{
if (dx * 12 < -dy)
dir = DIR_UP;
else if (-dy * 12 < dx)
dir = DIR_RIGHT;
}
else // dy >= 0 .
{
if (dx * 12 < dy)
dir = DIR_DOWN;
else if (dy * 12 < dx)
dir = DIR_RIGHT;
}
}
return dir;
}
public static int atan(int dx, int dy)
{
int angle;
// Trivial cases.
if (dy == 0)
{
angle = 0;
if (dx < 0)
angle = ANGLE_PI;
return angle;
}
else if (dx == 0)
{
angle = ANGLE_PI2;
if (dy < 0)
angle = - ANGLE_PI2;
return angle;
}
angle = 0;
if (dx < 0)
{
dx = -dx;
dy = -dy;
angle = ANGLE_PI;
}
if (dy < 0)
{
int tmp = dx;
dx = -dy;
dy = tmp;
angle -= ANGLE_PI2;
}
if (dx == 0 && dy == 0)
return 0;
if (dx == dy)
angle += ANGLE_PI4;
else if (dx > dy)
{
angle += ATAN[Fixed.div(dy, dx) << (ATAN_BITS - 6)];
}
else
{
angle += ANGLE_PI2 - ATAN[Fixed.div(dx, dy) << (ATAN_BITS - 6)];
}
if (angle > ANGLE_PI)
angle -= ANGLE_2PI;
return angle;
}
public static int angleDiff(int ang1, int ang2)
{
int delta = ang2 - ang1;
delta %= ANGLE_2PI;
if (delta < 0)
delta += ANGLE_2PI;
if (delta > ANGLE_PI)
delta -= ANGLE_2PI;
return delta;
}
static void sort(int num, int[] array)
{
int swap;
for (int i = 1; i < num; i++)
{
for (int j = i; j > 0; j--)
{
if (array[j] > array[j - 1])
break;
swap = array[j];
array[j] = array[j - 1];
array[j - 1] = swap;
}
}
}
static void sort(int num, Width[] array)
{
Width swap;
for (int i = 1; i < num; i++)
{
for (int j = 1; j > 0; j--)
{
if (array[j].org > array[j - 1].org)
break;
swap = array[j];
array[j] = array[j - 1];
array[j - 1] = swap;
}
}
}
static int pixRound(int val)
{
return pixFloor(val + 32);
}
static int pixFloor(int val)
{
return val & ~63;
}
public static int mulDiv(int a, int b, int c)
{
long prod = a * b;
long div = (prod / c);
return (int) div;
}
}

View file

@ -43,4 +43,20 @@ public class Width
int org;
int cur;
int fit;
Width(int dist)
{
org = dist;
}
public String toString()
{
StringBuilder s = new StringBuilder();
s.append("[Width] org: ");
s.append(org);
s.append(", cur: ");
s.append(cur);
s.append(", fit: ");
s.append(fit);
return s.toString();
}
}

View file

@ -0,0 +1,63 @@
/* Hinter.java -- The interface to a hinting implementation
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. */
package gnu.java.awt.font.opentype;
import gnu.java.awt.font.opentype.truetype.Zone;
/**
* The interface to a hinting implementation.
*/
public interface Hinter
{
/**
* Initializes the hinter.
*
* @param face the font for which the hinter should be used
*/
void init(OpenTypeFont face);
/**
* Hints the specified outline.
*
* @param outline the outline to hint
*/
void applyHints(Zone outline);
void setFlags(int flags);
}

View file

@ -51,6 +51,7 @@ import java.util.Locale;
import gnu.java.awt.font.FontDelegate;
import gnu.java.awt.font.GNUGlyphVector;
import gnu.java.awt.font.autofit.AutoHinter;
import gnu.java.awt.font.opentype.truetype.TrueTypeScaler;
import gnu.java.awt.font.opentype.truetype.Zone;
@ -146,7 +147,8 @@ public final class OpenTypeFont
*/
private GlyphNamer glyphNamer;
private Hinter hinter;
/**
* Constructs an OpenType or TrueType font.
*
@ -579,6 +581,9 @@ public final class OpenTypeFont
FontRenderContext frc,
CharacterIterator ci)
{
// Initialize hinter if necessary.
checkHinter(FontDelegate.FLAG_FITTED);
CharGlyphMap cmap;
int numGlyphs;
int[] glyphs;
@ -689,13 +694,15 @@ public final class OpenTypeFont
float pointSize,
AffineTransform transform,
boolean antialias,
boolean fractionalMetrics)
boolean fractionalMetrics,
int flags)
{
/* The synchronization is needed because the scaler is not
* synchronized.
*/
checkHinter(flags);
return scaler.getOutline(glyph, pointSize, transform,
antialias, fractionalMetrics);
antialias, fractionalMetrics, hinter, flags);
}
/**
@ -837,4 +844,29 @@ public final class OpenTypeFont
c[3] = (char) (tag & 0xff);
return new String(c);
}
/**
* Checks if a hinter is installed and installs one when not.
*/
private void checkHinter(int flags)
{
// When another hinting impl gets added (maybe a true TrueType hinter)
// then add some options here. The Hinter interface might need to be
// tweaked.
if (hinter == null)
{
try
{
hinter = new AutoHinter();
hinter.init(this);
}
catch (Exception ex)
{
// Protect from problems inside hinter.
hinter = null;
ex.printStackTrace();
}
}
hinter.setFlags(flags);
}
}

View file

@ -90,7 +90,8 @@ public abstract class Scaler
float pointSize,
AffineTransform transform,
boolean antialias,
boolean fractionalMetrics);
boolean fractionalMetrics,
Hinter hinter, int type);
/**

View file

@ -48,7 +48,7 @@ package gnu.java.awt.font.opentype.truetype;
*
* @author Sascha Brawer (brawer@dandelis.ch)
*/
final class Fixed
public final class Fixed
{
public static final int ONE = 1<<6;
@ -69,14 +69,21 @@ final class Fixed
return (int) ((((long) a) * b) >> 6);
}
public static int mul16(int a, int b)
{
return (int) ((((long) a) * b) >> 16);
}
public static int div(int a, int b)
{
return (int) ((((long) a) << 6) / b);
}
public static int div16(int a, int b)
{
return (int) ((((long) a) << 16) / b);
}
public static int ceil(int a)
{
return (a + 63) & -64;
@ -119,7 +126,10 @@ final class Fixed
{
return ((float) f) / 64;
}
public static float floatValue16(int f)
{
return ((float) f) / 65536;
}
public static double doubleValue(int f)
{
@ -138,6 +148,10 @@ final class Fixed
return (int) (d * 64);
}
public static int valueOf16(double d)
{
return (int) (d * (1 << 16));
}
/**
* Makes a string representation of a fixed-point number.

View file

@ -38,6 +38,8 @@ exception statement from your version. */
package gnu.java.awt.font.opentype.truetype;
import gnu.java.awt.font.opentype.Hinter;
import java.awt.geom.AffineTransform;
import java.nio.ByteBuffer;
@ -112,17 +114,17 @@ final class GlyphLoader
double pointSize,
AffineTransform transform,
boolean antialias,
Zone glyphZone)
Zone glyphZone, Hinter hinter)
{
glyphZone.setNumPoints(4);
loadSubGlyph(glyphIndex, pointSize, transform, antialias, glyphZone,
0, 0);
0, 0, hinter);
}
public void loadGlyph(int glyphIndex, AffineTransform transform,
Zone glyphZone)
Zone glyphZone, Hinter hinter)
{
loadGlyph(glyphIndex, unitsPerEm, transform, false, glyphZone);
loadGlyph(glyphIndex, unitsPerEm, transform, false, glyphZone, hinter);
}
private void loadSubGlyph(int glyphIndex,
@ -131,7 +133,8 @@ final class GlyphLoader
boolean antialias,
Zone glyphZone,
int preTranslateX,
int preTranslateY)
int preTranslateY,
Hinter hinter)
{
ByteBuffer glyph;
int numContours;
@ -159,11 +162,11 @@ final class GlyphLoader
if (numContours >= 0)
loadSimpleGlyph(glyphIndex, pointSize, transform, antialias,
numContours, glyph, glyphZone,
preTranslateX, preTranslateY);
preTranslateX, preTranslateY, hinter);
else
loadCompoundGlyph(glyphIndex, pointSize, transform, antialias,
glyph, glyphZone,
preTranslateX, preTranslateY);
preTranslateX, preTranslateY, hinter);
}
@ -172,7 +175,8 @@ final class GlyphLoader
boolean antialias,
int numContours, ByteBuffer glyph,
Zone glyphZone,
int preTranslateX, int preTranslateY)
int preTranslateX, int preTranslateY,
Hinter hinter)
{
int numPoints;
int posInstructions, numInstructions;
@ -203,10 +207,10 @@ final class GlyphLoader
glyphZone.transform(pointSize, transform, unitsPerEm,
preTranslateX, preTranslateY);
if (execInstructions)
{
// FIXME: Hint the glyph.
}
if (execInstructions && hinter != null)
{
hinter.applyHints(glyphZone);
}
}
@ -229,7 +233,8 @@ final class GlyphLoader
boolean antialias,
ByteBuffer glyph,
Zone glyphZone,
int preTranslateX, int preTranslateY)
int preTranslateX, int preTranslateY,
Hinter hinter)
{
short flags;
int subGlyphIndex;
@ -326,7 +331,7 @@ final class GlyphLoader
loadSubGlyph(subGlyphIndex, pointSize, componentTransform,
antialias, subGlyphZone,
Math.round((float) e + preTranslateX),
Math.round(-((float) f + preTranslateY)));
Math.round(-((float) f + preTranslateY)), hinter);
glyphZone.combineWithSubGlyph(subGlyphZone, 4);
glyph.limit(lim).position(pos);
}

View file

@ -0,0 +1,285 @@
/* Point.java -- Holds information for one point on a glyph outline
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. */
package gnu.java.awt.font.opentype.truetype;
/**
* Encapsulates information regarding one point on a glyph outline.
*/
public class Point
{
public static final short FLAG_TOUCHED_X = 1;
public static final short FLAG_TOUCHED_Y = 2;
public static final short FLAG_ON_CURVE = 4;
public static final short FLAG_CONTOUR_END = 8;
public static final short FLAG_WEAK_INTERPOLATION = 16;
public static final short FLAG_INFLECTION = 32;
public static final short FLAG_DONE_X = 64;
public static final short FLAG_DONE_Y = 128;
/**
* Right direction.
*/
public static final int DIR_RIGHT = 1;
/**
* Left direction.
*/
public static final int DIR_LEFT = -1;
/**
* Up direction.
*/
public static final int DIR_UP = 2;
/**
* Down direction.
*/
public static final int DIR_DOWN = -2;
/**
* The original x coordinate in font units.
*/
int origX;
/**
* The original y coordinate in font units.
*/
int origY;
/**
* The x coordinate scaled to the target.
*/
int scaledX;
/**
* The y coordinate scaled to the target.
*/
int scaledY;
/**
* The final hinted and scaled x coordinate.
*/
int x;
/**
* The final hinted and scaled y coordinate.
*/
int y;
int u;
int v;
/**
* The glyph flags.
*/
short flags;
/**
* The previous point in the contour.
*/
private Point prev;
/**
* The next point in the contour.
*/
private Point next;
/**
* The in-direction of the point, according to the DIR_* constants of this
* class.
*/
int inDir;
/**
* The out-direction of the point, according to the DIR_* constants of this
* class.
*/
int outDir;
public Point getNext()
{
return next;
}
public void setNext(Point next)
{
this.next = next;
}
public Point getPrev()
{
return prev;
}
public void setPrev(Point prev)
{
this.prev = prev;
}
public int getOrigX()
{
return origX;
}
public void setOrigX(int origX)
{
this.origX = origX;
}
public int getOrigY()
{
return origY;
}
public void setOrigY(int origY)
{
this.origY = origY;
}
public int getInDir()
{
return inDir;
}
public void setInDir(int inDir)
{
this.inDir = inDir;
}
public int getOutDir()
{
return outDir;
}
public void setOutDir(int outDir)
{
this.outDir = outDir;
}
public short getFlags()
{
return flags;
}
public void setFlags(short flags)
{
this.flags = flags;
}
public void addFlags(short flags)
{
this.flags |= flags;
}
public boolean isControlPoint()
{
return (flags & FLAG_ON_CURVE) == 0;
}
public int getU()
{
return u;
}
public void setU(int u)
{
this.u = u;
}
public int getV()
{
return v;
}
public void setV(int v)
{
this.v = v;
}
public String toString()
{
StringBuilder s = new StringBuilder();
s.append("[Point] origX: ");
s.append(origX);
s.append(", origY: ");
s.append(origY);
// TODO: Add more info when needed.
return s.toString();
}
public int getX()
{
return x;
}
public void setX(int x)
{
this.x = x;
}
public int getY()
{
return y;
}
public void setY(int y)
{
this.y = y;
}
public int getScaledX()
{
return scaledX;
}
public void setScaledX(int scaledX)
{
this.scaledX = scaledX;
}
public int getScaledY()
{
return scaledY;
}
public void setScaledY(int scaledY)
{
this.scaledY = scaledY;
}
}

View file

@ -37,6 +37,7 @@ exception statement from your version. */
package gnu.java.awt.font.opentype.truetype;
import gnu.java.awt.font.opentype.Hinter;
import gnu.java.awt.font.opentype.Scaler;
import java.awt.FontFormatException;
@ -191,17 +192,18 @@ public final class TrueTypeScaler
float pointSize,
AffineTransform deviceTransform,
boolean antialias,
boolean fractionalMetrics)
boolean fractionalMetrics, Hinter hinter,
int type)
{
glyphLoader.loadGlyph(glyphIndex, pointSize, deviceTransform,
antialias, glyphZone);
return glyphZone.getPath();
antialias, glyphZone, hinter);
return glyphZone.getPath(type);
}
public Zone getRawOutline(int glyphIndex, AffineTransform transform)
{
Zone zone = new Zone(glyphZone.getCapacity());
glyphLoader.loadGlyph(glyphIndex, transform, zone);
glyphLoader.loadGlyph(glyphIndex, transform, zone, null);
return zone;
}

View file

@ -37,6 +37,8 @@ exception statement from your version. */
package gnu.java.awt.font.opentype.truetype;
import gnu.java.awt.font.FontDelegate;
import java.awt.geom.AffineTransform;
import java.awt.geom.GeneralPath;
import java.awt.geom.PathIterator;
@ -47,27 +49,19 @@ import java.awt.geom.PathIterator;
*/
public final class Zone
{
private final int[] pos;
private final int[] origPos;
private final byte[] flags;
private Point[] points;
private int numPoints;
private static final int FLAG_TOUCHED_X = 1;
private static final int FLAG_TOUCHED_Y = 2;
private static final int FLAG_ON_CURVE = 4;
private static final int FLAG_CONTOUR_END = 8;
public double scaleX, scaleY, shearX, shearY;
public Zone(int maxNumPoints)
{
origPos = new int[maxNumPoints * 2];
pos = new int[maxNumPoints * 2];
flags = new byte[maxNumPoints];
points = new Point[maxNumPoints];
}
public int getCapacity()
{
return flags.length;
return points.length;
}
@ -79,91 +73,110 @@ public final class Zone
public int getX(int point)
{
return pos[2 * point];
return getX(point, FontDelegate.FLAG_FITTED);
}
public int getX(int point, int flags)
{
int x;
if ((flags & FontDelegate.FLAG_FITTED) != 0)
x = points[point].x;
else
x = points[point].scaledX;
return x;
}
public void setX(int point, int value, boolean touch)
{
pos[2 * point] = value;
points[point].scaledX = value;
points[point].x = value;
if (touch)
flags[point] |= FLAG_TOUCHED_X;
points[point].flags |= Point.FLAG_TOUCHED_X;
}
public void setY(int point, int value, boolean touch)
{
pos[2 * point + 1] = value;
points[point].scaledY = value;
points[point].y = value;
if (touch)
flags[point] |= FLAG_TOUCHED_Y;
points[point].flags |= Point.FLAG_TOUCHED_Y;
}
public int getY(int point)
{
return pos[2 * point + 1];
return getY(point, FontDelegate.FLAG_FITTED);
}
public int getY(int point, int flags)
{
int y;
if ((flags & FontDelegate.FLAG_FITTED) != 0)
y = points[point].y;
else
y = points[point].scaledY;
return y;
}
public int getOriginalX(int point)
{
return origPos[2 * point];
return points[point].origX;
}
public int getOriginalY(int point)
{
return origPos[2 * point + 1];
return points[point].origY;
}
public void setOriginalX(int point, int x)
{
origPos[2 * point] = x;
points[point].origX = x;
}
public void setOriginalY(int point, int y)
{
origPos[2 * point + 1] = y;
points[point].origY = y;
}
public void setNumPoints(int numPoints)
{
this.numPoints = numPoints;
for (int i = 0; i < numPoints; i++)
flags[i] = 0;
for (int i = 0; i < 2 * numPoints; i++)
origPos[i] = pos[i] = 0;
points[i] = new Point();
this.numPoints = numPoints;
}
public boolean isOnCurve(int point)
{
return (flags[point] & FLAG_ON_CURVE) != 0;
return (points[point].flags & Point.FLAG_ON_CURVE) != 0;
}
public void setOnCurve(int point, boolean onCurve)
{
if (onCurve)
flags[point] |= FLAG_ON_CURVE;
points[point].flags |= Point.FLAG_ON_CURVE;
else
flags[point] &= ~FLAG_ON_CURVE;
points[point].flags &= ~Point.FLAG_ON_CURVE;
}
public boolean isContourEnd(int point)
{
return (flags[point] & FLAG_CONTOUR_END) != 0;
return (points[point].flags & Point.FLAG_CONTOUR_END) != 0;
}
public void setContourEnd(int point, boolean segEnd)
{
if (segEnd)
flags[point] |= FLAG_CONTOUR_END;
points[point].flags |= Point.FLAG_CONTOUR_END;
else
flags[point] &= ~FLAG_CONTOUR_END;
points[point].flags &= ~Point.FLAG_CONTOUR_END;
}
@ -172,7 +185,6 @@ public final class Zone
void transform(double pointSize, AffineTransform deviceTransform,
int unitsPerEm, int preTranslateX, int preTranslateY)
{
double scaleX, scaleY, shearX, shearY;
double factor;
factor = pointSize / (double) unitsPerEm;
@ -183,11 +195,13 @@ public final class Zone
for (int i = 0; i < numPoints; i++)
{
int x = origPos[2 * i] + preTranslateX;
int y = origPos[2 * i + 1] + preTranslateY;
int x = points[i].origX + preTranslateX;
int y = points[i].origY + preTranslateY;
origPos[2*i] = pos[2 * i] = Fixed.valueOf(scaleX * x + shearX * y);
origPos[2*i+1] = pos[2 * i + 1] = Fixed.valueOf(shearY * x + scaleY * y);
points[i].scaledX = points[i].x = Fixed.valueOf(scaleX * x
+ shearX * y);
points[i].scaledY = points[i].y = Fixed.valueOf(shearY * x
+ scaleY * y);
}
}
@ -197,11 +211,7 @@ public final class Zone
{
int offset = this.numPoints - numPhantomPoints;
int count = zone.numPoints;
System.arraycopy(zone.origPos, 0, this.origPos, 2 * offset,
count * 2);
System.arraycopy(zone.pos, 0, this.pos, 2 * offset,
count * 2);
System.arraycopy(zone.flags, 0, this.flags, offset, count);
System.arraycopy(zone.points, 0, this.points, offset, count);
this.numPoints += count - numPhantomPoints;
}
@ -211,9 +221,9 @@ public final class Zone
for (int i = 0; i < numPoints; i++)
{
System.out.print(" " + i + ": ");
System.out.print(Fixed.toString(pos[i*2], pos[i*2+1]));
System.out.print(Fixed.toString(points[i].scaledX, points[i].scaledY));
System.out.print(' ');
System.out.print(Fixed.toString(origPos[i*2], origPos[i*2+1]));
System.out.print(Fixed.toString(points[i].origX, points[i].origY));
System.out.print(' ');
if (isOnCurve(i))
System.out.print('.');
@ -228,16 +238,54 @@ public final class Zone
}
public PathIterator getPathIterator()
public PathIterator getPathIterator(int type)
{
return new ZonePathIterator(this);
return new ZonePathIterator(this, type);
}
public GeneralPath getPath()
public GeneralPath getPath(int type)
{
GeneralPath p = new GeneralPath(GeneralPath.WIND_NON_ZERO, numPoints);
p.append(getPathIterator(), /* connect */ false);
p.append(getPathIterator(type), /* connect */ false);
return p;
}
/**
* Returns the number of contours in this outline.
*
* @return the number of contours in this outline
*/
public int getNumContours()
{
int num = 0;
for (int i = 0; i < numPoints; i++)
{
if (isContourEnd(i))
num++;
}
return num;
}
public int getContourEnd(int n)
{
int idx = -1;
int num = 0;
for (int i = 0; i < numPoints; i++)
{
if (isContourEnd(i))
{
idx = i;
if (num == n)
break;
num++;
}
}
return idx;
}
public Point[] getPoints()
{
return points;
}
}

View file

@ -116,6 +116,7 @@ final class ZonePathIterator
private int contourStart;
private int type;
/**
* Constructs a ZonePathIterator for the specified zone.
@ -123,9 +124,10 @@ final class ZonePathIterator
* @param zone the zone whose segments will be enumerated
* by this iterator.
*/
ZonePathIterator(Zone zone)
ZonePathIterator(Zone zone, int t)
{
this.zone = zone;
type = t;
numPoints = zone.getSize() - /* four phantom points */ 4;
// The first segment that needs to be emitted is a SEG_MOVETO.
@ -309,8 +311,8 @@ final class ZonePathIterator
int curX, curY;
int succ, succX, succY;
curX = zone.getX(cur);
curY = zone.getY(cur);
curX = zone.getX(cur, type);
curY = zone.getY(cur, type);
coords[0] = Fixed.floatValue(curX);
coords[1] = Fixed.floatValue(curY);
@ -318,8 +320,8 @@ final class ZonePathIterator
return PathIterator.SEG_LINETO;
succ = getSuccessor(cur);
succX = zone.getX(succ);
succY = zone.getY(succ);
succX = zone.getX(succ, type);
succY = zone.getY(succ, type);
if (zone.isOnCurve(succ))
{
@ -359,8 +361,8 @@ final class ZonePathIterator
if (zone.isOnCurve(contourStart))
{
x = zone.getX(contourStart);
y = zone.getY(contourStart);
x = zone.getX(contourStart, type);
y = zone.getY(contourStart, type);
}
else
{
@ -374,13 +376,13 @@ final class ZonePathIterator
/* An example is the 'o' glyph of the Helvetica which comes
* with Apple MacOS X 10.1.5.
*/
x = zone.getX(contourEnd);
y = zone.getY(contourEnd);
x = zone.getX(contourEnd, type);
y = zone.getY(contourEnd, type);
}
else
{
x = (zone.getX(contourStart) + zone.getX(contourEnd)) / 2;
y = (zone.getY(contourStart) + zone.getY(contourEnd)) / 2;
x = (zone.getX(contourStart, type) + zone.getX(contourEnd, type)) / 2;
y = (zone.getY(contourStart, type) + zone.getY(contourEnd, type)) / 2;
}
}

View file

@ -67,8 +67,6 @@ import java.awt.geom.Ellipse2D;
import java.awt.geom.GeneralPath;
import java.awt.geom.Line2D;
import java.awt.geom.NoninvertibleTransformException;
import java.awt.geom.PathIterator;
import java.awt.geom.Rectangle2D;
import java.awt.geom.RoundRectangle2D;
import java.awt.image.BufferedImage;
import java.awt.image.BufferedImageOp;
@ -82,7 +80,6 @@ import java.awt.image.renderable.RenderableImage;
import java.text.AttributedCharacterIterator;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
/**
@ -153,6 +150,11 @@ public abstract class AbstractGraphics2D
implements Cloneable
{
/**
* The default font to use on the graphics object.
*/
private static final Font FONT = new Font("SansSerif", Font.PLAIN, 12);
/**
* Accuracy of the sampling in the anti-aliasing shape filler.
* Lower values give more speed, while higher values give more quality.
@ -164,7 +166,14 @@ public abstract class AbstractGraphics2D
* Caches certain shapes to avoid massive creation of such Shapes in
* the various draw* and fill* methods.
*/
private static final ThreadLocal shapeCache = new ThreadLocal();
private static final ThreadLocal<ShapeCache> shapeCache =
new ThreadLocal<ShapeCache>();
/**
* The scanline converters by thread.
*/
private static final ThreadLocal<ScanlineConverter> scanlineConverters =
new ThreadLocal<ScanlineConverter>();
/**
* The transformation for this Graphics2D instance
@ -176,6 +185,11 @@ public abstract class AbstractGraphics2D
*/
private Paint paint;
/**
* The paint context during rendering.
*/
private PaintContext paintContext;
/**
* The background.
*/
@ -239,6 +253,17 @@ public abstract class AbstractGraphics2D
*/
private boolean isOptimized = true;
private static final BasicStroke STANDARD_STROKE = new BasicStroke();
private static final HashMap STANDARD_HINTS;
static {
HashMap hints = new HashMap();
hints.put(RenderingHints.KEY_TEXT_ANTIALIASING,
RenderingHints.VALUE_TEXT_ANTIALIAS_DEFAULT);
hints.put(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_DEFAULT);
STANDARD_HINTS = hints;
}
/**
* Creates a new AbstractGraphics2D instance.
*/
@ -247,13 +272,8 @@ public abstract class AbstractGraphics2D
transform = new AffineTransform();
background = Color.WHITE;
composite = AlphaComposite.SrcOver;
stroke = new BasicStroke();
HashMap hints = new HashMap();
hints.put(RenderingHints.KEY_TEXT_ANTIALIASING,
RenderingHints.VALUE_TEXT_ANTIALIAS_DEFAULT);
hints.put(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_DEFAULT);
renderingHints = new RenderingHints(hints);
stroke = STANDARD_STROKE;
renderingHints = new RenderingHints(STANDARD_HINTS);
}
/**
@ -958,15 +978,8 @@ public abstract class AbstractGraphics2D
*/
public void drawGlyphVector(GlyphVector gv, float x, float y)
{
int numGlyphs = gv.getNumGlyphs();
translate(x, y);
// TODO: We could use fill(gv.getOutline()), but that seems to be
// slightly more inefficient.
for (int i = 0; i < numGlyphs; i++)
{
Shape o = gv.getGlyphOutline(i);
fillShape(o, true);
}
fillShape(gv.getOutline(), true);
translate(-x, -y);
}
@ -1557,21 +1570,14 @@ public abstract class AbstractGraphics2D
antialias = (v == RenderingHints.VALUE_ANTIALIAS_ON);
}
Rectangle2D userBounds = s.getBounds2D();
Rectangle2D deviceBounds = new Rectangle2D.Double();
ArrayList segs = getSegments(s, transform, deviceBounds, false);
Rectangle2D clipBounds = new Rectangle2D.Double();
ArrayList clipSegs = getSegments(clip, transform, clipBounds, true);
segs.addAll(clipSegs);
Rectangle2D inclClipBounds = new Rectangle2D.Double();
Rectangle2D.union(clipBounds, deviceBounds, inclClipBounds);
if (segs.size() > 0)
ScanlineConverter sc = getScanlineConverter();
int resolution = 0;
if (antialias)
{
if (antialias)
fillShapeAntialias(segs, deviceBounds, userBounds, inclClipBounds);
else
fillShapeImpl(segs, deviceBounds, userBounds, inclClipBounds);
// Adjust resolution according to rendering hints.
resolution = 2;
}
sc.renderShape(this, s, clip, transform, resolution);
}
/**
@ -1704,141 +1710,6 @@ public abstract class AbstractGraphics2D
throw new UnsupportedOperationException("Not implemented yet.");
}
/**
* Fills the specified polygon without anti-aliasing.
*/
private void fillShapeImpl(ArrayList segs, Rectangle2D deviceBounds2D,
Rectangle2D userBounds,
Rectangle2D inclClipBounds)
{
// This is an implementation of a polygon scanline conversion algorithm
// described here:
// http://www.cs.berkeley.edu/~ug/slide/pipeline/assignments/scan/
// Create table of all edges.
// The edge buckets, sorted and indexed by their Y values.
double minX = deviceBounds2D.getMinX();
double minY = deviceBounds2D.getMinY();
double maxX = deviceBounds2D.getMaxX();
double maxY = deviceBounds2D.getMaxY();
double icMinY = inclClipBounds.getMinY();
double icMaxY = inclClipBounds.getMaxY();
Rectangle deviceBounds = new Rectangle((int) minX, (int) minY,
(int) Math.ceil(maxX) - (int) minX,
(int) Math.ceil(maxY) - (int) minY);
PaintContext pCtx = paint.createContext(getColorModel(), deviceBounds,
userBounds, transform, renderingHints);
ArrayList[] edgeTable = new ArrayList[(int) Math.ceil(icMaxY)
- (int) Math.ceil(icMinY) + 1];
for (Iterator i = segs.iterator(); i.hasNext();)
{
PolyEdge edge = (PolyEdge) i.next();
int yindex = (int) Math.ceil(edge.y0) - (int) Math.ceil(icMinY);
if (edgeTable[yindex] == null) // Create bucket when needed.
edgeTable[yindex] = new ArrayList();
edgeTable[yindex].add(edge); // Add edge to the bucket of its line.
}
// TODO: The following could be useful for a future optimization.
// // Sort all the edges in the edge table within their buckets.
// for (int y = 0; y < edgeTable.length; y++)
// {
// if (edgeTable[y] != null)
// Collections.sort(edgeTable[y]);
// }
// The activeEdges list contains all the edges of the current scanline
// ordered by their intersection points with this scanline.
ArrayList activeEdges = new ArrayList();
PolyEdgeComparator comparator = new PolyEdgeComparator();
// Scan all relevant lines.
int minYInt = (int) Math.ceil(icMinY);
Rectangle devClip = getDeviceBounds();
int scanlineMax = (int) Math.min(maxY, devClip.getMaxY());
for (int y = minYInt; y < scanlineMax; y++)
{
ArrayList bucket = edgeTable[y - minYInt];
// Update all the x intersections in the current activeEdges table
// and remove entries that are no longer in the scanline.
for (Iterator i = activeEdges.iterator(); i.hasNext();)
{
PolyEdge edge = (PolyEdge) i.next();
if (y > edge.y1)
i.remove();
else
{
edge.xIntersection += edge.slope;
//edge.xIntersection = edge.x0 + edge.slope * (y - edge.y0);
//System.err.println("edge.xIntersection: " + edge.xIntersection);
}
}
if (bucket != null)
activeEdges.addAll(bucket);
// Sort current edges. We are using a bubble sort, because the order
// of the intersections will not change in most situations. They
// will only change, when edges intersect each other.
int size = activeEdges.size();
if (size > 1)
{
for (int i = 1; i < size; i++)
{
PolyEdge e1 = (PolyEdge) activeEdges.get(i - 1);
PolyEdge e2 = (PolyEdge) activeEdges.get(i);
if (comparator.compare(e1, e2) > 0)
{
// Swap e2 with its left neighbor until it 'fits'.
int j = i;
do
{
activeEdges.set(j, e1);
activeEdges.set(j - 1, e2);
j--;
if (j >= 1)
e1 = (PolyEdge) activeEdges.get(j - 1);
} while (j >= 1 && comparator.compare(e1, e2) > 0);
}
}
}
// Now draw all pixels inside the polygon.
// This is the last edge that intersected the scanline.
PolyEdge previous = null; // Gets initialized below.
boolean insideShape = false;
boolean insideClip = false;
//System.err.println("scanline: " + y);
for (Iterator i = activeEdges.iterator(); i.hasNext();)
{
PolyEdge edge = (PolyEdge) i.next();
if (edge.y1 <= y)
continue;
// Draw scanline when we are inside the shape AND inside the
// clip.
if (insideClip && insideShape)
{
int x0 = (int) previous.xIntersection;
int x1 = (int) edge.xIntersection;
if (x0 < x1)
fillScanline(pCtx, x0, x1, y);
}
// Update state.
previous = edge;
if (edge.isClip)
insideClip = ! insideClip;
else
insideShape = ! insideShape;
}
}
pCtx.dispose();
}
/**
* Paints a scanline between x0 and x1. Override this when your backend
* can efficiently draw/fill horizontal lines.
@ -1847,8 +1718,9 @@ public abstract class AbstractGraphics2D
* @param x1 the right offset
* @param y the scanline
*/
protected void fillScanline(PaintContext pCtx, int x0, int x1, int y)
protected void fillScanline(int x0, int x1, int y)
{
PaintContext pCtx = paintContext;
Raster paintRaster = pCtx.getRaster(x0, y, x1 - x0, 1);
ColorModel paintColorModel = pCtx.getColorModel();
CompositeContext cCtx = composite.createContext(paintColorModel,
@ -1860,198 +1732,6 @@ public abstract class AbstractGraphics2D
cCtx.dispose();
}
/**
* Fills arbitrary shapes in an anti-aliased fashion.
*
* @param segs the line segments which define the shape which is to be filled
*/
private void fillShapeAntialias(ArrayList segs, Rectangle2D deviceBounds2D,
Rectangle2D userBounds,
Rectangle2D inclClipBounds)
{
// This is an implementation of a polygon scanline conversion algorithm
// described here:
// http://www.cs.berkeley.edu/~ug/slide/pipeline/assignments/scan/
// The antialiasing is implemented using a sampling technique, we do
// not scan whole lines but fractions of the line.
double minX = deviceBounds2D.getMinX();
double minY = deviceBounds2D.getMinY();
double maxX = deviceBounds2D.getMaxX();
double maxY = deviceBounds2D.getMaxY();
double icMinY = inclClipBounds.getMinY();
double icMaxY = inclClipBounds.getMaxY();
double icMinX = inclClipBounds.getMinX();
double icMaxX = inclClipBounds.getMaxX();
Rectangle deviceBounds = new Rectangle((int) minX, (int) minY,
(int) Math.ceil(maxX) - (int) minX,
(int) Math.ceil(maxY) - (int) minY);
PaintContext pCtx = paint.createContext(ColorModel.getRGBdefault(),
deviceBounds,
userBounds, transform,
renderingHints);
// This array will contain the oversampled transparency values for
// each pixel in the scanline.
int numScanlines = (int) Math.ceil(icMaxY) - (int) icMinY;
int numScanlinePixels = (int) Math.ceil(icMaxX) - (int) icMinX + 1;
if (alpha == null || alpha.length < (numScanlinePixels + 1))
alpha = new int[numScanlinePixels + 1];
int firstLine = (int) icMinY;
//System.err.println("minY: " + minY);
int firstSubline = (int) (Math.ceil((icMinY - Math.floor(icMinY)) * AA_SAMPLING));
double firstLineDouble = firstLine + firstSubline / (double) AA_SAMPLING;
//System.err.println("firstSubline: " + firstSubline);
// Create table of all edges.
// The edge buckets, sorted and indexed by their Y values.
//System.err.println("numScanlines: " + numScanlines);
if (edgeTable == null
|| edgeTable.length < numScanlines * AA_SAMPLING + AA_SAMPLING)
edgeTable = new ArrayList[numScanlines * AA_SAMPLING + AA_SAMPLING];
//System.err.println("firstLineDouble: " + firstLineDouble);
for (Iterator i = segs.iterator(); i.hasNext();)
{
PolyEdge edge = (PolyEdge) i.next();
int yindex = (int) (Math.ceil((edge.y0 - firstLineDouble) * AA_SAMPLING));
//System.err.println("yindex: " + yindex + " for y0: " + edge.y0);
// Initialize edge's slope and initial xIntersection.
edge.slope = ((edge.x1 - edge.x0) / (edge.y1 - edge.y0)) / AA_SAMPLING;
if (edge.y0 == edge.y1) // Horizontal edge.
edge.xIntersection = Math.min(edge.x0, edge.x1);
else
{
double alignedFirst = Math.ceil(edge.y0 * AA_SAMPLING) / AA_SAMPLING;
edge.xIntersection = edge.x0 + (edge.slope * AA_SAMPLING) * (alignedFirst - edge.y0);
}
//System.err.println(edge);
// FIXME: Sanity check should not be needed when clipping works.
if (yindex >= 0 && yindex < edgeTable.length)
{
if (edgeTable[yindex] == null) // Create bucket when needed.
edgeTable[yindex] = new ArrayList();
edgeTable[yindex].add(edge); // Add edge to the bucket of its line.
}
}
// The activeEdges list contains all the edges of the current scanline
// ordered by their intersection points with this scanline.
ArrayList activeEdges = new ArrayList();
PolyEdgeComparator comparator = new PolyEdgeComparator();
// Scan all lines.
int yindex = 0;
//System.err.println("firstLine: " + firstLine + ", maxY: " + maxY + ", firstSubline: " + firstSubline);
for (int y = firstLine; y <= icMaxY; y++)
{
int leftX = (int) icMaxX;
int rightX = (int) icMinX;
boolean emptyScanline = true;
for (int subY = firstSubline; subY < AA_SAMPLING; subY++)
{
//System.err.println("scanline: " + y + ", subScanline: " + subY);
ArrayList bucket = edgeTable[yindex];
// Update all the x intersections in the current activeEdges table
// and remove entries that are no longer in the scanline.
for (Iterator i = activeEdges.iterator(); i.hasNext();)
{
PolyEdge edge = (PolyEdge) i.next();
// TODO: Do the following using integer arithmetics.
if ((y + ((double) subY / (double) AA_SAMPLING)) > edge.y1)
i.remove();
else
{
edge.xIntersection += edge.slope;
//System.err.println("edge: " + edge);
//edge.xIntersection = edge.x0 + edge.slope * (y - edge.y0);
//System.err.println("edge.xIntersection: " + edge.xIntersection);
}
}
if (bucket != null)
{
activeEdges.addAll(bucket);
edgeTable[yindex].clear();
}
// Sort current edges. We are using a bubble sort, because the order
// of the intersections will not change in most situations. They
// will only change, when edges intersect each other.
int size = activeEdges.size();
if (size > 1)
{
for (int i = 1; i < size; i++)
{
PolyEdge e1 = (PolyEdge) activeEdges.get(i - 1);
PolyEdge e2 = (PolyEdge) activeEdges.get(i);
if (comparator.compare(e1, e2) > 0)
{
// Swap e2 with its left neighbor until it 'fits'.
int j = i;
do
{
activeEdges.set(j, e1);
activeEdges.set(j - 1, e2);
j--;
if (j >= 1)
e1 = (PolyEdge) activeEdges.get(j - 1);
} while (j >= 1 && comparator.compare(e1, e2) > 0);
}
}
}
// Now draw all pixels inside the polygon.
// This is the last edge that intersected the scanline.
PolyEdge previous = null; // Gets initialized below.
boolean insideClip = false;
boolean insideShape = false;
//System.err.println("scanline: " + y + ", subscanline: " + subY);
for (Iterator i = activeEdges.iterator(); i.hasNext();)
{
PolyEdge edge = (PolyEdge) i.next();
if (edge.y1 <= (y + (subY / (double) AA_SAMPLING)))
continue;
if (insideClip && insideShape)
{
// TODO: Use integer arithmetics here.
if (edge.y1 > (y + (subY / (double) AA_SAMPLING)))
{
//System.err.println(edge);
// TODO: Eliminate the aligments.
int x0 = (int) Math.min(Math.max(previous.xIntersection, minX), maxX);
int x1 = (int) Math.min(Math.max(edge.xIntersection, minX), maxX);
//System.err.println("minX: " + minX + ", x0: " + x0 + ", x1: " + x1 + ", maxX: " + maxX);
// TODO: Pull out cast.
int left = x0 - (int) minX;
int right = x1 - (int) minX + 1;
alpha[left]++;
alpha[right]--;
leftX = Math.min(x0, leftX);
rightX = Math.max(x1+2, rightX);
emptyScanline = false;
}
}
previous = edge;
if (edge.isClip)
insideClip = ! insideClip;
else
insideShape = ! insideShape;
}
yindex++;
}
firstSubline = 0;
// Render full scanline.
//System.err.println("scanline: " + y);
if (! emptyScanline)
fillScanlineAA(alpha, leftX, y, rightX - leftX, pCtx, (int) minX);
}
pCtx.dispose();
}
/**
* Fills a horizontal line between x0 and x1 for anti aliased rendering.
@ -2113,7 +1793,6 @@ public abstract class AbstractGraphics2D
cCtx.dispose();
}
/**
* Initializes this graphics object. This must be called by subclasses in
* order to correctly initialize the state of this object.
@ -2121,13 +1800,8 @@ public abstract class AbstractGraphics2D
protected void init()
{
setPaint(Color.BLACK);
setFont(new Font("SansSerif", Font.PLAIN, 12));
setFont(FONT);
isOptimized = true;
// FIXME: Should not be necessary. A clip of null should mean
// 'clip against device bounds.
destinationRaster = getDestinationRaster();
clip = getDeviceBounds();
}
/**
@ -2266,80 +1940,6 @@ public abstract class AbstractGraphics2D
p.transform(t);
}
/**
* Converts the specified shape into a list of segments.
*
* @param s the shape to convert
* @param t the transformation to apply before converting
* @param deviceBounds an output parameter; holds the bounding rectangle of
* s in device space after return
* @param isClip true when the shape is a clip, false for normal shapes;
* this influences the settings in the created PolyEdge instances.
*
* @return a list of PolyEdge that form the shape in device space
*/
private ArrayList getSegments(Shape s, AffineTransform t,
Rectangle2D deviceBounds, boolean isClip)
{
// Flatten the path. TODO: Determine the best flattening factor
// wrt to speed and quality.
PathIterator path = s.getPathIterator(getTransform(), 1.0);
// Build up polygons and let the native backend render this using
// rawFillShape() which would provide a default implementation for
// drawPixel using a PolyScan algorithm.
double[] seg = new double[6];
// TODO: Use ArrayList<PolyEdge> here when availble.
ArrayList segs = new ArrayList();
double segX = 0.; // The start point of the current edge.
double segY = 0.;
double polyX = 0.; // The start point of the current polygon.
double polyY = 0.;
double minX = Integer.MAX_VALUE;
double maxX = Integer.MIN_VALUE;
double minY = Integer.MAX_VALUE;
double maxY = Integer.MIN_VALUE;
//System.err.println("fill polygon");
while (! path.isDone())
{
int segType = path.currentSegment(seg);
minX = Math.min(minX, seg[0]);
maxX = Math.max(maxX, seg[0]);
minY = Math.min(minY, seg[1]);
maxY = Math.max(maxY, seg[1]);
//System.err.println("segment: " + segType + ", " + seg[0] + ", " + seg[1]);
if (segType == PathIterator.SEG_MOVETO)
{
segX = seg[0];
segY = seg[1];
polyX = seg[0];
polyY = seg[1];
}
else if (segType == PathIterator.SEG_CLOSE)
{
// Close the polyline.
PolyEdge edge = new PolyEdge(segX, segY,
polyX, polyY, isClip);
segs.add(edge);
}
else if (segType == PathIterator.SEG_LINETO)
{
PolyEdge edge = new PolyEdge(segX, segY,
seg[0], seg[1], isClip);
segs.add(edge);
segX = seg[0];
segY = seg[1];
}
path.next();
}
deviceBounds.setRect(minX, minY, maxX - minX, maxY - minY);
return segs;
}
/**
* Returns the ShapeCache for the calling thread.
*
@ -2347,7 +1947,7 @@ public abstract class AbstractGraphics2D
*/
private ShapeCache getShapeCache()
{
ShapeCache sc = (ShapeCache) shapeCache.get();
ShapeCache sc = shapeCache.get();
if (sc == null)
{
sc = new ShapeCache();
@ -2355,4 +1955,20 @@ public abstract class AbstractGraphics2D
}
return sc;
}
/**
* Returns the scanline converter for this thread.
*
* @return the scanline converter for this thread
*/
private ScanlineConverter getScanlineConverter()
{
ScanlineConverter sc = scanlineConverters.get();
if (sc == null)
{
sc = new ScanlineConverter();
scanlineConverters.set(sc);
}
return sc;
}
}

View file

@ -0,0 +1,195 @@
/* ActiveEdges.java -- A collection of active edges for scanline conversion
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. */
package gnu.java.awt.java2d;
/**
* A collection of active edges for scanline conversion.
*/
final class ActiveEdges
{
/**
* The active edges. This can contain null values at arbirary locations.
* The method #sort() packs this together.
*/
private PolyEdge[] activeEdges;
/**
* The actual number of active edges. The array can be bigger than this
* number.
*/
private int numActiveEdges;
/**
* Creates a new ActiveEdges object.
*/
ActiveEdges()
{
activeEdges = new PolyEdge[8];
numActiveEdges = 0;
}
/**
* Clears out all active edges. This is cheap as it simply resets the
* counter to 0. It does not release all references to PolyEdge instances.
*/
void clear()
{
numActiveEdges = 0;
}
/**
* Adds the specified edge to the list of active edges. This does not yet
* sort the edges and therefore does destroy any order of the list.
*
* @param edge the edge to add
*/
void add(PolyEdge edge)
{
// Grow array when necessary.
int oldSize = activeEdges.length;
if (numActiveEdges >= oldSize)
{
int newSize = oldSize + oldSize / 4 + 1;
PolyEdge[] newEdges = new PolyEdge[newSize];
System.arraycopy(activeEdges, 0, newEdges, 0, oldSize);
activeEdges = newEdges;
}
activeEdges[numActiveEdges] = edge;
numActiveEdges++;
}
/**
* Intersects all active edges, sorts them according to their intersection
* points and packs the array to remove unneeded edges. This does also
* remove any edges that do not intersect the scanline (i.e. they end above
* of the scanline).
*
* @param y the scanline height
*/
void intersectSortAndPack(int n, int y)
{
// Intersect and pack in one go.
int last = 0;
PolyEdge tmp;
for (int i = 0; i < numActiveEdges; i++)
{
PolyEdge edge = activeEdges[i];
// Clear out edge that ends above the scanline.
if (edge != null && edge.y1 >= y)
{
assert edge.y1 >= y && edge.y0 <= y : "edge must cross scanline";
edge.intersect(n, y);
activeEdges[last] = edge;
last++;
// Bubble up the added edge.
for (int j = last - 1; j > 0; j--)
{
if (activeEdges[j].xIntersection
< activeEdges[j - 1].xIntersection)
{
tmp = activeEdges[j];
activeEdges[j] = activeEdges[j - 1];
activeEdges[j - 1] = tmp;
}
else
{
// The beginning of the list is already sorted.
break;
}
}
}
}
numActiveEdges = last;
}
/**
* Returns the number of active edges. This is only reliable after a
* call to {@link #intersectSortAndPack(int, int)}.
*
* @return the number of active edges
*/
int getNumActiveEdges()
{
return numActiveEdges;
}
/**
* Returns the active edge at the position <code>i</code>.
*
* @param i the index
*
* @return the active edge at the specified index
*/
PolyEdge getActiveEdge(int i)
{
return activeEdges[i];
}
/**
* Removes all edges that end above the specified height.
*
* @param y the cut-off height
*/
void remove(int y)
{
for (int i = 0; i < numActiveEdges; i++)
{
PolyEdge edge = activeEdges[i];
if (edge != null && edge.y1 < y)
{
activeEdges[i] = null;
}
}
}
public String toString()
{
StringBuilder s = new StringBuilder();
s.append("[ActiveEdges] ");
for (int i = 0; i < numActiveEdges; i++)
{
s.append(activeEdges[i]);
s.append(',');
}
return s.toString();
}
}

View file

@ -38,37 +38,62 @@ exception statement from your version. */
package gnu.java.awt.java2d;
import gnu.java.math.Fixed;
/**
* An edge in a polygon. This is used by the scanline conversion algorithm
* implemented in {@link AbstractGraphics2D#rawFillShape}.
* An edge in a polygon.
*
* @author Roman Kennke (kennke@aicas.com)
*/
public class PolyEdge
final class PolyEdge
implements Comparable
{
/**
* The start and end coordinates of the edge. y0 is always smaller or equal
* than y1.
*
* These values are stored as fixed-point decimals.
*/
public double x0, y0, x1, y1;
public int x0, y0, x1, y1;
/**
* The slope of the edge. This is dx / dy.
*
* This is a fixed point decimal.
*/
double slope;
private int slope;
/**
* The intersection of this edge with the current scanline.
*
* This is a fixed point decimal.
*/
double xIntersection;
int xIntersection;
/**
* Indicates whether this edge is from the clip or from the target shape.
*/
boolean isClip;
/**
* Implements a linked list for the edge pool.
*/
PolyEdge poolNext;
/**
* Implements a linked list for the scanline edge lists.
*/
PolyEdge scanlineNext;
/**
* Create an uninitialized edge.
*/
PolyEdge()
{
// Nothing to do here.
}
/**
* Creates a new PolyEdge with the specified coordinates.
*
@ -77,7 +102,20 @@ public class PolyEdge
* @param x1 the end point, x coordinate
* @param y1 the end point, y coordinate
*/
PolyEdge(double x0, double y0, double x1, double y1, boolean clip)
PolyEdge(int n, int x0, int y0, int x1, int y1, boolean clip)
{
init(n, x0, y0, x1, y1, clip);
}
/**
* (Re-) Initializes this edge.
*
* @param x0
* @param y0
* @param x1
* @param y1
*/
void init(int n, int x0, int y0, int x1, int y1, boolean clip)
{
isClip = clip;
if (y0 < y1)
@ -94,11 +132,7 @@ public class PolyEdge
this.x1 = x0;
this.y1 = y0;
}
slope = (this.x1 - this.x0) / (this.y1 - this.y0);
if (this.y0 == this.y1) // Horizontal edge.
xIntersection = Math.min(this.x0, this.x1);
else
xIntersection = this.x0 + slope * (Math.ceil(this.y0) - this.y0);
slope = Fixed.div(n, this.x1 - this.x0, this.y1 - this.y0);
}
/**
@ -115,6 +149,19 @@ public class PolyEdge
return comp;
}
/**
* Intersects this edge with the scanline at height y. The result is
* stored in {@link #xIntersection}.
*
* @param y the scanline
*/
void intersect(int n, int y)
{
int dy = y - y0;
int dx = Fixed.mul(n, slope, dy);
xIntersection = x0 + dx;
}
public String toString()
{
return "Edge: " + x0 + ", " + y0 + ", " + x1 + ", " + y1 + ", slope: "

View file

@ -0,0 +1,91 @@
/* Scanline.java -- A scanline for the scanline converter
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. */
package gnu.java.awt.java2d;
/**
* Represents a scanline in the {@link ScanlineConverter}. This is basically
* a sorted list of {@link PolyEdge}s that is made for maximum reuse.
*/
class Scanline
{
/**
* The actual edges array. The fields can be null.
*/
private PolyEdge edges;
/**
* Clears this scanline. This only resets the number of edges to 0. The
* actual PolyEdge objects are preserved for possible later reuse.
*/
void clear()
{
edges = null;
}
/**
* Create a new Scanline.
*/
Scanline()
{
// Nothing to do.
}
/**
* Inserts an edge into this scanline. This is performed in a sorted fashion,
* and so that it reuses as much existing resources as possible.
*/
void addEdge(PolyEdge edge)
{
// Allocate PolyEdge when necessary or reuse an old one.
edge.scanlineNext = edges;
edges = edge;
}
/**
* Returns the edges queue.
*
* @return the edges queue
*/
PolyEdge getEdges()
{
return edges;
}
}

View file

@ -0,0 +1,404 @@
/* ScanlineConverter.java -- Rasterizes Shapes
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. */
package gnu.java.awt.java2d;
import gnu.java.math.Fixed;
import java.awt.Shape;
import java.awt.geom.AffineTransform;
import java.awt.geom.PathIterator;
/**
* Rasterizes {@link Shape} objects on an AbstractGraphics2D.
*/
final class ScanlineConverter
{
/**
* The number of digits to use for fixed point arithmetics.
*/
private static int FIXED_DIGITS = 6;
/**
* The fixed value for the number 1.
*/
private static int ONE = Fixed.fixedValue(FIXED_DIGITS, 1);
/**
* The actual number of scanlines.
*/
private int numScanlines;
/**
* The number of scanlines. This can contain more elements than we have
* scanlines. The real number of scanlines is stored in
* {@link #numScanlines}. This can also contain null values for empty
* scanlines.
*/
private Scanline[] scanlines;
/**
* The upper bounds which correspond to the index 0 in the scanline array.
*
* This is a fixed point value.
*/
private int upperBounds;
/**
* The resolution of the scanline converter.
*
* This is a fixed point value.
*/
private int resolution;
/**
* One half step according to the resolution. This is stored to avoid
* unnecessary operations during rendering.
*/
private int halfStep;
/**
* This is used in {@link #addShape(PathIterator, boolean)} to
* receive the coordinates of the path.
*/
private float[] coords;
/**
* The active edges.
*/
private ActiveEdges activeEdges;
private PolyEdge edgePool;
private PolyEdge edgePoolLast;
private int minY;
private int maxY;
/**
* Create a new ScanlineConverter.
*/
ScanlineConverter()
{
scanlines = new Scanline[10];
coords = new float[6];
activeEdges = new ActiveEdges();
edgePool = new PolyEdge();
edgePoolLast = edgePool;
}
/**
* Renders the specified shape using the specified clip and transform.
*
* @param shape the shape to render
* @param clip the clip
* @param trans the transform
*/
void renderShape(AbstractGraphics2D g, Shape shape, Shape clip,
AffineTransform trans, int res)
{
// Prepare resolution and upper bounds.
clear();
setResolution(res);
boolean haveClip = clip != null;
// Add shapes.
PathIterator path = shape.getPathIterator(trans, resolution);
addShape(path, false);
if (haveClip)
{
path= clip.getPathIterator(trans, resolution);
addShape(path, true);
}
setUpperBounds(minY);
PolyEdge edge = edgePool;
while (edge != edgePoolLast)
{
addEdge(edge);
edge = edge.poolNext;
}
int y = upperBounds;
int lastIndex = scanlineIndex(y - resolution);
int index;
activeEdges.clear();
// The render loop...
Scanline scanline = null;
while (y <= maxY)
{
// First we put together our list of active edges.
index = scanlineIndex(y);
// If we go outside the scanline array we still need to render the
// remaining edges until they end.
scanline = index < scanlines.length ? scanlines[index] : null;
if (scanline != null)
{
edge = scanline.getEdges();
while (edge != null)
{
activeEdges.add(edge);
edge = edge.scanlineNext;
}
}
// Then we intersect all active edges with the current scanline
// and sort them according to their intersection points.
activeEdges.intersectSortAndPack(FIXED_DIGITS, y + halfStep);
// Ok, now we can perform the actual scanlining.
boolean push = lastIndex != index;
doScanline(g, y, push, haveClip);
// Remove obsolete active edges.
//activeEdges.remove(y + halfStep);
// Go on with the next line...
y += resolution;
lastIndex = index;
}
}
/**
* Clears all scanlines.
*/
private void clear()
{
// Reset edge pool.
edgePoolLast = edgePool;
// Reset scanlines.
for (int i = scanlines.length - 1; i >= 0 ; i--)
{
Scanline sl = scanlines[i];
if (sl != null)
sl.clear();
}
// Reset bounds.
minY = Integer.MAX_VALUE;
maxY = Integer.MIN_VALUE;
}
/**
* Performs the scanlining on the current set of active edges.
*/
private void doScanline(AbstractGraphics2D g, int y, boolean push,
boolean haveClip)
{
// We begin outside the clip and outside the shape. We only draw when
// we are inside the clip AND inside the shape.
boolean inClip = ! haveClip;
boolean inShape = false;
PolyEdge lastEdge = null;
int numEdges = activeEdges.getNumActiveEdges();
for (int i = 0; i < numEdges; i++)
{
PolyEdge edge = activeEdges.getActiveEdge(i);
if (inClip && inShape)
{
assert lastEdge != null;
int x0 = lastEdge.xIntersection;
int x1 = edge.xIntersection;
assert x0 <= x1;
if (push)
{
if (resolution == ONE)
{
// Non-AA rendering.
g.fillScanline(Fixed.intValue(FIXED_DIGITS, x0),
Fixed.intValue(FIXED_DIGITS, x1 - resolution),
Fixed.intValue(FIXED_DIGITS, y));
}
else
{
// AA rendering.
// FIXME: Implement.
System.err.println("Implement AA rendering.");
}
}
}
if (edge.isClip)
inClip = ! inClip;
else
inShape = ! inShape;
lastEdge = edge;
}
}
/**
* Sets the resolution. A value of 0 rasterizes the shape normally without
* anti-aliasing. Greater values renders with a resolution of 2 ^ res.
*
* @param res the resolution
*/
private void setResolution(int res)
{
int one = Fixed.fixedValue(FIXED_DIGITS, 1);
resolution = one / (1 << res);
halfStep = resolution / 2;
}
/**
* Sets the vertical bounds of that shape that is beeing rendered.
*
* @param y0 the upper bounds
*/
private void setUpperBounds(int y0)
{
upperBounds = fit(y0);
}
/**
* Add a shape to the scanline converter.
*
* @param path
* @param clip
*/
private void addShape(PathIterator path, boolean clip)
{
int startX = 0;
int startY = 0;
int lastX = 0;
int lastY = 0;
while (! path.isDone())
{
int type = path.currentSegment(coords);
switch (type)
{
case PathIterator.SEG_MOVETO:
startX = lastX = Fixed.fixedValue(FIXED_DIGITS, coords[0]);
startY = lastY = Fixed.fixedValue(FIXED_DIGITS, coords[1]);
minY = Math.min(startY, minY);
maxY = Math.max(startY, maxY);
break;
case PathIterator.SEG_LINETO:
int x = Fixed.fixedValue(FIXED_DIGITS, coords[0]);
int y = Fixed.fixedValue(FIXED_DIGITS, coords[1]);
edgePoolAdd(lastX, lastY, x, y, clip);
lastX = x;
lastY = y;
minY = Math.min(lastY, minY);
maxY = Math.max(lastY, maxY);
break;
case PathIterator.SEG_CLOSE:
edgePoolAdd(lastX, lastY, startX, startY, clip);
lastX = startX;
lastY = startY;
break;
case PathIterator.SEG_CUBICTO:
case PathIterator.SEG_QUADTO:
default:
assert false;
}
path.next();
}
}
/**
* Adds an edge into the scanline array.
*/
private void addEdge(PolyEdge edge)
{
// Determine index.
int upper = Math.min(edge.y0, edge.y1);
// Fit to raster.
int index = scanlineIndex(upper);
// Grow array when necessary.
if (index >= scanlines.length)
{
int oldSize = scanlines.length;
int newSize = Math.max(oldSize + oldSize / 2 + 1, index + 10);
Scanline[] newScanlines = new Scanline[newSize];
System.arraycopy(scanlines, 0, newScanlines, 0, oldSize);
scanlines = newScanlines;
}
// Add edge.
if (scanlines[index] == null)
{
scanlines[index] = new Scanline();
}
scanlines[index].addEdge(edge);
}
/**
* Fits an Y coordinate to the grid.
*
* @param y the Y coordinate to fit
*
* @return the fitted Y coordinate
*/
private int fit(int y)
{
int val1 = Fixed.div(FIXED_DIGITS, y, resolution);
int rounded = Fixed.round(FIXED_DIGITS, val1);
return Fixed.div(FIXED_DIGITS, rounded, resolution);
}
/**
* Calculates the scanline index for the specified y coordinate.
*
* @param y the y coordinate as fixed point value
*
* @return the scanline index
*/
private int scanlineIndex(int y)
{
int fitted = fit(y);
// Cleverly skip the fixed point conversions here.
return (fitted - upperBounds)/ resolution;
}
private void edgePoolAdd(int x0, int y0, int x1, int y1, boolean clip)
{
// Don't need no horizontal edges.
if (y0 != y1)
{
edgePoolLast.init(FIXED_DIGITS, x0, y0, x1, y1, clip);
if (edgePoolLast.poolNext == null)
{
edgePoolLast.poolNext = new PolyEdge();
}
edgePoolLast = edgePoolLast.poolNext;
}
}
}

View file

@ -0,0 +1,301 @@
/* ClasspathDesktopPeer.java -- Offers a concrete implementation for DesktopPeer
Copyright (C) 2006, 2007 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. */
package gnu.java.awt.peer;
import java.awt.AWTPermission;
import java.awt.Desktop.Action;
import java.awt.peer.DesktopPeer;
import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.util.prefs.Preferences;
/**
* Offers a common implementation for the Desktop peers, that enables
* access to default system application within java processes.
*
* @author Mario Torre <neugens@limasoftware.net>
*/
public class ClasspathDesktopPeer
implements DesktopPeer
{
/** This is the fallback browser, if no desktop was detected. */
protected static final String _DEFAULT_BROWSER = "firefox";
/** gnu.java.awt.peer.Desktop.html.command */
protected static final String _BROWSE = "html";
/** gnu.java.awt.peer.Desktop.mail.command */
protected static final String _MAIL = "mail";
/** gnu.java.awt.peer.Desktop.edit.command */
protected static final String _EDIT = "edit";
/** gnu.java.awt.peer.Desktop.print.command */
protected static final String _PRINT = "print";
/** gnu.java.awt.peer.Desktop.open.command */
protected static final String _OPEN = "open";
/** */
protected static final KDEDesktopPeer kde = new KDEDesktopPeer();
/** */
protected static final GnomeDesktopPeer gnome = new GnomeDesktopPeer();
/** */
protected static final ClasspathDesktopPeer classpath =
new ClasspathDesktopPeer();
/**
* Preference subsystem. Packagers and users can override the default
* behaviour of this class via preferences and system properties.
*/
protected Preferences prefs =
Preferences.userNodeForPackage(ClasspathDesktopPeer.class).node("Desktop");
/**
* @param target
*/
protected ClasspathDesktopPeer()
{
/* nothing to do */
}
public boolean isSupported(Action action)
{
String check = null;
switch(action)
{
case BROWSE:
check = _BROWSE;
break;
case MAIL:
check = _MAIL;
break;
case EDIT:
check = _EDIT;
break;
case PRINT:
check = _PRINT;
break;
case OPEN: default:
check = _OPEN;
break;
}
return this.supportCommand(check);
}
public void browse(URI url) throws IOException
{
checkPermissions();
String browser = getCommand(_BROWSE);
if (browser == null)
throw new UnsupportedOperationException();
browser = browser + " " + url.toString();
Runtime.getRuntime().exec(browser);
}
public void edit(File file) throws IOException
{
checkPermissions(file, false);
String edit = getCommand(_EDIT);
if (edit == null)
throw new UnsupportedOperationException();
edit = edit + " " + file.getAbsolutePath();
Runtime.getRuntime().exec(edit);
}
public void mail(URI mailtoURL) throws IOException
{
checkPermissions();
String scheme = mailtoURL.getScheme();
if (scheme == null || !scheme.equalsIgnoreCase("mailto"))
throw new IllegalArgumentException("URI Scheme not of type mailto");
String mail = getCommand(_MAIL);
if (mail == null)
throw new UnsupportedOperationException();
mail = mail + " " + mailtoURL.toString();
Runtime.getRuntime().exec(mail);
}
public void mail() throws IOException
{
checkPermissions();
String mail = getCommand(_MAIL);
if (mail == null)
throw new UnsupportedOperationException();
Runtime.getRuntime().exec(mail);
}
public void open(File file) throws IOException
{
checkPermissions(file, true);
String open = getCommand(_OPEN);
if (open == null)
throw new UnsupportedOperationException();
open = open + " " + file.getAbsolutePath();
Runtime.getRuntime().exec(open);
}
public void print(File file) throws IOException
{
checkPrintPermissions(file);
String print = getCommand(_PRINT);
if (print == null)
throw new UnsupportedOperationException();
print = print + " " + file.getAbsolutePath();
Runtime.getRuntime().exec(print);
}
protected String getCommand(String action)
{
// check if a system property exist
String command =
System.getProperty("gnu.java.awt.peer.Desktop." + action + ".command");
// otherwise, get it from preferences, if any
if (command == null)
{
command = prefs.node(action).get("command", null);
}
return command;
}
/**
* Note: Checks for AWTPermission("showWindowWithoutWarningBanner") only.
*/
protected void checkPermissions()
{
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkPermission(new AWTPermission("showWindowWithoutWarningBanner"));
}
}
/**
* Calls checkPermissions() and checks for SecurityManager.checkRead()
* and, if readOnly is false, for SecurityManager.checkWrite()
*/
protected void checkPermissions(File file, boolean readOnly)
{
checkPermissions();
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkRead(file.toString());
if (!readOnly) sm.checkWrite(file.toString());
}
}
/**
* Calls checkPermissions(file, true) and checks for
* SecurityManager.checkPrintJobAccess()
*/
protected void checkPrintPermissions(File file)
{
checkPermissions(file, true);
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkPrintJobAccess();
}
}
/**
* @param check
* @return
*/
protected boolean supportCommand(String check)
{
return ((this.getCommand(check) != null) ? true : false);
}
/**
* @return
*/
public static DesktopPeer getDesktop()
{
// check if we are under Gnome or KDE or anything else
String desktopSession = System.getenv("GNOME_DESKTOP_SESSION_ID");
if (desktopSession == null)
{
desktopSession = System.getenv("KDE_FULL_SESSION");
if (desktopSession != null)
return kde;
}
else
{
return gnome;
}
// revert to this class for default values
return classpath;
}
}

View file

@ -54,6 +54,7 @@ import java.awt.peer.FontPeer;
import java.text.AttributedCharacterIterator;
import java.text.CharacterIterator;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Locale;
import java.util.Map;
@ -120,6 +121,23 @@ public abstract class ClasspathFontPeer
*/
protected AffineTransform transform;
static class LRUCache<K,V> extends LinkedHashMap<K,V>
{
int max_entries;
public LRUCache(int max)
{
super(max, 0.75f, true);
max_entries = max;
}
protected boolean removeEldestEntry(Map.Entry eldest)
{
return size() > max_entries;
}
}
private static LRUCache<AffineTransform,TransformAttribute> transCache =
new LRUCache<AffineTransform,TransformAttribute>(50);
protected static ClasspathToolkit tk()
{
return (ClasspathToolkit)(Toolkit.getDefaultToolkit ());
@ -200,7 +218,19 @@ public abstract class ClasspathFontPeer
protected static void copyTransformToAttrs (AffineTransform trans, Map attrs)
{
if (trans != null)
attrs.put(TextAttribute.TRANSFORM, new TransformAttribute (trans));
{
TransformAttribute ta;
synchronized(transCache)
{
ta = transCache.get(trans);
if (ta == null)
{
ta = new TransformAttribute(trans);
transCache.put(trans, ta);
}
}
attrs.put(TextAttribute.TRANSFORM, ta);
}
}

View file

@ -0,0 +1,153 @@
/* GnomeDesktopPeer.java -- Offers a GNOME Desktop peer for DesktopPeer
Copyright (C) 2006, 2007 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. */
package gnu.java.awt.peer;
import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
/**
* @author Mario Torre <neugens@limasoftware.net>
*/
public class GnomeDesktopPeer
extends ClasspathDesktopPeer
{
/**
* Query string to use if a GNOME desktop is detected to get the name of the
* default browser. This requires gconftool-2 (part of GNOME).
*/
private static final String BROWSER_QUERY_GNOME =
"gconftool-2 -g /desktop/gnome/url-handlers/http/command";
protected String getCommand(String action)
{
// check if a command already exists
String command = super.getCommand(action);
if (command == null)
{
try
{
if (action == _BROWSE)
{
command = execQuery(BROWSER_QUERY_GNOME);
}
else if (action == _PRINT)
{
command = null;
}
else
{
command = "gnome-open";
}
}
catch (Exception e)
{
command = null;
}
}
return command;
}
public void browse(URI url) throws IOException
{
checkPermissions();
String browser = getCommand(_BROWSE);
if (browser == null)
throw new UnsupportedOperationException();
browser = browser + " " + url.toString();
Runtime.getRuntime().exec(browser);
}
protected boolean supportCommand(String check)
{
if (check == _PRINT)
{
return super.supportCommand(check);
}
return true;
}
public void mail() throws IOException
{
checkPermissions();
String mail = getCommand(_MAIL);
if (mail == null)
throw new UnsupportedOperationException();
Runtime.getRuntime().exec(mail + " mailto:");
}
protected String execQuery(String command) throws IOException
{
InputStream in = null;
StringBuilder output = new StringBuilder();
try
{
Process process = Runtime.getRuntime().exec(command);
// Get the input stream and read from it
in = process.getInputStream();
int c;
while ((c = in.read()) != - 1)
{
output.append((char) c);
}
}
finally
{
if (in != null)
in.close();
}
// remove %s from the string, leave only the command line
int index = output.indexOf("%s");
output.delete(index, index + 1);
return output.toString().trim();
}
}

View file

@ -0,0 +1,135 @@
/* GnomeDesktopPeer.java -- Offers a KDE Desktop peer for DesktopPeer
Copyright (C) 2006, 2007 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. */
package gnu.java.awt.peer;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
/**
* @author Mario Torre <neugens@limasoftware.net>
*/
public class KDEDesktopPeer
extends ClasspathDesktopPeer
{
/**
* Query string to use if a GNOME desktop is detected to get the name of the
* default browser. This requires gconftool-2 (part of GNOME).
*/
private static final String BROWSER_QUERY_GNOME =
"gconftool-2 -g /desktop/gnome/url-handlers/http/command";
protected String getCommand(String action)
{
// check if a command already exists
String command = super.getCommand(action);
if (command == null)
{
try
{
if (action == _MAIL)
{
command = "kfmclient exec";
}
else if (action == _PRINT)
{
command = "kprinter";
}
else
{
command = "kfmclient openURL";
}
}
catch (Exception e)
{
command = null;
}
}
return command;
}
protected boolean supportCommand(String check)
{
return true;
}
public void mail() throws IOException
{
checkPermissions();
String mail = getCommand(_MAIL);
if (mail == null)
throw new UnsupportedOperationException();
Runtime.getRuntime().exec(mail + " 'mailto: '");
}
protected String execQuery(String command) throws IOException
{
InputStream in = null;
StringBuilder output = new StringBuilder();
try
{
Process process = Runtime.getRuntime().exec(command);
// Get the input stream and read from it
in = process.getInputStream();
int c;
while ((c = in.read()) != - 1)
{
output.append((char) c);
}
}
finally
{
if (in != null)
in.close();
}
// remove %s from the string, leave only the command line
int index = output.indexOf("%s");
output.delete(index, index + 1);
return output.toString().trim();
}
}

View file

@ -61,11 +61,11 @@ public class AsyncImage
private class NullImageSource
implements ImageProducer
{
private ArrayList consumers;
private ArrayList<ImageConsumer> consumers;
NullImageSource()
{
consumers = new ArrayList();
consumers = new ArrayList<ImageConsumer>();
}
public void addConsumer(ImageConsumer ic)
@ -145,14 +145,14 @@ public class AsyncImage
*
* This is package private to avoid accessor methods.
*/
HashSet observers;
HashSet<ImageObserver> observers;
/**
* Creates a new AsyncImage that loads from the specified URL.
*/
AsyncImage(URL url)
{
observers = new HashSet();
observers = new HashSet<ImageObserver>();
Loader l = new Loader(url);
Thread t = new Thread(l);
t.start();
@ -221,7 +221,7 @@ public class AsyncImage
{
// This field gets null when image loading is complete and we don't
// need to store any more observers.
HashSet observs = observers;
HashSet<ImageObserver> observs = observers;
if (observs != null)
{
observs.add(obs);

View file

@ -40,6 +40,7 @@ package gnu.java.awt.peer.gtk;
import java.awt.AlphaComposite;
import java.awt.Color;
import java.awt.Composite;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.GraphicsConfiguration;
@ -49,7 +50,6 @@ import java.awt.Shape;
import java.awt.Toolkit;
import java.awt.font.GlyphVector;
import java.awt.geom.AffineTransform;
import java.awt.geom.Point2D;
import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage;
import java.awt.image.ColorModel;
@ -74,12 +74,6 @@ public class BufferedImageGraphics extends CairoGraphics2D
*/
private BufferedImage image, buffer;
/**
* Allows us to lock the image from updates (if we want to perform a few
* intermediary operations on the cairo surface, then update it all at once)
*/
private boolean locked;
/**
* Image size.
*/
@ -93,7 +87,8 @@ public class BufferedImageGraphics extends CairoGraphics2D
/**
* Cache BufferedImageGraphics surfaces.
*/
static WeakHashMap bufferedImages = new WeakHashMap();
static WeakHashMap<BufferedImage, CairoSurface> bufferedImages
= new WeakHashMap<BufferedImage, CairoSurface>();
/**
* Its corresponding cairo_t.
@ -109,30 +104,30 @@ public class BufferedImageGraphics extends CairoGraphics2D
this.image = bi;
imageWidth = bi.getWidth();
imageHeight = bi.getHeight();
locked = false;
if (!(image.getSampleModel() instanceof SinglePixelPackedSampleModel))
hasFastCM = false;
else if(bi.getColorModel().equals(CairoSurface.cairoCM_opaque))
{
hasFastCM = true;
hasAlpha = false;
hasFastCM = true;
hasAlpha = false;
}
else if(bi.getColorModel().equals(CairoSurface.cairoColorModel))
else if(bi.getColorModel().equals(CairoSurface.cairoColorModel)
|| bi.getColorModel().equals(CairoSurface.cairoCM_pre))
{
hasFastCM = true;
hasAlpha = true;
hasFastCM = true;
hasAlpha = true;
}
else
hasFastCM = false;
// Cache surfaces.
if( bufferedImages.get( bi ) != null )
surface = (CairoSurface)bufferedImages.get( bi );
surface = bufferedImages.get( bi );
else
{
surface = new CairoSurface( imageWidth, imageHeight );
bufferedImages.put(bi, surface);
surface = new CairoSurface( imageWidth, imageHeight );
bufferedImages.put(bi, surface);
}
cairo_t = surface.newCairoContext();
@ -148,10 +143,7 @@ public class BufferedImageGraphics extends CairoGraphics2D
int minY = image.getRaster().getSampleModelTranslateY();
// Pull pixels directly out of data buffer
if(raster instanceof CairoSurface)
pixels = ((CairoSurface)raster).getPixels(raster.getWidth() * raster.getHeight());
else
pixels = ((DataBufferInt)raster.getDataBuffer()).getData();
pixels = ((DataBufferInt)raster.getDataBuffer()).getData();
// Discard pixels that fall outside of the image's bounds
// (ie, this image is actually a subimage of a different image)
@ -161,7 +153,8 @@ public class BufferedImageGraphics extends CairoGraphics2D
int scanline = sm.getScanlineStride();
for (int i = 0; i < imageHeight; i++)
System.arraycopy(pixels, (i - minY) * scanline - minX, pixels2, i * imageWidth, imageWidth);
System.arraycopy(pixels, (i - minY) * scanline - minX, pixels2,
i * imageWidth, imageWidth);
pixels = pixels2;
}
@ -173,11 +166,13 @@ public class BufferedImageGraphics extends CairoGraphics2D
}
else
{
pixels = CairoGraphics2D.findSimpleIntegerArray(image.getColorModel(),image.getData());
pixels = CairoGraphics2D.findSimpleIntegerArray(image.getColorModel(),
image.getData());
if (pixels != null)
System.arraycopy(pixels, 0, surface.getData(),
0, pixels.length);
}
surface.setPixels( pixels );
setup( cairo_t );
setClip(0, 0, imageWidth, imageHeight);
}
@ -189,7 +184,6 @@ public class BufferedImageGraphics extends CairoGraphics2D
cairo_t = surface.newCairoContext();
imageWidth = copyFrom.imageWidth;
imageHeight = copyFrom.imageHeight;
locked = false;
hasFastCM = copyFrom.hasFastCM;
hasAlpha = copyFrom.hasAlpha;
@ -202,17 +196,14 @@ public class BufferedImageGraphics extends CairoGraphics2D
*/
private void updateBufferedImage(int x, int y, int width, int height)
{
if (locked)
return;
double[] points = new double[]{x, y, width+x, height+y};
transform.transform(points, 0, points, 0, 2);
x = (int)points[0];
y = (int)points[1];
width = (int)Math.ceil(points[2] - points[0]);
height = (int)Math.ceil(points[3] - points[1]);
Rectangle bounds = new Rectangle(x, y, width, height);
bounds = getTransformedBounds(bounds, transform).getBounds();
x = bounds.x;
y = bounds.y;
width = bounds.width;
height = bounds.height;
int[] pixels = surface.getPixels(imageWidth * imageHeight);
int[] pixels = surface.getData();
if( x > imageWidth || y > imageHeight )
return;
@ -403,14 +394,10 @@ public class BufferedImageGraphics extends CairoGraphics2D
BufferedImage bImg = (BufferedImage) img;
// Find translated bounds
Point2D origin = new Point2D.Double(bImg.getMinX(), bImg.getMinY());
Point2D pt = new Point2D.Double(bImg.getWidth() + bImg.getMinX(),
bImg.getHeight() + bImg.getMinY());
Rectangle2D bounds = new Rectangle(bImg.getMinX(), bImg.getMinY(),
bImg.getWidth(), bImg.getHeight());
if (xform != null)
{
origin = xform.transform(origin, origin);
pt = xform.transform(pt, pt);
}
bounds = getTransformedBounds(bounds, xform);
// Create buffer and draw image
createBuffer();
@ -420,10 +407,7 @@ public class BufferedImageGraphics extends CairoGraphics2D
g2d.drawImage(img, xform, obs);
// Perform compositing
return drawComposite(new Rectangle2D.Double(origin.getX(),
origin.getY(),
pt.getX(), pt.getY()),
obs);
return drawComposite(bounds, obs);
}
}
@ -438,6 +422,11 @@ public class BufferedImageGraphics extends CairoGraphics2D
if (comp == null || comp instanceof AlphaComposite)
{
super.drawGlyphVector(gv, x, y);
// this returns an integer-based Rectangle (rather than a
// Rectangle2D), which takes care of any necessary rounding for us.
bounds = bounds.getBounds();
updateBufferedImage((int)bounds.getX(), (int)bounds.getY(),
(int)bounds.getWidth(), (int)bounds.getHeight());
}
@ -468,12 +457,7 @@ public class BufferedImageGraphics extends CairoGraphics2D
private boolean drawComposite(Rectangle2D bounds, ImageObserver observer)
{
// Find bounds in device space
double[] points = new double[] {bounds.getX(), bounds.getY(),
bounds.getMaxX(), bounds.getMaxY()};
transform.transform(points, 0, points, 0, 2);
bounds = new Rectangle2D.Double(points[0], points[1],
(points[2] - points[0]),
(points[3] - points[1]));
bounds = getTransformedBounds(bounds, transform);
// Clip bounds by the stored clip, and by the internal buffer
Rectangle2D devClip = this.getClipInDevSpace();
@ -482,17 +466,15 @@ public class BufferedImageGraphics extends CairoGraphics2D
buffer.getWidth(), buffer.getHeight());
Rectangle2D.intersect(bounds, devClip, bounds);
// Round bounds as needed, but be conservative in our rounding
// Round bounds as needed, but be careful in our rounding
// (otherwise it may leave unpainted stripes)
double x = bounds.getX();
double y = bounds.getY();
double w = bounds.getWidth();
double h = bounds.getHeight();
if (Math.floor(x) != x)
w--;
if (Math.floor(y) != y)
h--;
bounds.setRect(Math.ceil(x), Math.ceil(y), Math.floor(w), Math.floor(h));
double maxX = x + bounds.getWidth();
double maxY = y + bounds.getHeight();
x = Math.round(x);
y = Math.round(y);
bounds.setRect(x, y, Math.round(maxX - x), Math.round(maxY - y));
// Find subimage of internal buffer for updating
BufferedImage buffer2 = buffer;
@ -511,9 +493,10 @@ public class BufferedImageGraphics extends CairoGraphics2D
compCtx.compose(buffer2.getRaster(), current.getRaster(),
current.getRaster());
// Prevent the clearRect in CairoGraphics2D.drawImage from clearing
// our composited image
locked = true;
// Set cairo's composite to direct SRC, since we've already done our own
// compositing
Composite oldcomp = comp;
setComposite(AlphaComposite.Src);
// This MUST call directly into the "action" method in CairoGraphics2D,
// not one of the wrappers, to ensure that the composite isn't processed
@ -521,8 +504,9 @@ public class BufferedImageGraphics extends CairoGraphics2D
boolean rv = super.drawImage(current,
AffineTransform.getTranslateInstance(bounds.getX(),
bounds.getY()),
new Color(0,0,0,0), null);
locked = false;
null, null);
setComposite(oldcomp);
updateColor();
return rv;
}

View file

@ -172,6 +172,12 @@ public abstract class CairoGraphics2D extends Graphics2D
* Rendering hint map.
*/
private RenderingHints hints;
/**
* Status of the anti-alias flag in cairo.
*/
private boolean antialias = false;
private boolean ignoreAA = false;
/**
* Some operations (drawing rather than filling) require that their
@ -228,6 +234,7 @@ public abstract class CairoGraphics2D extends Graphics2D
setPaint(Color.black);
setStroke(new BasicStroke());
setTransform(new AffineTransform());
cairoSetAntialias(nativePointer, antialias);
}
/**
@ -244,7 +251,7 @@ public abstract class CairoGraphics2D extends Graphics2D
if (g.fg.getAlpha() != -1)
foreground = new Color(g.fg.getRed(), g.fg.getGreen(), g.fg.getBlue(),
g.fg.getAlpha());
g.fg.getAlpha());
else
foreground = new Color(g.fg.getRGB());
@ -274,6 +281,9 @@ public abstract class CairoGraphics2D extends Graphics2D
setTransformImpl(transform);
setClip(clip);
setComposite(comp);
antialias = !g.antialias;
setAntialias(g.antialias);
}
/**
@ -311,8 +321,8 @@ public abstract class CairoGraphics2D extends Graphics2D
public abstract GraphicsConfiguration getDeviceConfiguration();
protected abstract void copyAreaImpl(int x, int y,
int width, int height, int dx, int dy);
protected abstract void copyAreaImpl(int x, int y, int width, int height,
int dx, int dy);
/**
@ -345,8 +355,8 @@ public abstract class CairoGraphics2D extends Graphics2D
int g2, int b2, int a2, boolean cyclic);
protected native void setPaintPixels(long pointer, int[] pixels, int w,
int h, int stride, boolean repeat,
int x, int y);
int h, int stride, boolean repeat,
int x, int y);
/**
* Set the current transform matrix
@ -390,9 +400,9 @@ public abstract class CairoGraphics2D extends Graphics2D
/*
* Draws a Glyph Vector
*/
native void cairoDrawGlyphVector(long pointer, GdkFontPeer font,
protected native void cairoDrawGlyphVector(long pointer, GdkFontPeer font,
float x, float y, int n,
int[] codes, float[] positions);
int[] codes, float[] positions, long[] fontset);
/**
* Set the font in cairo.
@ -454,9 +464,15 @@ public abstract class CairoGraphics2D extends Graphics2D
protected native void cairoClip(long pointer);
/**
* Save clip
* Clear clip
*/
protected native void cairoResetClip(long pointer);
/**
* Set antialias.
*/
protected native void cairoSetAntialias(long pointer, boolean aa);
///////////////////////// TRANSFORMS ///////////////////////////////////
/**
@ -648,33 +664,35 @@ public abstract class CairoGraphics2D extends Graphics2D
setColor((Color) paint);
customPaint = false;
}
else if (paint instanceof TexturePaint)
{
TexturePaint tp = (TexturePaint) paint;
BufferedImage img = tp.getImage();
TexturePaint tp = (TexturePaint) paint;
BufferedImage img = tp.getImage();
// map the image to the anchor rectangle
int width = (int) tp.getAnchorRect().getWidth();
int height = (int) tp.getAnchorRect().getHeight();
// map the image to the anchor rectangle
int width = (int) tp.getAnchorRect().getWidth();
int height = (int) tp.getAnchorRect().getHeight();
double scaleX = width / (double) img.getWidth();
double scaleY = height / (double) img.getHeight();
double scaleX = width / (double) img.getWidth();
double scaleY = height / (double) img.getHeight();
AffineTransform at = new AffineTransform(scaleX, 0, 0, scaleY, 0, 0);
AffineTransformOp op = new AffineTransformOp(at, getRenderingHints());
BufferedImage texture = op.filter(img, null);
int[] pixels = texture.getRGB(0, 0, width, height, null, 0, width);
setPaintPixels(nativePointer, pixels, width, height, width, true, 0, 0);
AffineTransform at = new AffineTransform(scaleX, 0, 0, scaleY, 0, 0);
AffineTransformOp op = new AffineTransformOp(at, getRenderingHints());
BufferedImage texture = op.filter(img, null);
int[] pixels = texture.getRGB(0, 0, width, height, null, 0, width);
setPaintPixels(nativePointer, pixels, width, height, width, true, 0, 0);
customPaint = false;
}
else if (paint instanceof GradientPaint)
{
GradientPaint gp = (GradientPaint) paint;
Point2D p1 = gp.getPoint1();
Point2D p2 = gp.getPoint2();
Color c1 = gp.getColor1();
Color c2 = gp.getColor2();
setGradient(nativePointer, p1.getX(), p1.getY(), p2.getX(), p2.getY(),
GradientPaint gp = (GradientPaint) paint;
Point2D p1 = gp.getPoint1();
Point2D p2 = gp.getPoint2();
Color c1 = gp.getColor1();
Color c2 = gp.getColor2();
setGradient(nativePointer, p1.getX(), p1.getY(), p2.getX(), p2.getY(),
c1.getRed(), c1.getGreen(), c1.getBlue(), c1.getAlpha(),
c2.getRed(), c2.getGreen(), c2.getBlue(), c2.getAlpha(),
gp.isCyclic());
@ -703,15 +721,11 @@ public abstract class CairoGraphics2D extends Graphics2D
int userHeight = bounds.height;
// Find bounds in device space
Point2D origin = transform.transform(new Point2D.Double(userX, userY),
null);
Point2D extreme = transform.transform(new Point2D.Double(userWidth + userX,
userHeight + userY),
null);
int deviceX = (int)origin.getX();
int deviceY = (int)origin.getY();
int deviceWidth = (int)Math.ceil(extreme.getX() - origin.getX());
int deviceHeight = (int)Math.ceil(extreme.getY() - origin.getY());
Rectangle2D bounds2D = getTransformedBounds(bounds, transform);
int deviceX = (int)bounds2D.getX();
int deviceY = (int)bounds2D.getY();
int deviceWidth = (int)Math.ceil(bounds2D.getWidth());
int deviceHeight = (int)Math.ceil(bounds2D.getHeight());
// Get raster of the paint background
PaintContext pc = paint.createContext(CairoSurface.cairoColorModel,
@ -792,21 +806,22 @@ public abstract class CairoGraphics2D extends Graphics2D
stroke = st;
if (stroke instanceof BasicStroke)
{
BasicStroke bs = (BasicStroke) stroke;
cairoSetLine(nativePointer, bs.getLineWidth(), bs.getEndCap(),
bs.getLineJoin(), bs.getMiterLimit());
BasicStroke bs = (BasicStroke) stroke;
cairoSetLine(nativePointer, bs.getLineWidth(), bs.getEndCap(),
bs.getLineJoin(), bs.getMiterLimit());
float[] dashes = bs.getDashArray();
if (dashes != null)
{
double[] double_dashes = new double[dashes.length];
for (int i = 0; i < dashes.length; i++)
double_dashes[i] = dashes[i];
cairoSetDash(nativePointer, double_dashes, double_dashes.length,
(double) bs.getDashPhase());
}
else
cairoSetDash(nativePointer, new double[0], 0, 0.0);
float[] dashes = bs.getDashArray();
if (dashes != null)
{
double[] double_dashes = new double[dashes.length];
for (int i = 0; i < dashes.length; i++)
double_dashes[i] = dashes[i];
cairoSetDash(nativePointer, double_dashes, double_dashes.length,
(double) bs.getDashPhase());
}
else
cairoSetDash(nativePointer, new double[0], 0, 0.0);
}
}
@ -864,6 +879,7 @@ public abstract class CairoGraphics2D extends Graphics2D
{
if (fg == null)
fg = Color.BLACK;
cairoSetRGBAColor(nativePointer, fg.getRed() / 255.0,
fg.getGreen() / 255.0,fg.getBlue() / 255.0,
fg.getAlpha() / 255.0);
@ -916,18 +932,7 @@ public abstract class CairoGraphics2D extends Graphics2D
if (transform == null)
return uclip;
else
{
Point2D pos = transform.transform(new Point2D.Double(uclip.getX(),
uclip.getY()),
(Point2D) null);
Point2D extent = transform.deltaTransform(new Point2D.Double(uclip
.getWidth(),
uclip
.getHeight()),
(Point2D) null);
return new Rectangle2D.Double(pos.getX(), pos.getY(), extent.getX(),
extent.getY());
}
return getTransformedBounds(clip.getBounds2D(), transform);
}
public void setClip(int x, int y, int width, int height)
@ -946,8 +951,8 @@ public abstract class CairoGraphics2D extends Graphics2D
// initial clip properly.
if( firstClip )
{
originalClip = s;
firstClip = false;
originalClip = s;
firstClip = false;
}
clip = s;
@ -1007,7 +1012,7 @@ public abstract class CairoGraphics2D extends Graphics2D
if (comp instanceof AlphaComposite)
{
AlphaComposite a = (AlphaComposite) comp;
AlphaComposite a = (AlphaComposite) comp;
cairoSetOperator(nativePointer, a.getRule());
}
@ -1066,7 +1071,9 @@ public abstract class CairoGraphics2D extends Graphics2D
Rectangle r = findStrokedBounds(s);
setCustomPaint(r);
}
setAntialias(!hints.get(RenderingHints.KEY_ANTIALIASING)
.equals(RenderingHints.VALUE_ANTIALIAS_OFF));
createPath(s, true);
cairoStroke(nativePointer);
}
@ -1077,7 +1084,9 @@ public abstract class CairoGraphics2D extends Graphics2D
if (customPaint)
setCustomPaint(s.getBounds());
setAntialias(!hints.get(RenderingHints.KEY_ANTIALIASING)
.equals(RenderingHints.VALUE_ANTIALIAS_OFF));
double alpha = 1.0;
if (comp instanceof AlphaComposite)
alpha = ((AlphaComposite) comp).getAlpha();
@ -1263,13 +1272,15 @@ public abstract class CairoGraphics2D extends Graphics2D
public void copyArea(int ox, int oy, int owidth, int oheight,
int odx, int ody)
{
// FIXME: does this handle a rotation transform properly?
// (the width/height might not be correct)
Point2D pos = transform.transform(new Point2D.Double(ox, oy),
(Point2D) null);
(Point2D) null);
Point2D dim = transform.transform(new Point2D.Double(ox + owidth,
oy + oheight),
(Point2D) null);
oy + oheight),
(Point2D) null);
Point2D p2 = transform.transform(new Point2D.Double(ox + odx, oy + ody),
(Point2D) null);
(Point2D) null);
int x = (int)pos.getX();
int y = (int)pos.getY();
int width = (int)(dim.getX() - pos.getX());
@ -1291,14 +1302,14 @@ public abstract class CairoGraphics2D extends Graphics2D
// Clip edges if necessary
if( x + dx < r.getX() ) // left
{
width = x + dx + width;
x = (int)r.getX() - dx;
width = x + dx + width;
x = (int)r.getX() - dx;
}
if( y + dy < r.getY() ) // top
{
height = y + dy + height;
y = (int)r.getY() - dy;
height = y + dy + height;
y = (int)r.getY() - dy;
}
if( x + dx + width >= r.getWidth() ) // right
@ -1325,10 +1336,10 @@ public abstract class CairoGraphics2D extends Graphics2D
return hints.get(hintKey);
}
public void setRenderingHints(Map hints)
public void setRenderingHints(Map<?,?> hints)
{
this.hints = new RenderingHints(getDefaultHints());
this.hints.add(new RenderingHints(hints));
this.hints.putAll(hints);
shiftDrawCalls = hints.containsValue(RenderingHints.VALUE_STROKE_NORMALIZE)
|| hints.containsValue(RenderingHints.VALUE_STROKE_DEFAULT);
@ -1342,7 +1353,7 @@ public abstract class CairoGraphics2D extends Graphics2D
public void addRenderingHints(Map hints)
{
this.hints.add(new RenderingHints(hints));
this.hints.putAll(hints);
}
public RenderingHints getRenderingHints()
@ -1373,6 +1384,24 @@ public abstract class CairoGraphics2D extends Graphics2D
// Do bilinear interpolation as default
return INTERPOLATION_BILINEAR;
}
/**
* Set antialias if needed. If the ignoreAA flag is set, this method will
* return without doing anything.
*
* @param needAA RenderingHints.VALUE_ANTIALIAS_ON or RenderingHints.VALUE_ANTIALIAS_OFF
*/
private void setAntialias(boolean needAA)
{
if (ignoreAA)
return;
if (needAA != antialias)
{
antialias = !antialias;
cairoSetAntialias(nativePointer, antialias);
}
}
///////////////////////// IMAGE. METHODS ///////////////////////////////////
@ -1396,12 +1425,12 @@ public abstract class CairoGraphics2D extends Graphics2D
try
{
invertedXform = xform.createInverse();
invertedXform = xform.createInverse();
}
catch (NoninvertibleTransformException e)
{
throw new ImagingOpException("Unable to invert transform "
+ xform.toString());
throw new ImagingOpException("Unable to invert transform "
+ xform.toString());
}
// Unrecognized image - convert to a BufferedImage
@ -1411,10 +1440,10 @@ public abstract class CairoGraphics2D extends Graphics2D
img = AsyncImage.realImage(img, obs);
if( !(img instanceof BufferedImage) )
{
ImageProducer source = img.getSource();
if (source == null)
return false;
img = Toolkit.getDefaultToolkit().createImage(source);
ImageProducer source = img.getSource();
if (source == null)
return false;
img = Toolkit.getDefaultToolkit().createImage(source);
}
BufferedImage b = (BufferedImage) img;
@ -1427,7 +1456,7 @@ public abstract class CairoGraphics2D extends Graphics2D
// use the cached CairoSurface that BIG is drawing onto
if( BufferedImageGraphics.bufferedImages.get( b ) != null )
raster = (Raster)BufferedImageGraphics.bufferedImages.get( b );
raster = BufferedImageGraphics.bufferedImages.get( b );
else
raster = b.getRaster();
@ -1437,12 +1466,12 @@ public abstract class CairoGraphics2D extends Graphics2D
if (comp instanceof AlphaComposite)
alpha = ((AlphaComposite) comp).getAlpha();
if(raster instanceof CairoSurface)
if(raster instanceof CairoSurface
&& ((CairoSurface)raster).sharedBuffer == true)
{
((CairoSurface)raster).drawSurface(nativePointer, i2u, alpha,
getInterpolation());
drawCairoSurface((CairoSurface)raster, xform, alpha, getInterpolation());
updateColor();
return true;
return true;
}
if( bgcolor != null )
@ -1450,24 +1479,31 @@ public abstract class CairoGraphics2D extends Graphics2D
Color oldColor = bg;
setBackground(bgcolor);
double[] origin = new double[] {0,0};
double[] dimensions = new double[] {width, height};
xform.transform(origin, 0, origin, 0, 1);
xform.deltaTransform(dimensions, 0, dimensions, 0, 1);
clearRect((int)origin[0], (int)origin[1],
(int)dimensions[0], (int)dimensions[1]);
Rectangle2D bounds = new Rectangle2D.Double(0, 0, width, height);
bounds = getTransformedBounds(bounds, xform);
clearRect((int)bounds.getX(), (int)bounds.getY(),
(int)bounds.getWidth(), (int)bounds.getHeight());
setBackground(oldColor);
}
int[] pixels = b.getRGB(0, 0, width, height, null, 0, width);
// FIXME: The above method returns data in the standard ARGB colorspace,
// meaning data should NOT be alpha pre-multiplied; however Cairo expects
// data to be premultiplied.
cairoSave(nativePointer);
Rectangle2D bounds = new Rectangle2D.Double(0, 0, width, height);
bounds = getTransformedBounds(bounds, xform);
cairoRectangle(nativePointer, bounds.getX(), bounds.getY(),
bounds.getWidth(), bounds.getHeight());
cairoClip(nativePointer);
drawPixels(nativePointer, pixels, width, height, width, i2u, alpha,
getInterpolation());
cairoRestore(nativePointer);
// Cairo seems to lose the current color which must be restored.
updateColor();
@ -1578,6 +1614,66 @@ public abstract class CairoGraphics2D extends Graphics2D
{
return drawImage(img, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, null, observer);
}
/**
* Optimized method for drawing a CairoSurface onto this graphics context.
*
* @param surface The surface to draw.
* @param tx The transformation matrix (cannot be null).
* @param alpha The alpha value to paint with ( 0 <= alpha <= 1).
* @param interpolation The interpolation type.
*/
protected void drawCairoSurface(CairoSurface surface, AffineTransform tx,
double alpha, int interpolation)
{
// Find offset required if this surface is a sub-raster, and append offset
// to transformation.
if (surface.getSampleModelTranslateX() != 0
|| surface.getSampleModelTranslateY() != 0)
{
Point2D origin = new Point2D.Double(0, 0);
Point2D offset = new Point2D.Double(surface.getSampleModelTranslateX(),
surface.getSampleModelTranslateY());
tx.transform(origin, origin);
tx.transform(offset, offset);
tx.translate(offset.getX() - origin.getX(),
offset.getY() - origin.getY());
}
// Find dimensions of this surface relative to the root parent surface
Rectangle bounds = new Rectangle(-surface.getSampleModelTranslateX(),
-surface.getSampleModelTranslateY(),
surface.width, surface.height);
// Clip to the translated image
// We use direct cairo methods to avoid the overhead of maintaining a
// java copy of the clip, since we will be reverting it immediately
// after drawing
Shape newBounds = tx.createTransformedShape(bounds);
cairoSave(nativePointer);
walkPath(newBounds.getPathIterator(null), false);
cairoClip(nativePointer);
// Draw the surface
try
{
double[] i2u = new double[6];
tx.createInverse().getMatrix(i2u);
surface.nativeDrawSurface(surface.surfacePointer, nativePointer, i2u,
alpha, interpolation);
}
catch (NoninvertibleTransformException ex)
{
// This should never happen(?), so we don't need to do anything here.
;
}
// Restore clip
cairoRestore(nativePointer);
}
///////////////////////// TEXT METHODS ////////////////////////////////////
@ -1592,7 +1688,15 @@ public abstract class CairoGraphics2D extends Graphics2D
tl = new TextLayout( str, getFont(), getFontRenderContext() );
fontPeer.textLayoutCache.put(str, tl);
}
// Set antialias to text_antialiasing, and set the ignoreAA flag so that
// the setting doesn't get overridden in a draw() or fill() call.
setAntialias(!hints.get(RenderingHints.KEY_TEXT_ANTIALIASING)
.equals(RenderingHints.VALUE_TEXT_ANTIALIAS_OFF));
ignoreAA = true;
tl.draw(this, x, y);
ignoreAA = false;
}
public void drawString(String str, int x, int y)
@ -1617,19 +1721,25 @@ public abstract class CairoGraphics2D extends Graphics2D
if (comp instanceof AlphaComposite)
alpha = ((AlphaComposite) comp).getAlpha();
setAntialias(!hints.get(RenderingHints.KEY_TEXT_ANTIALIASING)
.equals(RenderingHints.VALUE_TEXT_ANTIALIAS_OFF));
ignoreAA = true;
if (gv instanceof FreetypeGlyphVector && alpha == 1.0)
{
int n = gv.getNumGlyphs ();
int[] codes = gv.getGlyphCodes (0, n, null);
long[] fontset = ((FreetypeGlyphVector)gv).getGlyphFonts (0, n, null);
float[] positions = gv.getGlyphPositions (0, n, null);
setFont (gv.getFont ());
GdkFontPeer fontPeer = (GdkFontPeer) font.getPeer();
synchronized (fontPeer)
{
cairoDrawGlyphVector(nativePointer, fontPeer,
x, y, n, codes, positions);
}
synchronized (fontPeer)
{
cairoDrawGlyphVector(nativePointer, fontPeer,
x, y, n, codes, positions, fontset);
}
}
else
{
@ -1637,6 +1747,8 @@ public abstract class CairoGraphics2D extends Graphics2D
fill(gv.getOutline());
translate(-x, -y);
}
ignoreAA = false;
}
public void drawString(AttributedCharacterIterator ci, float x, float y)
@ -1702,9 +1814,9 @@ public abstract class CairoGraphics2D extends Graphics2D
{
if( onStroke )
{
Shape stroked = stroke.createStrokedShape( s );
return stroked.intersects( (double)rect.x, (double)rect.y,
(double)rect.width, (double)rect.height );
Shape stroked = stroke.createStrokedShape( s );
return stroked.intersects( (double)rect.x, (double)rect.y,
(double)rect.width, (double)rect.height );
}
return s.intersects( (double)rect.x, (double)rect.y,
(double)rect.width, (double)rect.height );
@ -1747,34 +1859,34 @@ public abstract class CairoGraphics2D extends Graphics2D
imageToUser.getMatrix(i2u);
else
{
i2u[0] = 1;
i2u[1] = 0;
i2u[2] = 0;
i2u[3] = 1;
i2u[4] = 0;
i2u[5] = 0;
i2u[0] = 1;
i2u[1] = 0;
i2u[2] = 0;
i2u[3] = 1;
i2u[4] = 0;
i2u[5] = 0;
}
int[] pixels = findSimpleIntegerArray(cm, r);
if (pixels == null)
{
// FIXME: I don't think this code will work correctly with a non-RGB
// MultiPixelPackedSampleModel. Although this entire method should
// probably be rewritten to better utilize Cairo's different supported
// data formats.
if (sm instanceof MultiPixelPackedSampleModel)
{
pixels = r.getPixels(0, 0, r.getWidth(), r.getHeight(), pixels);
for (int i = 0; i < pixels.length; i++)
pixels[i] = cm.getRGB(pixels[i]);
}
else
{
pixels = new int[r.getWidth() * r.getHeight()];
for (int i = 0; i < pixels.length; i++)
pixels[i] = cm.getRGB(db.getElem(i));
}
// FIXME: I don't think this code will work correctly with a non-RGB
// MultiPixelPackedSampleModel. Although this entire method should
// probably be rewritten to better utilize Cairo's different supported
// data formats.
if (sm instanceof MultiPixelPackedSampleModel)
{
pixels = r.getPixels(0, 0, r.getWidth(), r.getHeight(), pixels);
for (int i = 0; i < pixels.length; i++)
pixels[i] = cm.getRGB(pixels[i]);
}
else
{
pixels = new int[r.getWidth() * r.getHeight()];
for (int i = 0; i < pixels.length; i++)
pixels[i] = cm.getRGB(db.getElem(i));
}
}
// Change all transparent pixels in the image to the specified bgcolor,
@ -1782,20 +1894,21 @@ public abstract class CairoGraphics2D extends Graphics2D
// correctly.
if (cm.hasAlpha())
{
if (bgcolor != null && cm.hasAlpha())
for (int i = 0; i < pixels.length; i++)
{
if (cm.getAlpha(pixels[i]) == 0)
pixels[i] = bgcolor.getRGB();
}
if (bgcolor != null && cm.hasAlpha())
for (int i = 0; i < pixels.length; i++)
{
if (cm.getAlpha(pixels[i]) == 0)
pixels[i] = bgcolor.getRGB();
}
}
else
for (int i = 0; i < pixels.length; i++)
pixels[i] |= 0xFF000000;
pixels[i] |= 0xFF000000;
double alpha = 1.0;
if (comp instanceof AlphaComposite)
alpha = ((AlphaComposite) comp).getAlpha();
drawPixels(nativePointer, pixels, r.getWidth(), r.getHeight(),
r.getWidth(), i2u, alpha, getInterpolation());
@ -1815,7 +1928,7 @@ public abstract class CairoGraphics2D extends Graphics2D
double shift = 0.5;
if (!transform.isIdentity())
shift /= transform.getScaleX();
return Math.round(coord) + shift;
return (coord + shift);
}
else
return coord;
@ -1831,7 +1944,7 @@ public abstract class CairoGraphics2D extends Graphics2D
double shift = 0.5;
if (!transform.isIdentity())
shift /= transform.getScaleY();
return Math.round(coord) + shift;
return (coord + shift);
}
else
return coord;
@ -1849,53 +1962,54 @@ public abstract class CairoGraphics2D extends Graphics2D
cairoSetFillRule(nativePointer, p.getWindingRule());
for (; ! p.isDone(); p.next())
{
int seg = p.currentSegment(coords);
switch (seg)
{
case PathIterator.SEG_MOVETO:
x = shiftX(coords[0], doShift);
y = shiftY(coords[1], doShift);
cairoMoveTo(nativePointer, x, y);
break;
case PathIterator.SEG_LINETO:
x = shiftX(coords[0], doShift);
y = shiftY(coords[1], doShift);
cairoLineTo(nativePointer, x, y);
break;
case PathIterator.SEG_QUADTO:
// splitting a quadratic bezier into a cubic:
// see: http://pfaedit.sourceforge.net/bezier.html
double x1 = x + (2.0 / 3.0) * (shiftX(coords[0], doShift) - x);
double y1 = y + (2.0 / 3.0) * (shiftY(coords[1], doShift) - y);
int seg = p.currentSegment(coords);
switch (seg)
{
case PathIterator.SEG_MOVETO:
x = shiftX(coords[0], doShift);
y = shiftY(coords[1], doShift);
cairoMoveTo(nativePointer, x, y);
break;
case PathIterator.SEG_LINETO:
x = shiftX(coords[0], doShift);
y = shiftY(coords[1], doShift);
cairoLineTo(nativePointer, x, y);
break;
case PathIterator.SEG_QUADTO:
// splitting a quadratic bezier into a cubic:
// see: http://pfaedit.sourceforge.net/bezier.html
double x1 = x + (2.0 / 3.0) * (shiftX(coords[0], doShift) - x);
double y1 = y + (2.0 / 3.0) * (shiftY(coords[1], doShift) - y);
double x2 = x1 + (1.0 / 3.0) * (shiftX(coords[2], doShift) - x);
double y2 = y1 + (1.0 / 3.0) * (shiftY(coords[3], doShift) - y);
double x2 = x1 + (1.0 / 3.0) * (shiftX(coords[2], doShift) - x);
double y2 = y1 + (1.0 / 3.0) * (shiftY(coords[3], doShift) - y);
x = shiftX(coords[2], doShift);
y = shiftY(coords[3], doShift);
cairoCurveTo(nativePointer, x1, y1, x2, y2, x, y);
break;
case PathIterator.SEG_CUBICTO:
x = shiftX(coords[4], doShift);
y = shiftY(coords[5], doShift);
cairoCurveTo(nativePointer, shiftX(coords[0], doShift),
shiftY(coords[1], doShift),
shiftX(coords[2], doShift),
shiftY(coords[3], doShift), x, y);
break;
case PathIterator.SEG_CLOSE:
cairoClosePath(nativePointer);
break;
}
x = shiftX(coords[2], doShift);
y = shiftY(coords[3], doShift);
cairoCurveTo(nativePointer, x1, y1, x2, y2, x, y);
break;
case PathIterator.SEG_CUBICTO:
x = shiftX(coords[4], doShift);
y = shiftY(coords[5], doShift);
cairoCurveTo(nativePointer, shiftX(coords[0], doShift),
shiftY(coords[1], doShift),
shiftX(coords[2], doShift),
shiftY(coords[3], doShift), x, y);
break;
case PathIterator.SEG_CLOSE:
cairoClosePath(nativePointer);
break;
}
}
}
/**
* Used by setRenderingHints()
*/
private Map getDefaultHints()
private Map<RenderingHints.Key, Object> getDefaultHints()
{
HashMap defaultHints = new HashMap();
HashMap<RenderingHints.Key, Object> defaultHints =
new HashMap<RenderingHints.Key, Object>();
defaultHints.put(RenderingHints.KEY_TEXT_ANTIALIASING,
RenderingHints.VALUE_TEXT_ANTIALIAS_DEFAULT);
@ -1972,11 +2086,27 @@ public abstract class CairoGraphics2D extends Graphics2D
if (clip == null)
return;
if (! (clip instanceof GeneralPath))
clip = new GeneralPath(clip);
GeneralPath p = (GeneralPath) clip;
p.transform(t);
// If the clip is a rectangle, and the transformation preserves the shape
// (translate/stretch only), then keep the clip as a rectangle
double[] matrix = new double[4];
t.getMatrix(matrix);
if (clip instanceof Rectangle2D && matrix[1] == 0 && matrix[2] == 0)
{
Rectangle2D rect = (Rectangle2D)clip;
double[] origin = new double[] {rect.getX(), rect.getY()};
double[] dimensions = new double[] {rect.getWidth(), rect.getHeight()};
t.transform(origin, 0, origin, 0, 1);
t.deltaTransform(dimensions, 0, dimensions, 0, 1);
rect.setRect(origin[0], origin[1], dimensions[0], dimensions[1]);
}
else
{
if (! (clip instanceof GeneralPath))
clip = new GeneralPath(clip);
GeneralPath p = (GeneralPath) clip;
p.transform(t);
}
}
private static Rectangle computeIntersection(int x, int y, int w, int h,
@ -1999,4 +2129,39 @@ public abstract class CairoGraphics2D extends Graphics2D
return rect;
}
static Rectangle2D getTransformedBounds(Rectangle2D bounds, AffineTransform tx)
{
double x1 = bounds.getX();
double x2 = bounds.getX() + bounds.getWidth();
double x3 = x1;
double x4 = x2;
double y1 = bounds.getY();
double y2 = y1;
double y3 = bounds.getY() + bounds.getHeight();
double y4 = y3;
double[] points = new double[] {x1, y1, x2, y2, x3, y3, x4, y4};
tx.transform(points, 0, points, 0, 4);
double minX = points[0];
double maxX = minX;
double minY = points[1];
double maxY = minY;
for (int i = 0; i < 8; i++)
{
if (points[i] < minX)
minX = points[i];
if (points[i] > maxX)
maxX = points[i];
i++;
if (points[i] < minY)
minY = points[i];
if (points[i] > maxY)
maxY = points[i];
}
return new Rectangle2D.Double(minX, minY, (maxX - minX), (maxY - minY));
}
}

View file

@ -1,5 +1,5 @@
/* CairoSurface.java
Copyright (C) 2006 Free Software Foundation, Inc.
Copyright (C) 2006, 2007 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@ -42,15 +42,22 @@ import gnu.java.awt.Buffers;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.Shape;
import java.awt.color.ColorSpace;
import java.awt.geom.AffineTransform;
import java.awt.image.BufferedImage;
import java.awt.image.ColorModel;
import java.awt.image.DataBuffer;
import java.awt.image.DataBufferInt;
import java.awt.image.DirectColorModel;
import java.awt.image.Raster;
import java.awt.image.RasterFormatException;
import java.awt.image.SampleModel;
import java.awt.image.SinglePixelPackedSampleModel;
import java.awt.image.WritableRaster;
import java.nio.ByteOrder;
import java.util.Arrays;
import java.util.Hashtable;
/**
@ -68,9 +75,9 @@ public class CairoSurface extends WritableRaster
long surfacePointer;
/**
* The native pointer to the image's data buffer
* Whether the data buffer is shared between java and cairo.
*/
long bufferPointer;
boolean sharedBuffer;
// FIXME: use only the cairoCM_pre colormodel
// since that's what Cairo really uses (is there a way to do this cheaply?
@ -98,22 +105,12 @@ public class CairoSurface extends WritableRaster
* @param width, height - the image size
* @param stride - the buffer row stride. (in ints)
*/
private native void create(int width, int height, int stride);
private native void create(int width, int height, int stride, int[] buf);
/**
* Destroys the cairo surface and frees the buffer.
*/
private native void destroy(long surfacePointer, long bufferPointer);
/**
* Gets buffer elements
*/
private native int nativeGetElem(long bufferPointer, int i);
/**
* Sets buffer elements.
*/
private native void nativeSetElem(long bufferPointer, int i, int val);
private native void destroy(long surfacePointer, int[] buf);
/**
* Draws this image to a given CairoGraphics context,
@ -123,33 +120,30 @@ public class CairoSurface extends WritableRaster
double[] i2u, double alpha,
int interpolation);
public void drawSurface(long contextPointer, double[] i2u, double alpha,
int interpolation)
{
nativeDrawSurface(surfacePointer, contextPointer, i2u, alpha, interpolation);
}
/**
* getPixels -return the pixels as a java array.
* Synchronizes the image's data buffers, copying any changes made in the
* Java array into the native array.
*
* This method should only be called if (sharedBuffers == false).
*/
native int[] nativeGetPixels(long bufferPointer, int size);
public int[] getPixels(int size)
{
return nativeGetPixels(bufferPointer, size);
}
native void syncNativeToJava(long surfacePointer, int[] buffer);
/**
* getPixels -return the pixels as a java array.
* Synchronizes the image's data buffers, copying any changes made in the
* native array into the Java array.
*
* This method should only be called if (sharedBuffers == false).
*/
native void nativeSetPixels(long bufferPointer, int[] pixels);
public void setPixels(int[] pixels)
{
nativeSetPixels(bufferPointer, pixels);
}
native long getFlippedBuffer(long bufferPointer, int size);
native void syncJavaToNative(long surfacePointer, int[] buffer);
/**
* Return the buffer, with the sample values of each pixel reversed
* (ie, in ABGR instead of ARGB).
*
* @return A pointer to a flipped buffer. The memory is allocated in native
* code, and must be explicitly freed when it is no longer needed.
*/
native long getFlippedBuffer(long surfacePointer);
/**
* Create a cairo_surface_t with specified width and height.
@ -158,20 +152,38 @@ public class CairoSurface extends WritableRaster
*/
public CairoSurface(int width, int height)
{
super(createCairoSampleModel(width, height),
null, new Point(0, 0));
this(0, 0, width, height);
}
public CairoSurface(int x, int y, int width, int height)
{
super(createCairoSampleModel(width, height), null, new Point(x, y));
if(width <= 0 || height <= 0)
throw new IllegalArgumentException("Image must be at least 1x1 pixels.");
this.width = width;
this.height = height;
create(width, height, width);
dataBuffer = new DataBufferInt(width * height);
create(width, height, width, getData());
if(surfacePointer == 0 || bufferPointer == 0)
if(surfacePointer == 0)
throw new Error("Could not allocate bitmap.");
dataBuffer = new CairoDataBuffer();
}
/**
* Create a Cairo Surface that is a subimage of another Cairo Surface
*/
public CairoSurface(SampleModel sm, CairoSurface parent, Rectangle bounds,
Point origin)
{
super(sm, parent.dataBuffer, bounds, origin, parent);
this.width = super.width;
this.height = super.height;
this.surfacePointer = parent.surfacePointer;
this.sharedBuffer = parent.sharedBuffer;
this.dataBuffer = parent.dataBuffer;
}
/**
@ -188,39 +200,39 @@ public class CairoSurface extends WritableRaster
// Swap ordering from GdkPixbuf to Cairo
if (ByteOrder.nativeOrder() == ByteOrder.BIG_ENDIAN)
{
for (int i = 0; i < data.length; i++ )
{
// On a big endian system we get a RRGGBBAA data array.
int alpha = data[i] & 0xFF;
if( alpha == 0 ) // I do not know why we need this, but it works.
data[i] = 0;
else
{
// Cairo needs a ARGB32 native array.
data[i] = (data[i] >>> 8) | (alpha << 24);
}
}
for (int i = 0; i < data.length; i++ )
{
// On a big endian system we get a RRGGBBAA data array.
int alpha = data[i] & 0xFF;
if( alpha == 0 ) // I do not know why we need this, but it works.
data[i] = 0;
else
{
// Cairo needs a ARGB32 native array.
data[i] = (data[i] >>> 8) | (alpha << 24);
}
}
}
else
{
for (int i = 0; i < data.length; i++ )
{
// On a little endian system we get a AABBGGRR data array.
int alpha = data[i] & 0xFF000000;
if( alpha == 0 ) // I do not know why we need this, but it works.
data[i] = 0;
else
{
int b = (data[i] & 0xFF0000) >> 16;
int g = (data[i] & 0xFF00);
int r = (data[i] & 0xFF) << 16;
// Cairo needs a ARGB32 native array.
data[i] = alpha | r | g | b;
}
}
for (int i = 0; i < data.length; i++ )
{
// On a little endian system we get a AABBGGRR data array.
int alpha = data[i] & 0xFF000000;
if( alpha == 0 ) // I do not know why we need this, but it works.
data[i] = 0;
else
{
int b = (data[i] & 0xFF0000) >> 16;
int g = (data[i] & 0xFF00);
int r = (data[i] & 0xFF) << 16;
// Cairo needs a ARGB32 native array.
data[i] = alpha | r | g | b;
}
}
}
setPixels( data );
System.arraycopy(data, 0, getData(), 0, data.length);
}
/**
@ -228,8 +240,8 @@ public class CairoSurface extends WritableRaster
*/
public void dispose()
{
if(surfacePointer != 0)
destroy(surfacePointer, bufferPointer);
if(surfacePointer != 0 && parent == null)
destroy(surfacePointer, getData());
}
/**
@ -245,8 +257,17 @@ public class CairoSurface extends WritableRaster
*/
public GtkImage getGtkImage()
{
return new GtkImage( width, height,
getFlippedBuffer(bufferPointer, width * height ));
return new GtkImage(width, height, getFlippedBuffer(surfacePointer));
}
/**
* Convenience method to quickly grab the data array backing this Raster.
*
* @return The array behind the databuffer.
*/
public int[] getData()
{
return ((DataBufferInt)dataBuffer).getData();
}
/**
@ -276,34 +297,6 @@ public class CairoSurface extends WritableRaster
new Hashtable());
}
private class CairoDataBuffer extends DataBuffer
{
public CairoDataBuffer()
{
super(DataBuffer.TYPE_INT, width * height);
}
/**
* DataBuffer.getElem implementation
*/
public int getElem(int bank, int i)
{
if(bank != 0 || i < 0 || i >= width * height)
throw new IndexOutOfBoundsException(i+" size: "+width * height);
return nativeGetElem(bufferPointer, i);
}
/**
* DataBuffer.setElem implementation
*/
public void setElem(int bank, int i, int val)
{
if(bank != 0 || i < 0 || i >= width*height)
throw new IndexOutOfBoundsException(i+" size: "+width * height);
nativeSetElem(bufferPointer, i, val);
}
}
/**
* Return a Graphics2D drawing to the CairoSurface.
*/
@ -325,16 +318,25 @@ public class CairoSurface extends WritableRaster
}
/**
* Copy an area of the surface. Expects parameters must be within bounds.
* Count on a segfault otherwise.
* Copy a portion of this surface to another area on the surface. The given
* parameters must be within bounds - count on a segfault otherwise.
*
* @param x The x coordinate of the area to be copied from.
* @param y The y coordinate of the area to be copied from.
* @param width The width of the area to be copied.
* @param height The height of the area to be copied.
* @param dx The destination x coordinate.
* @param dy The destination y coordinate.
* @param stride The scanline stride.
*/
native void copyAreaNative2(long bufferPointer, int x, int y, int width,
int height, int dx, int dy, int stride);
public void copyAreaNative(int x, int y, int width,
int height, int dx, int dy, int stride)
{
copyAreaNative2(bufferPointer, x, y, width, height, dx, dy, stride);
copyAreaNative2(surfacePointer, x, y, width, height, dx, dy, stride);
}
native void copyAreaNative2(long surfacePointer,
int x, int y, int width, int height,
int dx, int dy, int stride);
/**
* Creates a SampleModel that matches Cairo's native format
@ -345,4 +347,83 @@ public class CairoSurface extends WritableRaster
new int[]{0x00FF0000, 0x0000FF00,
0x000000FF, 0xFF000000});
}
/**
* Returns whether this ColorModel is compatible with Cairo's native types.
*
* @param cm The color model to check.
* @return Whether it is compatible.
*/
public static boolean isCompatibleColorModel(ColorModel cm)
{
return (cm.equals(cairoCM_pre) || cm.equals(cairoCM_opaque) ||
cm.equals(cairoColorModel));
}
/**
* Returns whether this SampleModel is compatible with Cairo's native types.
*
* @param sm The sample model to check.
* @return Whether it is compatible.
*/
public static boolean isCompatibleSampleModel(SampleModel sm)
{
return (sm instanceof SinglePixelPackedSampleModel
&& sm.getDataType() == DataBuffer.TYPE_INT
&& Arrays.equals(((SinglePixelPackedSampleModel)sm).getBitMasks(),
new int[]{0x00FF0000, 0x0000FF00,
0x000000FF, 0xFF000000}));
}
///// Methods interhited from Raster and WritableRaster /////
public Raster createChild(int parentX, int parentY, int width, int height,
int childMinX, int childMinY, int[] bandList)
{
return createWritableChild(parentX, parentY, width, height,
childMinX, childMinY, bandList);
}
public WritableRaster createCompatibleWritableRaster()
{
return new CairoSurface(width, height);
}
public WritableRaster createCompatibleWritableRaster (int x, int y,
int w, int h)
{
return new CairoSurface(x, y, w, h);
}
public Raster createTranslatedChild(int childMinX, int childMinY)
{
return createWritableTranslatedChild(childMinX, childMinY);
}
public WritableRaster createWritableChild(int parentX, int parentY,
int w, int h, int childMinX,
int childMinY, int[] bandList)
{
if (parentX < minX || parentX + w > minX + width
|| parentY < minY || parentY + h > minY + height)
throw new RasterFormatException("Child raster extends beyond parent");
SampleModel sm = (bandList == null) ?
sampleModel :
sampleModel.createSubsetSampleModel(bandList);
return new CairoSurface(sm, this,
new Rectangle(childMinX, childMinY, w, h),
new Point(sampleModelTranslateX + childMinX - parentX,
sampleModelTranslateY + childMinY - parentY));
}
public WritableRaster createWritableTranslatedChild(int x, int y)
{
int tcx = sampleModelTranslateX - minX + x;
int tcy = sampleModelTranslateY - minY + y;
return new CairoSurface(sampleModel, this,
new Rectangle(x, y, width, height),
new Point(tcx, tcy));
}
}

View file

@ -40,6 +40,7 @@ package gnu.java.awt.peer.gtk;
import java.awt.AlphaComposite;
import java.awt.Color;
import java.awt.Composite;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.GraphicsConfiguration;
@ -50,7 +51,6 @@ import java.awt.Shape;
import java.awt.Toolkit;
import java.awt.font.GlyphVector;
import java.awt.geom.AffineTransform;
import java.awt.geom.Point2D;
import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage;
import java.awt.image.ColorModel;
@ -116,6 +116,18 @@ public class CairoSurfaceGraphics extends CairoGraphics2D
*/
public void draw(Shape s)
{
if (!surface.sharedBuffer)
surface.syncJavaToNative(surface.surfacePointer, surface.getData());
// Find total bounds of shape
Rectangle r = findStrokedBounds(s);
if (shiftDrawCalls)
{
r.width++;
r.height++;
}
// Do the drawing
if (comp == null || comp instanceof AlphaComposite)
super.draw(s);
@ -126,14 +138,21 @@ public class CairoSurfaceGraphics extends CairoGraphics2D
Graphics2D g2d = (Graphics2D)buffer.getGraphics();
g2d.setStroke(this.getStroke());
g2d.setColor(this.getColor());
g2d.setTransform(transform);
g2d.draw(s);
drawComposite(s.getBounds2D(), null);
drawComposite(r.getBounds2D(), null);
}
if (!surface.sharedBuffer)
surface.syncNativeToJava(surface.surfacePointer, surface.getData());
}
public void fill(Shape s)
{
if (!surface.sharedBuffer)
surface.syncJavaToNative(surface.surfacePointer, surface.getData());
if (comp == null || comp instanceof AlphaComposite)
super.fill(s);
@ -144,14 +163,21 @@ public class CairoSurfaceGraphics extends CairoGraphics2D
Graphics2D g2d = (Graphics2D)buffer.getGraphics();
g2d.setPaint(this.getPaint());
g2d.setColor(this.getColor());
g2d.setTransform(transform);
g2d.fill(s);
drawComposite(s.getBounds2D(), null);
}
if (!surface.sharedBuffer)
surface.syncNativeToJava(surface.surfacePointer, surface.getData());
}
public void drawRenderedImage(RenderedImage image, AffineTransform xform)
{
if (!surface.sharedBuffer)
surface.syncJavaToNative(surface.surfacePointer, surface.getData());
if (comp == null || comp instanceof AlphaComposite)
super.drawRenderedImage(image, xform);
@ -161,18 +187,25 @@ public class CairoSurfaceGraphics extends CairoGraphics2D
Graphics2D g2d = (Graphics2D)buffer.getGraphics();
g2d.setRenderingHints(this.getRenderingHints());
g2d.setTransform(transform);
g2d.drawRenderedImage(image, xform);
drawComposite(buffer.getRaster().getBounds(), null);
}
if (!surface.sharedBuffer)
surface.syncNativeToJava(surface.surfacePointer, surface.getData());
}
protected boolean drawImage(Image img, AffineTransform xform,
Color bgcolor, ImageObserver obs)
{
if (!surface.sharedBuffer)
surface.syncJavaToNative(surface.surfacePointer, surface.getData());
boolean ret;
if (comp == null || comp instanceof AlphaComposite)
return super.drawImage(img, xform, bgcolor, obs);
ret = super.drawImage(img, xform, bgcolor, obs);
else
{
@ -187,14 +220,10 @@ public class CairoSurfaceGraphics extends CairoGraphics2D
BufferedImage bImg = (BufferedImage) img;
// Find translated bounds
Point2D origin = new Point2D.Double(bImg.getMinX(), bImg.getMinY());
Point2D pt = new Point2D.Double(bImg.getWidth() + bImg.getMinX(),
bImg.getHeight() + bImg.getMinY());
Rectangle2D bounds = new Rectangle(bImg.getMinX(), bImg.getMinY(),
bImg.getWidth(), bImg.getHeight());
if (xform != null)
{
origin = xform.transform(origin, origin);
pt = xform.transform(pt, pt);
}
bounds = getTransformedBounds(bounds, xform);
// Create buffer and draw image
createBuffer();
@ -204,15 +233,20 @@ public class CairoSurfaceGraphics extends CairoGraphics2D
g2d.drawImage(img, xform, obs);
// Perform compositing
return drawComposite(new Rectangle2D.Double(origin.getX(),
origin.getY(),
pt.getX(), pt.getY()),
obs);
ret = drawComposite(bounds, obs);
}
if (!surface.sharedBuffer)
surface.syncNativeToJava(surface.surfacePointer, surface.getData());
return ret;
}
public void drawGlyphVector(GlyphVector gv, float x, float y)
{
if (!surface.sharedBuffer)
surface.syncJavaToNative(surface.surfacePointer, surface.getData());
if (comp == null || comp instanceof AlphaComposite)
super.drawGlyphVector(gv, x, y);
@ -230,51 +264,64 @@ public class CairoSurfaceGraphics extends CairoGraphics2D
bounds.getWidth(), bounds.getHeight());
drawComposite(bounds, null);
}
if (!surface.sharedBuffer)
surface.syncNativeToJava(surface.surfacePointer, surface.getData());
}
private boolean drawComposite(Rectangle2D bounds, ImageObserver observer)
{
// Clip source to visible areas that need updating
Rectangle2D clip = this.getClipBounds();
Rectangle2D.intersect(bounds, clip, bounds);
clip = new Rectangle(buffer.getMinX(), buffer.getMinY(),
buffer.getWidth(), buffer.getHeight());
Rectangle2D.intersect(bounds, clip, bounds);
// Find bounds in device space
bounds = getTransformedBounds(bounds, transform);
// Clip bounds by the stored clip, and by the internal buffer
Rectangle2D devClip = this.getClipInDevSpace();
Rectangle2D.intersect(bounds, devClip, bounds);
devClip = new Rectangle(buffer.getMinX(), buffer.getMinY(),
buffer.getWidth(), buffer.getHeight());
Rectangle2D.intersect(bounds, devClip, bounds);
// Round bounds as needed, but be careful in our rounding
// (otherwise it may leave unpainted stripes)
double x = bounds.getX();
double y = bounds.getY();
double maxX = x + bounds.getWidth();
double maxY = y + bounds.getHeight();
x = Math.round(x);
y = Math.round(y);
bounds.setRect(x, y, Math.round(maxX - x), Math.round(maxY - y));
// Find subimage of internal buffer for updating
BufferedImage buffer2 = buffer;
if (!bounds.equals(buffer2.getRaster().getBounds()))
buffer2 = buffer2.getSubimage((int)bounds.getX(), (int)bounds.getY(),
(int)bounds.getWidth(),
(int)bounds.getHeight());
// Get destination clip to bounds
double[] points = new double[] {bounds.getX(), bounds.getY(),
bounds.getMaxX(), bounds.getMaxY()};
transform.transform(points, 0, points, 0, 2);
Rectangle2D deviceBounds = new Rectangle2D.Double(points[0], points[1],
points[2] - points[0],
points[3] - points[1]);
Rectangle2D.intersect(deviceBounds, this.getClipInDevSpace(), deviceBounds);
// Find subimage of main image for updating
BufferedImage current = CairoSurface.getBufferedImage(surface);
current = current.getSubimage((int)deviceBounds.getX(),
(int)deviceBounds.getY(),
(int)deviceBounds.getWidth(),
(int)deviceBounds.getHeight());
current = current.getSubimage((int)bounds.getX(), (int)bounds.getY(),
(int)bounds.getWidth(),
(int)bounds.getHeight());
// Perform actual composite operation
compCtx.compose(buffer2.getRaster(), current.getRaster(),
buffer2.getRaster());
// Set cairo's composite to direct SRC, since we've already done our own
// compositing
Composite oldcomp = comp;
setComposite(AlphaComposite.Src);
// This MUST call directly into the "action" method in CairoGraphics2D,
// not one of the wrappers, to ensure that the composite isn't processed
// more than once!
boolean rv = super.drawImage(buffer2,
AffineTransform.getTranslateInstance(bounds.getX(),
bounds.getY()),
new Color(0,0,0,0), null);
null, null);
setComposite(oldcomp);
updateColor();
return rv;
}

View file

@ -52,7 +52,6 @@ import java.awt.Shape;
import java.awt.Toolkit;
import java.awt.font.GlyphVector;
import java.awt.geom.AffineTransform;
import java.awt.geom.Line2D;
import java.awt.geom.Point2D;
import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage;
@ -78,7 +77,7 @@ public class ComponentGraphics extends CairoGraphics2D
protected long cairo_t;
private BufferedImage buffer, componentBuffer;
private static ThreadLocal hasLock = new ThreadLocal();
private static ThreadLocal<Integer> hasLock = new ThreadLocal<Integer>();
private static Integer ONE = Integer.valueOf(1);
ComponentGraphics()
@ -122,11 +121,11 @@ public class ComponentGraphics extends CairoGraphics2D
*/
private void lock()
{
Integer i = (Integer) hasLock.get();
Integer i = hasLock.get();
if (i == null)
{
start_gdk_drawing();
hasLock.set(ONE);
start_gdk_drawing();
hasLock.set(ONE);
}
else
hasLock.set(Integer.valueOf(i.intValue() + 1));
@ -137,14 +136,16 @@ public class ComponentGraphics extends CairoGraphics2D
*/
private void unlock()
{
Integer i = (Integer) hasLock.get();
Integer i = hasLock.get();
if (i == null)
throw new IllegalStateException();
if (i == ONE)
{
hasLock.set(null);
end_gdk_drawing();
hasLock.set(null);
end_gdk_drawing();
}
else if (i.intValue() == 2)
hasLock.set(ONE);
else
hasLock.set(Integer.valueOf(i.intValue() - 1));
}
@ -176,11 +177,11 @@ public class ComponentGraphics extends CairoGraphics2D
private static native Pointer nativeGrab(GtkComponentPeer component);
private native void copyAreaNative(GtkComponentPeer component, int x, int y,
int width, int height, int dx, int dy);
int width, int height, int dx, int dy);
private native void drawVolatile(GtkComponentPeer component,
long vimg, int x, int y,
int width, int height, int cx, int cy,
long vimg, int x, int y,
int width, int height, int cx, int cy,
int cw, int ch);
/**
@ -232,16 +233,16 @@ public class ComponentGraphics extends CairoGraphics2D
{
if (comp == null || comp instanceof AlphaComposite)
super.draw(s);
else
{
createBuffer();
Graphics2D g2d = (Graphics2D)buffer.getGraphics();
g2d.setStroke(this.getStroke());
g2d.setColor(this.getColor());
g2d.draw(s);
drawComposite(s.getBounds2D(), null);
}
}
@ -250,16 +251,16 @@ public class ComponentGraphics extends CairoGraphics2D
{
if (comp == null || comp instanceof AlphaComposite)
super.fill(s);
else
{
createBuffer();
Graphics2D g2d = (Graphics2D)buffer.getGraphics();
g2d.setPaint(this.getPaint());
g2d.setColor(this.getColor());
g2d.fill(s);
drawComposite(s.getBounds2D(), null);
}
}
@ -268,7 +269,7 @@ public class ComponentGraphics extends CairoGraphics2D
{
if (comp == null || comp instanceof AlphaComposite)
super.drawRenderedImage(image, xform);
else
{
createBuffer();
@ -276,7 +277,7 @@ public class ComponentGraphics extends CairoGraphics2D
Graphics2D g2d = (Graphics2D)buffer.getGraphics();
g2d.setRenderingHints(this.getRenderingHints());
g2d.drawRenderedImage(image, xform);
drawComposite(buffer.getRaster().getBounds(), null);
}
}
@ -287,7 +288,7 @@ public class ComponentGraphics extends CairoGraphics2D
boolean rv;
if (comp == null || comp instanceof AlphaComposite)
rv = super.drawImage(img, xform, bgcolor, obs);
else
{
// Get buffered image of source
@ -299,7 +300,7 @@ public class ComponentGraphics extends CairoGraphics2D
img = Toolkit.getDefaultToolkit().createImage(source);
}
BufferedImage bImg = (BufferedImage) img;
// Find translated bounds
Point2D origin = new Point2D.Double(bImg.getMinX(), bImg.getMinY());
Point2D pt = new Point2D.Double(bImg.getWidth() + bImg.getMinX(),
@ -309,18 +310,18 @@ public class ComponentGraphics extends CairoGraphics2D
origin = xform.transform(origin, origin);
pt = xform.transform(pt, pt);
}
// Create buffer and draw image
createBuffer();
Graphics2D g2d = (Graphics2D)buffer.getGraphics();
g2d.setRenderingHints(this.getRenderingHints());
g2d.drawImage(img, xform, obs);
// Perform compositing
rv = drawComposite(new Rectangle2D.Double(origin.getX(),
origin.getY(),
pt.getX(), pt.getY()),
origin.getY(),
pt.getX(), pt.getY()),
obs);
}
return rv;
@ -330,7 +331,7 @@ public class ComponentGraphics extends CairoGraphics2D
{
if (comp == null || comp instanceof AlphaComposite)
super.drawGlyphVector(gv, x, y);
else
{
createBuffer();
@ -339,7 +340,7 @@ public class ComponentGraphics extends CairoGraphics2D
g2d.setPaint(this.getPaint());
g2d.setStroke(this.getStroke());
g2d.drawGlyphVector(gv, x, y);
Rectangle2D bounds = gv.getLogicalBounds();
bounds = new Rectangle2D.Double(x + bounds.getX(), y + bounds.getY(),
bounds.getWidth(), bounds.getHeight());
@ -373,8 +374,8 @@ public class ComponentGraphics extends CairoGraphics2D
(int) r.getHeight());
return true;
}
else
return super.drawImage(vimg.getSnapshot(), x, y, observer);
else
return super.drawImage(vimg.getSnapshot(), x, y, observer);
}
BufferedImage bimg;
@ -382,7 +383,7 @@ public class ComponentGraphics extends CairoGraphics2D
bimg = (BufferedImage) img;
else
{
ImageProducer source = img.getSource();
ImageProducer source = img.getSource();
if (source == null)
return false;
bimg = (BufferedImage) Toolkit.getDefaultToolkit().createImage(source);
@ -418,9 +419,9 @@ public class ComponentGraphics extends CairoGraphics2D
(int) r.getHeight());
return true;
}
else
return super.drawImage(vimg.getSnapshot(), x, y,
width, height, observer);
else
return super.drawImage(vimg.getSnapshot(), x, y,
width, height, observer);
}
BufferedImage bimg;
@ -429,7 +430,7 @@ public class ComponentGraphics extends CairoGraphics2D
bimg = (BufferedImage) img;
else
{
ImageProducer source = img.getSource();
ImageProducer source = img.getSource();
if (source == null)
return false;
bimg = (BufferedImage) Toolkit.getDefaultToolkit().createImage(source);
@ -458,8 +459,8 @@ public class ComponentGraphics extends CairoGraphics2D
transform.transform(points, 0, points, 0, 2);
Rectangle2D deviceBounds = new Rectangle2D.Double(points[0], points[1],
points[2] - points[0],
points[3] - points[1]);
points[2] - points[0],
points[3] - points[1]);
Rectangle2D.intersect(deviceBounds, this.getClipInDevSpace(), deviceBounds);
@ -519,8 +520,8 @@ public class ComponentGraphics extends CairoGraphics2D
new Point(0,0));
componentBuffer = new BufferedImage(GtkVolatileImage.gdkColorModel, rst,
GtkVolatileImage.gdkColorModel.isAlphaPremultiplied(),
new Hashtable());
GtkVolatileImage.gdkColorModel.isAlphaPremultiplied(),
new Hashtable());
}
}
@ -723,7 +724,7 @@ public class ComponentGraphics extends CairoGraphics2D
unlock();
}
}
@Override
protected void cairoRectangle(long pointer, double x, double y,
double width, double height)
@ -908,4 +909,33 @@ public class ComponentGraphics extends CairoGraphics2D
unlock();
}
}
@Override
protected void cairoSetAntialias(long pointer, boolean aa)
{
try
{
lock();
super.cairoSetAntialias(pointer, aa);
}
finally
{
unlock();
}
}
@Override
protected void drawCairoSurface(CairoSurface surface, AffineTransform tx,
double alpha, int interpolation)
{
try
{
lock();
super.drawCairoSurface(surface, tx, alpha, interpolation);
}
finally
{
unlock();
}
}
}

View file

@ -79,6 +79,11 @@ public class FreetypeGlyphVector extends GlyphVector
* The glyph codes
*/
private int[] glyphCodes;
/**
* The set of fonts used in this glyph vector.
*/
private long[] fontSet = null;
/**
* Glyph transforms. (de facto only the translation is used)
@ -86,6 +91,19 @@ public class FreetypeGlyphVector extends GlyphVector
private AffineTransform[] glyphTransforms;
private GlyphMetrics[] metricsCache;
private native void dispose(long[] fonts);
/**
* Returns a pointer to the native PangoFcFont object.
*
* The object will be referenced with g_object_ref n times before being
* returned, and must be unreferenced a corresponding number of times.
*
* @param n Number of times to reference the object.
* @return Pointer to the native default font.
*/
private native long getNativeFontPointer(int n);
/**
* Create a glyphvector from a given (Freetype) font and a String.
@ -112,11 +130,11 @@ public class FreetypeGlyphVector extends GlyphVector
getGlyphs();
if( flags == Font.LAYOUT_RIGHT_TO_LEFT )
{
// reverse the glyph ordering.
int[] temp = new int[ nGlyphs ];
for(int i = 0; i < nGlyphs; i++)
temp[ i ] = glyphCodes[ nGlyphs - i - 1];
glyphCodes = temp;
// reverse the glyph ordering.
int[] temp = new int[ nGlyphs ];
for(int i = 0; i < nGlyphs; i++)
temp[i] = glyphCodes[nGlyphs - i - 1];
glyphCodes = temp;
}
performDefaultLayout();
}
@ -135,6 +153,13 @@ public class FreetypeGlyphVector extends GlyphVector
glyphCodes = new int[ codes.length ];
System.arraycopy(codes, 0, glyphCodes, 0, codes.length);
nGlyphs = glyphCodes.length;
if (fontSet == null)
{
fontSet = new long[nGlyphs];
Arrays.fill(fontSet, getNativeFontPointer(nGlyphs));
}
performDefaultLayout();
}
@ -152,11 +177,12 @@ public class FreetypeGlyphVector extends GlyphVector
if( gv.metricsCache != null )
{
metricsCache = new GlyphMetrics[ nGlyphs ];
System.arraycopy(gv.metricsCache, 0, metricsCache, 0, nGlyphs);
metricsCache = new GlyphMetrics[ nGlyphs ];
System.arraycopy(gv.metricsCache, 0, metricsCache, 0, nGlyphs);
}
glyphCodes = new int[ nGlyphs ];
fontSet = new long[nGlyphs];
glyphPositions = new float[(nGlyphs + 1) * 2];
glyphTransforms = new AffineTransform[ nGlyphs ];
for(int i = 0; i < nGlyphs; i++ )
@ -166,6 +192,13 @@ public class FreetypeGlyphVector extends GlyphVector
}
System.arraycopy(gv.glyphPositions, 0, glyphPositions, 0,
glyphPositions.length);
System.arraycopy(gv.glyphCodes, 0, glyphCodes, 0, nGlyphs);
System.arraycopy(gv.fontSet, 0, fontSet, 0, nGlyphs);
}
public void finalize()
{
dispose(fontSet);
}
/**
@ -175,16 +208,17 @@ public class FreetypeGlyphVector extends GlyphVector
{
nGlyphs = s.codePointCount( 0, s.length() );
glyphCodes = new int[ nGlyphs ];
fontSet = new long[ nGlyphs ];
int[] codePoints = new int[ nGlyphs ];
int stringIndex = 0;
for(int i = 0; i < nGlyphs; i++)
{
codePoints[i] = s.codePointAt( stringIndex );
codePoints[i] = s.codePointAt( stringIndex );
// UTF32 surrogate handling
if( codePoints[i] != (int)s.charAt( stringIndex ) )
stringIndex ++;
stringIndex ++;
if( codePoints[i] != (int)s.charAt( stringIndex ) )
stringIndex ++;
stringIndex ++;
if (Character.isISOControl(codePoints[i]))
{
@ -194,22 +228,22 @@ public class FreetypeGlyphVector extends GlyphVector
}
}
glyphCodes = getGlyphs( codePoints );
getGlyphs( codePoints, glyphCodes, fontSet );
}
/**
* Returns the glyph code within the font for a given character
*/
public native int[] getGlyphs(int[] codepoints);
public native void getGlyphs(int[] codepoints, int[] glyphs, long[] fonts);
/**
* Returns the kerning of a glyph pair
*/
private native Point2D getKerning(int leftGlyph, int rightGlyph);
private native Point2D getKerning(int leftGlyph, int rightGlyph, long font);
private native double[] getMetricsNative( int glyphCode );
private native double[] getMetricsNative(int glyphCode, long font);
private native GeneralPath getGlyphOutlineNative(int glyphIndex);
private native GeneralPath getGlyphOutlineNative(int glyphIndex, long font);
public Object clone()
@ -267,10 +301,12 @@ public class FreetypeGlyphVector extends GlyphVector
x += gm.getAdvanceX();
y += gm.getAdvanceY();
if (i != nGlyphs-1)
// Get the kerning only if it's not the last glyph, and the two glyphs are
// using the same font
if (i != nGlyphs-1 && fontSet[i] == fontSet[i+1])
{
Point2D p = getKerning(glyphCodes[i], glyphCodes[i + 1]);
Point2D p = getKerning(glyphCodes[i], glyphCodes[i + 1], fontSet[i]);
x += p.getX();
y += p.getY();
}
@ -291,7 +327,7 @@ public class FreetypeGlyphVector extends GlyphVector
* Returns multiple glyphcodes.
*/
public int[] getGlyphCodes(int beginGlyphIndex, int numEntries,
int[] codeReturn)
int[] codeReturn)
{
int[] rval;
@ -305,6 +341,26 @@ public class FreetypeGlyphVector extends GlyphVector
return rval;
}
/**
* Returns pointers to the fonts used in this glyph vector.
*
* The array index matches that of the glyph vector itself.
*/
protected long[] getGlyphFonts(int beginGlyphIndex, int numEntries,
long[] codeReturn)
{
long[] rval;
if( codeReturn == null || codeReturn.length < numEntries)
rval = new long[ numEntries ];
else
rval = codeReturn;
System.arraycopy(fontSet, beginGlyphIndex, rval, 0, numEntries);
return rval;
}
public Shape getGlyphLogicalBounds(int glyphIndex)
{
GlyphMetrics gm = getGlyphMetrics( glyphIndex );
@ -335,26 +391,24 @@ public class FreetypeGlyphVector extends GlyphVector
for(int i = 0; i < nGlyphs; i++)
{
GlyphMetrics gm = (GlyphMetrics)
peer.getGlyphMetrics( glyphCodes[ i ] );
if( gm == null )
{
double[] val = getMetricsNative( glyphCodes[ i ] );
if( val == null )
gm = null;
else
{
gm = new GlyphMetrics( true,
(float)val[1],
(float)val[2],
new Rectangle2D.Double
( val[3], val[4],
val[5], val[6] ),
GlyphMetrics.STANDARD );
peer.putGlyphMetrics( glyphCodes[ i ], gm );
}
}
metricsCache[ i ] = gm;
GlyphMetrics gm = (GlyphMetrics)peer.getGlyphMetrics(glyphCodes[i]);
if( gm == null )
{
double[] val = getMetricsNative(glyphCodes[i], fontSet[i]);
if( val == null )
gm = null;
else
{
gm = new GlyphMetrics(true,
(float)val[1],
(float)val[2],
new Rectangle2D.Double(val[3], val[4],
val[5], val[6] ),
GlyphMetrics.STANDARD );
peer.putGlyphMetrics( glyphCodes[ i ], gm );
}
}
metricsCache[ i ] = gm;
}
}
@ -371,13 +425,21 @@ public class FreetypeGlyphVector extends GlyphVector
/**
* Returns the outline of a single glyph.
*
* Despite what the Sun API says, this method returns the glyph relative to
* the origin of the *entire string*, not each individual glyph.
*/
public Shape getGlyphOutline(int glyphIndex)
{
GeneralPath gp = getGlyphOutlineNative( glyphCodes[ glyphIndex ] );
if (glyphTransforms[glyphIndex] != null)
gp.transform( glyphTransforms[glyphIndex]);
GeneralPath gp = getGlyphOutlineNative(glyphCodes[glyphIndex],
fontSet[glyphIndex]);
AffineTransform tx = AffineTransform.getTranslateInstance(glyphPositions[glyphIndex*2],
glyphPositions[glyphIndex*2+1]);
if (glyphTransforms[glyphIndex] != null)
tx.concatenate( glyphTransforms[glyphIndex]);
gp.transform(tx);
return gp;
}
@ -432,7 +494,6 @@ public class FreetypeGlyphVector extends GlyphVector
return logicalBounds;
Rectangle2D rect = (Rectangle2D)getGlyphLogicalBounds( 0 );
AffineTransform tx = new AffineTransform();
for( int i = 1; i < nGlyphs; i++ )
{
Rectangle2D r2 = (Rectangle2D)getGlyphLogicalBounds( i );
@ -458,14 +519,8 @@ public class FreetypeGlyphVector extends GlyphVector
public Shape getOutline()
{
GeneralPath path = new GeneralPath();
AffineTransform tx = new AffineTransform();
for( int i = 0; i < getNumGlyphs(); i++ )
{
Shape outline = getGlyphOutline(i);
tx.setToTranslation(glyphPositions[i*2], glyphPositions[i*2 +1]);
outline = tx.createTransformedShape(outline);
path.append(outline, false);
}
path.append(getGlyphOutline(i), false);
return path;
}

Some files were not shown because too many files have changed in this diff Show more