changeset 120:536e43f63c81

Comprehensive update for Win32/Linux32 dmd-2.053/dmd-1.068+Tango-r5661 ===D2=== * added [Try]Immutable/Const/Shared templates to work with differenses in D1/D2 instead of version statements used these templates to work with strict type storage rules of dmd-2.053 * com.ibm.icu now also compilable with D2, but not tested yet * small fixes Snippet288 - shared data is in TLS ===Phobos=== * fixed critical bugs in Phobos implemention completely incorrect segfault prone fromStringz (Linux's port ruthless killer) terrible, incorrect StringBuffer realization (StyledText killer) * fixed small bugs as well Snippet72 - misprint in the snippet * implemented missed functionality for Phobos ByteArrayOutputStream implemented (image loading available) formatting correctly works for all DWT's cases As a result, folowing snippets now works with Phobos (Snippet### - what is fixed): Snippet24, 42, 111, 115, 130, 235, 276 - bad string formatting Snippet48, 282 - crash on image loading Snippet163, 189, 211, 213, 217, 218, 222 - crash on copy/cut in StyledText Snippet244 - hang-up ===Tango=== * few changes for the latest Tango trunc-r5661 * few small performance improvments ===General=== * implMissing-s for only one version changed to implMissingInTango/InPhobos * incorrect calls to Format in toString-s fixed * fixed loading \uXXXX characters in ResourceBundle * added good UTF-8 support for StyledText, TextLayout (Win32) and friends UTF functions revised and tested. It is now in java.nonstandard.*Utf modules StyledText and TextLayout (Win32) modules revised for UTF-8 support * removed small diferences in most identical files in *.swt.* folders *.swt.internal.image, *.swt.events and *.swt.custom are identical in Win32/Linux32 now 179 of 576 (~31%) files in *.swt.* folders are fully identical * Win32: snippets now have right subsystem, pretty icons and native system style controls * small fixes in snippets Snippet44 - it's not Snippet44 Snippet212 - functions work with different images and offsets arrays Win32: Snippet282 - crash on close if the button has an image Snippet293 - setGrayed is commented and others Win32: As a result, folowing snippets now works Snippet68 - color doesn't change Snippet163, 189, 211, 213, 217, 218, 222 - UTF-8 issues (see above) Snippet193 - no tabel headers
author Denis Shelomovskij <verylonglogin.reg@gmail.com>
date Sat, 09 Jul 2011 15:50:20 +0300
parents d00e8db0a568
children dc6fc593e8d7
files base/src/java/io/ByteArrayOutputStream.d base/src/java/io/File.d base/src/java/io/FileInputStream.d base/src/java/io/FileOutputStream.d base/src/java/io/InputStream.d base/src/java/io/OutputStream.d base/src/java/lang/Byte.d base/src/java/lang/Character.d base/src/java/lang/Double.d base/src/java/lang/Float.d base/src/java/lang/Integer.d base/src/java/lang/Long.d base/src/java/lang/Math.d base/src/java/lang/Short.d base/src/java/lang/String.d base/src/java/lang/StringBuffer.d base/src/java/lang/System.d base/src/java/lang/Thread.d base/src/java/lang/exceptions.d base/src/java/lang/util.d base/src/java/lang/wrappers.d base/src/java/nonstandard/Locale.d base/src/java/nonstandard/SafeUtf.d base/src/java/nonstandard/UnsafeUtf.d base/src/java/nonstandard/UtfBase.d base/src/java/util/ArrayList.d base/src/java/util/HashMap.d base/src/java/util/HashSet.d base/src/java/util/IdentityHashMap.d base/src/java/util/LinkedList.d base/src/java/util/ResourceBundle.d base/src/java/util/Timer.d base/src/java/util/TreeMap.d base/src/java/util/TreeSet.d base/src/java/util/zip/InflaterInputStream.d com.ibm.icu/src/com/ibm/icu/mangoicu/ICU.d com.ibm.icu/src/com/ibm/icu/mangoicu/UBreakIterator.d com.ibm.icu/src/com/ibm/icu/mangoicu/UCalendar.d com.ibm.icu/src/com/ibm/icu/mangoicu/UChar.d com.ibm.icu/src/com/ibm/icu/mangoicu/UCollator.d com.ibm.icu/src/com/ibm/icu/mangoicu/UConverter.d com.ibm.icu/src/com/ibm/icu/mangoicu/UDateFormat.d com.ibm.icu/src/com/ibm/icu/mangoicu/UDomainName.d com.ibm.icu/src/com/ibm/icu/mangoicu/UEnumeration.d com.ibm.icu/src/com/ibm/icu/mangoicu/ULocale.d com.ibm.icu/src/com/ibm/icu/mangoicu/UMessageFormat.d com.ibm.icu/src/com/ibm/icu/mangoicu/UNormalize.d com.ibm.icu/src/com/ibm/icu/mangoicu/UNumberFormat.d com.ibm.icu/src/com/ibm/icu/mangoicu/URegex.d com.ibm.icu/src/com/ibm/icu/mangoicu/UResourceBundle.d com.ibm.icu/src/com/ibm/icu/mangoicu/USearch.d com.ibm.icu/src/com/ibm/icu/mangoicu/USet.d com.ibm.icu/src/com/ibm/icu/mangoicu/UString.d com.ibm.icu/src/com/ibm/icu/mangoicu/UStringPrep.d com.ibm.icu/src/com/ibm/icu/mangoicu/UText.d com.ibm.icu/src/com/ibm/icu/mangoicu/UTimeZone.d com.ibm.icu/src/com/ibm/icu/mangoicu/UTransform.d com.ibm.icu/src/com/ibm/icu/text/BreakIterator.d com.ibm.icu/src/com/ibm/icu/text/Collator.d com.ibm.icu/src/com/ibm/icu/text/MessageFormat.d org.eclipse.draw2d/src/org/eclipse/draw2d/geometry/Geometry.d org.eclipse.jface.text/src/org/eclipse/jface/text/DefaultDocumentAdapter.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/accessibility/ACC.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/accessibility/AccessibleAdapter.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/accessibility/AccessibleControlAdapter.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/accessibility/AccessibleControlEvent.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/accessibility/AccessibleControlListener.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/accessibility/AccessibleEvent.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/accessibility/AccessibleListener.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/accessibility/AccessibleTextAdapter.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/accessibility/AccessibleTextEvent.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/accessibility/AccessibleTextListener.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/browser/AppFileLocProvider.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/browser/HelperAppLauncherDialog.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/browser/HelperAppLauncherDialog_1_9.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/browser/LocationEvent.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/browser/Mozilla.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/browser/ProgressEvent.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/browser/StatusTextEvent.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/browser/TitleEvent.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/browser/WindowEvent.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/AnimatedProgress.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/BidiSegmentListener.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/CBanner.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/CBannerLayout.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/CCombo.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/CLabel.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/CLayoutData.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/CTabFolder.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/CTabFolder2Adapter.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/CTabFolder2Listener.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/CTabFolderAdapter.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/CTabFolderEvent.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/CTabFolderListener.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/CTabItem.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/DefaultContent.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/ExtendedModifyListener.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/LineBackgroundListener.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/LineStyleListener.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/MovementListener.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/PaintObjectEvent.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/PaintObjectListener.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/PopupList.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/ST.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/SashFormData.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/ScrolledCompositeLayout.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/StackLayout.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/StyleRange.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/StyledText.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/StyledTextContent.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/StyledTextEvent.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/StyledTextListener.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/StyledTextRenderer.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/TextChangeListener.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/TextChangedEvent.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/VerifyKeyListener.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/ViewForm.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/all.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/dnd/ImageTransfer.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/ArmEvent.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/ArmListener.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/ControlAdapter.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/ControlEvent.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/ControlListener.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/DisposeEvent.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/DisposeListener.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/DragDetectEvent.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/DragDetectListener.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/ExpandAdapter.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/ExpandEvent.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/ExpandListener.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/FocusAdapter.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/FocusEvent.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/FocusListener.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/HelpEvent.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/HelpListener.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/KeyAdapter.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/KeyEvent.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/KeyListener.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/MenuAdapter.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/MenuDetectEvent.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/MenuDetectListener.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/MenuEvent.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/MenuListener.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/ModifyEvent.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/ModifyListener.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/MouseAdapter.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/MouseListener.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/MouseMoveListener.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/MouseTrackAdapter.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/MouseTrackListener.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/MouseWheelListener.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/PaintListener.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/SelectionAdapter.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/SelectionEvent.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/SelectionListener.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/ShellAdapter.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/ShellEvent.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/ShellListener.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/TraverseEvent.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/TraverseListener.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/TreeAdapter.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/TreeEvent.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/TreeListener.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/TypedEvent.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/VerifyEvent.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/VerifyListener.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/all.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/graphics/Color.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/graphics/Cursor.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/graphics/Font.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/graphics/GC.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/graphics/ImageLoaderEvent.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/graphics/TextLayout.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/Compatibility.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/c/XInput.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/c/XTest.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/c/Xlib.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/c/Xrender.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/c/Xutil.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/c/atk.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/c/cairo.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/c/cairo_pdf.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/c/cairo_ps.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/c/cairo_xlib.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/c/cairo_xlib_xrender.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/c/gdk.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/c/gdkx.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/c/glib_object.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/c/glx.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/c/gmodule.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/c/gtk.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/c/gtk_unix_print_2_0.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/c/pango.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/c/pangocairo.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/GIFFileFormat.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/JPEGAppn.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/JPEGArithmeticConditioningTable.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/JPEGComment.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/JPEGDecoder.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/JPEGEndOfImage.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/JPEGFixedSizeSegment.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/JPEGHuffmanTable.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/JPEGQuantizationTable.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/JPEGRestartInterval.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/JPEGSegment.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/JPEGStartOfImage.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/JPEGVariableSizeSegment.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/LEDataInputStream.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/LEDataOutputStream.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/LZWNode.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/PngChunk.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/PngChunkReader.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/PngDecodingDataStream.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/PngDeflater.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/PngEncoder.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/PngFileReadState.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/PngHuffmanTable.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/PngHuffmanTables.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/PngIendChunk.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/PngIhdrChunk.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/PngInputStream.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/PngLzBlockReader.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/PngTrnsChunk.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/TIFFFileFormat.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/TIFFModifiedHuffmanCodec.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/TIFFRandomFileAccess.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/mozilla/XPCOMInit.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/mozilla/nsID.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/mozilla/nsStringAPI.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/layout/FillData.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/layout/FillLayout.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/layout/FormData.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/layout/FormLayout.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/layout/GridData.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/layout/GridLayout.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/layout/RowData.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/layout/RowLayout.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/layout/all.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/opengl/GLData.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/opengl/all.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/program/Program.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/widgets/DateTime.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/widgets/Display.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/widgets/Link.d org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/widgets/Widget.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet10.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet108.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet115.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet118.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet119.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet122.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet127.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet128.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet130.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet130a.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet132.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet133.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet134.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet14.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet140.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet142.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet143.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet144.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet146.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet147.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet150.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet153.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet16.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet162.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet169.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet174.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet190.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet195.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet206.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet207.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet208.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet21.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet212.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet214.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet215.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet217.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet222.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet224.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet235.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet237.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet24.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet242.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet244.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet245.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet247.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet25.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet250.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet251.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet268.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet269.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet275.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet276.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet282.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet288.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet289.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet293.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet294.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet33.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet39.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet42.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet43.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet44.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet45.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet46.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet60.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet62.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet66.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet68.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet7.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet72.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet74.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet75.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet81.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet82.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet92.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet94.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet96.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet98.d org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/accessibility/AccessibleControlEvent.d org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/accessibility/AccessibleEvent.d org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/custom/Bullet.d org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/custom/BusyIndicator.d org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/custom/CCombo.d org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/custom/CLabel.d org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/custom/CTabFolder.d org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/custom/CTabItem.d org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/custom/DefaultContent.d org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/custom/SashFormData.d org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/custom/StackLayout.d org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/custom/StyledText.d org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/custom/StyledTextContent.d org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/custom/StyledTextRenderer.d org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/custom/TableEditor.d org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/custom/TableTreeEditor.d org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/custom/TreeEditor.d org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/custom/ViewForm.d org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/events/ControlEvent.d org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/events/DisposeEvent.d org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/events/DragDetectEvent.d org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/events/ExpandEvent.d org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/events/FocusEvent.d org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/events/HelpEvent.d org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/events/KeyEvent.d org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/events/MenuDetectEvent.d org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/events/MenuEvent.d org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/events/ModifyEvent.d org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/events/MouseEvent.d org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/events/PaintEvent.d org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/events/SelectionEvent.d org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/events/ShellEvent.d org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/events/TraverseEvent.d org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/events/TreeEvent.d org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/events/TypedEvent.d org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/events/VerifyEvent.d org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/graphics/Color.d org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/graphics/GC.d org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/graphics/Image.d org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/graphics/ImageLoader.d org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/graphics/ImageLoaderEvent.d org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/graphics/RGB.d org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/graphics/TextLayout.d org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/graphics/TextStyle.d org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/Compatibility.d org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/Library.d org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/gdip/Gdip.d org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/gdip/native.d org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/image/FileFormat.d org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/image/GIFFileFormat.d org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/image/LEDataOutputStream.d org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/image/PngChunk.d org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/image/PngDeflater.d org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/image/PngEncoder.d org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/image/PngHuffmanTable.d org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/image/PngHuffmanTables.d org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/image/PngInputStream.d org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/image/TIFFModifiedHuffmanCodec.d org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/ole/win32/COM.d org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/ole/win32/COMTYPES.d org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/ole/win32/extras.d org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/win32/OS.d org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/win32/WINAPI.d org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/win32/WINTYPES.d org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/IME.d org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/Text.d org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/Widget.d rakefile win-res/enable-theme.xml win-res/resource.rc win-res/resource.res win-res/resource.res.build.cmd win-res/swt-logo.ico
diffstat 397 files changed, 4616 insertions(+), 5605 deletions(-) [+]
line wrap: on
line diff
--- a/base/src/java/io/ByteArrayOutputStream.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/base/src/java/io/ByteArrayOutputStream.d	Sat Jul 09 15:50:20 2011 +0300
@@ -9,6 +9,7 @@
 version(Tango){
     import tango.io.device.Array;
 } else { // Phobos
+    import std.outbuffer;
 }
 
 public class ByteArrayOutputStream : java.io.OutputStream.OutputStream {
@@ -16,13 +17,14 @@
     version(Tango){
         protected Array buffer;
     } else { // Phobos
+        protected OutBuffer buffer;
     }
 
     public this (){
         version(Tango){
             buffer = new Array(0);
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            buffer = new OutBuffer();
         }
     }
 
@@ -30,38 +32,38 @@
         version(Tango){
             buffer = new Array(par_size);
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            buffer = new OutBuffer();
+            buffer.reserve(par_size);
         }
     }
 
     public override void write( int b ){
         synchronized {
             version(Tango){
-                byte[1] a;
-                a[0] = b & 0xFF;
+                byte[1] a = b & 0xFF;
                 buffer.append(a);
             } else { // Phobos
-                implMissing( __FILE__, __LINE__ );
+                buffer.write(cast(ubyte)(b & 0xFF));
             }
         }
     }
 
-    public override void write( byte[] b, int off, int len ){
+    public override void write( in byte[] b, int off, int len ){
         synchronized {
             version(Tango){
-                buffer.append( b[ off .. off + len ]);
+                buffer.append( b[ off .. off + len ] );
             } else { // Phobos
-                implMissing( __FILE__, __LINE__ );
+                buffer.write( cast(ubyte[]) b[ off .. off + len ]);
             }
         }
     }
 
-    public override void write( byte[] b ){
+    public override void write( in byte[] b ){
         synchronized {
             version(Tango){
                 buffer.append( b );
             } else { // Phobos
-                implMissing( __FILE__, __LINE__ );
+                buffer.write( cast(ubyte[]) b );
             }
         }
     }
@@ -79,10 +81,9 @@
     public byte[] toByteArray(){
         synchronized {
             version(Tango){
-                return cast(byte[])buffer.slice();
+                return cast(byte[]) buffer.slice();
             } else { // Phobos
-                implMissing( __FILE__, __LINE__ );
-                return null;
+                return cast(byte[]) buffer.toBytes();
             }
         }
     }
@@ -107,7 +108,7 @@
         return null;
     }
 
-    public  override void close(){
+    public override void close(){
         implMissing( __FILE__, __LINE__ );
     }
 }
--- a/base/src/java/io/File.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/base/src/java/io/File.d	Sat Jul 09 15:50:20 2011 +0300
@@ -11,9 +11,14 @@
     static import tango.io.Path;
     static import tango.io.FileSystem;
     static import tango.sys.Environment;
+    static import tango.sys.Common;
+    static import tango.stdc.stringz; //for toStringz
+    version(Posix) static import tango.stdc.posix.unistd; //for access
 } else { // Phobos
     static import std.file;
     static import std.path;
+    static import std.string; //for toStringz
+    version(Posix) static import core.sys.posix.unistd; //for access
 }
 // Implement this more efficient by using FilePath in Tango 
 public class File {
@@ -32,46 +37,42 @@
             pathSeparator = tango.io.model.IFile.FileConst.SystemPathString;
             pathSeparatorChar = tango.io.model.IFile.FileConst.SystemPathChar;
         } else { // Phobos
-            version(Windows){
-                separator = "\\";
-                separatorChar = '\\';
-                pathSeparator = ";";
-                pathSeparatorChar = ';';
-            }
-            else{
-                separator = "/";
-                separatorChar = '/';
-                pathSeparator = ":";
-                pathSeparatorChar = ':';
-            }
+            separator = std.path.sep;
+            separatorChar = std.path.sep[0];
+            pathSeparator = std.path.pathsep;
+            pathSeparatorChar = std.path.pathsep[0];
         }
     }
 
-    private static String toStd( CString path ){
+    private static String toStd( String path ){
         version(Tango){
-            return tango.io.Path.standard( path._idup() );
+            return tango.io.Path.standard( path.dup );
         } else { // Phobos
-            return path._idup();
+            return path;
         }
     }
-    private static String join( CString path, CString file ){
+    private static String join( String path, String file ){
         version(Tango){
-            return tango.io.Path.join( path._idup(), file._idup() );
+            return tango.io.Path.join( toStd(path), toStd(file) );
         } else { // Phobos
-            return std.path.join( path._idup(), file._idup() );
+            return std.path.join( toStd(path), toStd(file) );
         }
     }
 
-    public this ( CString pathname ){
+    public this ( String pathname ){
         mFilePath = toStd( pathname );
     }
 
-    public this ( CString parent, CString child ){
-        mFilePath = join( toStd(parent), toStd(child) );
+    public this ( String parent, String child ){
+        mFilePath = join( parent, child );
     }
 
-    public this ( java.io.File.File parent, CString child ){
-        mFilePath = join( parent.mFilePath, toStd(child) );
+    public this ( java.io.File.File parent, String child ){
+        version(Tango){
+            mFilePath = tango.io.Path.join( parent.mFilePath, toStd(child) );
+        } else { // Phobos
+            mFilePath = std.path.join( parent.mFilePath, toStd(child) );
+        }
     }
 
     public int getPrefixLength(){
@@ -108,18 +109,12 @@
         version(Tango){
             return (new tango.io.FilePath.FilePath(mFilePath)).absolute(tango.sys.Environment.Environment.cwd).toString;
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
-            return "";
+            return std.path.rel2abs(mFilePath);
         }
     }
 
     public java.io.File.File getAbsoluteFile(){
-        version(Tango){
-            return new File( getAbsolutePath() );
-        } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
-            return null;
-        }
+        return new File( getAbsolutePath() );
     }
 
     public String getCanonicalPath(){
@@ -138,20 +133,27 @@
     }
 
     public bool canWrite(){
-        version(Tango){
-            return tango.io.Path.isWritable(mFilePath);
-        } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
-            return false;
-        }
+        version(Windows) { //Windows's ACL isn't supported
+            version(Tango) {
+                return tango.io.Path.isWritable(mFilePath);
+            } else { // Phobos
+                return !(std.file.getAttributes(mFilePath) & 1); //FILE_ATTRIBUTE_READONLY = 1
+            }
+        } else version(Posix) { //workaround Tango's bug (isWritable is always true)
+            version(Tango) {
+                return tango.stdc.posix.unistd.access (tango.stdc.stringz.toStringz(mFilePath), 2) is 0; //W_OK = 2
+            } else { // Phobos
+                return core.sys.posix.unistd.access (std.string.toStringz(mFilePath), 2) is 0; //W_OK = 2
+            }
+        } else
+            static assert(0);
     }
 
     public bool exists(){
         version(Tango){
             return tango.io.Path.exists(mFilePath);
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
-            return false;
+            return std.file.exists(mFilePath);
         }
     }
 
@@ -159,8 +161,7 @@
         version(Tango){
             return tango.io.Path.isFolder(mFilePath);
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
-            return false;
+            return std.file.isDir(mFilePath);
         }
     }
 
@@ -238,12 +239,12 @@
         return null;
     }
 
-    public static java.io.File.File createTempFile( CString prefix, CString suffix, java.io.File.File directory ){
+    public static java.io.File.File createTempFile( String prefix, String suffix, java.io.File.File directory ){
         implMissing( __FILE__, __LINE__ );
         return null;
     }
 
-    public static java.io.File.File createTempFile( CString prefix, CString suffix ){
+    public static java.io.File.File createTempFile( String prefix, String suffix ){
         implMissing( __FILE__, __LINE__ );
         return null;
     }
--- a/base/src/java/io/FileInputStream.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/base/src/java/io/FileInputStream.d	Sat Jul 09 15:50:20 2011 +0300
@@ -108,11 +108,7 @@
     }
 
     public override void close(){
-        version(Tango){
-            conduit.close();
-        } else { // Phobos
-            conduit.close();
-        }
+        conduit.close();
     }
 }
 
--- a/base/src/java/io/FileOutputStream.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/base/src/java/io/FileOutputStream.d	Sat Jul 09 15:50:20 2011 +0300
@@ -11,8 +11,7 @@
 version(Tango){
     import TangoFile = tango.io.device.File;
 } else { // Phobos
-    static import std.file;
-    static import std.path;
+    static import std.stream;
 }
 
 public class FileOutputStream : java.io.OutputStream.OutputStream {
@@ -20,15 +19,16 @@
     alias java.io.OutputStream.OutputStream.write write;
     alias java.io.OutputStream.OutputStream.close close;
     version(Tango){
-        TangoFile.File fc;
+        private TangoFile.File fc;
     } else { // Phobos
+        private std.stream.File fc;
     }
 
     public this ( String name ){
         version(Tango){
             fc = new TangoFile.File( name, TangoFile.File.WriteCreate );
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            fc = new std.stream.File( name, std.stream.FileMode.OutNew );
         }
     }
 
@@ -36,7 +36,7 @@
         version(Tango){
             fc = new TangoFile.File( name, append ? TangoFile.File.WriteAppending : TangoFile.File.WriteCreate );
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            fc = new std.stream.File( name, append ? std.stream.FileMode.Append : std.stream.FileMode.OutNew );
         }
     }
 
@@ -49,21 +49,16 @@
     }
 
     public override void write( int b ){
-        ubyte[1] a;
-        a[0] = b & 0xFF;
         version(Tango){
+            ubyte[1] a = b & 0xFF;
             fc.write(a);
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            fc.write(cast(byte)(b & 0xFF));
         }
     }
 
     public override void close(){
-        version(Tango){
-            fc.close();
-        } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
-        }
+        fc.close();
     }
 
     public void finalize(){
--- a/base/src/java/io/InputStream.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/base/src/java/io/InputStream.d	Sat Jul 09 15:50:20 2011 +0300
@@ -15,7 +15,7 @@
     public abstract int read();
 
     public int read( byte[] b ){
-        foreach( uint idx, inout byte val; b ){
+        foreach( uint idx, ref byte val; b ){
             int c = read();
             if( c == -1 ){
                 return ( idx == 0 ) ? -1 : idx;
--- a/base/src/java/io/OutputStream.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/base/src/java/io/OutputStream.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,13 +12,13 @@
 
     public abstract void write( int b );
 
-    public void write( byte[] b ){
+    public void write( in byte[] b ){
         foreach( bv; b ){
             write(bv);
         }
     }
 
-    public void write( byte[] b, int off, int len ){
+    public void write( in byte[] b, int off, int len ){
         write(b[off .. off+len]);
     }
 
--- a/base/src/java/lang/Byte.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/base/src/java/lang/Byte.d	Sat Jul 09 15:50:20 2011 +0300
@@ -4,10 +4,12 @@
 import java.lang.exceptions;
 import java.lang.Number;
 import java.lang.Class;
+import java.lang.String;
 
 version(Tango){
     static import tango.text.convert.Integer;
 } else { // Phobos
+    static import std.conv;
 }
 class Byte : Number {
     public static const byte MIN_VALUE = byte.min;
@@ -27,8 +29,12 @@
                 throw new NumberFormatException( e );
             }
         } else { // Phobos
-            implMissing( __FILE__, __LINE__);
-            return 0;
+            try{
+                return std.conv.to!(byte)(s);
+            }
+            catch( std.conv.ConvException e ){
+                throw new NumberFormatException( e );
+            }
         }
     }
     this( byte value ){
--- a/base/src/java/lang/Character.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/base/src/java/lang/Character.d	Sat Jul 09 15:50:20 2011 +0300
@@ -1,78 +1,68 @@
 module java.lang.Character;
 
+import java.lang.util;
 import java.lang.exceptions;
-import java.lang.util;
 import java.lang.Class;
+import java.lang.String;
 
 version(Tango){
     static import tango.text.Unicode;
-    static import tango.text.UnicodeData;
+    static import tango.text.UnicodeData; //for getUnicodeData
 } else { // Phobos
     static import std.utf;
+    static import std.conv;
     static import std.uni;
     static import std.ctype;
     static import std.string;
 }
 
 class Character {
+    public static const int MIN_RADIX = 2;
+    public static const int MAX_RADIX = 36;
     public static bool isUpperCase( dchar c ){
-        implMissing( __FILE__, __LINE__);
-        return false;
-    }
-    public static dchar toUpperCase( wchar c ){
         version(Tango){
-            wchar[1] src;
-            src[0] = c;
-            dchar[1] buf;
-            uint ate;
-            dchar[] darr = tango.text.convert.Utf.toString32( src, buf, &ate );
+            implMissingInTango( __FILE__, __LINE__);
+            return false;
         } else { // Phobos
-            wchar[1] src;
-            src[0] = c;
-            auto darr = std.utf.toUTF32(src);
+            return !!std.uni.isUniUpper(c);
         }
-        return toUpperCase( darr[0] );
-    }
-    public static String toString(char c){
-        implMissing(__FILE__, __LINE__ );
-        return null;
-    }
-    public static String toString(wchar c){
-        implMissing(__FILE__, __LINE__ );
-        return null;
-    }
-    public static String toString(dchar c){
-        implMissing(__FILE__, __LINE__ );
-        return null;
     }
     public static dchar toUpperCase( dchar c ){
         version(Tango){
-            dchar[1] src;
-            src[0] = c;
+            dchar[1] src = c;
             dchar[] r = tango.text.Unicode.toUpper( src );
             return r[0];
         } else { // Phobos
             return std.uni.toUniUpper( c );
         }
     }
-    public static dchar toLowerCase( wchar c ){
+    public static String toString( char c ){
+        version(Tango){
+            implMissingInTango(__FILE__, __LINE__ );
+            return null;
+        } else { // Phobos
+            return std.conv.to!(String)( c );
+        }
+    }
+    public static String toString( wchar c ){
         version(Tango){
-            wchar[1] src;
-            src[0] = c;
-            dchar[1] buf;
-            uint ate;
-            dchar[] darr = tango.text.convert.Utf.toString32( src, buf, &ate );
+            implMissingInTango(__FILE__, __LINE__ );
+            return null;
         } else { // Phobos
-            wchar[1] src;
-            src[0] = c;
-            auto darr = std.utf.toUTF32(src);
+            return std.conv.to!(String)( c );
         }
-        return toLowerCase( darr[0] );
+    }
+    public static String toString( dchar c ){
+        version(Tango){
+            implMissingInTango(__FILE__, __LINE__ );
+            return null;
+        } else { // Phobos
+            return std.conv.to!(String)( c );
+        }
     }
     public static dchar toLowerCase( dchar c ){
         version(Tango){
-            dchar[1] src;
-            src[0] = c;
+            dchar[1] src = c;
             dchar[] r = tango.text.Unicode.toLower( src );
             return r[0];
         } else { // Phobos
@@ -86,32 +76,26 @@
             return std.string.iswhite(c);
         }
     }
+    alias isWhitespace isWhiteSpace;
+    public static bool isSpace( dchar c ){
+        version(Tango){
+            return tango.text.Unicode.isSpace(c);
+        } else { // Phobos
+            return !!std.ctype.isspace(c);
+        }
+    }
     public static bool isDigit( dchar c ){
         version(Tango){
             return tango.text.Unicode.isDigit( c );
         } else { // Phobos
-            return std.string.isNumeric(c);
+            return !!std.ctype.isdigit(c);
         }
     }
     public static bool isLetter( dchar c ){
         version(Tango){
             return tango.text.Unicode.isLetter(c);
         } else { // Phobos
-            return std.uni.isUniAlpha(c) != 0;
-        }
-    }
-    public static bool isSpace( dchar c ){
-        version(Tango){
-            return tango.text.Unicode.isSpace(c);
-        } else { // Phobos
-            return cast(bool)std.ctype.isspace(c);
-        }
-    }
-    public static bool isWhiteSpace( dchar c ){
-        version(Tango){
-            return tango.text.Unicode.isWhitespace(c);
-        } else { // Phobos
-            return std.string.iswhite(c);
+            return !!std.uni.isUniAlpha(c);
         }
     }
     public static bool isLetterOrDigit( dchar c ){
@@ -155,66 +139,26 @@
 
 bool CharacterIsDefined( dchar ch ){
     version(Tango){
-    	return (ch in tango.text.UnicodeData.unicodeData) !is null;
+    	return tango.text.UnicodeData.getUnicodeData(ch) !is null;
     } else { // Phobos
-        implMissing( __FILE__, __LINE__);
-        return false;
-    }
-}
-
-dchar CharacterFirstToLower( CString str ){
-    int consumed;
-    return CharacterFirstToLower( str, consumed );
-}
-
-dchar CharacterFirstToLower( CString str, out int consumed ){
-    version(Tango){
-        dchar[1] buf;
-        buf[0] = firstCodePoint( str, consumed );
-        dchar[] r = tango.text.Unicode.toLower( buf );
-        return r[0];
-    } else { // Phobos
-        implMissing( __FILE__, __LINE__);
-        return 0;
+        return std.utf.isValidDchar(ch);
     }
 }
 
 dchar CharacterToLower( dchar c ){
-    version(Tango){
-        dchar[] r = tango.text.Unicode.toLower( [c] );
-        return r[0];
-    } else { // Phobos
-        return std.uni.toUniLower(c);
-    }
+    return Character.toLowerCase(c);
 }
 dchar CharacterToUpper( dchar c ){
-    version(Tango){
-        dchar[] r = tango.text.Unicode.toUpper( [c] );
-        return r[0];
-    } else { // Phobos
-        return std.uni.toUniUpper(c);
-    }
+    return Character.toUpperCase(c);
 }
 bool CharacterIsWhitespace( dchar c ){
-    version(Tango){
-        return tango.text.Unicode.isWhitespace( c );
-    } else { // Phobos
-        return std.string.iswhite(c);
-    }
+    return Character.isWhitespace(c);
 }
 bool CharacterIsDigit( dchar c ){
-    version(Tango){
-        return tango.text.Unicode.isDigit( c );
-    } else { // Phobos
-        return std.string.isNumeric(c);
-    }
+    return Character.isDigit(c);
 }
 bool CharacterIsLetter( dchar c ){
-    version(Tango){
-        return tango.text.Unicode.isLetter( c );
-    } else { // Phobos
-        return std.uni.isUniAlpha(c) != 0;
-    }
+    return Character.isLetter(c);
 }
 
 
--- a/base/src/java/lang/Double.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/base/src/java/lang/Double.d	Sat Jul 09 15:50:20 2011 +0300
@@ -1,8 +1,16 @@
 module java.lang.Double;
 
 import java.lang.util;
+import java.lang.exceptions;
 import java.lang.Number;
 import java.lang.Class;
+import java.lang.String;
+
+version(Tango){
+    static import tango.text.convert.Float;
+} else { // Phobos
+    static import std.conv;
+}
 
 class Double : Number {
     public static double POSITIVE_INFINITY = double.infinity;
@@ -15,16 +23,28 @@
         this.value = value;
     }
     this( String str ){
-        implMissing( __FILE__, __LINE__ );
         super();
+        this.value = parseDouble(str);
     }
     public static String toString( double value ){
-        implMissing( __FILE__, __LINE__ );
-        return null;
+        return String_valueOf(value);
     }
     public static double parseDouble(String s){
-        implMissing( __FILE__, __LINE__ );
-        return 0.0;
+        version(Tango){
+            try{
+                return tango.text.convert.Float.toFloat( s );
+            }
+            catch( IllegalArgumentException e ){
+                throw new NumberFormatException( e );
+            }
+        } else { // Phobos
+            try{
+                return std.conv.to!(double)(s);
+            }
+            catch( std.conv.ConvException e ){
+                throw new NumberFormatException( e );
+            }
+        }
     }
 
     private static Class TYPE_;
--- a/base/src/java/lang/Float.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/base/src/java/lang/Float.d	Sat Jul 09 15:50:20 2011 +0300
@@ -4,12 +4,19 @@
 import java.lang.exceptions;
 import java.lang.Number;
 import java.lang.Class;
+import java.lang.String;
+
+version(Tango){
+    static import tango.text.convert.Float;
+} else { // Phobos
+    static import std.conv;
+}
 
 class Float : Number {
 
-    public static float POSITIVE_INFINITY = (1.0f / 0.0f);
-    public static float NEGATIVE_INFINITY = ((-1.0f) / 0.0f);
-    public static float NaN = (0.0f / 0.0f);
+    public static float POSITIVE_INFINITY = float.infinity;
+    public static float NEGATIVE_INFINITY = -float.infinity;
+    public static float NaN = float.nan;
     public static float MAX_VALUE = 3.4028235e+38f;
     public static float MIN_VALUE = float.min; //1.4e-45f
     public static int SIZE = 32;
@@ -20,12 +27,11 @@
         this.value = value;
     }
     this( String str ){
-        implMissing( __FILE__, __LINE__ );
         super();
+        this.value = parseFloat(str);
     }
     public static String toString( float value ){
-        implMissing( __FILE__, __LINE__ );
-        return null;
+        return String_valueOf(value);
     }
     public static float parseFloat( String s ){
         version(Tango){
@@ -36,8 +42,12 @@
                 throw new NumberFormatException( e );
             }
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
-            return 0.0f;
+            try{
+                return std.conv.to!(float)(s);
+            }
+            catch( std.conv.ConvException e ){
+                throw new NumberFormatException( e );
+            }
         }
     }
 
--- a/base/src/java/lang/Integer.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/base/src/java/lang/Integer.d	Sat Jul 09 15:50:20 2011 +0300
@@ -4,18 +4,16 @@
 import java.lang.exceptions;
 import java.lang.Number;
 import java.lang.Class;
+import java.lang.Character;
 import java.lang.String;
 
 version(Tango){
+    static import tango.text.convert.Integer;
 } else { // Phobos
     static import std.conv;
     static import std.string;
 }
 
-version(Tango){
-} else { // Phobos
-}
-
 
 class Integer : Number {
 
@@ -39,64 +37,59 @@
     }
 
     public static String toString( int i, int radix ){
-        switch( radix ){
-            case 2:
-                return toBinaryString(i);
-            case 8:
-                return toOctalString(i);
-            case 10:
-                return toString(i);
-            case 16:
-                return toHexString(i);
-            default:
-                implMissing( __FILE__, __LINE__ );
-                return null;
+        if(radix < Character.MIN_RADIX || radix > Character.MAX_RADIX)
+            radix = 10;
+        version(Tango){
+            switch( radix ){
+                case 10:
+                    return tango.text.convert.Integer.toString(i);
+                case 16:
+                    return tango.text.convert.Integer.toString(i, "x" );
+                case 2:
+                    return tango.text.convert.Integer.toString(i, "b" );
+                case 8:
+                    return tango.text.convert.Integer.toString(i, "o" );
+                default:
+                    implMissingInTango( __FILE__, __LINE__ );
+                    return null;
+            }
+        } else { // Phobos
+            return std.conv.to!(String)(i, radix);
         }
     }
 
     public static String toHexString( int i ){
-        version(Tango){
-            return tango.text.convert.Integer.toString(i, "x" );
-        } else { // Phobos
-            return std.string.format("%x", i);
-        }
+        return toString(i, 16);
     }
 
     public static String toOctalString( int i ){
-        version(Tango){
-            return tango.text.convert.Integer.toString(i, "o" );
-        } else { // Phobos
-            return std.string.format("%o", i);
-        }
+        return toString(i, 8);
     }
 
     public static String toBinaryString( int i ){
-        version(Tango){
-            return tango.text.convert.Integer.toString(i, "b" );
-        } else { // Phobos
-            return std.string.format("%b", i);
-        }
+        return toString(i, 2);
     }
 
     public static String toString( int i ){
-        version(Tango){
-            return tango.text.convert.Integer.toString(i);
-        } else { // Phobos
-            return std.conv.to!(string)( i );
-        }
+        return String_valueOf(i);
     }
 
     public static int parseInt( String s, int radix ){
+        if(radix < Character.MIN_RADIX || radix > Character.MAX_RADIX)
+            throw new NumberFormatException("The radix is out of range");
         version(Tango){
             try{
-                return tango.text.convert.Integer.toLong( s, radix );
+                return tango.text.convert.Integer.toInt( s, radix );
             }
             catch( IllegalArgumentException e ){
                 throw new NumberFormatException( e );
             }
         } else { // Phobos
             try{
-            	return std.conv.parse!(int)( s, radix );
+                immutable res = std.conv.parse!(int)( s, radix );
+                if(s.length)
+                    throw new NumberFormatException("String has invalid characters: " ~ s);
+                return res;
             }
             catch( std.conv.ConvException e ){
                 throw new NumberFormatException( e );
@@ -113,7 +106,7 @@
     }
 
     public static Integer valueOf( String s ){
-        return valueOf( parseInt(s));
+        return valueOf(parseInt(s));
     }
 
     public static Integer valueOf( int i ){
@@ -149,11 +142,7 @@
     }
 
     public override String toString(){
-        version(Tango){
-            return tango.text.convert.Integer.toString( value );
-        } else { // Phobos
-            return std.conv.to!(string)(value);
-        }
+        return toString(value);
     }
 
     private static Class TYPE_;
--- a/base/src/java/lang/Long.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/base/src/java/lang/Long.d	Sat Jul 09 15:50:20 2011 +0300
@@ -3,7 +3,16 @@
 import java.lang.util;
 import java.lang.exceptions;
 import java.lang.Number;
+import java.lang.Character;
 import java.lang.Class;
+import java.lang.String;
+
+version(Tango){
+    static import tango.text.convert.Integer;
+} else { // Phobos
+    static import std.conv;
+    static import std.string;
+}
 
 class Long : Number {
     public static const long MIN_VALUE = long.min;
@@ -14,8 +23,8 @@
         this.value = value;
     }
     this( String str ){
-        implMissing( __FILE__, __LINE__ );
         super();
+        this.value = parseLong(str);
     }
     public byte byteValue(){
         return cast(byte)value;
@@ -44,6 +53,8 @@
         return parseLong( s, 10 );
     }
     public static long parseLong(String s, int radix){
+        if(radix < Character.MIN_RADIX || radix > Character.MAX_RADIX)
+            throw new NumberFormatException("The radix is out of range");
         version(Tango){
             try{
                 return tango.text.convert.Integer.toLong( s, radix );
@@ -52,13 +63,19 @@
                 throw new NumberFormatException( e );
             }
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
-            return 0;
+            try{
+                immutable res = std.conv.parse!(long)( s, radix );
+                if(s.length)
+                    throw new NumberFormatException("String has invalid characters: " ~ s);
+                return res;
+            }
+            catch( std.conv.ConvException e ){
+                throw new NumberFormatException( e );
+            }
         }
     }
-    public static String toString( double value ){
-        implMissing( __FILE__, __LINE__ );
-        return null;
+    public static String toString( long i ){
+        return String_valueOf(i);
     }
     private static Class TYPE_;
     public static Class TYPE(){
--- a/base/src/java/lang/Math.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/base/src/java/lang/Math.d	Sat Jul 09 15:50:20 2011 +0300
@@ -17,34 +17,8 @@
     static int    abs(int    a){ return a > 0 ? a : -a; }
     static long   abs(long   a){ return a > 0 ? a : -a; }
 
-    static double min(double a, double b){ return a < b ? a : b; }
-    static double min(double a, int    b){ return a < b ? a : b; }
-    static float  min(float  a, float  b){ return a < b ? a : b; }
-    static float  min(float  a, int    b){ return a < b ? a : b; }
-    static float  min(int    a, float  b){ return a < b ? a : b; }
-    static int    min(byte   a, byte   b){ return a < b ? a : b; }
-    static int    min(byte   a, int    b){ return a < b ? a : b; }
-    static int    min(int    a, int    b){ return a < b ? a : b; }
-    static int    min(uint   a, int    b){ return a < b ? a : b; }
-    static int    min(int    a, uint   b){ return a < b ? a : b; }
-    static int    min(uint   a, uint   b){ return a < b ? a : b; }
-    static long   min(int    a, long   b){ return a < b ? a : b; }
-    static long   min(long   a, long   b){ return a < b ? a : b; }
-    static long   min(long   a, int    b){ return a < b ? a : b; }
-
-    static double max(double a, double b){ return a > b ? a : b; }
-    static double max(double a, int    b){ return a > b ? a : b; }
-    static float  max(float  a, float  b){ return a > b ? a : b; }
-    static float  max(float  a, int    b){ return a > b ? a : b; }
-    static float  max(int    a, float  b){ return a > b ? a : b; }
-    static int    max(byte   a, byte   b){ return a > b ? a : b; }
-    static int    max(int    a, int    b){ return a > b ? a : b; }
-    static int    max(uint   a, int    b){ return a > b ? a : b; }
-    static int    max(int    a, uint   b){ return a > b ? a : b; }
-    static int    max(uint   a, uint   b){ return a > b ? a : b; }
-    static long   max(int    a, long   b){ return a > b ? a : b; }
-    static long   max(long   a, long   b){ return a > b ? a : b; }
-    static long   max(long   a, int    b){ return a > b ? a : b; }
+    static typeof(T1.init < T2.init ? T1.init : T2.init) min(T1, T2)(T1 a, T2 b){ return a < b ? a : b; }
+    static typeof(T1.init > T2.init ? T1.init : T2.init) max(T1, T2)(T1 a, T2 b){ return a > b ? a : b; }
 
 
     static double sin(double a)  { return MathLib.sin(a); }
--- a/base/src/java/lang/Short.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/base/src/java/lang/Short.d	Sat Jul 09 15:50:20 2011 +0300
@@ -4,20 +4,22 @@
 import java.lang.exceptions;
 import java.lang.Number;
 import java.lang.Class;
+import java.lang.String;
 
 version(Tango){
     static import tango.text.convert.Integer;
 } else { // Phobos
+    static import std.conv;
 }
 class Short : Number {
     public static const short MIN_VALUE = short.min;
     public static const short MAX_VALUE = short.max;
     private short value;
-    public static byte parseShort( String s ){
+    public static short parseShort( String s ){
         version(Tango){
             try{
                 int res = tango.text.convert.Integer.parse( s );
-                if( res < byte.min || res > byte.max ){
+                if( res < short.min || res > short.max ){
                     throw new NumberFormatException( "out of range" );
                 }
                 return res;
@@ -26,8 +28,12 @@
                 throw new NumberFormatException( e );
             }
         } else { // Phobos
-            implMissing( __FILE__, __LINE__);
-            return 0;
+            try{
+                return std.conv.to!(short)(s);
+            }
+            catch( std.conv.ConvException e ){
+                throw new NumberFormatException( e );
+            }
         }
     }
     this( short value ){
--- a/base/src/java/lang/String.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/base/src/java/lang/String.d	Sat Jul 09 15:50:20 2011 +0300
@@ -11,379 +11,21 @@
     static import tango.text.Unicode;
     static import tango.text.convert.Utf;
 } else { // Phobos
-    static import core.exception;
-    static import std.uni;
-    static import std.utf;
     static import std.array;
     static import std.string;
     static import std.conv;
     static import std.exception;
 }
 
-version(Tango){
-    public alias char[] String;
-    public alias char[] CString;
-    public alias wchar[] String16;
-    public alias wchar[] CString16;
-    public alias char*   ICharPtr;
-    public alias char*   CCharPtr;
-    public alias wchar*  CWCharPtr;
-    public alias wchar*  IWCharPtr;
-} else { // Phobos
-    public alias string String;
-    public alias wstring String16;
-    mixin(
-        "public alias const(char)[]     CString;
-        public alias const(wchar)[]    CString16;
-        public alias immutable(char)*  ICharPtr;
-        public alias const(char)*      CCharPtr;
-        public alias const(wchar)*     CWCharPtr;
-        public alias immutable(wchar)* IWCharPtr;"
-    );
-}
-
-int codepointIndexToIndex( CString str, int cpIndex ){
-    int cps = cpIndex;
-    int res = 0;
-    while( cps > 0 ){
-        cps--;
-        if( str[res] < 0x80 ){
-            res+=1;
-        }
-        else if( str[res] < 0xE0 ){
-            res+=2;
-        }
-        else if( str[res] & 0xF0 ){
-            res+=3;
-        }
-        else{
-            res+=4;
-        }
-    }
-    return res;
-}
-
-/++
-+
-+/
-int indexToCodepointIndex( CString str, int index ){
-    if( index < 0 ) return index;
-    int i = 0;
-    int res = 0;
-    while( i < index ){
-        if( i >= str.length ){
-            break;
-        }
-        if( str[i] < 0x80 ){
-            i+=1;
-        }
-        else if( str[i] < 0xE0 ){
-            i+=2;
-        }
-        else if( str[i] & 0xF0 ){
-            i+=3;
-        }
-        else{
-            i+=4;
-        }
-        res++;
-    }
-    return res;
-}
+alias TryImmutable!(char)[]  String;
+alias TryImmutable!(wchar)[] String16;
 
-/++
-+ Get that String, that contains the next codepoint of a String.
-+/
-String firstCodePointStr( CString str, out int consumed ){
-    version(Tango){
-        dchar[1] buf;
-        uint ate;
-        dchar[] res = tango.text.convert.Utf.toString32( str, buf, &ate );
-        consumed = ate;
-        return str[ 0 .. ate ];
-    } else { // Phobos
-        implMissing( __FILE__, __LINE__ );
-        return null;
-    }
-}
-
-/++
-+ Get first codepoint of a String. If an offset is needed, simply use a slice:
-+ ---
-+ dchar res = str[ offset .. $ ].firstCodePoint();
-+ ---
-+/
-dchar firstCodePoint( CString str ){
-    int dummy;
-    return firstCodePoint( str, dummy );
-}
-dchar firstCodePoint( CString str, out int consumed ){
-    version(Tango){
-        dchar[1] buf;
-        uint ate;
-        dchar[] res = tango.text.convert.Utf.toString32( str, buf, &ate );
-        consumed = ate;
-        if( ate is 0 || res.length is 0 ){
-            getDwtLogger().trace( __FILE__, __LINE__, "str.length={} str={:X2}", str.length, cast(ubyte[])str );
-        }
-        assert( ate > 0 );
-        assert( res.length is 1 );
-        return res[0];
-    } else { // Phobos
-        size_t ate = 0;
-        auto res = std.utf.decode(str, ate);
-
-        if (ate == 0)
-            getDwtLogger().trace( __FILE__, __LINE__, "str.length={} str={:X2}", str.length, cast(ubyte[])str );
-
-        assert(ate > 0);
-        consumed = ate;
-
-        return res;
-    }
-}
-dchar firstCodePoint( CString16 str, out int consumed ){
-    version(Tango){
-        dchar[1] buf;
-        uint ate;
-        dchar[] res = tango.text.convert.Utf.toString32( str, buf, &ate );
-        consumed = ate;
-        if( ate is 0 || res.length is 0 ){
-            getDwtLogger().trace( __FILE__, __LINE__, "str.length={} str={:X2}", str.length, cast(ubyte[])str );
-        }
-        assert( ate > 0 );
-        assert( res.length is 1 );
-        return res[0];
-    } else { // Phobos
-        size_t ate = 0;
-        auto res = std.utf.decode(str, ate);
-
-        if (ate == 0)
-            getDwtLogger().trace( __FILE__, __LINE__, "str.length={} str={:X2}", str.length, cast(ubyte[])str );
-
-        assert(ate > 0);
-        consumed = ate;
-
-        return res;
-    }
-}
-
-String dcharToString( dchar key ){
-    version(Tango){
-        dchar[1] buf;
-        buf[0] = key;
-        return tango.text.convert.Utf.toString( buf );
-    } else { // Phobos
-        return std.conv.to!(string)(key);
-    }
-}
-
-int codepointCount( CString str ){
-    version(Tango){
-        scope dchar[] buf = new dchar[]( str.length );
-        uint ate;
-        dchar[] res = tango.text.convert.Utf.toString32( str, buf, &ate );
-        assert( ate is str.length );
-        return res.length;
-    } else { // Phobos
-        return std.utf.count(str);
-    }
+String new_String( String cont, int offset, int len ){
+    return _idup(cont[ offset .. offset+len ]);
 }
 
-//alias tango.text.convert.Utf.toString16 toString16;
-//alias tango.text.convert.Utf.toString toString;
-
-int toAbsoluteCodePointStartOffset( CString str, int index ){
-    //getDwtLogger().trace( __FILE__, __LINE__, "str={}, str.length={}, index={}", str, str.length, index );
-    //getDwtLogger().trace( __FILE__, __LINE__, Trace.memory( str );
-    if( str.length is index ){
-        return index;
-    }
-    if( ( str[index] & 0x80 ) is 0x00 ) {
-        return index;
-    }
-    else{
-        int steps = 0;
-        while(( str[index] & 0xC0 ) is 0x80 ){
-            index--;
-            steps++;
-            if( steps > 3 || index < 0 ){
-                break;
-            }
-        }
-        if((( str[index] & 0xE0 ) is 0xC0) && ( steps <= 1 )){
-            // ok
-        }
-        else if((( str[index] & 0xF0 ) is 0xE0) && ( steps <= 2 )){
-            // ok
-        }
-        else if((( str[index] & 0xF8 ) is 0xF0) && ( steps <= 3 )){
-            // ok
-        }
-        else{
-            throw new UnicodeException( "invalid utf8 input to toAbsoluteCodePointStartOffset", index );
-        }
-        return index;
-    }
-}
-int getRelativeCodePointOffset( CString str, int startIndex, int searchRelCp ){
-    return getAbsoluteCodePointOffset( str, startIndex, searchRelCp ) - startIndex;
-}
-int getAbsoluteCodePointOffset( CString str, int startIndex, int searchRelCp ){
-
-    //getDwtLogger().trace( __FILE__, __LINE__, "str={}, str.length={}, startIndex={}, searchRelCp={}", str, str.length, startIndex, searchRelCp );
-    //getDwtLogger().trace( __FILE__, __LINE__, Trace.memory( str );
-
-    int ignore;
-    int i = startIndex;
-    if( searchRelCp > 0 ){
-        while( searchRelCp !is 0 ){
-
-            if( ( i < str.length )
-                    && (( str[i] & 0x80 ) is 0x00 ))
-            {
-                i+=1;
-            }
-            else if( ( i+1 < str.length )
-                    && (( str[i+1] & 0xC0 ) is 0x80 )
-                    && (( str[i  ] & 0xE0 ) is 0xC0 ))
-            {
-                i+=2;
-            }
-            else if( ( i+2 < str.length )
-                    && (( str[i+2] & 0xC0 ) is 0x80 )
-                    && (( str[i+1] & 0xC0 ) is 0x80 )
-                    && (( str[i  ] & 0xF0 ) is 0xE0 ))
-            {
-                i+=3;
-            }
-            else if(( i+3 < str.length )
-                    && (( str[i+3] & 0xC0 ) is 0x80 )
-                    && (( str[i+2] & 0xC0 ) is 0x80 )
-                    && (( str[i+1] & 0xC0 ) is 0x80 )
-                    && (( str[i  ] & 0xF8 ) is 0xF0 ))
-            {
-                i+=4;
-            }
-            else{
-                getDwtLogger().trace( __FILE__, __LINE__, "getAbsoluteCodePointOffset invalid utf8 characters:  {:X2}", cast(ubyte[]) str );
-                throw new UnicodeException( "invalid utf8 input", i );
-            }
-            searchRelCp--;
-        }
-    }
-    else if( searchRelCp < 0 ){
-        while( searchRelCp !is 0 ){
-            do{
-                i--;
-                if( i < 0 ){
-                    return startIndex-1;
-                }
-            } while(( str[i] & 0xC0 ) is 0x80 );
-            searchRelCp++;
-        }
-    }
-    return i;
-}
-int getAbsoluteCodePointOffset( CString16 str, int startIndex, int searchRelCp ){
-    int ignore;
-    int i = startIndex;
-    if( searchRelCp > 0 ){
-        while( searchRelCp !is 0 ){
-
-            if( ( i < str.length )
-                    && ( str[i] & 0xD800 ) !is 0xD800 )
-            {
-                i+=1;
-            }
-            else if( ( i+1 < str.length )
-                    && (( str[i+1] & 0xDC00 ) is 0xDC00 )
-                    && (( str[i  ] & 0xDC00 ) is 0xD800 ))
-            {
-                i+=2;
-            }
-            else{
-                getDwtLogger().trace( __FILE__, __LINE__, "invalid utf16 characters:  {:X2}", cast(ubyte[]) str );
-                throw new UnicodeException( "invalid utf16 input", i );
-            }
-            searchRelCp--;
-        }
-    }
-    else if( searchRelCp < 0 ){
-        while( searchRelCp !is 0 ){
-            do{
-                i--;
-                if( i < 0 ){
-                    return startIndex-1;
-                    //getDwtLogger().trace( __FILE__, __LINE__, "dwthelper.utils getRelativeCodePointOffset {}: str={}, startIndex={}, searchRelCp={}", __LINE__, str, startIndex, searchRelCp );
-                    //tango.text.convert.Utf.onUnicodeError( "invalid utf16 input", i );
-                }
-            } while(( str[i] & 0xDC00 ) is 0xDC00 );
-            searchRelCp++;
-        }
-    }
-    return i;
-}
-dchar getRelativeCodePoint( CString str, int startIndex, int searchRelCp ){
-    int dummy;
-    return getRelativeCodePoint( str, startIndex, dummy );
-}
-dchar getRelativeCodePoint( CString str, int startIndex, int searchRelCp, out int relIndex ){
-    relIndex = getRelativeCodePointOffset( str, startIndex, searchRelCp );
-    int ignore;
-    return firstCodePoint( str[ startIndex+relIndex .. $ ], ignore );
-}
-
-int utf8AdjustOffset( CString str, int offset ){
-    if( str.length <= offset || offset <= 0 ){
-        return offset;
-    }
-    while(( str[offset] & 0xC0 ) is 0x80 ){
-        offset--;
-    }
-    return offset;
-}
-int utf8OffsetIncr( CString str, int offset ){
-    int res = offset +1;
-    if( str.length <= res || res <= 0 ){
-        return res;
-    }
-    int tries = 4;
-    while(( str[res] & 0xC0 ) is 0x80 ){
-        res++;
-        assert( tries-- > 0 );
-    }
-    return res;
-}
-int utf8OffsetDecr( CString str, int offset ){
-    int res = offset-1;
-    if( str.length <= res || res <= 0 ){
-        return res;
-    }
-    int tries = 4;
-    while(( str[res] & 0xC0 ) is 0x80 ){
-        res--;
-        assert( tries-- > 0 );
-    }
-    getDwtLogger().trace( __FILE__, __LINE__, "utf8OffsetDecr {}->{}", offset, res );
-    getDwtLogger().trace( __FILE__, __LINE__, "{}", str );
-    return res;
-}
-
-String new_String( CString cont, int offset, int len ){
-    version(D_Version2){
-        return cont[ offset .. offset+len ].idup;
-    } else {
-        return cont[ offset .. offset+len ].dup;
-    }
-}
-
-String new_String( CString cont ){
-    version(D_Version2){
-        return cont.idup;
-    } else {
-        return cont.dup;
-    }
+String new_String( String cont ){
+    return _idup(cont);
 }
 
 String String_valueOf( bool v ){
@@ -391,38 +33,19 @@
 }
 
 String String_valueOf( byte v ){
-    version(Tango){
-        return tango.text.convert.Integer.toString(v);
-    } else { // Phobos
-        implMissing( __FILE__, __LINE__ );
-        return null;
-    }
+    return String_valueOf( cast(long) v );
 }
 
 String String_valueOf( ubyte v ){
-    version(Tango){
-        return tango.text.convert.Integer.toString(v);
-    } else { // Phobos
-        implMissing( __FILE__, __LINE__ );
-        return null;
-    }
+    return String_valueOf( cast(uint) v );
 }
 
 String String_valueOf( short v ){
-    version(Tango){
-        return tango.text.convert.Integer.toString(v);
-    } else { // Phobos
-        implMissing( __FILE__, __LINE__ );
-        return null;
-    }
+    return String_valueOf( cast(long) v );
 }
 
 String String_valueOf( int v ){
-    version(Tango){
-        return tango.text.convert.Integer.toString(v);
-    } else { // Phobos
-        return std.conv.to!(String)(v);
-    }
+    return String_valueOf( cast(long) v );
 }
 
 String String_valueOf( uint v ){
@@ -458,30 +81,31 @@
 }
 
 String String_valueOf( dchar v ){
-    return dcharToString(v);
+    version(Tango){
+        dchar[1] buf = v;
+        return tango.text.convert.Utf.toString( buf );
+    } else { // Phobos
+        return std.conv.to!(String)(v);
+    }
+}
+
+String dcharToString( dchar v ){
+    return String_valueOf(v);
 }
 
 String String_valueOf( char[] v ){
-    version(D_Version2){
-        return v.idup;
-    } else {
-        return v.dup;
-    }
+    return _idup(v);
 }
 
 String String_valueOf( char[] v, int offset, int len ){
-    version(D_Version2){
-        return v[ offset .. offset+len ].idup;
-    } else {
-        return v[ offset .. offset+len ].dup;
-    }
+    return _idup(v[ offset .. offset+len ]);
 }
 
 String String_valueOf( Object v ){
     return v is null ? "null" : v.toString();
 }
 
-String String_valueOf( CString16 wstr ){
+String String_valueOf( in wchar[] wstr ){
     version(Tango){
         return tango.text.convert.Utf.toString(wstr);
     } else { // Phobos
@@ -489,152 +113,270 @@
     }
 }
 
-int length( CString str ){
+int length( String str ){
     return str.length;
 }
 
 /// Extension to String
-public String toUpperCase( CString str ){
+public String toUpperCase( String str ){
     version(Tango){
         return tango.text.Unicode.toUpper( str );
     } else { // Phobos
-        implMissing( __FILE__, __LINE__ );
-        return null;
+        return cast(String) std.string.toupper( str );
     }
 }
 
 /// Extension to String
-public String replaceFirst( CString str, CString regex, CString replacement ){
+public String replaceFirst( String str, String regex, String replacement ){
     implMissing(__FILE__,__LINE__);
     return null;
 }
 
+version(Tango) int tangoToJavaIdx(T)(int idx, T[] arr) {
+    return idx is arr.length ? -1 : idx;
+}
+
 /// Extension to String
-public int indexOf( CString str, char searched ){
+public int indexOf( in char[] str, char searched ){
     version(Tango){
-        int res = tango.text.Util.locate( str, searched );
-        if( res is str.length ) res = -1;
-        return res;
+        return tangoToJavaIdx(tango.text.Util.locate( str, searched ), str);
     } else { // Phobos
         return std.string.indexOf(str, searched);
     }
 }
 
 /// Extension to String
-public int indexOf( CString str, char searched, int startpos ){
+public int indexOf( in char[] str, char searched, int fromIndex ){
+    if(fromIndex >= str.length)
+        return -1;
     version(Tango){
-        int res = tango.text.Util.locate( str, searched, startpos );
-        if( res is str.length ) res = -1;
+        return tangoToJavaIdx(tango.text.Util.locate( str, searched, fromIndex ), str);
+    } else { // Phobos
+        int res = std.string.indexOf(str[fromIndex .. $], searched);
+        if (res !is -1) res += fromIndex;
         return res;
+    }
+}
+
+/// Extension to String
+public int indexOf(in char[] str, in char[] sub){
+    return indexOf( str, sub, 0 );
+}
+
+/// Extension to String
+public int indexOf(in char[] str, in char[] sub, int fromIndex){
+    if(fromIndex + sub.length > str.length)
+        return -1;
+    if(!sub.length)
+        return fromIndex;
+    version(Tango){
+        return tangoToJavaIdx(tango.text.Util.locatePattern( str, sub, fromIndex ), str);
     } else { // Phobos
-        int res = std.string.indexOf(str[startpos .. $], searched);
-        if (res !is -1) res += startpos;
+        int res = std.string.indexOf(str[fromIndex .. $], sub);
+        if (res !is -1) res += fromIndex;
         return res;
     }
 }
 
 /// Extension to String
-public int indexOf(CString str, String ch){
-    return indexOf( str, ch, 0 );
+public int lastIndexOf(in char[] str, char ch){
+    return lastIndexOf( str, ch, str.length - 1 );
 }
 
 /// Extension to String
-public int indexOf(CString str, String ch, int start){
+public int lastIndexOf(in char[] str, char ch, int fromIndex){
+    if(fromIndex >= str.length)
+        fromIndex = str.length - 1;
     version(Tango){
-        int res = tango.text.Util.locatePattern( str, ch, start );
-        if( res is str.length ) res = -1;
-        return res;
+        return tangoToJavaIdx(tango.text.Util.locatePrior( str, ch, fromIndex + 1 ), str);
     } else { // Phobos
-        return std.string.indexOf(str[start .. $], ch);
+        return std.string.lastIndexOf(str[0 .. fromIndex + 1], ch);
     }
 }
 
 /// Extension to String
-public int lastIndexOf(CString str, char ch){
-    return lastIndexOf( str, ch, str.length );
-}
-
-/// Extension to String
-public int lastIndexOf(CString str, char ch, int formIndex){
-    version(Tango){
-        int res = tango.text.Util.locatePrior( str, ch, formIndex );
-        if( res is str.length ) res = -1;
-        return res;
-    } else { // Phobos
-        return std.string.lastIndexOf(str[0 .. formIndex], ch);
-    }
+public int lastIndexOf(in char[] str, in char[] sub ){
+    return lastIndexOf( str, sub, str.length - sub.length );
 }
 
 /// Extension to String
-public int lastIndexOf(CString str, String ch ){
-    return lastIndexOf( str, ch, str.length );
+public int lastIndexOf(in char[] str, in char[] sub, int fromIndex){
+    int max = cast(int)str.length - cast(int)sub.length;
+    if(fromIndex > max)
+        fromIndex = max;
+    if(!sub.length)
+        return fromIndex;
+    version(Tango){
+        return tangoToJavaIdx(tango.text.Util.locatePatternPrior( str, sub, fromIndex + 1 ), str);
+    } else { // Phobos
+        size_t to = fromIndex + sub.length;
+        return std.string.lastIndexOf(str[0 .. to < $ ? to : $], sub);
+    }
+}
+
+unittest {
+    sizediff_t i;
+
+    i = lastIndexOf("", 'a');
+    assert(i == -1);
+    i = lastIndexOf("def", 'a');
+    assert(i == -1);
+    i = lastIndexOf("abba", 'a');
+    assert(i == 3);
+    i = lastIndexOf("abba", 'a', 0);
+    assert(i == 0);
+    i = lastIndexOf("abba", 'a', 1);
+    assert(i == 0);
+    i = lastIndexOf("abba", 'a', 2);
+    assert(i == 0);
+    i = lastIndexOf("abba", 'a', 3);
+    assert(i == 3);
+    i = lastIndexOf("abba", 'a', 4);
+    assert(i == 3);
+    i = lastIndexOf("abba", 'a', 10);
+    assert(i == 3);
+    i = lastIndexOf("def", 'f');
+    assert(i == 2);
+
+    i = lastIndexOf("", "a");
+    assert(i == -1);
+    i = lastIndexOf("", "");
+    assert(i == 0);
+    i = lastIndexOf("abcdefcdef", "c");
+    assert(i == 6);
+    i = lastIndexOf("abcdefcdef", "cd");
+    assert(i == 6);
+    i = lastIndexOf("abcdefcdef", "cd", 5);
+    assert(i == 2);
+    i = lastIndexOf("abcdefcdef", "cd", 6);
+    assert(i == 6);
+    i = lastIndexOf("abcdefcdef", "cd", 7);
+    assert(i == 6);
+    i = lastIndexOf("abcdefcdef", "cd", 10);
+    assert(i == 6);
+    i = lastIndexOf("abcdefcdef", "x");
+    assert(i == -1);
+    i = lastIndexOf("abcdefcdef", "xy");
+    assert(i == -1);
+    i = lastIndexOf("abcdefcdef", "");
+    assert(i == 10);
+    i = lastIndexOf("abcdefcdef", "", 9);
+    assert(i == 9);
+    i = lastIndexOf("abcabc", "abc");
+    assert(i == 3);
+    i = lastIndexOf("abcabc", "abc", 2);
+    assert(i == 0);
+    i = lastIndexOf("abcabc", "abc", 3);
+    assert(i == 3);
+    i = lastIndexOf("abcabc", "abc", 4);
+    assert(i == 3);
+
+
+
+    i = indexOf("", 'a');
+    assert(i == -1);
+    i = indexOf("def", 'a');
+    assert(i == -1);
+    i = indexOf("abba", 'a');
+    assert(i == 0);
+    i = indexOf("abba", 'a', 0);
+    assert(i == 0);
+    i = indexOf("abba", 'a', 1);
+    assert(i == 3);
+    i = indexOf("abba", 'a', 2);
+    assert(i == 3);
+    i = indexOf("abba", 'a', 3);
+    assert(i == 3);
+    i = indexOf("abba", 'a', 4);
+    assert(i == -1);
+    i = indexOf("abba", 'a', 10);
+    assert(i == -1);
+    i = indexOf("def", 'f');
+    assert(i == 2);
+
+    i = indexOf("", "a");
+    assert(i == -1);
+    i = indexOf("", "");
+    assert(i == 0);
+    i = indexOf("abcdefcdef", "c");
+    assert(i == 2);
+    i = indexOf("abcdefcdef", "cd");
+    assert(i == 2);
+    i = indexOf("abcdefcdef", "cd", 4);
+    assert(i == 6);
+    i = indexOf("abcdefcdef", "cd", 5);
+    assert(i == 6);
+    i = indexOf("abcdefcdef", "cd", 6);
+    assert(i == 6);
+    i = indexOf("abcdefcdef", "cd", 7);
+    assert(i == -1);
+    i = indexOf("abcdefcdef", "cd", 10);
+    assert(i == -1);
+    i = indexOf("abcdefcdef", "x");
+    assert(i == -1);
+    i = indexOf("abcdefcdef", "xy");
+    assert(i == -1);
+    i = indexOf("abcdefcdef", "");
+    assert(i == 0);
+    i = indexOf("abcabc", "abc");
+    assert(i == 0);
+    i = indexOf("abcabc", "abc", 2);
+    assert(i == 3);
+    i = indexOf("abcabc", "abc", 3);
+    assert(i == 3);
+    i = indexOf("abcabc", "abc", 4);
+    assert(i == -1);
 }
 
 /// Extension to String
-public int lastIndexOf(CString str, String ch, int start ){
-    version(Tango){
-        int res = tango.text.Util.locatePatternPrior( str, ch, start );
-        if( res is str.length ) res = -1;
-        return res;
-    } else { // Phobos
-        implMissing( __FILE__, __LINE__ );
-        return 0;
-    }
-}
-
-/// Extension to String
-public String replaceAll( CString str, String regex, String replacement ){
+public String replaceAll( String str, String regex, String replacement ){
     implMissing(__FILE__,__LINE__);
     return null;
 }
 
 /// Extension to String
-public String replace( CString str, char from, char to ){
+public String replace( String str, char from, char to ){
     version(Tango){
         return tango.text.Util.replace( str.dup, from, to );
     } else { // Phobos
-        auto res = std.array.replace(str, [from], [to]);
+        char[1] f = from, t = to;
+        auto res = std.array.replace(str, f[], t[]);
         return std.exception.assumeUnique(res);
     }
 }
 
 /// Extension to String
-public String substring( CString str, int start ){
-    return cast(String)str[ start .. $ ].dup;
+public String substring( String str, int start ){
+    return _idup(str[ start .. $ ]);
 }
 
 /// Extension to String
-public String substring( CString str, int start, int end ){
-    return cast(String)str[ start .. end ].dup;
+public String substring( String str, int start, int end ){
+    return _idup(str[ start .. end ]);
 }
 
 /// Extension to String
-public wchar[] substring( CString16 str, int start ){
-    return cast(wchar[])(str[ start .. $ ].dup);
+public wchar[] substring( String16 str, int start ){
+    return str[ start .. $ ].dup;
 }
 
 /// Extension to String
-public wchar[] substring( CString16 str, int start, int end ){
+public wchar[] substring( String16 str, int start, int end ){
     return str[ start .. end ].dup;
 }
 
 /// Extension to String
-public char charAt( CString str, int pos ){
+public char charAt( String str, int pos ){
     return str[ pos ];
 }
 
 /// Extension to String
-public dchar dcharAt( CString str, int pos ){
-    return str[ pos .. $ ].firstCodePoint();
-}
-
-/// Extension to String
 public void getChars( String src, int srcBegin, int srcEnd, char[] dst, int dstBegin){
     dst[ dstBegin .. dstBegin + srcEnd - srcBegin ] = src[ srcBegin .. srcEnd ];
 }
 
 /// Extension to String
-public String16 toWCharArray( CString str ){
+public String16 toWCharArray( in char[] str ){
     version(Tango){
         return tango.text.convert.Utf.toString16(str);
     } else { // Phobos
@@ -643,12 +385,12 @@
 }
 
 /// Extension to String
-public char[] toCharArray( CString str ){
+public char[] toCharArray( String str ){
     return cast(char[])str;
 }
 
 /// Extension to String
-public bool endsWith( CString src, CString pattern ){
+public bool endsWith( String src, String pattern ){
     if( src.length < pattern.length ){
         return false;
     }
@@ -656,37 +398,55 @@
 }
 
 /// Extension to String
-public bool equals( CString src, CString other ){
+public bool equals( in char[] src, in char[] other ){
     return src == other;
 }
 
 /// Extension to String
-public bool equalsIgnoreCase( CString src, CString other ){
-    version(Tango){
-        return tango.text.Unicode.toFold(src) == tango.text.Unicode.toFold(other);
+public bool equalsIgnoreCase( in char[] src, in char[] other ){
+    version(Tango) {
+        if(src.length != other.length)
+            return false;
+        String s1b = new char[ src.length * 2 ]; //*2, or Tango may reallocate buffers
+        String s2b = new char[ other.length * 2 ];
+        scope(exit) {
+            delete s1b;
+            delete s2b;
+        }
+        return tango.text.Unicode.toFold( src, s1b ) ==
+            tango.text.Unicode.toFold( other, s2b );
     } else { // Phobos
-        implMissing( __FILE__, __LINE__ );
-        return false;
+        return std.string.icmp(src, other) == 0;
     }
 }
 
 /// Extension to String
-public int compareToIgnoreCase( CString src, CString other ){
+public int compareToIgnoreCase( in char[] src, in char[] other ){
     version(Tango){
-        return compareTo( tango.text.Unicode.toFold(src), tango.text.Unicode.toFold(other));
+        String s1b = new char[ src.length * 2 ]; //*2, or Tango may reallocate buffers
+        String s2b = new char[ other.length * 2 ];
+        scope(exit) {
+            delete s1b;
+            delete s2b;
+        }
+        return compareTo( tango.text.Unicode.toFold(src, s1b),
+            tango.text.Unicode.toFold(other, s2b));
     } else { // Phobos
-        implMissing( __FILE__, __LINE__ );
-        return 0;
+        return std.string.icmp(src, other);
     }
 }
 
 /// Extension to String
-public int compareTo( CString src, CString other ){
-    return typeid(String).compare( cast(void*)&src, cast(void*)&other );
+public int compareTo( in char[] src, in char[] other ){
+    version(Tango){
+        return typeid(String).compare( cast(void*)&src, cast(void*)&other );
+    } else { // Phobos
+        return std.string.cmp(src, other);
+    }
 }
 
 /// Extension to String
-public bool startsWith( CString src, CString pattern ){
+public bool startsWith( String src, String pattern ){
     if( src.length < pattern.length ){
         return false;
     }
@@ -694,23 +454,22 @@
 }
 
 /// Extension to String
-public String toLowerCase( CString src ){
+public String toLowerCase( String src ){
     version(Tango){
         return tango.text.Unicode.toLower( src );
     } else { // Phobos
-        implMissing( __FILE__, __LINE__ );
-        return null;
+        return cast(String) std.string.tolower(src);
     }
 }
 
 /// Extension to String
-public hash_t toHash( CString src ){
+public hash_t toHash( String src ){
     return typeid(String).getHash(&src);
 }
 public alias toHash String_toHash;
 
 /// Extension to String
-public String trim( CString str ){
+public String trim( String str ){
     version(Tango){
         return tango.text.Util.trim( str ).dup;
     } else { // Phobos
@@ -719,22 +478,8 @@
 }
 
 /// Extension to String
-public String intern( CString str ){
-    return str._idup();
-}
-
-/++
- + This is like tango.stdc.stringz.toStringz, but in case of an empty input string,
- + this function returns a pointer to a null value instead of a null ptr.
- +/
-public char* toStringzValidPtr( CString src ){
-    if( src ){
-        return src.toStringz();
-    }
-    else{
-        static const char[] nullPtr = "\0";
-        return cast(char*)nullPtr.ptr;
-    }
+public String intern( String str ){
+    return _idup(str);
 }
 
 version(Tango){
@@ -742,60 +487,67 @@
     public alias tango.stdc.stringz.toString16z toString16z;
     public alias tango.stdc.stringz.fromStringz fromStringz;
     public alias tango.stdc.stringz.fromString16z fromString16z;
-} else { // Phobos
-    public char* toStringz( CString s ){
-        if (s.ptr) {
-            if (s.length == 0)
-                return "\0".dup.ptr;
-                
-            else
-                return (s ~ "\0").dup.ptr;
+
+    /++
+     + This is like tango.stdc.stringz.toStringz, but in case of an empty input string,
+     + this function returns a pointer to a null value instead of a null ptr.
+     +/
+    public char* toStringzValidPtr( String src ){
+        if( src ){
+            return src.toStringz();
         }
-        
-        return null;
-    }
-    public wchar* toString16z( CString16 s ){
-        if (s.ptr) {
-            if (s.length == 0)
-                return "\0"w.dup.ptr;
-                
-            else
-                return (s ~ "\0"w).dup.ptr;
+        else{
+            return "".ptr;
         }
-        
-        return null;
+    }
+} else { // Phobos
+    static import std.c.string;
+    
+    public char* toStringzValidPtr( in char[] s ) {
+        auto copy = new char[s.length + 1];
+        copy[0..s.length] = s;
+        copy[s.length] = 0;
+        return copy.ptr;
+    }
+    
+    public char* toStringz( in char[] s ) {
+        return s is null ? null : toStringzValidPtr(s);
+    }
+    
+    public char[] fromStringz( in char* s ){
+        return s ? s[0 .. std.c.string.strlen(s)].dup : cast(char[])null;
     }
-    public char[] fromStringz( CCharPtr s ){
-        size_t len;
-        
-        if (s)
-            while (*s++)
-                len++;
-                
-        return s[0 .. len].dup;
+    /*public string fromStringz( in char* s ){
+        return std.conv.to!(string)(s);
+    }*/
+    
+    private size_t w_strlen(in wchar* s) {
+        size_t res = 0;
+        while(*(s+res))
+            ++res;
+        return res;
     }
-    public wchar[] fromString16z( CWCharPtr s ){
-        size_t len;
-        
-        if (s)
-            while (*s++)
-                len++;
-                
-        return s[0 .. len].dup;
+    
+    public wchar* toString16z( in wchar[] s ){
+        if(s is null)
+            return null;
+        auto copy = new wchar[s.length + 1];
+        copy[0..s.length] = s;
+        copy[s.length] = 0;
+        return copy.ptr;
+    }
+    
+    //Copy of std.conv.toImpl(T, S)(S s) for C-style strings
+    public wstring fromString16z( in wchar* s ){
+        return s ? s[0 .. w_strlen(s)].idup : cast(wstring)null;
     }
 }
 
-static String toHex(uint value, bool prefix = true, int radix = 8){
+static String toHex(uint i){
     version(Tango){
-        return tango.text.convert.Integer.toString(
-                value,
-                radix is 10 ? "d" :
-                radix is  8 ? "o" :
-                radix is 16 ? "x" :
-                "d" );
+        return tango.text.convert.Integer.toString(i, "x");
     } else { // Phobos
-        implMissing( __FILE__, __LINE__ );
-        return null;
+        return std.conv.to!(String)(i, 16);
     }
 }
 
@@ -807,16 +559,16 @@
     this( String str ){
         this.str = str;
     }
-    char           charAt(int index){
+    char charAt(int index){
         return str[index];
     }
-    int             length(){
+    int length(){
         return str.length;
     }
-    CharSequence    subSequence(int start, int end){
+    CharSequence subSequence(int start, int end){
         return new StringCharSequence( str[ start .. end ]);
     }
-    String          toString(){
+    String toString(){
         return str;
     }
 }
@@ -831,5 +583,3 @@
     }
 
 }
-
-
--- a/base/src/java/lang/StringBuffer.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/base/src/java/lang/StringBuffer.d	Sat Jul 09 15:50:20 2011 +0300
@@ -1,96 +1,85 @@
 module java.lang.StringBuffer;
 
 import java.lang.util;
+import java.lang.exceptions;
+import java.lang.String;
 
 version(Tango){
     static import tango.text.Text;
     static import tango.text.convert.Utf;
 } else { // Phobos
-    static import std.uni;
+    static import std.outbuffer;
     static import std.utf;
 }
 
 class StringBuffer : CharSequence {
     version(Tango){
         alias tango.text.Text.Text!(char) TBuf;
-        TBuf buf;
     } else { // Phobos
-        const int STDINCR = 128;
-        char[] buf;
-        int used;
+        alias std.outbuffer.OutBuffer TBuf;
     }
+    private TBuf buffer;
 
     public this(){
-        version(Tango){
-            buf = new TBuf();
-        } else { // Phobos
-        }
+        buffer = new TBuf();
     }
 
     public this( int cap ){
         version(Tango){
-            buf = new TBuf(cap);
+            buffer = new TBuf(cap);
         } else { // Phobos
-            buf.length = cap;
+            buffer = new TBuf();
+            buffer.reserve(cap);
         }
     }
 
-    public this( CString content ){
+    public this( String content ){
         version(Tango){
-            buf = new TBuf( content );
+            buffer = new TBuf( content );
         } else { // Phobos
-            buf.length = content.length + STDINCR;
-            buf[ 0 .. content.length ] = content;
-            used = content.length;
+            buffer = new TBuf();
+            append(content);
         }
     }
 
     char charAt(int index){
         version(Tango){
-            return buf.slice()[ index ];
+            return buffer.slice()[ index ];
         } else { // Phobos
-            return buf[ index ];
+            return buffer.toBytes()[ index ];
         }
     }
 
     int length(){
         version(Tango){
-            return buf.length();
+            return buffer.length();
         } else { // Phobos
-            return used;
+            return buffer.offset;
         }
     }
 
     CharSequence subSequence(int start, int end){
-        version(Tango){
-            return new StringBuffer( buf.slice()[ start .. end ] );
-        } else { // Phobos
-            return new StringBuffer( cast(String)buf[ start .. end ] );
-        }
+        return new StringCharSequence( substring(start, end) );
     }
 
     String toString(){
         version(Tango){
-            return buf.slice();
+            return buffer.slice().dup;
         } else { // Phobos
-            return cast(String)buf[ 0 .. used ];
+            return buffer.toString();
         }
     }
 
-    StringBuffer append( CString s ){
+    StringBuffer append( in char[] s ){
         version(Tango){
-            buf.append( s );
+            buffer.append( s );
         } else { // Phobos
-            if( buf.length < used + s.length ){
-                buf.length = used + s.length + STDINCR;
-            }
-            buf[ used .. used + s.length ] = s;
-            used += s.length;
+            buffer.write( s );
         }
         return this;
     }
 
-    StringBuffer append( CString s, int offset, int len ){
+    StringBuffer append( in char[] s, int offset, int len ){
         return append( s[ offset .. offset+len ] );
     }
 
@@ -103,21 +92,37 @@
     }
 
     StringBuffer append( char c ){
-        char[1] src;
-        src[0] = c;
-        return append( cast(String)src );
+        version(Tango){
+            char[1] src = c;
+            return append( src );
+        } else { // Phobos
+            buffer.write(c);
+            return this;
+        }
     }
 
     StringBuffer append( wchar c ){
-        wchar[1] src;
-        src[0] = c;
         version(Tango){
-            char[2] trg;
+            wchar[1] src = c;
+            char[1 * 2 + 3] trg; // or Tango will reallocate output to input.length * 2 + 3
             auto arr = tango.text.convert.Utf.toString( src, trg );
+            return append( arr );
         } else { // Phobos
-            auto arr = std.utf.toUTF8( src );
+            char[4] trg;
+            return append( trg[0 .. std.utf.encode(trg, c)] );
         }
-        return append( arr );
+    }
+
+    StringBuffer append( dchar c ){
+        version(Tango){
+            dchar[1] src = c;
+            char[1 * 2 + 4] trg; // or Tango will reallocate output to input.length * 2 + 4
+            auto arr = tango.text.convert.Utf.toString( src, trg );
+            return append( arr );
+        } else { // Phobos
+            char[4] trg;
+            return append( trg[0 .. std.utf.encode(trg, c)] );
+        }
     }
 
     StringBuffer append( bool i ){
@@ -132,103 +137,87 @@
         return append( String_valueOf(i) );
     }
 
-    StringBuffer append( dchar c ){
-        dchar[1] src;
-        src[0] = c;
+    StringBuffer replace(int start, int end, in char[] str) {
+        if(start < 0 || start > length() || start > end)
+            throw new StringIndexOutOfBoundsException("start is negative, greater than length(), or greater than end");
+        
         version(Tango){
-            char[4] trg;
-            auto arr = tango.text.convert.Utf.toString( src, trg );
-        } else { // Phobos
-            auto arr = std.utf.toUTF8( src );
-        }
-        return append( arr );
-    }
-
-
-    StringBuffer insert(int offset, int i){
-        return insert( offset, String_valueOf(i) );
-    }
-    StringBuffer insert(int offset, CString str){
-        return replace( offset, offset, str );
-    }
-
-    StringBuffer insert(int offset, StringBuffer other){
-        return insert( offset, other.slice());
-    }
-
-    StringBuffer replace(int start, int end, CString str) {
-        version(Tango){
-            buf.select(start, end-start);
-            buf.replace(str);
-            buf.select();
+            buffer.select(start, end-start);
+            buffer.replace(str);
+            buffer.select();
         } else { // Phobos
-            int incr = end - start - str.length;
-            if( incr > 0 ){
-                if( buf.length < used + incr ){
-                    char[] newbuf = new char[ 2*(used + incr) + STDINCR ];
-                    newbuf[ 0 .. start ] = buf[ 0 .. start ];
-                    newbuf[ start .. start + str.length ] = str;
-                    newbuf[ start + str.length .. used + str.length ] = buf[ end .. used ];
-                    buf = newbuf;
+            if(end >= length()) {
+                buffer.offset = start;
+                return append(str);
+            }
+            int strEnd = start + str.length, incr = strEnd - end;
+            
+            if( incr > 0 ) {
+                buffer.spread(end, incr);
+            }
+            else if( incr < 0 ) {
+                auto bytes = buffer.toBytes();
+                bytes[ start .. strEnd ] = cast(ubyte[])str;
+                foreach (i, b; bytes[ end .. $ ]) {
+                    bytes[strEnd + i] = bytes[end + i];
                 }
-                else{
-                    char* s = buf.ptr + start;
-                    char* t = buf.ptr + start + str.length;
-                    char* e = buf.ptr + start + str.length;
-                    while( s !is e ){
-                        *t = *s;
-                        s++; t++;
-                    }
-                    buf[ start .. start + str.length ] = str;
-                }
+                buffer.offset += incr;
             }
-            else if( incr == 0 ){
-                buf[ start .. end ] = str;
-            }
-            else{
-                buf[ start .. end ] = str;
-                char* s = buf.ptr + end;
-                char* t = buf.ptr + start + str.length;
-                char* e = buf.ptr + start + str.length;
-                while( s !is e ){
-                    *t = *s;
-                    s--; t--;
-                }
-            }
-            used += incr;
+            buffer.toBytes()[ start .. strEnd ] = cast(ubyte[])str;
         }
         return this;
     }
 
+    StringBuffer insert(int offset, in char[] str){
+        return replace( offset, offset, str );
+    }
+    
+    StringBuffer insert(int offset, int i){
+        return insert( offset, String_valueOf(i) );
+    }
+
+    StringBuffer insert(int offset, StringBuffer other){
+        return insert( offset, other.slice() );
+    }
+
     void setLength( int newLength ){
+        if(newLength < 0)
+            throw new IndexOutOfBoundsException("the newLength argument is negative");
+        
         version(Tango){
-            buf.truncate( newLength );
+            buffer.truncate( newLength );
         } else { // Phobos
-            if( buf.length < newLength ){
-                buf.length = 2*newLength + STDINCR;
-            }
-            used = newLength;
+            immutable d = newLength - length();
+            if( d > 0 )
+                buffer.reserve(d);
+            else
+                buffer.offset += d;
         }
     }
 
     String substring( int start, int end ){
+        if(start < 0 || end < 0 || end > length() || start > end)
+            throw new StringIndexOutOfBoundsException("start or end are negative, if end is greater than length(), or if start is greater than end");
+        
         version(Tango){
-            return buf.slice()[ start .. end ].dup;
+            return buffer.slice()[ start .. end ].dup;
         } else { // Phobos
-            return buf[ start .. end ].idup;
+            return (cast(char[]) buffer.toBytes()[ start .. end ]).idup;
         }
     }
 
     void delete_( int start, int end ){
         replace( start, end, "" );
     }
-    String slice(){
+    
+    TryConst!(char)[] slice(){
         version(Tango){
-            return buf.slice();
+            return buffer.slice();
         } else { // Phobos
-            return cast(String)buf[ 0 .. used ];
+            return cast(TryConst!(char)[]) buffer.toBytes();
         }
     }
+    
     void truncate( int start ){
         setLength( start );
     }
--- a/base/src/java/lang/System.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/base/src/java/lang/System.d	Sat Jul 09 15:50:20 2011 +0300
@@ -81,12 +81,7 @@
         }
     }
 
-    version(D_Version2){
-        mixin("alias const(T) CT;");
-    } else { // D1
-        alias T CT;
-    }
-    static void arraycopy(CT[] src, uint srcPos, T[] dest, uint destPos, uint len)
+    static void arraycopy(in T[] src, uint srcPos, T[] dest, uint destPos, uint len)
     {
         if(len == 0) return;
 
--- a/base/src/java/lang/Thread.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/base/src/java/lang/Thread.d	Sat Jul 09 15:50:20 2011 +0300
@@ -22,7 +22,7 @@
         private alias tango.core.Thread.ThreadLocal!(Thread) TTLS;
         private static TTLS tls;
     } else { // Phobos
-        mixin( "static __thread Thread tls;" );
+        private static Thread tls; //in tls
     }
 
     public static const int MAX_PRIORITY  = 10;
@@ -136,7 +136,7 @@
         thread.name = name;
     }
     public String getName(){
-        return cast(String)thread.name;
+        return thread.name;
     }
 
     void interrupt() {
@@ -168,7 +168,7 @@
         return thread;
     }
     public override String toString(){
-        return cast(String) "Thread "~cast(String)thread.name;
+        return "Thread " ~ thread.name;
     }
     public static void yield(){
         TThread.yield();
--- a/base/src/java/lang/exceptions.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/base/src/java/lang/exceptions.d	Sat Jul 09 15:50:20 2011 +0300
@@ -100,6 +100,12 @@
     }
 }
 
+class StringIndexOutOfBoundsException : IndexOutOfBoundsException {
+    this( String e = null){
+        super(e);
+    }
+}
+
 class InterruptedException : Exception {
     this( String e = null ){
         super(e);
--- a/base/src/java/lang/util.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/base/src/java/lang/util.d	Sat Jul 09 15:50:20 2011 +0300
@@ -18,6 +18,8 @@
     static import std.stdio;
     static import std.array;
     static import std.format;
+    static import std.typetuple;
+    static import std.traits;
     static import std.exception;
     alias std.c.stdlib.exit exit;
 }
@@ -78,23 +80,30 @@
         }
     }
 } else { // Phobos
+	static import core.vararg;
+	
     class DwtLogger : IDwtLogger {
-        private this( String name ){
+        private this( String name ) {
         }
         void trace( String file, ulong line, String fmt, ... ){
-            std.stdio.writefln( "TRC %s %d: %s", file, line, fmt );
-        }
-        void info( String file, ulong line, String fmt, ... ){
-            std.stdio.writefln( "INF %s %d: %s", file, line, fmt );
-        }
-        void warn( String file, ulong line, String fmt, ... ){
-            std.stdio.writefln( "WRN %s %d: %s", file, line, fmt );
-        }
+			fmt = fmtFromTangoFmt(fmt);
+            std.stdio.writefln( "TRC %s %s: %s", file, line, doVarArgFormat(typeid(fmt) ~ _arguments, &fmt) );
+        }																	
+        void info( String file, ulong line, String fmt, ... ){	
+			fmt = fmtFromTangoFmt(fmt);		
+            std.stdio.writefln( "INF %s %s: %s", file, line, doVarArgFormat(typeid(fmt) ~ _arguments, &fmt) );
+        }																	
+        void warn( String file, ulong line, String fmt, ... ){	
+			fmt = fmtFromTangoFmt(fmt);		
+            std.stdio.writefln( "WRN %s %s: %s", file, line, doVarArgFormat(typeid(fmt) ~ _arguments, &fmt) );
+        }																	
         void error( String file, ulong line, String fmt, ... ){
-            std.stdio.writefln( "ERR %s %d: %s", file, line, fmt );
-        }
+			fmt = fmtFromTangoFmt(fmt);		
+            std.stdio.writefln( "ERR %s %s: %s", file, line, doVarArgFormat(typeid(fmt) ~ _arguments, &fmt) );
+        }																	
         void fatal( String file, ulong line, String fmt, ... ){
-            std.stdio.writefln( "FAT %s %d: %s", file, line, fmt );
+			fmt = fmtFromTangoFmt(fmt);	
+            std.stdio.writefln( "FAT %s %s: %s", file, line, doVarArgFormat(typeid(fmt) ~ _arguments, &fmt) );
         }
     }
 }
@@ -119,37 +128,352 @@
     exit(1);
 }
 
+void implMissingInTango(T = void)( String file, uint line ) {
+    version(Tango) {} else static assert(0, "For Tango implMissings only");
+    getDwtLogger().fatal( file, line, "implementation missing in Tango version" );
+    implMissing( file, line );
+}
+
+void implMissingInPhobos( String file = __FILE__, uint line = __LINE__ )() {
+    version(Tango) static assert(0, "For Phobos implMissings only");
+    getDwtLogger().fatal( file, line, "implementation missing in Phobos version" );
+    implMissing( file, line );
+}
+
 version(Tango){
     public alias tango.text.convert.Format.Format Format;
 } else { // Phobos
+	private string fmtFromTangoFmt(string tangoFmt) {
+		auto app = std.array.appender!(string)();
+		app.reserve(tangoFmt.length);
+	L:	for(int i = 0; i < tangoFmt.length; ++i) {
+			char c = tangoFmt[i];
+			if(c == '%')
+				app.put("%%");
+			else if(c == '{') {
+                if(i + 1 < tangoFmt.length && tangoFmt[i + 1] == '{') {
+                    app.put('{');
+                    ++i;
+                } else {
+                    int j = i;
+                    do {
+                        ++j;
+                        if(j == tangoFmt.length) {
+                            app.put("{malformed format}");
+                            break L;
+                        }
+                    } while(tangoFmt[j] != '}');
+                    string f = tangoFmt[i + 1 .. j];
+                    i = j;
+                    if(f.length) {
+                        string fres = "%";
+                        try {
+                            if(std.ctype.isdigit(f[0])) {
+                                int n = std.conv.parse!(int)(f);
+                                fres ~= std.conv.to!(string)(n + 1) ~ '$';
+                            }
+                            if(f.length) {
+                                std.exception.enforce(f[0] == ':' && f.length > 1);
+                                c = f[1];
+                                if(f.length == 2 && "bodxXeEfFgG".indexOf(c) != -1)
+                                    fres ~= c;
+                                else
+                                    fres = null;
+                            } else
+                                fres ~= 's';
+                        } catch {
+                            fres = "{malformed format}";
+                        }
+                        if(fres)
+                            app.put(fres);
+                        else
+                            implMissingInPhobos();
+                    } else
+                        app.put("%s");
+                }
+			} else
+				app.put(c);
+		}
+        return app.data();
+	}
+    
+    unittest
+    {
+        alias Format Formatter;
+
+        // basic layout tests
+        assert( Formatter( "abc" ) == "abc" );
+        assert( Formatter( "{0}", 1 ) == "1" );
+        assert( Formatter( "{0}", -1 ) == "-1" );
+
+        assert( Formatter( "{}", 1 ) == "1" );
+        assert( Formatter( "{} {}", 1, 2) == "1 2" );
+        // assert( Formatter( "{} {0} {}", 1, 3) == "1 1 3" );
+        // assert( Formatter( "{} {0} {} {}", 1, 3) == "1 1 3 {invalid index}" );
+        // assert( Formatter( "{} {0} {} {:x}", 1, 3) == "1 1 3 {invalid index}" );
+        assert( Formatter( "{0} {0} {1}", 1, 3) == "1 1 3" );
+        assert( Formatter( "{0} {0} {1} {0}", 1, 3) == "1 1 3 1" );
+
+        assert( Formatter( "{0}", true ) == "true" , Formatter( "{0}", true ));
+        assert( Formatter( "{0}", false ) == "false" );
+
+        assert( Formatter( "{0}", cast(byte)-128 ) == "-128" );
+        assert( Formatter( "{0}", cast(byte)127 ) == "127" );
+        assert( Formatter( "{0}", cast(ubyte)255 ) == "255" );
+
+        assert( Formatter( "{0}", cast(short)-32768  ) == "-32768" );
+        assert( Formatter( "{0}", cast(short)32767 ) == "32767" );
+        assert( Formatter( "{0}", cast(ushort)65535 ) == "65535" );
+        // assert( Formatter( "{0:x4}", cast(ushort)0xafe ) == "0afe" );
+        // assert( Formatter( "{0:X4}", cast(ushort)0xafe ) == "0AFE" );
+
+        assert( Formatter( "{0}", -2147483648 ) == "-2147483648" );
+        assert( Formatter( "{0}", 2147483647 ) == "2147483647" );
+        assert( Formatter( "{0}", 4294967295 ) == "4294967295" );
+
+        // large integers
+        assert( Formatter( "{0}", -9223372036854775807L) == "-9223372036854775807" );
+        assert( Formatter( "{0}", 0x8000_0000_0000_0000L) == "9223372036854775808" );
+        assert( Formatter( "{0}", 9223372036854775807L ) == "9223372036854775807" );
+        assert( Formatter( "{0:X}", 0xFFFF_FFFF_FFFF_FFFF) == "FFFFFFFFFFFFFFFF" );
+        assert( Formatter( "{0:x}", 0xFFFF_FFFF_FFFF_FFFF) == "ffffffffffffffff" );
+        assert( Formatter( "{0:x}", 0xFFFF_1234_FFFF_FFFF) == "ffff1234ffffffff" );
+        // assert( Formatter( "{0:x19}", 0x1234_FFFF_FFFF) == "00000001234ffffffff" );
+        assert( Formatter( "{0}", 18446744073709551615UL ) == "18446744073709551615" );
+        assert( Formatter( "{0}", 18446744073709551615UL ) == "18446744073709551615" );
+
+        // fragments before and after
+        assert( Formatter( "d{0}d", "s" ) == "dsd" );
+        assert( Formatter( "d{0}d", "1234567890" ) == "d1234567890d" );
+
+        // brace escaping
+        assert( Formatter( "d{0}d", "<string>" ) == "d<string>d");
+        assert( Formatter( "d{{0}d", "<string>" ) == "d{0}d");
+        assert( Formatter( "d{{{0}d", "<string>" ) == "d{<string>d");
+        assert( Formatter( "d{0}}d", "<string>" ) == "d<string>}d");
+
+        // hex conversions, where width indicates leading zeroes
+        assert( Formatter( "{0:x}", 0xafe0000 ) == "afe0000" );
+        // assert( Formatter( "{0:x7}", 0xafe0000 ) == "afe0000" );
+        // assert( Formatter( "{0:x8}", 0xafe0000 ) == "0afe0000" );
+        // assert( Formatter( "{0:X8}", 0xafe0000 ) == "0AFE0000" );
+        // assert( Formatter( "{0:X9}", 0xafe0000 ) == "00AFE0000" );
+        // assert( Formatter( "{0:X13}", 0xafe0000 ) == "000000AFE0000" );
+        // assert( Formatter( "{0:x13}", 0xafe0000 ) == "000000afe0000" );
+
+        // decimal width
+        // assert( Formatter( "{0:d6}", 123 ) == "000123" );
+        // assert( Formatter( "{0,7:d6}", 123 ) == " 000123" );
+        // assert( Formatter( "{0,-7:d6}", 123 ) == "000123 " );
+
+        // width & sign combinations
+        // assert( Formatter( "{0:d7}", -123 ) == "-0000123" );
+        // assert( Formatter( "{0,7:d6}", 123 ) == " 000123" );
+        // assert( Formatter( "{0,7:d7}", -123 ) == "-0000123" );
+        // assert( Formatter( "{0,8:d7}", -123 ) == "-0000123" );
+        // assert( Formatter( "{0,5:d7}", -123 ) == "-0000123" );
+
+        // Negative numbers in various bases
+        assert( Formatter( "{:b}", cast(byte) -1 ) == "11111111" );
+        assert( Formatter( "{:b}", cast(short) -1 ) == "1111111111111111" );
+        assert( Formatter( "{:b}", cast(int) -1 )
+                == "11111111111111111111111111111111" );
+        assert( Formatter( "{:b}", cast(long) -1 )
+                == "1111111111111111111111111111111111111111111111111111111111111111" );
+
+        assert( Formatter( "{:o}", cast(byte) -1 ) == "377" );
+        assert( Formatter( "{:o}", cast(short) -1 ) == "177777" );
+        assert( Formatter( "{:o}", cast(int) -1 ) == "37777777777" );
+        assert( Formatter( "{:o}", cast(long) -1 ) == "1777777777777777777777" );
+
+        assert( Formatter( "{:d}", cast(byte) -1 ) == "-1" );
+        assert( Formatter( "{:d}", cast(short) -1 ) == "-1" );
+        assert( Formatter( "{:d}", cast(int) -1 ) == "-1" );
+        assert( Formatter( "{:d}", cast(long) -1 ) == "-1" );
+
+        assert( Formatter( "{:x}", cast(byte) -1 ) == "ff" );
+        assert( Formatter( "{:x}", cast(short) -1 ) == "ffff" );
+        assert( Formatter( "{:x}", cast(int) -1 ) == "ffffffff" );
+        assert( Formatter( "{:x}", cast(long) -1 ) == "ffffffffffffffff" );
+
+        // argument index
+        assert( Formatter( "a{0}b{1}c{2}", "x", "y", "z" ) == "axbycz" );
+        assert( Formatter( "a{2}b{1}c{0}", "x", "y", "z" ) == "azbycx" );
+        assert( Formatter( "a{1}b{1}c{1}", "x", "y", "z" ) == "aybycy" );
+
+        // alignment does not restrict the length
+        // assert( Formatter( "{0,5}", "hellohello" ) == "hellohello" );
+
+        // alignment fills with spaces
+        // assert( Formatter( "->{0,-10}<-", "hello" ) == "->hello     <-" );
+        // assert( Formatter( "->{0,10}<-", "hello" ) == "->     hello<-" );
+        // assert( Formatter( "->{0,-10}<-", 12345 ) == "->12345     <-" );
+        // assert( Formatter( "->{0,10}<-", 12345 ) == "->     12345<-" );
+
+        // chop at maximum specified length; insert ellipses when chopped
+        // assert( Formatter( "->{.5}<-", "hello" ) == "->hello<-" );
+        // assert( Formatter( "->{.4}<-", "hello" ) == "->hell...<-" );
+        // assert( Formatter( "->{.-3}<-", "hello" ) == "->...llo<-" );
+
+        // width specifier indicates number of decimal places
+        assert( Formatter( "{0:f}", 1.23f ) == "1.230000" );
+        // assert( Formatter( "{0:f4}", 1.23456789L ) == "1.2346" );
+        // assert( Formatter( "{0:e4}", 0.0001) == "1.0000e-04");
+
+        assert( Formatter( "{0:f}", 1.23f*1i ) == "1.230000i");
+        // assert( Formatter( "{0:f4}", 1.23456789L*1i ) == "1.2346*1i" );
+        // assert( Formatter( "{0:e4}", 0.0001*1i) == "1.0000e-04*1i");
+
+        assert( Formatter( "{0:f}", 1.23f+1i ) == "1.230000+1.000000i" );
+        // assert( Formatter( "{0:f4}", 1.23456789L+1i ) == "1.2346+1.0000*1i" );
+        // assert( Formatter( "{0:e4}", 0.0001+1i) == "1.0000e-04+1.0000e+00*1i");
+        assert( Formatter( "{0:f}", 1.23f-1i ) == "1.230000+-1.000000i" );
+        // assert( Formatter( "{0:f4}", 1.23456789L-1i ) == "1.2346-1.0000*1i" );
+        // assert( Formatter( "{0:e4}", 0.0001-1i) == "1.0000e-04-1.0000e+00*1i");
+
+        // 'f.' & 'e.' format truncates zeroes from floating decimals
+        // assert( Formatter( "{:f4.}", 1.230 ) == "1.23" );
+        // assert( Formatter( "{:f6.}", 1.230 ) == "1.23" );
+        // assert( Formatter( "{:f1.}", 1.230 ) == "1.2" );
+        // assert( Formatter( "{:f.}", 1.233 ) == "1.23" );
+        // assert( Formatter( "{:f.}", 1.237 ) == "1.24" );
+        // assert( Formatter( "{:f.}", 1.000 ) == "1" );
+        // assert( Formatter( "{:f2.}", 200.001 ) == "200");
+
+        // array output
+        int[] a = [ 51, 52, 53, 54, 55 ];
+        assert( Formatter( "{}", a ) == "[51, 52, 53, 54, 55]" );
+        assert( Formatter( "{:x}", a ) == "[33, 34, 35, 36, 37]" );
+        // assert( Formatter( "{,-4}", a ) == "[51  , 52  , 53  , 54  , 55  ]" );
+        // assert( Formatter( "{,4}", a ) == "[  51,   52,   53,   54,   55]" );
+        int[][] b = [ [ 51, 52 ], [ 53, 54, 55 ] ];
+        assert( Formatter( "{}", b ) == "[[51, 52], [53, 54, 55]]" );
+
+        char[1024] static_buffer;
+        static_buffer[0..10] = "1234567890";
+
+        assert (Formatter( "{}", static_buffer[0..10]) == "1234567890");
+
+        version(X86)
+        {
+            ushort[3] c = [ cast(ushort)51, 52, 53 ];
+            assert( Formatter( "{}", c ) == "[51, 52, 53]" );
+        }
+
+        /*// integer AA
+        ushort[long] d;
+        d[234] = 2;
+        d[345] = 3;
+
+        assert( Formatter( "{}", d ) == "{234 => 2, 345 => 3}" ||
+                Formatter( "{}", d ) == "{345 => 3, 234 => 2}");
+
+        // bool/string AA
+        bool[char[]] e;
+        e[ "key".dup ] = true;
+        e[ "value".dup ] = false;
+        assert( Formatter( "{}", e ) == "{key => true, value => false}" ||
+                Formatter( "{}", e ) == "{value => false, key => true}");
+
+        // string/double AA
+        char[][ double ] f;
+        f[ 1.0 ] = "one".dup;
+        f[ 3.14 ] = "PI".dup;
+        assert( Formatter( "{}", f ) == "{1.00 => one, 3.14 => PI}" ||
+                Formatter( "{}", f ) == "{3.14 => PI, 1.00 => one}");*/
+    }
+    
+	private String doVarArgFormat(TypeInfo[] _arguments, core.vararg.va_list _argptr) {
+		char[] res;
+        void putc(dchar c) {
+            std.utf.encode(res, c);
+        }
+        std.format.doFormat(&putc, _arguments, _argptr);
+		return std.exception.assumeUnique(res);
+	}
+	
     class Format{
-        static String opCall( String fmt, ... ){
-            fmt = std.array.replace(fmt, "%", "%%");
-            fmt = std.array.replace(fmt, "{}", "%s");
-            char[] buf;
-            void putc(dchar c) {
-                if (c <= 0x7F) {
-                   buf ~= cast(char)c;
-                } else {
-                    char[4] buf2;
-                    buf ~= std.utf.toUTF8(buf2, c);
-                }
-            }
-            std.format.doFormat(&putc, _arguments, _argptr);
-            return std.exception.assumeUnique(buf);
+        template UnTypedef(T) {
+            static if (is(T U == typedef))
+                alias std.traits.Unqual!(U) UnTypedef;
+            else
+                alias std.traits.Unqual!(T) UnTypedef;
+        }
+        static String opCall(A...)( String _fmt, A _args ){
+            //Formatting a typedef is deprecated
+            std.typetuple.staticMap!(UnTypedef, A) args;
+            foreach(i, _a; _args)
+                static if (is(T U == typedef))
+                    args[i] = cast(U) _a;
+                else
+                    args[i] = _a;
+            
+			auto writer = std.array.appender!(String)();
+            std.format.formattedWrite(writer, fmtFromTangoFmt(_fmt), args);
+            auto res = writer.data();
+            return std.exception.assumeUnique(res);
         }
     }
 }
 
-version( D_Version2 ){
-    mixin("immutable(T)[] _idup(T)( T[] str ){ return str.idup; }");
+version( D_Version2 ) {
+    //dmd v2.052 bug: mixin("alias const(Type) Name;"); will be unvisible outside it's module => we should write alias Const!(Type) Name;
+    template Immutable(T) {
+        mixin("alias immutable(T) Immutable;");
+    }
+    template Const(T) {
+        mixin("alias const(T) Const;");
+    }
+    template Shared(T) {
+        mixin("alias shared(T) Shared;");
+    }
+    
+    alias Immutable TryImmutable;
+    alias Const TryConst;
+    alias Shared TryShared;
+
+    //e.g. for passing strings to com.ibm.icu: *.text.* modules assepts String,
+    //but internal *.mangoicu.* modules work with char[] even if they don't modify it
+    std.traits.Unqual!(T)[] Unqual(T)(T[] t) {
+        return cast(std.traits.Unqual!(T)[])t;
+    }
+    
+    Immutable!(T)[] _idup(T)( T[] str ){ return str.idup; }
+    
+    template prefixedIfD2(String prefix, String content) {
+        const prefixedIfD2 = prefix ~ " " ~ content;
+    }
 } else { // D1
+    template AliasT(T) { alias T AliasT; }
+    
+    alias AliasT TryImmutable;
+    alias AliasT TryConst;
+    alias AliasT TryShared;
+    
+    T Unqual(T)(T t) { return t; }
+    
     String16 _idup( String16 str ){
         return str.dup;
     }
     String _idup( String str ){
         return str.dup;
     }
+    
+    template prefixedIfD2(String prefix, String content) {
+        const prefixedIfD2 = content;
+    }
+}
+
+template sharedStaticThis(String content) {
+    const sharedStaticThis = prefixedIfD2!("shared", "static this()" ~ content);
+}
+
+template gshared(String content) {
+    const gshared = prefixedIfD2!("__gshared:", content);
+}
+
+template constFuncs(String content) {
+    const constFuncs = prefixedIfD2!("const:", content);
 }
 
 private struct GCStats {
@@ -263,15 +587,6 @@
     }
 }
 
-template getImportData(String name ){
+template getImportData(String name) {
     const ImportData getImportData = ImportData( cast(void[]) import(name), name );
-}
-
-template gshared (String content)
-{
-    version (D_Version2)
-        const gshared = "__gshared: " ~ content;
-        
-    else
-        const gshared = content;
-}
+}
\ No newline at end of file
--- a/base/src/java/lang/wrappers.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/base/src/java/lang/wrappers.d	Sat Jul 09 15:50:20 2011 +0300
@@ -1,5 +1,6 @@
 module java.lang.wrappers;
 
+import java.lang.util;
 import java.lang.String;
 
 abstract class ArrayWrapper{
@@ -30,7 +31,7 @@
     }
     static if( is( T == char )){
         public override String toString(){
-            return cast(String)array;
+            return _idup(array);
         }
     }
 }
@@ -88,8 +89,8 @@
 }
 
 String stringcast( Object o ){
-    if( auto str = cast(ArrayWrapperString) o ){
-        return cast(String)str.array;
+    if( auto swrapper = cast(ArrayWrapperString) o ){
+        return swrapper.toString();
     }
     return null;
 }
@@ -119,7 +120,7 @@
         String[] res = new String[ wrapper.array.length ];
         foreach( idx, o; wrapper.array ){
             if( auto swrapper = cast(ArrayWrapperString) o ){
-                res[idx] = cast(String)swrapper.array;
+                res[idx] = swrapper.toString();
             }
         }
         return res;
--- a/base/src/java/nonstandard/Locale.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/base/src/java/nonstandard/Locale.d	Sat Jul 09 15:50:20 2011 +0300
@@ -14,71 +14,71 @@
 } else { // Phobos
     private import std.conv;
     private import std.exception;
-}
-version (Windows) {
-    private import std.c.string;
-    private import std.c.windows.windows;
-    private bool W_VERSION;
-    static this() {
-        W_VERSION = GetVersion < 0x80000000;
-    }
-    private extern (Windows) {
-        enum LCID : DWORD {
-            /// The default locale for the user or process.
-            LOCALE_USER_DEFAULT     = 0x0400,
-        }
-        enum LCTYPE : DWORD {
-            /// ISO639 language name.
-            LOCALE_SISO639LANGNAME  = 0x0059,
-            /// ISO3166 country name.
-            LOCALE_SISO3166CTRYNAME = 0x005A
+
+    version (Windows) {
+        private import std.c.string;
+        private import std.c.windows.windows;
+        private bool W_VERSION;
+        static this() {
+            W_VERSION = GetVersion < 0x80000000;
         }
-        /// Retrieves information about a locale specified by identifier.
-        /// See_Also: GetLocaleInfo Function (Windows)
-        ///           (http://msdn.microsoft.com/en-us/library/dd318101%28VS.85%29.aspx)
-        INT GetLocaleInfoW(
-            LCID Locale,
-            LCTYPE LCType,
-            LPWSTR lpLCData,
-            INT cchData
-        );
-        /// ditto
-        INT GetLocaleInfoA(
-            LCID Locale,
-            LCTYPE LCType,
-            LPCSTR lpLCData,
-            INT cchData
-        );
+        private extern (Windows) {
+            enum LCID : DWORD {
+                /// The default locale for the user or process.
+                LOCALE_USER_DEFAULT     = 0x0400,
+            }
+            enum LCTYPE : DWORD {
+                /// ISO639 language name.
+                LOCALE_SISO639LANGNAME  = 0x0059,
+                /// ISO3166 country name.
+                LOCALE_SISO3166CTRYNAME = 0x005A
+            }
+            /// Retrieves information about a locale specified by identifier.
+            /// See_Also: GetLocaleInfo Function (Windows)
+            ///           (http://msdn.microsoft.com/en-us/library/dd318101%28VS.85%29.aspx)
+            INT GetLocaleInfoW(
+                LCID Locale,
+                LCTYPE LCType,
+                LPWSTR lpLCData,
+                INT cchData
+            );
+            /// ditto
+            INT GetLocaleInfoA(
+                LCID Locale,
+                LCTYPE LCType,
+                LPCSTR lpLCData,
+                INT cchData
+            );
+        }
+        /// A purpose of this templete is switch of W or A in Windows.
+        private String caltureNameImpl(Char, alias GetLocalInfo)() {
+            INT len;
+            Char[] res;
+            Char[] buf;
+            len = GetLocalInfo(LCID.LOCALE_USER_DEFAULT,
+                LCTYPE.LOCALE_SISO639LANGNAME, null, 0);
+            enforce(len, new Exception("LOCALE_SISO639LANGNAME (len)", __FILE__, __LINE__));
+            buf.length = len;
+            len = GetLocalInfo(LCID.LOCALE_USER_DEFAULT,
+                LCTYPE.LOCALE_SISO639LANGNAME, buf.ptr, buf.length);
+            enforce(len, new Exception("LOCALE_SISO639LANGNAME", __FILE__, __LINE__));
+            res ~= buf[0 .. len - 1];
+            res ~= "-";
+            len = GetLocalInfo(LCID.LOCALE_USER_DEFAULT,
+                LCTYPE.LOCALE_SISO3166CTRYNAME, null, 0);
+            enforce(len, new Exception("LOCALE_SISO3166CTRYNAME (len)", __FILE__, __LINE__));
+            buf.length = len;
+            len = GetLocalInfo(LCID.LOCALE_USER_DEFAULT,
+                LCTYPE.LOCALE_SISO3166CTRYNAME, buf.ptr, buf.length);
+            enforce(len, new Exception("LOCALE_SISO3166CTRYNAME", __FILE__, __LINE__));
+            res ~= buf[0 .. len - 1];
+            return to!(String)(res);
+        }
+    } else version (Posix) {
+        private import std.process : getenv;
+        private import std.string : indexOf, replace;
     }
-    /// A purpose of this templete is switch of W or A in Windows.
-    private String caltureNameImpl(Char, alias GetLocalInfo)() {
-        INT len;
-        Char[] res;
-        Char[] buf;
-        len = GetLocalInfo(LCID.LOCALE_USER_DEFAULT,
-            LCTYPE.LOCALE_SISO639LANGNAME, null, 0);
-        enforce(len, new Exception("LOCALE_SISO639LANGNAME (len)", __FILE__, __LINE__));
-        buf.length = len;
-        len = GetLocalInfo(LCID.LOCALE_USER_DEFAULT,
-            LCTYPE.LOCALE_SISO639LANGNAME, buf.ptr, buf.length);
-        enforce(len, new Exception("LOCALE_SISO639LANGNAME", __FILE__, __LINE__));
-        res ~= buf[0 .. len - 1];
-        res ~= "-";
-        len = GetLocalInfo(LCID.LOCALE_USER_DEFAULT,
-            LCTYPE.LOCALE_SISO3166CTRYNAME, null, 0);
-        enforce(len, new Exception("LOCALE_SISO3166CTRYNAME (len)", __FILE__, __LINE__));
-        buf.length = len;
-        len = GetLocalInfo(LCID.LOCALE_USER_DEFAULT,
-            LCTYPE.LOCALE_SISO3166CTRYNAME, buf.ptr, buf.length);
-        enforce(len, new Exception("LOCALE_SISO3166CTRYNAME", __FILE__, __LINE__));
-        res ~= buf[0 .. len - 1];
-        return to!(String)(res);
-    }
-} else version (Posix) {
-    private import std.process : getenv;
-    private import std.string : indexOf, replace;
 }
-
 /// Get a omitted calture name. for example: "en-US"
 String caltureName() {
     version(Tango){
@@ -103,8 +103,7 @@
             if (dot != -1) res = res[0 .. dot];
             return .replace(res, "_", "-");
         } else {
-            implMissing(__FILE__, __LINE__);
-            return "";
+            static assert(0);
         }
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/base/src/java/nonstandard/SafeUtf.d	Sat Jul 09 15:50:20 2011 +0300
@@ -0,0 +1,70 @@
+/** 
+ * Stuff for working with narrow strings.
+ * Safe because of strong type checking.
+ * 
+ * Authors: Denis Shelomovskij <verylonglogin.reg@gmail.com>
+ */
+module java.nonstandard.SafeUtf;
+
+import java.nonstandard.UtfBase;
+
+private const bool UTFTypeCheck = true;
+mixin(UtfBaseText);
+
+unittest {
+    auto s = "abаб回家\U00064321\U00064321d"; assert(s.length == 1+1+2+2+3+3+4+4+1);
+    auto ws = "abаб回家\U00064321\U00064321d"w; assert(ws.length == 1+1+1+1+1+1+2+2+1);
+    auto dchars = "abаб回家\U00064321\U00064321d"d;
+    auto  starts  = [1, 1, 1,0, 1,0, 1,0,0, 1,0,0, 1,0,0,0, 1,0,0,0, 1];
+    auto wstarts  = [1, 1, 1,   1,   1,     1,     1,0,     1,0    , 1];
+    assert(s.length == starts.length);
+    assert(ws.length == wstarts.length);
+    
+    auto  strides = [1, 1, 2, 2, 3, 3, 4, 4, 1];
+    auto wstrides = [1, 1, 1, 1, 1, 1, 2, 2, 1];
+    auto shifts0 = [0, 1, 1+1, 1+1+2, 1+1+2+2, 1+1+2+2+3, 1+1+2+2+3+3, 1+1+2+2+3+3+4, 1+1+2+2+3+3+4+4];
+    assert(strides.length == dchars.length);
+    assert(wstrides.length == dchars.length);
+    assert(shifts0.length == dchars.length);
+    
+    UTF8index prevStart = 0;
+    UCSindex n = 0;
+    foreach(UTF8index i, char ch; s) {
+        assert(s.isUTF8sequenceStart(i) == starts[i]);
+        if(starts[i]) {
+            s.validateUTF8index(i);
+            assert(s.UTF8strideAt(i) == strides[n]);
+            assert(s.toUTF8shift(0, n) == shifts0[n]);
+            assert(s.toUTF8shift(shifts0[n], -n) == -shifts0[n]);
+            if(i) assert(s.offsetBefore(i) == prevStart);
+            assert(s[0 .. val(i)].UCScount == n);
+            assert(s[val(i) .. $].UCScount == strides.length - n);
+            
+            UTF8shift di;
+            assert(s.dcharAt(i, di) == dchars[n]);
+            assert(di == strides[n]);
+            if(i) assert(s.dcharBefore(i) == s.dcharAt(prevStart));
+            if(i) assert(s.dcharAfter(prevStart) == s.dcharAt(i));
+            auto dcharStr = s[val(i) .. val(i) + strides[n]];
+            assert(s.dcharAsStringAt(i, di) == dcharStr && di == dcharStr.length);
+            assert(dcharToString(s.dcharAt(i)) == dcharStr);
+            prevStart = i;
+            ++n;
+        }
+        UTF8index t = i;
+        s.adjustUTF8index(t);
+        assert(t == prevStart);
+    }
+    
+    n = 0;
+    foreach(UTF16index i, wchar ch; ws)
+        if(wstarts[i]) {
+            //s.validateUTF16index(i);
+            UTF16shift di;
+            assert(ws.dcharAt(i, di) == dchars[n]);
+            assert(di == wstrides[n]);
+            ++n;
+        }
+    
+    s.validateUTF8index(s.length);
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/base/src/java/nonstandard/UnsafeUtf.d	Sat Jul 09 15:50:20 2011 +0300
@@ -0,0 +1,12 @@
+/** 
+ * Stuff for working with narrow strings.
+ * Unsafe because of no type checking.
+ * 
+ * Authors: Denis Shelomovskij <verylonglogin.reg@gmail.com>
+ */
+module java.nonstandard.UnsafeUtf;
+
+import java.nonstandard.UtfBase;
+
+private const bool UTFTypeCheck = false;
+mixin(UtfBaseText);
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/base/src/java/nonstandard/UtfBase.d	Sat Jul 09 15:50:20 2011 +0300
@@ -0,0 +1,416 @@
+/** 
+ * Stuff for working with narrow strings.
+ * This module shouldn't be imported directly.
+ * Use SafeUtf/UnsafeUtf modules instead.
+ * 
+ * Authors: Denis Shelomovskij <verylonglogin.reg@gmail.com>
+ */
+module java.nonstandard.UtfBase;
+
+package const UtfBaseText = `
+# line 11 "java\nonstandard\UtfBase.d"
+import java.lang.util;
+
+version(Tango){
+    static import tango.text.convert.Utf;
+} else { // Phobos
+    static import std.utf;
+    static import std.conv;
+}
+
+///The Universal Character Set (UCS), defined by the International Standard ISO/IEC 10646
+/*typedef*/alias int UCSindex;
+alias UCSindex UCSshift;
+
+static if(UTFTypeCheck) {
+    ///UTF-16 (16-bit Unicode Transformation Format)
+    /*struct UTF16index {
+        int internalValue;
+        alias internalValue val;
+        
+        private static UTF16index opCall(int _val) {
+            UTF16index t = { _val };
+            return t;
+        }
+        
+        void opAddAssign(in UTF16shift di) {
+            val += di;
+        }
+        
+        void opSubAssign(in UTF16shift di) {
+            val -= di;
+        }
+        
+mixin(constFuncs!("
+        UTF16index opAdd(in UTF16shift di) {
+            return UTF16index(val + di);
+        }
+        
+        UTF16index opSub(in UTF16shift di) {
+            return UTF16index(val - di);
+        }
+        
+        version(Windows) {
+            UTF16index opAdd(in int di) {
+                return UTF16index(val + di);
+            }
+            
+            UTF16index opSub(in int di) {
+                return UTF16index(val - di);
+            }
+        }
+        
+        int opCmp(in UTF16index i2) {
+            return val - i2.val;
+        }
+"));
+    }*/
+    typedef int UTF16index;
+    typedef int UTF16shift;
+
+    ///UTF-8 (UCS Transformation Format — 8-bit)
+    //typedef int UTF8index;
+    //alias UTF8index UTF8shift;
+    struct UTF8index {
+        int internalValue;
+        alias internalValue val;
+        
+        private static UTF8index opCall(int _val) {
+            UTF8index t = { _val };
+            return t;
+        }
+        
+        void opAddAssign(in UTF8shift di) {
+            val += di.val;
+        }
+        
+        void opSubAssign(in UTF8shift di) {
+            val -= di.val;
+        }
+        
+mixin(constFuncs!("
+        UTF8index opAdd(in UTF8shift di) {
+            return UTF8index(val + di.val);
+        }
+        
+        UTF8index opSub(in UTF8shift di) {
+            return UTF8index(val - di.val);
+        }
+        
+        UTF8shift opSub(in UTF8index di) {
+            return UTF8shift(val - di.val);
+        }
+        
+        int opCmp(in UTF8index i2) {
+            return val - i2.val;
+        }
+"));
+    }
+    
+    private UTF8index newUTF8index(int i) {
+        return UTF8index(i);
+    }
+    
+    private int val(T)(T i) {
+        static if(is(T : UTF16index))
+            return cast(int) i;
+        else
+            return i.val;
+    }
+    
+    private void dec(ref UTF8index i) {
+        --i.val;
+    }
+    
+    struct UTF8shift {
+        int internalValue;
+        alias internalValue val;
+        
+        private static UTF8shift opCall(int _val) {
+            UTF8shift t = { _val };
+            return t;
+        }
+        
+        void opAddAssign(in UTF8shift di) {
+            val += di.val;
+        }
+        
+        void opSubAssign(in UTF8shift di) {
+            val -= di.val;
+        }
+        
+mixin(constFuncs!("
+        UTF8shift opAdd(in UTF8shift di) {
+            return UTF8shift(val + di.val);
+        }
+        
+        UTF8shift opSub(in UTF8shift di) {
+            return UTF8shift(val - di.val);
+        }
+        
+        int opCmp(in UTF8shift di2) {
+            return val - di2.val;
+        }
+"));
+    }
+    
+
+    UTF8index asUTF8index(int i) {
+        return UTF8index(i);
+    }
+
+    UTF8shift asUTF8shift(int i) {
+        return UTF8shift(i);
+    }
+} else {
+    alias int UTF16index;
+    alias int UTF16shift;
+    
+    alias int UTF8index;
+    alias int UTF8shift;
+    
+    private int val(int i) {
+        return i;
+    }
+    
+    private void dec(ref UTF8index i) {
+        --i;
+    }
+}
+
+char charByteAt(in char[] s, in UTF8index i) {
+    return s[val(i)];
+}
+
+UTF8index preFirstIndex(in char[] s) {
+    return cast(UTF8index) -1;
+}
+
+UTF8index firstIndex(in char[] s) {
+    return cast(UTF8index) 0;
+}
+
+UTF8index endIndex(in char[] s) {
+    return cast(UTF8index) s.length;
+}
+
+UTF8index beforeEndIndex(in char[] s) {
+    return s.offsetBefore(s.endIndex());
+}
+
+
+//These variables aren't in TLS so it can be used only for writing
+mixin(gshared!("
+private UCSindex UCSdummyShift;
+private UTF8shift UTF8dummyShift;
+private UTF16shift UTF16dummyShift;
+"));
+
+private const ubyte[256] p_UTF8stride =
+[
+    1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+    1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+    1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+    1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+    1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+    1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+    1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+    1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+    0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+    0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+    0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+    0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+    2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
+    2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
+    3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,
+    4,4,4,4,4,4,4,4,5,5,5,5,6,6,0xFF,0xFF,
+];
+
+private String toUTF8infoString(in char[] s, UTF8index i) {
+    return Format("i = {}, s[i] = {}, s = {}", val(i), cast(ubyte)s.charByteAt(i), cast(ubyte[])s);
+}
+
+class UTF8Exception : Exception {
+    this( String msg, in char[] s, UTF8index i){
+        super( Format("{}:\n{}", msg, toUTF8infoString(s, i)));
+    }
+}
+
+bool isUTF8sequenceStart( in char[] s, in UTF8index i ) {
+    return p_UTF8stride[s.charByteAt(i)] != 0xFF;
+}
+
+void validateUTF8index( in char[] s, in UTF8index i ) {
+    if(i != s.endIndex() && !s.isUTF8sequenceStart(i))
+        throw new UTF8Exception("Not a start of an UTF-8 sequence", s, i);
+}
+
+UTF8shift UTF8strideAt( in char[] s, in UTF8index i ) {
+    s.validateUTF8index(i);
+    version(Tango) {
+        return cast(UTF8shift)p_UTF8stride[s.charByteAt(i)];
+    } else { // Phobos
+        return cast(UTF8shift)std.utf.stride( s, val(i) );
+    }
+}
+
+UTF16shift UTF16strideAt( in wchar[] s, in UTF16index i ) {
+    //s.validateUTF16index(i);
+    version(Tango) {
+        uint u = s[val(i)];
+        return cast(UTF16shift)(1 + (u >= 0xD800 && u <= 0xDBFF));
+    } else { // Phobos
+        return cast(UTF16shift)std.utf.stride( s, val(i) );
+    }
+}
+
+UCSindex UCScount( in char[] s ){
+    version(Tango){
+        scope dchar[] buf = new dchar[]( s.length );
+        uint ate;
+        dchar[] res = tango.text.convert.Utf.toString32( s, buf, &ate );
+        assert( ate is s.length );
+        return res.length;
+    } else { // Phobos
+        return std.utf.count(s);
+    }
+}
+
+UTF8shift toUTF8shift( in char[] s, in UTF8index i, in UCSshift dn ) {
+    s.validateUTF8index(i);
+    UTF8index j = i;
+    UCSshift tdn = dn;
+    if(tdn > 0)
+        do {
+            j += s.UTF8strideAt(j);
+            if(j > s.endIndex())
+                throw new UTF8Exception(Format("toUTF8shift (dn = {}): No end of the UTF-8 sequence", dn), s, i);
+        } while(--tdn)
+    else if(tdn < 0) {
+        do {
+            if(!val(j))
+                if(tdn == -1) {
+                    j = s.preFirstIndex();
+                    break;
+                } else
+                    throw new UTF8Exception(Format("toUTF8shift (dn = {}): Can only go down to -1, not {}", dn, tdn), s, i);
+            int l = 0;
+            do {
+                if(!val(j))
+                    throw new UTF8Exception(Format("toUTF8shift (dn = {}): No start of the UTF-8 sequence before", dn), s, i);
+                ++l;
+                dec(j);
+            } while(!s.isUTF8sequenceStart(j))
+            l -= val(s.UTF8strideAt(j));
+            if(l > 0)
+                throw new UTF8Exception(Format("toUTF8shift (dn = {}): Overlong UTF-8 sequence before", dn), s, i);
+            else if(l < 0)
+                throw new UTF8Exception(Format("toUTF8shift (dn = {}): Too short UTF-8 sequence before", dn), s, i);
+        } while(++tdn)
+    }
+    return j - i;
+}
+
+UTF8index offsetBefore( in char[] s, in UTF8index i ) {
+   return i + s.toUTF8shift(i, -1);
+}
+
+UTF8index offsetAfter( in char[] s, in UTF8index i ) {
+   return i + s.toUTF8shift(i, 1);
+}
+
+/**
+If the index is in a midle of an UTF-8 byte sequence, it
+will return the position of the first byte of this sequence.
+*/
+void adjustUTF8index( in char[] s, ref UTF8index i ){
+    if(i == s.endIndex() || s.isUTF8sequenceStart(i))
+        return;
+    
+    int l = 0;
+    alias i res;
+    do {
+        if(!val(res))
+            throw new UTF8Exception("adjustUTF8index: No start of the UTF-8 sequence", s, i);
+        ++l;
+        dec(res);
+    } while(!s.isUTF8sequenceStart(res))
+    l -= val(s.UTF8strideAt(i));
+    if(l > 0)
+        throw new UTF8Exception("adjustUTF8index: Overlong UTF-8 sequence", s, i);
+}
+
+UTF8index takeIndexArg(String F = __FILE__, uint L = __LINE__)(String s, int i_arg, String location) {
+    UTF8index res = cast(UTF8index) i_arg;
+    if(i_arg > 0 && i_arg < s.length) {
+        auto t = res;
+        s.adjustUTF8index(res);
+        if(t != res)
+            getDwtLogger().warn(F, L, Format("Fixed invalid UTF-8 index at {}:\nnew i = {}, {}", location, val(res), toUTF8infoString(s, t)));
+    }
+    return res;
+}
+
+dchar dcharAt( in char[] s, in UTF8index i, out UTF8shift stride = UTF8dummyShift ) {
+    s.validateUTF8index(i);
+    auto str = s[val(i) .. $];
+    version(Tango){
+        dchar[1] buf;
+        uint ate;
+        dchar[] res = tango.text.convert.Utf.toString32( str, buf, &ate );
+        assert( ate > 0 && res.length is 1 );
+        stride = cast(UTF8shift)ate;
+        return res[0];
+    } else { // Phobos
+        size_t ate = 0;
+        dchar res = std.utf.decode(str, ate);
+        stride = cast(UTF8shift)ate;
+        return res;
+    }
+}
+
+dchar dcharAt( in wchar[] s, in UTF16index i, out UTF16shift stride = UTF16dummyShift ) {
+    //s.validateUTF16index(i);
+    auto str = s[val(i) .. $];
+    version(Tango){
+        dchar[1] buf;
+        uint ate;
+        dchar[] res = tango.text.convert.Utf.toString32( str, buf, &ate );
+        assert( ate > 0 && res.length is 1 );
+        stride = cast(UTF16shift)ate;
+        if( ate is 0 || res.length is 0 ){
+            getDwtLogger().trace( __FILE__, __LINE__, "str.length={} str={:X2}", str.length, cast(ubyte[])str );
+        }
+        return res[0];
+    } else { // Phobos
+        size_t ate = 0;
+        dchar res = std.utf.decode(str, ate);
+        stride = cast(UTF16shift)ate;
+        return res;
+    }
+}
+
+dchar dcharBefore( in char[] s, in UTF8index i ) {
+   return s.dcharAt(s.offsetBefore(i));
+}
+
+dchar dcharAfter( in char[] s, in UTF8index i ) {
+    return s.dcharAt(i + s.toUTF8shift(i, 1));
+}
+
+///Get that String, that contains the next codepoint of a String.
+String dcharAsStringAt( in char[] s, in UTF8index i, out UTF8shift stride = UTF8dummyShift ) {
+    s.validateUTF8index(i);
+    auto str = s[val(i) .. $];
+    uint ate;
+    version(Tango){
+        dchar[1] buf;
+        dchar[] res = tango.text.convert.Utf.toString32( str, buf, &ate );
+    } else { // Phobos
+        ate = std.utf.stride( str, 0 );
+    }
+    stride = cast(UTF8shift)ate;
+    return str[ 0 .. ate ]._idup();
+}
+
+`;
--- a/base/src/java/util/ArrayList.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/base/src/java/util/ArrayList.d	Sat Jul 09 15:50:20 2011 +0300
@@ -277,7 +277,7 @@
             }
             return res;
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
             return null;
         }
     }
--- a/base/src/java/util/HashMap.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/base/src/java/util/HashMap.d	Sat Jul 09 15:50:20 2011 +0300
@@ -41,7 +41,7 @@
         version(Tango){
             map = new MapType();
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
         }
     }
     public this(int initialCapacity){
@@ -51,7 +51,7 @@
         version(Tango){
             map = new MapType(loadFactor);
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
         }
     }
     public this(Map m){
@@ -62,7 +62,7 @@
         version(Tango){
             map.clear();
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
         }
     }
     public bool containsKey(Object key){
@@ -71,7 +71,7 @@
             ObjRef keyr = ObjRef(key);
             return map.get(keyr, v );
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
             return false;
         }
     }
@@ -83,7 +83,7 @@
             ObjRef valuer = ObjRef(value);
             return map.contains(valuer);
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
             return false;
         }
     }
@@ -95,7 +95,7 @@
             }
             return res;
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
             return null;
         }
     }
@@ -115,7 +115,7 @@
             }
             return false;
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
             return false;
         }
     }
@@ -127,7 +127,7 @@
             }
             return null;
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
             return null;
         }
     }
@@ -141,7 +141,7 @@
         version(Tango){
             return map.isEmpty();
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
             return false;
         }
     }
@@ -153,7 +153,7 @@
             }
             return res;
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
             return null;
         }
     }
@@ -168,7 +168,7 @@
             map[ keyr ] = valuer;
             return res;
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
             return null;
         }
     }
@@ -187,7 +187,7 @@
                 map[ObjRef(k)] = ObjRef(v);
             }
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
         }
     }
     public Object remove(Object key){
@@ -200,7 +200,7 @@
             }
             return null;
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
             return null;
         }
     }
@@ -211,7 +211,7 @@
         version(Tango){
             return map.size();
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
             return 0;
         }
     }
@@ -223,7 +223,7 @@
             }
             return res;
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
             return null;
         }
     }
@@ -235,7 +235,7 @@
             }
             return map.opApply( &ldg );
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
             return 0;
         }
     }
@@ -246,7 +246,7 @@
             }
             return map.opApply( &ldg );
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
             return 0;
         }
     }
--- a/base/src/java/util/HashSet.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/base/src/java/util/HashSet.d	Sat Jul 09 15:50:20 2011 +0300
@@ -21,7 +21,7 @@
         version(Tango){
             set = new SetType();
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
         }
     }
     public this(Collection c){
@@ -29,28 +29,28 @@
             set = new SetType();
             addAll(c);
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
         }
     }
     public this(int initialCapacity){
         version(Tango){
             set = new SetType();
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
         }
     }
     public this(int initialCapacity, float loadFactor){
         version(Tango){
             set = new SetType(loadFactor);
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
         }
     }
     public bool    add(Object o){
         version(Tango){
             return set.add(o);
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
             return false;
         }
     }
@@ -68,14 +68,14 @@
         version(Tango){
             set.clear();
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
         }
     }
     public bool    contains(Object o){
         version(Tango){
             return set.contains(o);
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
             return false;
         }
     }
@@ -98,7 +98,7 @@
         version(Tango){
             return set.isEmpty();
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
             return false;
         }
     }
@@ -125,7 +125,7 @@
         version(Tango){
             return new LocalIterator(set.iterator());
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
             return null;
         }
     }
@@ -133,7 +133,7 @@
         version(Tango){
             return set.remove(o);
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
             return false;
         }
     }
@@ -152,7 +152,7 @@
         version(Tango){
             return set.size();
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
             return 0;
         }
     }
@@ -167,7 +167,7 @@
             }
             return res;
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
             return null;
         }
     }
@@ -185,7 +185,7 @@
         version(Tango){
             return set.opApply(dg);
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
             return 0;
         }
     }
--- a/base/src/java/util/IdentityHashMap.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/base/src/java/util/IdentityHashMap.d	Sat Jul 09 15:50:20 2011 +0300
@@ -25,7 +25,7 @@
         version(Tango){
             map = new MapType();
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
         }
     }
     public this(int initialCapacity){
@@ -37,7 +37,7 @@
         version(Tango){
             map = new MapType(loadFactor);
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
         }
     }
     public this(Map m){
@@ -49,7 +49,7 @@
         version(Tango){
             map.clear();
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
         }
     }
     public bool containsKey(Object key){
@@ -57,7 +57,7 @@
             Object v;
             return map.get(key, v );
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
             return false;
         }
     }
@@ -68,7 +68,7 @@
         version(Tango){
             return map.contains(value);
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
             return false;
         }
     }
@@ -80,7 +80,7 @@
             }
             return res;
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
             return null;
         }
     }
@@ -100,7 +100,7 @@
             }
             return false;
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
             return false;
         }
     }
@@ -111,7 +111,7 @@
             }
             return null;
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
             return null;
         }
     }
@@ -125,7 +125,7 @@
         version(Tango){
             return map.isEmpty();
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
             return false;
         }
     }
@@ -137,7 +137,7 @@
             }
             return res;
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
             return null;
         }
     }
@@ -150,7 +150,7 @@
             map[ key ] = value;
             return res;
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
             return null;
         }
     }
@@ -169,7 +169,7 @@
                 map[k] = v;
             }
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
         }
     }
     public Object remove(Object key){
@@ -182,7 +182,7 @@
             map.remove(key);
             return null;
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
             return null;
         }
     }
@@ -193,7 +193,7 @@
         version(Tango){
             return map.size();
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
             return 0;
         }
     }
@@ -205,7 +205,7 @@
             }
             return res;
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
             return null;
         }
     }
@@ -214,7 +214,7 @@
         version(Tango){
             return map.opApply( dg );
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
             return 0;
         }
     }
@@ -222,7 +222,7 @@
         version(Tango){
             return map.opApply( dg );
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
             return 0;
         }
     }
--- a/base/src/java/util/LinkedList.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/base/src/java/util/LinkedList.d	Sat Jul 09 15:50:20 2011 +0300
@@ -22,7 +22,7 @@
         version(Tango){
             list = new ListType();
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
         }
     }
     this( Collection c ){
@@ -33,7 +33,7 @@
         version(Tango){
             list.addAt(index,element);
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
         }
     }
     bool    add(Object o){
@@ -41,7 +41,7 @@
             list.add(o);
             return true;
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
             return false;
         }
     }
@@ -64,14 +64,14 @@
         version(Tango){
             list.prepend( o );
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
         }
     }
     void   addLast(Object o){
         version(Tango){
             list.append( o );
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
         }
     }
     //     void   addElement(Object obj){
@@ -85,7 +85,7 @@
         version(Tango){
             list.clear();
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
         }
     }
     Object     clone(){
@@ -96,7 +96,7 @@
         version(Tango){
             return list.contains(elem);
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
             return false;
         }
     }
@@ -110,7 +110,7 @@
             }
             return true;
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
             return false;
         }
     }
@@ -121,7 +121,7 @@
         version(Tango){
             return list.get(index);
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
             return null;
         }
     }
@@ -144,7 +144,7 @@
         version(Tango){
             return list.get(index);
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
             return null;
         }
     }
@@ -152,7 +152,7 @@
         version(Tango){
             return list.get(0);
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
             return null;
         }
     }
@@ -160,7 +160,7 @@
         version(Tango){
             return list.get(list.size()-1);
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
             return null;
         }
     }
@@ -183,7 +183,7 @@
         version(Tango){
             return list.isEmpty();
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
             return false;
         }
     }
@@ -219,7 +219,7 @@
         version(Tango){
             return list.remove(o,false) !is 0;
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
             return false;
         }
     }
@@ -234,7 +234,7 @@
             }
             return res;
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
             return false;
         }
     }
@@ -277,7 +277,7 @@
         version(Tango){
             return list.size();
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
             return 0;
         }
     }
@@ -289,7 +289,7 @@
         version(Tango){
             return list.toArray();
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
             return null;
         }
     }
@@ -297,7 +297,7 @@
         version(Tango){
             return list.toArray( a );
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
             return null;
         }
     }
@@ -313,7 +313,7 @@
             }
             return res;
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
             return null;
         }
     }
--- a/base/src/java/util/ResourceBundle.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/base/src/java/util/ResourceBundle.d	Sat Jul 09 15:50:20 2011 +0300
@@ -13,7 +13,7 @@
     //import tango.text.Util;
     import tango.io.device.File;
 } else { // Phobos
-    import std.file;
+    static import std.file;
 }
 
 
@@ -24,7 +24,7 @@
     /++
      + First entry is the default entry if no maching locale is found
      +/
-    public this( ImportData[] data ){
+    public this( in ImportData[] data ){
         char[] name = caltureName.dup;
         if( name.length is 5 && name[2] is '-' ){
             name[2] = '_';
@@ -48,7 +48,7 @@
         //Trace.formatln( "ResourceBundle default" );
         initialize( cast(String)data[0].data );
     }
-    public this( ImportData data ){
+    public this( in ImportData data ){
         initialize( cast(String)data.data );
     }
     public this( String data ){
@@ -101,7 +101,7 @@
                         case '\\': c = '\\'; break;
                         case '\"': c = '\"'; break;
                         case 'u' :
-                               dchar d = Integer.parseInt( line[ pos+1 .. pos+5 ], 16 );
+                               c = Integer.parseInt( line[ pos+1 .. pos+5 ], 16 );
                                pos += 4;
                                break;
                         default: break;
@@ -137,25 +137,17 @@
             key = java.lang.util.trim(key);
             value = java.lang.util.trim(value);
 
-            version(D_Version2){
-                map[ key.idup ] = value.idup;
-            } else {
-                map[ key.dup ] = value.dup;
-            }
+            map[ _idup(key) ] = _idup(value);
         }
     }
 
-    public bool hasString( CString key ){
+    public bool hasString( String key ){
         return ( key in map ) !is null;
     }
 
-    public String getString( CString key ){
+    public String getString( String key ){
         if( auto v = key in map ){
-            version(D_Version2){
-                return (*v).idup;
-            } else {
-                return (*v).dup;
-            }
+            return _idup(*v);
         }
         throw new MissingResourceException( "key not found", this.classinfo.name, key._idup() );
     }
@@ -168,13 +160,13 @@
         return map.keys;
     }
 
-    public static ResourceBundle getBundle( ImportData[] data ){
+    public static ResourceBundle getBundle( in ImportData[] data ){
         return new ResourceBundle( data );
     }
-    public static ResourceBundle getBundle( ImportData data ){
+    public static ResourceBundle getBundle( in ImportData data ){
         return new ResourceBundle( data );
     }
-    public static ResourceBundle getBundle( CString name ){
+    public static ResourceBundle getBundle( String name ){
         try{
             version(Tango){
                 return new ResourceBundle( cast(String) File.get(name) );
--- a/base/src/java/util/Timer.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/base/src/java/util/Timer.d	Sat Jul 09 15:50:20 2011 +0300
@@ -33,7 +33,7 @@
                 elements = 0;
                 nullOnEmpty = false;
             } else { // Phobos
-                implMissing(__FILE__,__LINE__);
+                implMissingInPhobos();
             }
         }
 
@@ -79,7 +79,7 @@
                     cond.notify();
                 }
             } else { // Phobos
-                implMissing(__FILE__,__LINE__);
+                implMissingInPhobos();
             }
         }
 
@@ -154,7 +154,7 @@
                     return task;
                 }
             } else { // Phobos
-                implMissing(__FILE__,__LINE__);
+                implMissingInPhobos();
                 return null;
             }
         }
@@ -166,7 +166,7 @@
                     cond.notify();
                 }
             } else { // Phobos
-                implMissing(__FILE__,__LINE__);
+                implMissingInPhobos();
             }
         }
 
@@ -178,7 +178,7 @@
                     cond.notify();
                 }
             } else { // Phobos
-                implMissing(__FILE__,__LINE__);
+                implMissingInPhobos();
             }
         }
 
--- a/base/src/java/util/TreeMap.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/base/src/java/util/TreeMap.d	Sat Jul 09 15:50:20 2011 +0300
@@ -27,7 +27,7 @@
         version(Tango){
             map = new MapType();
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
         }
     }
     public this(Comparator c){
@@ -43,7 +43,7 @@
         version(Tango){
             map.clear();
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
         }
     }
     Comparator     comparator(){
@@ -55,7 +55,7 @@
             Object v;
             return map.get(key, v );
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
             return false;
         }
     }
@@ -66,7 +66,7 @@
         version(Tango){
             return map.contains(value);
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
             return false;
         }
     }
@@ -78,7 +78,7 @@
             }
             return res;
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
             return null;
         }
     }
@@ -98,7 +98,7 @@
             }
             return false;
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
             return false;
         }
     }
@@ -109,7 +109,7 @@
             }
             throw new tango.core.Exception.NoSuchElementException( "TreeMap.firstKey" );
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
             return null;
         }
     }
@@ -136,7 +136,7 @@
         version(Tango){
             return map.isEmpty();
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
             return false;
         }
     }
@@ -148,7 +148,7 @@
             }
             return res;
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
             return null;
         }
     }
@@ -161,7 +161,7 @@
             if( map.size() ) return res;
             throw new tango.core.Exception.NoSuchElementException( "TreeMap.lastKey" );
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
             return null;
         }
     }
@@ -175,7 +175,7 @@
             map[key] = value;
             return null;
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
             return null;
         }
     }
@@ -199,7 +199,7 @@
             map.take(key,res);
             return res;
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
             return null;
         }
     }
@@ -210,7 +210,7 @@
         version(Tango){
             return map.size();
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
             return 0;
         }
     }
@@ -230,7 +230,7 @@
             }
             return res;
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
             return null;
         }
     }
@@ -239,7 +239,7 @@
         version(Tango){
             return map.opApply( dg );
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
             return 0;
         }
     }
@@ -247,7 +247,7 @@
         version(Tango){
             return map.opApply( dg );
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
             return 0;
         }
     }
--- a/base/src/java/util/TreeSet.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/base/src/java/util/TreeSet.d	Sat Jul 09 15:50:20 2011 +0300
@@ -24,7 +24,7 @@
         version(Tango){
             set = new SetType();
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
         }
     }
     public this(Collection c){
@@ -41,7 +41,7 @@
         version(Tango){
             return set.add(o, 0);
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
             return false;
         }
     }
@@ -49,7 +49,7 @@
         version(Tango){
             return add(stringcast(o));
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
             return false;
         }
     }
@@ -60,7 +60,7 @@
             }
             return true;
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
             return false;
         }
     }
@@ -68,14 +68,14 @@
         version(Tango){
             set.clear();
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
         }
     }
     public bool    contains(Object o){
         version(Tango){
             return set.containsKey(o);
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
             return false;
         }
     }
@@ -83,7 +83,7 @@
         version(Tango){
             return contains(stringcast(o));
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
             return false;
         }
     }
@@ -96,7 +96,7 @@
             }
             return true;
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
             return false;
         }
     }
@@ -124,7 +124,7 @@
         version(Tango){
             return set.isEmpty();
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
             return false;
         }
     }
@@ -144,7 +144,7 @@
         version(Tango){
             return remove(stringcast(key));
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
             return false;
         }
     }
@@ -160,7 +160,7 @@
         version(Tango){
             return set.size();
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
             return 0;
         }
     }
@@ -194,7 +194,7 @@
             }
             return set.opApply(&localDg);
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
             return 0;
         }
     }
--- a/base/src/java/util/zip/InflaterInputStream.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/base/src/java/util/zip/InflaterInputStream.d	Sat Jul 09 15:50:20 2011 +0300
@@ -6,7 +6,7 @@
 import java.lang.all;
 import java.io.InputStream;
 version(Tango){
-    import tango.io.compress.ZlibStream;
+    import tango.io.stream.Zlib;
     import tango.io.device.Conduit;
     version(Windows){
         pragma(lib,"zlib.lib");
@@ -84,7 +84,7 @@
         version(Tango){
             tangoIstr = new ZlibInput( new InputStreamWrapper(istr ));
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
         }
     }
 
@@ -97,7 +97,7 @@
             }
             return -1;
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            implMissingInPhobos();
             return -1;
         }
     }
--- a/com.ibm.icu/src/com/ibm/icu/mangoicu/ICU.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/com.ibm.icu/src/com/ibm/icu/mangoicu/ICU.d	Sat Jul 09 15:50:20 2011 +0300
@@ -89,8 +89,35 @@
 
 *******************************************************************************/
 
+package static String genICUNative(String t, funcs...)() {
+    static assert((t == "in" || t == "uc") && !(funcs.length & 1));
+    String gsh = " ", sh = "";
+    version(D_Version2) {
+        gsh = " __gshared ";
+        sh = "shared ";
+    }
+    String res = "private:
+static"~gsh~"void* library;
+static"~gsh~"extern(C) {\n";
+    foreach(int i, name; funcs) static if(i & 1)
+        res ~= funcs[i-1] ~ " " ~ name ~ ";\n";
+    res ~= "}
+static"~gsh~"FunctionLoader.Bind[] targets = [\n";
+    foreach(int i, name; funcs) static if(i & 1)
+        res ~= "{cast(void**) &" ~ name ~ ", `" ~ name ~ "`},\n";
+    res ~= "];
+"~sh~"static this() {
+    library = FunctionLoader.bind(ICU.icu" ~ t ~ ", targets);
+}
+"~sh~"static ~this() {
+    FunctionLoader.unbind(library);
+}";
+    return res;
+}
+
 protected class ICU
 {
+    
         /***********************************************************************
 
                 The library names to load within the target environment
@@ -178,16 +205,16 @@
 
         ***********************************************************************/
 
-        package static final void exception (CString msg)
+        package static final void exception (in char[] msg)
         {
-                throw new ICUException ( cast(String)msg);
+                throw new ICUException (cast(String)msg);
         }
 
         /***********************************************************************
 
         ***********************************************************************/
 
-        package static final void testError (UErrorCode e, CString msg)
+        package static final void testError (UErrorCode e, in char[] msg)
         {
                 if (e > 0)
                     exception (msg);
@@ -197,7 +224,7 @@
 
         ***********************************************************************/
 
-        package static final char* toString (CString string)
+        package static final char* toString (in char[] string)
         {
                 static char[] empty;
 
@@ -210,16 +237,16 @@
                    char[] copy = new char [string.length + 1];
                    copy [0..string.length] = string;
                    copy [string.length] = 0;
-                   string = copy;
+                   return copy.ptr;
                    }
-                return cast(char*)string.ptr;
+                //return cast(char*)string.ptr;
         }
 
         /***********************************************************************
 
         ***********************************************************************/
 
-        package static final wchar* toString (CString16 string)
+        package static final wchar* toString (in wchar[] string)
         {
                 static wchar[] empty;
 
@@ -232,9 +259,9 @@
                    wchar[] copy = new wchar [string.length + 1];
                    copy [0..string.length] = string;
                    copy [string.length] = 0;
-                   string = copy;
+                   return copy.ptr;
                    }
-                return cast(wchar*)string.ptr;
+                //return cast(wchar*)string.ptr;
         }
 
         /***********************************************************************
@@ -330,14 +357,14 @@
                 protected struct Bind
                 {
                         void**  fnc;
-                        CString  name;
+                        const String  name;
                 }
 
                 /***************************************************************
 
                 ***************************************************************/
 
-                static final void* bind (char[] library, inout Bind[] targets)
+                static final void* bind (char[] library, ref Bind[] targets)
                 {
                         HANDLE lib = LoadLibraryA (ICU.toString(library));
 
@@ -401,14 +428,14 @@
                 protected struct Bind
                 {
                         void**  fnc;
-                        CString  name;
+                        const String  name;
                 }
 
                 /***************************************************************
 
                 ***************************************************************/
 
-                static final void* bind (char[] library, inout Bind[] targets)
+                static final void* bind (char[] library, ref Bind[] targets)
                 {
                         static char[] errorInfo;
                         // printf("the library is %s\n", ICU.toString(library));
@@ -560,7 +587,7 @@
                 protected struct Bind
                 {
                         void**  fnc;
-                        CString  name;
+                        const String  name;
                 }
 
                 /***************************************************************
@@ -616,7 +643,7 @@
                         return NSAddressOfSymbol(symbol);
                 }
 
-                static final void* bind (char[] library, inout Bind[] targets)
+                static final void* bind (char[] library, ref Bind[] targets)
                 {
                         static char[] errorInfo;
 
--- a/com.ibm.icu/src/com/ibm/icu/mangoicu/UBreakIterator.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/com.ibm.icu/src/com/ibm/icu/mangoicu/UBreakIterator.d	Sat Jul 09 15:50:20 2011 +0300
@@ -102,7 +102,7 @@
 //
 //         ***********************************************************************/
 //
-//         this (inout ULocale locale, UStringView text = null)
+//         this (ref ULocale locale, UStringView text = null)
 //         {
 //                 super (Type.Character, locale, text);
 //         }
@@ -133,7 +133,7 @@
 //
 //         ***********************************************************************/
 //
-//         this (inout ULocale locale, UStringView text = null)
+//         this (ref ULocale locale, UStringView text = null)
 //         {
 //                 super (Type.Word, locale, text);
 //         }
@@ -145,7 +145,7 @@
 //
 //         ***********************************************************************/
 //
-//         void getStatus (inout Break b)
+//         void getStatus (ref Break b)
 //         {
 //                 b = cast(Break) super.getStatus();
 //         }
@@ -170,7 +170,7 @@
 //
 //         ***********************************************************************/
 //
-//         this (inout ULocale locale, UStringView text = null)
+//         this (ref ULocale locale, UStringView text = null)
 //         {
 //                 super (Type.Line, locale, text);
 //         }
@@ -182,7 +182,7 @@
 //
 //         ***********************************************************************/
 //
-//         void getStatus (inout Break b)
+//         void getStatus (ref Break b)
 //         {
 //                 b = cast(Break) super.getStatus();
 //         }
@@ -207,7 +207,7 @@
 //
 //         ***********************************************************************/
 //
-//         this (inout ULocale locale, UStringView text = null)
+//         this (ref ULocale locale, UStringView text = null)
 //         {
 //                 super (Type.Sentence, locale, text);
 //         }
@@ -219,7 +219,7 @@
 //
 //         ***********************************************************************/
 //
-//         void getStatus (inout Break b)
+//         void getStatus (ref Break b)
 //         {
 //                 b = cast(Break) super.getStatus();
 //         }
@@ -236,7 +236,7 @@
 //
 //         ***********************************************************************/
 //
-//         this (inout ULocale locale, UStringView text = null)
+//         this (ref ULocale locale, UStringView text = null)
 //         {
 //                 super (Type.Title, locale, text);
 //         }
@@ -520,7 +520,7 @@
 
         ***********************************************************************/
 
-        void getStatus (inout uint s)
+        void getStatus (ref uint s)
         {
                 s = getStatus ();
         }
@@ -553,69 +553,21 @@
 
         ***********************************************************************/
 
-        private static void* library;
-
-        /***********************************************************************
-
-        ***********************************************************************/
-
-        private static extern (C)
-        {
-                Handle function (uint, char*, wchar*, uint, inout ICU.UErrorCode) ubrk_open;
-                Handle function (wchar*, uint, wchar*, uint, void*, inout ICU.UErrorCode) ubrk_openRules;
-                void   function (Handle) ubrk_close;
-                void   function (Handle, wchar*, uint, inout ICU.UErrorCode) ubrk_setText;
-                uint   function (Handle) ubrk_current;
-                uint   function (Handle) ubrk_next;
-                uint   function (Handle) ubrk_previous;
-                uint   function (Handle) ubrk_first;
-                uint   function (Handle) ubrk_last;
-                uint   function (Handle, uint) ubrk_preceding;
-                uint   function (Handle, uint) ubrk_following;
-                byte   function (Handle, uint) ubrk_isBoundary;
-                uint   function (Handle) ubrk_getRuleStatus;
-                Handle function (Handle, void *, int *, inout ICU.UErrorCode) ubrk_safeClone;
-                void   function (Handle, UText*, inout ICU.UErrorCode) ubrk_setUText;
-        }
-
-        /***********************************************************************
-
-        ***********************************************************************/
-
-        static FunctionLoader.Bind[] targets =
-                [
-                {cast(void**) &ubrk_open,               "ubrk_open"},
-                {cast(void**) &ubrk_close,              "ubrk_close"},
-                {cast(void**) &ubrk_openRules,          "ubrk_openRules"},
-                {cast(void**) &ubrk_setText,            "ubrk_setText"},
-                {cast(void**) &ubrk_current,            "ubrk_current"},
-                {cast(void**) &ubrk_next,               "ubrk_next"},
-                {cast(void**) &ubrk_previous,           "ubrk_previous"},
-                {cast(void**) &ubrk_first,              "ubrk_first"},
-                {cast(void**) &ubrk_last,               "ubrk_last"},
-                {cast(void**) &ubrk_preceding,          "ubrk_preceding"},
-                {cast(void**) &ubrk_following,          "ubrk_following"},
-                {cast(void**) &ubrk_isBoundary,         "ubrk_isBoundary"},
-                {cast(void**) &ubrk_getRuleStatus,      "ubrk_getRuleStatus"},
-                {cast(void**) &ubrk_setUText,           "ubrk_setUText"},
-                {cast(void**) &ubrk_safeClone,          "ubrk_safeClone"},
-                ];
-
-         /**********************************************************************
-
-         **********************************************************************/
-
-         static this ()
-         {
-                library = FunctionLoader.bind (ICU.icuuc, targets);
-         }
-
-         /**********************************************************************
-
-         **********************************************************************/
-
-         static ~this ()
-         {
-               FunctionLoader.unbind (library);
-         }
+        mixin(/*ICU.*/genICUNative!("uc"
+                ,"Handle function (uint, char*, wchar*, uint, ref ICU.UErrorCode)", "ubrk_open"
+                ,"Handle function (wchar*, uint, wchar*, uint, void*, ref ICU.UErrorCode)", "ubrk_openRules"
+                ,"void   function (Handle)", "ubrk_close"
+                ,"void   function (Handle, wchar*, uint, ref ICU.UErrorCode)", "ubrk_setText"
+                ,"uint   function (Handle)", "ubrk_current"
+                ,"uint   function (Handle)", "ubrk_next"
+                ,"uint   function (Handle)", "ubrk_previous"
+                ,"uint   function (Handle)", "ubrk_first"
+                ,"uint   function (Handle)", "ubrk_last"
+                ,"uint   function (Handle, uint)", "ubrk_preceding"
+                ,"uint   function (Handle, uint)", "ubrk_following"
+                ,"byte   function (Handle, uint)", "ubrk_isBoundary"
+                ,"uint   function (Handle)", "ubrk_getRuleStatus"
+                ,"Handle function (Handle, void *, int *, ref ICU.UErrorCode)", "ubrk_safeClone"
+                ,"void   function (Handle, UText*, ref ICU.UErrorCode)", "ubrk_setUText"
+        ));
 }
--- a/com.ibm.icu/src/com/ibm/icu/mangoicu/UCalendar.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/com.ibm.icu/src/com/ibm/icu/mangoicu/UCalendar.d	Sat Jul 09 15:50:20 2011 +0300
@@ -242,7 +242,7 @@
 
         ***********************************************************************/
 
-        this (inout UTimeZone zone, inout ULocale locale, Type type = Type.Traditional)
+        this (ref UTimeZone zone, ref ULocale locale, Type type = Type.Traditional)
         {
                 UErrorCode e;
 
@@ -278,7 +278,7 @@
 
         ***********************************************************************/
 
-        void setTimeZone (inout UTimeZone zone)
+        void setTimeZone (ref UTimeZone zone)
         {
                 UErrorCode e;
 
@@ -292,9 +292,9 @@
 
         ***********************************************************************/
 
-        void getTimeZoneName (UString s, inout ULocale locale, DisplayNameType type=DisplayNameType.Standard)
+        void getTimeZoneName (UString s, ref ULocale locale, DisplayNameType type=DisplayNameType.Standard)
         {       
-                uint format (wchar* dst, uint length, inout ICU.UErrorCode e)
+                uint format (wchar* dst, uint length, ref ICU.UErrorCode e)
                 {
                         return ucal_getTimeZoneDisplayName (handle, type, toString(locale.name), dst, length, e);
                 }
@@ -585,82 +585,27 @@
         
         ***********************************************************************/
 
-        private static void* library;
-
-        /***********************************************************************
-
-        ***********************************************************************/
-
-        private static extern (C) 
-        {
-                Handle  function (wchar*, uint, char*, Type, inout UErrorCode) ucal_open;
-                void    function (Handle) ucal_close;
-                UDate   function () ucal_getNow;
-                UDate   function (Handle, inout UErrorCode) ucal_getMillis;
-                void    function (Handle, UDate, inout UErrorCode) ucal_setMillis;
-                void    function (Handle, uint, uint, uint, inout UErrorCode) ucal_setDate;
-                void    function (Handle, uint, uint, uint, uint, uint, uint, inout UErrorCode) ucal_setDateTime;
-                byte    function (Handle, Handle) ucal_equivalentTo;
-                void    function (Handle, uint, uint, inout UErrorCode) ucal_add;
-                void    function (Handle, uint, uint, inout UErrorCode) ucal_roll;
-                uint    function (Handle, uint, inout UErrorCode) ucal_get;
-                void    function (Handle, uint, uint) ucal_set;
-                byte    function (Handle, uint) ucal_isSet;
-                void    function (Handle, uint) ucal_clearField;
-                void    function (Handle) ucal_clear;
-                uint    function (Handle, uint, uint, inout UErrorCode) ucal_getLimit;
-                void    function (Handle, wchar*, uint, inout UErrorCode) ucal_setTimeZone;
-                byte    function (Handle, uint) ucal_inDaylightTime;
-                uint    function (Handle, uint) ucal_getAttribute;
-                void    function (Handle, uint, uint) ucal_setAttribute;
-                uint    function (Handle, uint, char*, wchar*, uint, inout UErrorCode) ucal_getTimeZoneDisplayName;
-        }
-
-        /***********************************************************************
-
-        ***********************************************************************/
-
-        static  FunctionLoader.Bind[] targets = 
-                [
-                {cast(void**) &ucal_open,               "ucal_open"}, 
-                {cast(void**) &ucal_close,              "ucal_close"},
-                {cast(void**) &ucal_getNow,             "ucal_getNow"},
-                {cast(void**) &ucal_getMillis,          "ucal_getMillis"},
-                {cast(void**) &ucal_setMillis,          "ucal_setMillis"},
-                {cast(void**) &ucal_setDate,            "ucal_setDate"},
-                {cast(void**) &ucal_setDateTime,        "ucal_setDateTime"},
-                {cast(void**) &ucal_equivalentTo,       "ucal_equivalentTo"},
-                {cast(void**) &ucal_add,                "ucal_add"},
-                {cast(void**) &ucal_roll,               "ucal_roll"},
-                {cast(void**) &ucal_get,                "ucal_get"},
-                {cast(void**) &ucal_set,                "ucal_set"},
-                {cast(void**) &ucal_clearField,         "ucal_clearField"},
-                {cast(void**) &ucal_clear,              "ucal_clear"},
-                {cast(void**) &ucal_getLimit,           "ucal_getLimit"},
-                {cast(void**) &ucal_setTimeZone,        "ucal_setTimeZone"},
-                {cast(void**) &ucal_inDaylightTime,     "ucal_inDaylightTime"},
-                {cast(void**) &ucal_getAttribute,       "ucal_getAttribute"},
-                {cast(void**) &ucal_setAttribute,       "ucal_setAttribute"},
-                {cast(void**) &ucal_isSet,              "ucal_isSet"},
-                {cast(void**) &ucal_getTimeZoneDisplayName, "ucal_getTimeZoneDisplayName"},
-                ];
-
-        /***********************************************************************
-
-        ***********************************************************************/
-
-        static this ()
-        {
-                library = FunctionLoader.bind (icuin, targets);
-        }
-
-        /***********************************************************************
-
-        ***********************************************************************/
-
-        static ~this ()
-        {
-                FunctionLoader.unbind (library);
-        }
-
+        mixin(genICUNative!("in"
+                ,"Handle  function (wchar*, uint, char*, Type, ref UErrorCode)", "ucal_open"
+                ,"void    function (Handle)", "ucal_close"
+                ,"UDate   function ()", "ucal_getNow"
+                ,"UDate   function (Handle, ref UErrorCode)", "ucal_getMillis"
+                ,"void    function (Handle, UDate, ref UErrorCode)", "ucal_setMillis"
+                ,"void    function (Handle, uint, uint, uint, ref UErrorCode)", "ucal_setDate"
+                ,"void    function (Handle, uint, uint, uint, uint, uint, uint, ref UErrorCode)", "ucal_setDateTime"
+                ,"byte    function (Handle, Handle)", "ucal_equivalentTo"
+                ,"void    function (Handle, uint, uint, ref UErrorCode)", "ucal_add"
+                ,"void    function (Handle, uint, uint, ref UErrorCode)", "ucal_roll"
+                ,"uint    function (Handle, uint, ref UErrorCode)", "ucal_get"
+                ,"void    function (Handle, uint, uint)", "ucal_set"
+                ,"byte    function (Handle, uint)", "ucal_isSet"
+                ,"void    function (Handle, uint)", "ucal_clearField"
+                ,"void    function (Handle)", "ucal_clear"
+                ,"uint    function (Handle, uint, uint, ref UErrorCode)", "ucal_getLimit"
+                ,"void    function (Handle, wchar*, uint, ref UErrorCode)", "ucal_setTimeZone"
+                ,"byte    function (Handle, uint)", "ucal_inDaylightTime"
+                ,"uint    function (Handle, uint)", "ucal_getAttribute"
+                ,"void    function (Handle, uint, uint)", "ucal_setAttribute"
+                ,"uint    function (Handle, uint, char*, wchar*, uint, ref UErrorCode)", "ucal_getTimeZoneDisplayName"
+        ));
 }
--- a/com.ibm.icu/src/com/ibm/icu/mangoicu/UChar.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/com.ibm.icu/src/com/ibm/icu/mangoicu/UChar.d	Sat Jul 09 15:50:20 2011 +0300
@@ -670,7 +670,7 @@
 
         ***********************************************************************/
 
-        char[] getCharName (dchar c, CharNameChoice choice, inout char[] dst)
+        char[] getCharName (dchar c, CharNameChoice choice, ref char[] dst)
         {
                 UErrorCode e;
 
@@ -685,7 +685,7 @@
 
         ***********************************************************************/
 
-        char[] getComment (dchar c, inout char[] dst)
+        char[] getComment (dchar c, ref char[] dst)
         {
                 UErrorCode e;
 
@@ -740,7 +740,7 @@
 
         ***********************************************************************/
 
-        void getUnicodeVersion (inout Version v)
+        void getUnicodeVersion (ref Version v)
         {
                 u_getUnicodeVersion (v);
         }
@@ -751,7 +751,7 @@
 
         ***********************************************************************/
 
-        void getCharAge (dchar c, inout Version v)
+        void getCharAge (dchar c, ref Version v)
         {
                 u_charAge (c, v);
         }
@@ -1139,102 +1139,18 @@
 
         ***********************************************************************/
 
-        private static void* library;
-
-        /***********************************************************************
-
-        ***********************************************************************/
-
-        private static extern (C) 
-        {
-                uint   function (uint, uint) u_getIntPropertyValue;
-                uint   function (uint) u_getIntPropertyMinValue;
-                uint   function (uint) u_getIntPropertyMaxValue;
-                uint   function (dchar) u_charDirection;
-                uint   function (dchar) ublock_getCode;
-                uint   function (dchar, uint, char*, uint, inout UErrorCode) u_charName;
-                uint   function (dchar, char*, uint, inout UErrorCode) u_getISOComment;
-                uint   function (uint, char*, inout UErrorCode) u_charFromName;
-                char*  function (uint, uint) u_getPropertyName;
-                char*  function (uint, uint, uint) u_getPropertyValueName;
-                void   function (inout Version) u_getUnicodeVersion;
-                void   function (dchar, inout Version) u_charAge;
-        }
-
-        /***********************************************************************
-
-        ***********************************************************************/
-
-        static  FunctionLoader.Bind[] targets = 
-                [
-                {cast(void**) &forDigit,                "u_forDigit"},
-                {cast(void**) &digit,                   "u_digit"},
-                {cast(void**) &foldCase,                "u_foldCase"},
-                {cast(void**) &toTitle,                 "u_totitle"},
-                {cast(void**) &toUpper,                 "u_toupper"},
-                {cast(void**) &toLower,                 "u_tolower"},
-                {cast(void**) &charType,                "u_charType"},
-                {cast(void**) &charMirror,              "u_charMirror"},
-                {cast(void**) &charDigitValue,          "u_charDigitValue"},
-                {cast(void**) &isJavaIDPart,            "u_isJavaIDPart"},
-                {cast(void**) &isJavaIDStart,           "u_isJavaIDStart"},
-                {cast(void**) &isIDIgnorable,           "u_isIDIgnorable"},
-                {cast(void**) &isIDPart,                "u_isIDPart"},
-                {cast(void**) &isIDStart,               "u_isIDStart"},
-                {cast(void**) &isMirrored,              "u_isMirrored"},
-                {cast(void**) &isBase,                  "u_isbase"},
-                {cast(void**) &isPrint,                 "u_isprint"},
-                {cast(void**) &isISOControl,            "u_isISOControl"},
-                {cast(void**) &isCtrl,                  "u_iscntrl"},
-                {cast(void**) &isWhiteSpace,            "u_isWhitespace"},
-                {cast(void**) &isJavaSpaceChar,         "u_isJavaSpaceChar"},
-                {cast(void**) &isSpace,                 "u_isspace"},
-                {cast(void**) &isDefined,               "u_isdefined"},
-                {cast(void**) &isBlank,                 "u_isblank"},
-                {cast(void**) &isGraph,                 "u_isgraph"},
-                {cast(void**) &isPunct,                 "u_ispunct"},
-                {cast(void**) &isHexDigit,              "u_isxdigit"},
-                {cast(void**) &isAlpha,                 "u_isalpha"},
-                {cast(void**) &isAlphaNumeric,          "u_isalnum"},
-                {cast(void**) &isDigit,                 "u_isdigit"},
-                {cast(void**) &isTitle,                 "u_istitle"},
-                {cast(void**) &isUpper,                 "u_isupper"},
-                {cast(void**) &isLower,                 "u_islower"},
-                {cast(void**) &isUAlphabetic,           "u_isUAlphabetic"},
-                {cast(void**) &isUWhiteSpace,           "u_isUWhiteSpace"},
-                {cast(void**) &isUUppercase,            "u_isUUppercase"},
-                {cast(void**) &isULowercase,            "u_isULowercase"},
-                {cast(void**) &getNumericValue,         "u_getNumericValue"},
-                {cast(void**) &getCombiningClass,       "u_getCombiningClass"},
-                {cast(void**) &u_getIntPropertyValue,   "u_getIntPropertyValue"},
-                {cast(void**) &u_getIntPropertyMinValue,"u_getIntPropertyMinValue"},
-                {cast(void**) &u_getIntPropertyMaxValue,"u_getIntPropertyMaxValue"},
-                {cast(void**) &u_charDirection,         "u_charDirection"},
-                {cast(void**) &ublock_getCode,          "ublock_getCode"},
-                {cast(void**) &u_charName,              "u_charName"},
-                {cast(void**) &u_getISOComment,         "u_getISOComment"},
-                {cast(void**) &u_charFromName,          "u_charFromName"},
-                {cast(void**) &u_getPropertyName,       "u_getPropertyName"},
-                {cast(void**) &u_getPropertyValueName,  "u_getPropertyValueName"},
-                {cast(void**) &u_getUnicodeVersion,     "u_getUnicodeVersion"},
-                {cast(void**) &u_charAge,               "u_charAge"},
-                ];
-
-        /***********************************************************************
-
-        ***********************************************************************/
-
-        static this ()
-        {
-                library = FunctionLoader.bind (icuuc, targets);
-        }
-
-        /***********************************************************************
-
-        ***********************************************************************/
-
-        static ~this ()
-        {
-                FunctionLoader.unbind (library);
-        }
+        mixin(genICUNative!("uc"
+                ,"uint   function (uint, uint)", "u_getIntPropertyValue"
+                ,"uint   function (uint)", "u_getIntPropertyMinValue"
+                ,"uint   function (uint)", "u_getIntPropertyMaxValue"
+                ,"uint   function (dchar)", "u_charDirection"
+                ,"uint   function (dchar)", "ublock_getCode"
+                ,"uint   function (dchar, uint, char*, uint, ref UErrorCode)", "u_charName"
+                ,"uint   function (dchar, char*, uint, ref UErrorCode)", "u_getISOComment"
+                ,"uint   function (uint, char*, ref UErrorCode)", "u_charFromName"
+                ,"char*  function (uint, uint)", "u_getPropertyName"
+                ,"char*  function (uint, uint, uint)", "u_getPropertyValueName"
+                ,"void   function (ref Version)", "u_getUnicodeVersion"
+                ,"void   function (dchar, ref Version)", "u_charAge"
+        ));
 }
--- a/com.ibm.icu/src/com/ibm/icu/mangoicu/UCollator.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/com.ibm.icu/src/com/ibm/icu/mangoicu/UCollator.d	Sat Jul 09 15:50:20 2011 +0300
@@ -88,6 +88,7 @@
                 com.ibm.icu.mangoicu.USet,
                 com.ibm.icu.mangoicu.ULocale,
                 com.ibm.icu.mangoicu.UString;
+private import java.lang.util;
 
 /*******************************************************************************
 
@@ -350,7 +351,7 @@
 
         void getDisplayName (ULocale obj, ULocale display, UString dst)
         {
-                uint fmt (wchar* p, uint len, inout UErrorCode e)
+                uint fmt (wchar* p, uint len, ref UErrorCode e)
                 {
                         return ucol_getDisplayName (toString(obj.name), toString(display.name), dst.get.ptr, dst.len, e);
                 }
@@ -367,7 +368,7 @@
 
         void getRules (UString dst, RuleOption o = RuleOption.FullRules)
         {
-                uint fmt (wchar* p, uint len, inout UErrorCode e)
+                uint fmt (wchar* p, uint len, ref UErrorCode e)
                 {
                         uint needed = ucol_getRulesEx (handle, o, dst.get.ptr, dst.len);
                         if (needed > len)
@@ -503,7 +504,7 @@
 
         ***********************************************************************/
 
-        void getVersion (inout Version v)
+        void getVersion (ref Version v)
         {
                 ucol_getVersion (handle, v);
         }
@@ -514,7 +515,7 @@
 
         ***********************************************************************/
 
-        void getUCAVersion (inout Version v)
+        void getUCAVersion (ref Version v)
         {
                 ucol_getUCAVersion (handle, v);
         }
@@ -609,7 +610,7 @@
         {
                 UErrorCode e;
 
-                locale.name = toArray (ucol_getLocaleByType (handle, type, e));
+                locale.name = cast(String) toArray (ucol_getLocaleByType (handle, type, e));
                 if (isError(e) || locale.name is null)
                     exception ("failed to get collator locale");
         }
@@ -639,94 +640,34 @@
 
         ***********************************************************************/
 
-        private static void* library;
-
-        /***********************************************************************
-
-        ***********************************************************************/
-
-        private static extern (C)
-        {
-                void            function (Handle) ucol_close;
-                Handle          function (char *loc, inout UErrorCode e) ucol_open;
-                Handle          function (wchar* rules, uint rulesLength, AttributeValue normalizationMode, Strength strength, UParseError *parseError, inout UErrorCode e) ucol_openRules;
-                Handle          function (char *definition, byte forceDefaults, UParseError *parseError, inout UErrorCode e) ucol_openFromShortString;
-                uint            function (Handle, Handle conts, inout UErrorCode e) ucol_getContractions;
-                int             function (Handle, wchar* source, uint sourceLength, wchar* target, uint targetLength) ucol_strcoll;
-                byte            function (Handle, wchar* source, uint sourceLength, wchar* target, uint targetLength) ucol_greater;
-                byte            function (Handle, wchar* source, uint sourceLength, wchar* target, uint targetLength) ucol_greaterOrEqual;
-                byte            function (Handle, wchar* source, uint sourceLength, wchar* target, uint targetLength) ucol_equal;
-                Strength        function (Handle) ucol_getStrength;
-                void            function (Handle, Strength strength) ucol_setStrength;
-                uint            function (char *objLoc, char *dispLoc, wchar* result, uint resultLength, inout UErrorCode e) ucol_getDisplayName;
-                uint            function (Handle, char *locale, char *buffer, uint capacity, inout UErrorCode e) ucol_getShortDefinitionString;
-                uint            function (char *source, char *destination, uint capacity, UParseError *parseError, inout UErrorCode e) ucol_normalizeShortDefinitionString;
-                uint            function (Handle, wchar* source, uint sourceLength, ubyte *result, uint resultLength) ucol_getSortKey;
-                uint            function (ubyte *source, uint sourceLength, BoundMode boundType, uint noOfLevels, ubyte *result, uint resultLength, inout UErrorCode e) ucol_getBound;
-                void            function (Handle, Version info) ucol_getVersion;
-                void            function (Handle, Version info) ucol_getUCAVersion;
-                uint            function (ubyte *src1, uint src1Length, ubyte *src2, uint src2Length, ubyte *dest, uint destCapacity) ucol_mergeSortkeys;
-                void            function (Handle, Attribute attr, AttributeValue value, inout UErrorCode e) ucol_setAttribute;
-                AttributeValue  function (Handle, Attribute attr, inout UErrorCode e) ucol_getAttribute;
-                uint            function (Handle, wchar* varTop, uint len, inout UErrorCode e) ucol_setVariableTop;
-                uint            function (Handle, inout UErrorCode e) ucol_getVariableTop;
-                void            function (Handle, uint varTop, inout UErrorCode e) ucol_restoreVariableTop;
-                uint            function (Handle, RuleOption delta, wchar* buffer, uint bufferLen) ucol_getRulesEx;
-                char*           function (Handle, ULocale.Type type, inout UErrorCode e) ucol_getLocaleByType;
-                Handle          function (Handle, inout UErrorCode e) ucol_getTailoredSet;
-        }
-
-        /***********************************************************************
-
-        ***********************************************************************/
-
-        static  FunctionLoader.Bind[] targets =
-                [
-                {cast(void**) &ucol_open,                               "ucol_open"},
-                {cast(void**) &ucol_close,                              "ucol_close"},
-                {cast(void**) &ucol_openRules,                          "ucol_openRules"},
-                {cast(void**) &ucol_openFromShortString,                "ucol_openFromShortString"},
-                {cast(void**) &ucol_getContractions,                    "ucol_getContractions"},
-                {cast(void**) &ucol_strcoll,                            "ucol_strcoll"},
-                {cast(void**) &ucol_greater,                            "ucol_greater"},
-                {cast(void**) &ucol_greaterOrEqual,                     "ucol_greaterOrEqual"},
-                {cast(void**) &ucol_equal,                              "ucol_equal"},
-                {cast(void**) &ucol_getStrength,                        "ucol_getStrength"},
-                {cast(void**) &ucol_setStrength,                        "ucol_setStrength"},
-                {cast(void**) &ucol_getDisplayName,                     "ucol_getDisplayName"},
-                {cast(void**) &ucol_getShortDefinitionString,           "ucol_getShortDefinitionString"},
-                {cast(void**) &ucol_normalizeShortDefinitionString,     "ucol_normalizeShortDefinitionString"},
-                {cast(void**) &ucol_getSortKey,                         "ucol_getSortKey"},
-                {cast(void**) &ucol_getBound,                           "ucol_getBound"},
-                {cast(void**) &ucol_getVersion,                         "ucol_getVersion"},
-                {cast(void**) &ucol_getUCAVersion,                      "ucol_getUCAVersion"},
-                {cast(void**) &ucol_mergeSortkeys,                      "ucol_mergeSortkeys"},
-                {cast(void**) &ucol_setAttribute,                       "ucol_setAttribute"},
-                {cast(void**) &ucol_getAttribute,                       "ucol_getAttribute"},
-                {cast(void**) &ucol_setVariableTop,                     "ucol_setVariableTop"},
-                {cast(void**) &ucol_getVariableTop,                     "ucol_getVariableTop"},
-                {cast(void**) &ucol_restoreVariableTop,                 "ucol_restoreVariableTop"},
-                {cast(void**) &ucol_getRulesEx,                         "ucol_getRulesEx"},
-                {cast(void**) &ucol_getLocaleByType,                    "ucol_getLocaleByType"},
-                {cast(void**) &ucol_getTailoredSet,                     "ucol_getTailoredSet"},
-                ];
-
-        /***********************************************************************
-
-        ***********************************************************************/
-
-        static this ()
-        {
-                library = FunctionLoader.bind (icuin, targets);
-        }
-
-        /***********************************************************************
-
-        ***********************************************************************/
-
-        static ~this ()
-        {
-                FunctionLoader.unbind (library);
-        }
+        mixin(genICUNative!("in"
+                ,"void            function (Handle)", "ucol_close"
+                ,"Handle          function (char *loc, ref UErrorCode e)", "ucol_open"
+                ,"Handle          function (wchar* rules, uint rulesLength, AttributeValue normalizationMode, Strength strength, UParseError *parseError, ref UErrorCode e)", "ucol_openRules"
+                ,"Handle          function (char *definition, byte forceDefaults, UParseError *parseError, ref UErrorCode e)", "ucol_openFromShortString"
+                ,"uint            function (Handle, Handle conts, ref UErrorCode e)", "ucol_getContractions"
+                ,"int             function (Handle, wchar* source, uint sourceLength, wchar* target, uint targetLength)", "ucol_strcoll"
+                ,"byte            function (Handle, wchar* source, uint sourceLength, wchar* target, uint targetLength)", "ucol_greater"
+                ,"byte            function (Handle, wchar* source, uint sourceLength, wchar* target, uint targetLength)", "ucol_greaterOrEqual"
+                ,"byte            function (Handle, wchar* source, uint sourceLength, wchar* target, uint targetLength)", "ucol_equal"
+                ,"Strength        function (Handle)", "ucol_getStrength"
+                ,"void            function (Handle, Strength strength)", "ucol_setStrength"
+                ,"uint            function (char *objLoc, char *dispLoc, wchar* result, uint resultLength, ref UErrorCode e)", "ucol_getDisplayName"
+                ,"uint            function (Handle, char *locale, char *buffer, uint capacity, ref UErrorCode e)", "ucol_getShortDefinitionString"
+                ,"uint            function (char *source, char *destination, uint capacity, UParseError *parseError, ref UErrorCode e)", "ucol_normalizeShortDefinitionString"
+                ,"uint            function (Handle, wchar* source, uint sourceLength, ubyte *result, uint resultLength)", "ucol_getSortKey"
+                ,"uint            function (ubyte *source, uint sourceLength, BoundMode boundType, uint noOfLevels, ubyte *result, uint resultLength, ref UErrorCode e)", "ucol_getBound"
+                ,"void            function (Handle, Version info)", "ucol_getVersion"
+                ,"void            function (Handle, Version info)", "ucol_getUCAVersion"
+                ,"uint            function (ubyte *src1, uint src1Length, ubyte *src2, uint src2Length, ubyte *dest, uint destCapacity)", "ucol_mergeSortkeys"
+                ,"void            function (Handle, Attribute attr, AttributeValue value, ref UErrorCode e)", "ucol_setAttribute"
+                ,"AttributeValue  function (Handle, Attribute attr, ref UErrorCode e)", "ucol_getAttribute"
+                ,"uint            function (Handle, wchar* varTop, uint len, ref UErrorCode e)", "ucol_setVariableTop"
+                ,"uint            function (Handle, ref UErrorCode e)", "ucol_getVariableTop"
+                ,"void            function (Handle, uint varTop, ref UErrorCode e)", "ucol_restoreVariableTop"
+                ,"uint            function (Handle, RuleOption delta, wchar* buffer, uint bufferLen)", "ucol_getRulesEx"
+                ,"char*           function (Handle, ULocale.Type type, ref UErrorCode e)", "ucol_getLocaleByType"
+                ,"Handle          function (Handle, ref UErrorCode e)", "ucol_getTailoredSet"
+        ));
 }
 
--- a/com.ibm.icu/src/com/ibm/icu/mangoicu/UConverter.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/com.ibm.icu/src/com/ibm/icu/mangoicu/UConverter.d	Sat Jul 09 15:50:20 2011 +0300
@@ -104,7 +104,7 @@
 {
         void reset ();
 
-        bool convert (void[] input, void[] output, inout UAdjust x, bool flush);
+        bool convert (void[] input, void[] output, ref UAdjust x, bool flush);
 }
 
 /*******************************************************************************
@@ -438,7 +438,7 @@
 
         ***********************************************************************/
 
-        bool encode (wchar[] input, void[] output, inout UAdjust x, bool flush)
+        bool encode (wchar[] input, void[] output, ref UAdjust x, bool flush)
         {
                 UErrorCode   e;
                 wchar*  src = input.ptr;
@@ -549,7 +549,7 @@
 
         ***********************************************************************/
         
-        bool decode (void[] input, wchar[] output, inout UAdjust x, bool flush)
+        bool decode (void[] input, wchar[] output, ref UAdjust x, bool flush)
         {
                 UErrorCode   e;
                 void*   src = input.ptr;
@@ -596,7 +596,7 @@
 
         **********************************************************************/
 
-        static int opApply (int delegate(inout char[] element) dg)
+        static int opApply (int delegate(ref char[] element) dg)
         {
                 char[]          name;
                 int             result;
@@ -654,7 +654,7 @@
 
                 **************************************************************/
 
-                bool convert (void[] input, void[] output, inout UAdjust x, bool flush)
+                bool convert (void[] input, void[] output, ref UAdjust x, bool flush)
                 {
                         UErrorCode   e;
                         void*   src = input.ptr;
@@ -686,79 +686,28 @@
 
         ***********************************************************************/
 
-        private static void* library;
-
-        /***********************************************************************
-
-        ***********************************************************************/
-
-        private static extern (C) 
-        {
-                int    function (char*, char*) ucnv_compareNames;
-                Handle function (char*, inout UErrorCode) ucnv_open;
-                char*  function (void*, uint, inout uint, inout UErrorCode) ucnv_detectUnicodeSignature;
-                void   function (Handle) ucnv_close;
-                void   function (Handle) ucnv_reset;
-                int    function (Handle) ucnv_resetToUnicode;
-                int    function (Handle) ucnv_resetFromUnicode;
-                ubyte  function (Handle) ucnv_getMaxCharSize;
-                ubyte  function (Handle) ucnv_getMinCharSize;
-                char*  function (Handle, inout UErrorCode) ucnv_getName;
-                uint   function (Handle, wchar*, uint, void*, uint, inout UErrorCode) ucnv_toUChars;
-                uint   function (Handle, void*, uint, wchar*, uint, inout UErrorCode) ucnv_fromUChars;
-                void   function (Handle, void**, void*, wchar**, wchar*, int*, ubyte, inout UErrorCode) ucnv_fromUnicode;
-                void   function (Handle, wchar**, wchar*, void**, void*, int*, ubyte, inout UErrorCode)  ucnv_toUnicode;
-                void   function (Handle, Handle, void**, void*, void**, void*, wchar*, wchar*, wchar*, wchar*, ubyte, ubyte, inout UErrorCode) ucnv_convertEx;
-                ubyte  function (Handle) ucnv_isAmbiguous;
-                char*  function (uint) ucnv_getAvailableName;
-                uint   function () ucnv_countAvailable;
-        }
-
-        /***********************************************************************
-
-        ***********************************************************************/
-
-        static  FunctionLoader.Bind[] targets = 
-                [
-                {cast(void**) &ucnv_open,                   "ucnv_open"}, 
-                {cast(void**) &ucnv_close,                  "ucnv_close"},
-                {cast(void**) &ucnv_reset,                  "ucnv_reset"},
-                {cast(void**) &ucnv_resetToUnicode,         "ucnv_resetToUnicode"},
-                {cast(void**) &ucnv_resetFromUnicode,       "ucnv_resetFromUnicode"},
-                {cast(void**) &ucnv_compareNames,           "ucnv_compareNames"},
-                {cast(void**) &ucnv_getMaxCharSize,         "ucnv_getMaxCharSize"},
-                {cast(void**) &ucnv_getMinCharSize,         "ucnv_getMinCharSize"},
-                {cast(void**) &ucnv_getName,                "ucnv_getName"},
-                {cast(void**) &ucnv_detectUnicodeSignature, "ucnv_detectUnicodeSignature"},
-                {cast(void**) &ucnv_toUChars,               "ucnv_toUChars"},
-                {cast(void**) &ucnv_fromUChars,             "ucnv_fromUChars"},
-                {cast(void**) &ucnv_toUnicode,              "ucnv_toUnicode"},
-                {cast(void**) &ucnv_fromUnicode,            "ucnv_fromUnicode"},
-                {cast(void**) &ucnv_convertEx,              "ucnv_convertEx"},
-                {cast(void**) &ucnv_isAmbiguous,            "ucnv_isAmbiguous"},
-                {cast(void**) &ucnv_countAvailable,         "ucnv_countAvailable"},
-                {cast(void**) &ucnv_getAvailableName,       "ucnv_getAvailableName"},
-                ];
-
-        /***********************************************************************
-
-        ***********************************************************************/
-
-        static this ()
-        {
-                library = FunctionLoader.bind (icuuc, targets);
+        mixin(genICUNative!("uc"
+                ,"int    function (char*, char*)", "ucnv_compareNames"
+                ,"Handle function (char*, ref UErrorCode)", "ucnv_open"
+                ,"char*  function (void*, uint, ref uint, ref UErrorCode)", "ucnv_detectUnicodeSignature"
+                ,"void   function (Handle)", "ucnv_close"
+                ,"void   function (Handle)", "ucnv_reset"
+                ,"int    function (Handle)", "ucnv_resetToUnicode"
+                ,"int    function (Handle)", "ucnv_resetFromUnicode"
+                ,"ubyte  function (Handle)", "ucnv_getMaxCharSize"
+                ,"ubyte  function (Handle)", "ucnv_getMinCharSize"
+                ,"char*  function (Handle, ref UErrorCode)", "ucnv_getName"
+                ,"uint   function (Handle, wchar*, uint, void*, uint, ref UErrorCode)", "ucnv_toUChars"
+                ,"uint   function (Handle, void*, uint, wchar*, uint, ref UErrorCode)", "ucnv_fromUChars"
+                ,"void   function (Handle, void**, void*, wchar**, wchar*, int*, ubyte, ref UErrorCode)", "ucnv_fromUnicode"
+                ,"void   function (Handle, wchar**, wchar*, void**, void*, int*, ubyte, ref UErrorCode)", "ucnv_toUnicode"
+                ,"void   function (Handle, Handle, void**, void*, void**, void*, wchar*, wchar*, wchar*, wchar*, ubyte, ubyte, ref UErrorCode)", "ucnv_convertEx"
+                ,"ubyte  function (Handle)", "ucnv_isAmbiguous"
+                ,"char*  function (uint)", "ucnv_getAvailableName"
+                ,"uint   function ()", "ucnv_countAvailable"
+        ));
 /+
                 foreach (char[] name; UConverter)
                          printf ("%.*s\n", name);
 +/
-        }
-
-        /***********************************************************************
-
-        ***********************************************************************/
-
-        static ~this ()
-        {
-                FunctionLoader.unbind (library);
-        }
 }
--- a/com.ibm.icu/src/com/ibm/icu/mangoicu/UDateFormat.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/com.ibm.icu/src/com/ibm/icu/mangoicu/UDateFormat.d	Sat Jul 09 15:50:20 2011 +0300
@@ -178,7 +178,7 @@
 
         ***********************************************************************/
 
-        this (Style time, Style date, inout ULocale locale, inout UTimeZone tz, UStringView pattern=null)
+        this (Style time, Style date, ref ULocale locale, ref UTimeZone tz, UStringView pattern=null)
         {
                 UErrorCode  e;
                 wchar* p;
@@ -209,7 +209,7 @@
 
         void format (UString dst, UDate date, UFieldPos p = null)
         {
-                uint fmat (wchar* result, uint len, inout UErrorCode e)
+                uint fmat (wchar* result, uint len, ref UErrorCode e)
                 {
                         return udat_format (handle, date, result, len, p, e);
                 }
@@ -309,7 +309,7 @@
 
         void getPattern (UString dst, bool localize)
         {
-                uint fmat (wchar* result, uint len, inout UErrorCode e)
+                uint fmat (wchar* result, uint len, ref UErrorCode e)
                 {
                         return udat_toPattern (handle, localize, result, len, e);
                 }
@@ -359,67 +359,21 @@
 
         ***********************************************************************/
 
-        private static void* library;
-
-        /***********************************************************************
-
-        ***********************************************************************/
-
-        private static extern (C) 
-        {
-                Handle function (uint, uint, char*, wchar*, uint, wchar*, uint, inout UErrorCode) udat_open;
-                void   function (Handle) udat_close;
-                uint   function (Handle, UDate, wchar*, uint, UFieldPos, inout UErrorCode) udat_format;
-                UDate  function (Handle, wchar*, uint, uint*, inout UErrorCode) udat_parse;
-                void   function (Handle, Handle) udat_setCalendar;
-                void   function (Handle, Handle) udat_setNumberFormat;
-                UDate  function (Handle, inout UErrorCode) udat_get2DigitYearStart;
-                void   function (Handle, UDate, inout UErrorCode) udat_set2DigitYearStart;
-                uint   function (Handle, byte, wchar*, uint, inout UErrorCode) udat_toPattern;
-                void   function (Handle, byte, wchar*, uint) udat_applyPattern;
-                void   function (Handle, byte) udat_setLenient;
-                byte   function (Handle) udat_isLenient;
-                Handle function (Handle) udat_getCalendar;
-        }
-
-        /***********************************************************************
-
-        ***********************************************************************/
-
-        static  FunctionLoader.Bind[] targets = 
-                [
-                {cast(void**) &udat_open,               "udat_open"}, 
-                {cast(void**) &udat_close,              "udat_close"},
-                {cast(void**) &udat_format,             "udat_format"},
-                {cast(void**) &udat_parse,              "udat_parse"},
-                {cast(void**) &udat_setCalendar,        "udat_setCalendar"},
-                {cast(void**) &udat_setNumberFormat,    "udat_setNumberFormat"},
-                {cast(void**) &udat_get2DigitYearStart, "udat_get2DigitYearStart"},
-                {cast(void**) &udat_set2DigitYearStart, "udat_set2DigitYearStart"},
-                {cast(void**) &udat_toPattern,          "udat_toPattern"},
-                {cast(void**) &udat_applyPattern,       "udat_applyPattern"},
-                {cast(void**) &udat_setLenient,         "udat_setLenient"},
-                {cast(void**) &udat_isLenient,          "udat_isLenient"},
-                {cast(void**) &udat_getCalendar,        "udat_getCalendar"},
-                ];
-
-        /***********************************************************************
-
-        ***********************************************************************/
-
-        static this ()
-        {
-                library = FunctionLoader.bind (icuin, targets);
-        }
-
-        /***********************************************************************
-
-        ***********************************************************************/
-
-        static ~this ()
-        {
-                FunctionLoader.unbind (library);
-        }
+        mixin(genICUNative!("in"
+                ,"Handle function (uint, uint, char*, wchar*, uint, wchar*, uint, ref UErrorCode)", "udat_open"
+                ,"void   function (Handle)", "udat_close"
+                ,"uint   function (Handle, UDate, wchar*, uint, UFieldPos, ref UErrorCode)", "udat_format"
+                ,"UDate  function (Handle, wchar*, uint, uint*, ref UErrorCode)", "udat_parse"
+                ,"void   function (Handle, Handle)", "udat_setCalendar"
+                ,"void   function (Handle, Handle)", "udat_setNumberFormat"
+                ,"UDate  function (Handle, ref UErrorCode)", "udat_get2DigitYearStart"
+                ,"void   function (Handle, UDate, ref UErrorCode)", "udat_set2DigitYearStart"
+                ,"uint   function (Handle, byte, wchar*, uint, ref UErrorCode)", "udat_toPattern"
+                ,"void   function (Handle, byte, wchar*, uint)", "udat_applyPattern"
+                ,"void   function (Handle, byte)", "udat_setLenient"
+                ,"byte   function (Handle)", "udat_isLenient"
+                ,"Handle function (Handle)", "udat_getCalendar"
+        ));
 }
 
 
--- a/com.ibm.icu/src/com/ibm/icu/mangoicu/UDomainName.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/com.ibm.icu/src/com/ibm/icu/mangoicu/UDomainName.d	Sat Jul 09 15:50:20 2011 +0300
@@ -153,7 +153,7 @@
 
         void toAscii (UString dst, Options o = Options.Strict)
         {
-                uint fmt (wchar* p, uint len, inout UErrorCode e)
+                uint fmt (wchar* p, uint len, ref UErrorCode e)
                 {
                         return uidna_toASCII (text.get.ptr, text.len, p, len, o, null, e);
                 }
@@ -176,7 +176,7 @@
 
         void toUnicode (UString dst, Options o = Options.Strict)
         {
-                uint fmt (wchar* p, uint len, inout UErrorCode e)
+                uint fmt (wchar* p, uint len, ref UErrorCode e)
                 {
                         return uidna_toUnicode (text.get.ptr, text.len, p, len, o, null, e);
                 }
@@ -207,7 +207,7 @@
 
         void IdnToAscii (UString dst, Options o = Options.Strict)
         {
-                uint fmt (wchar* p, uint len, inout UErrorCode e)
+                uint fmt (wchar* p, uint len, ref UErrorCode e)
                 {
                         return uidna_IDNToASCII (text.get.ptr, text.len, p, len, o, null, e);
                 }
@@ -234,7 +234,7 @@
 
         void IdnToUnicode (UString dst, Options o = Options.Strict)
         {
-                uint fmt (wchar* p, uint len, inout UErrorCode e)
+                uint fmt (wchar* p, uint len, ref UErrorCode e)
                 {
                         return uidna_IDNToUnicode (text.get.ptr, text.len, p, len, o, null, e);
                 }
@@ -273,50 +273,12 @@
 
         ***********************************************************************/
 
-        private static void* library;
-
-        /***********************************************************************
-
-        ***********************************************************************/
-
-        private static extern (C) 
-        {
-                uint    function (wchar*, uint, wchar*, uint, uint, void*, inout UErrorCode) uidna_toASCII;
-                uint    function (wchar*, uint, wchar*, uint, uint, void*, inout UErrorCode) uidna_toUnicode;
-                uint    function (wchar*, uint, wchar*, uint, uint, void*, inout UErrorCode) uidna_IDNToASCII;
-                uint    function (wchar*, uint, wchar*, uint, uint, void*, inout UErrorCode) uidna_IDNToUnicode;
-                int     function (wchar*, uint, wchar*, uint, uint, inout UErrorCode) uidna_compare;
-        }
-
-        /***********************************************************************
-
-        ***********************************************************************/
-
-        static  FunctionLoader.Bind[] targets = 
-                [
-                {cast(void**) &uidna_toASCII,           "uidna_toASCII"}, 
-                {cast(void**) &uidna_toUnicode,         "uidna_toUnicode"},
-                {cast(void**) &uidna_IDNToASCII,        "uidna_IDNToASCII"},
-                {cast(void**) &uidna_IDNToUnicode,      "uidna_IDNToUnicode"},
-                {cast(void**) &uidna_compare,           "uidna_compare"},
-                ];
-
-        /***********************************************************************
-
-        ***********************************************************************/
-
-        static this ()
-        {
-                library = FunctionLoader.bind (icuuc, targets);
-        }
-
-        /***********************************************************************
-
-        ***********************************************************************/
-
-        static ~this ()
-        {
-                FunctionLoader.unbind (library);
-        }
+        mixin(genICUNative!("uc"
+                ,"uint    function (wchar*, uint, wchar*, uint, uint, void*, ref UErrorCode)", "uidna_toASCII"
+                ,"uint    function (wchar*, uint, wchar*, uint, uint, void*, ref UErrorCode)", "uidna_toUnicode"
+                ,"uint    function (wchar*, uint, wchar*, uint, uint, void*, ref UErrorCode)", "uidna_IDNToASCII"
+                ,"uint    function (wchar*, uint, wchar*, uint, uint, void*, ref UErrorCode)", "uidna_IDNToUnicode"
+                ,"int     function (wchar*, uint, wchar*, uint, uint, ref UErrorCode)", "uidna_compare"
+        ));
 }
 
--- a/com.ibm.icu/src/com/ibm/icu/mangoicu/UEnumeration.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/com.ibm.icu/src/com/ibm/icu/mangoicu/UEnumeration.d	Sat Jul 09 15:50:20 2011 +0300
@@ -195,7 +195,7 @@
 
         ***********************************************************************/
 
-        bool next (inout wchar[] dst)
+        bool next (ref wchar[] dst)
         {       
                 ICU.UErrorCode e;
                 uint      len;
@@ -216,49 +216,11 @@
 
         ***********************************************************************/
 
-        private static void* library;
-
-        /***********************************************************************
-
-        ***********************************************************************/
-
-        private static extern (C) 
-        {
-                void   function (Handle) uenum_close;
-                uint   function (Handle, inout UErrorCode) uenum_count;
-                void   function (Handle, inout UErrorCode) uenum_reset;
-                char*  function (Handle, uint*, inout UErrorCode) uenum_next;
-                wchar* function (Handle, uint*, inout UErrorCode) uenum_unext;
-        }
-
-        /***********************************************************************
-
-        ***********************************************************************/
-
-        static  FunctionLoader.Bind[] targets = 
-                [
-                {cast(void**) &uenum_close, "uenum_close"}, 
-                {cast(void**) &uenum_count, "uenum_count"}, 
-                {cast(void**) &uenum_reset, "uenum_reset"}, 
-                {cast(void**) &uenum_next,  "uenum_next"}, 
-                {cast(void**) &uenum_unext, "uenum_unext"}, 
-                ];
-
-        /***********************************************************************
-
-        ***********************************************************************/
-
-        static this ()
-        {
-                library = FunctionLoader.bind (icuuc, targets);
-        }
-
-        /***********************************************************************
-
-        ***********************************************************************/
-
-        static ~this ()
-        {
-                FunctionLoader.unbind (library);
-        }
+        mixin(genICUNative!("uc"
+                ,"void   function (Handle)", "uenum_close"
+                ,"uint   function (Handle, ref UErrorCode)", "uenum_count"
+                ,"void   function (Handle, ref UErrorCode)", "uenum_reset"
+                ,"char*  function (Handle, uint*, ref UErrorCode)", "uenum_next"
+                ,"wchar* function (Handle, uint*, ref UErrorCode)", "uenum_unext"
+        ));
 }
--- a/com.ibm.icu/src/com/ibm/icu/mangoicu/ULocale.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/com.ibm.icu/src/com/ibm/icu/mangoicu/ULocale.d	Sat Jul 09 15:50:20 2011 +0300
@@ -97,7 +97,7 @@
 
 struct ULocale 
 {
-        public CString name;
+        public String name;
 
         /***********************************************************************
         
@@ -157,9 +157,9 @@
         
         ***********************************************************************/
 
-        static void getDefault (inout ULocale locale)
+        static void getDefault (ref ULocale locale)
         {       
-                locale.name = ICU.toArray (uloc_getDefault());
+                locale.name = cast(String)ICU.toArray (uloc_getDefault());
                 if (! locale.name)
                       ICU.exception ("failed to get default locale");
         }
@@ -168,7 +168,7 @@
         
         ***********************************************************************/
         
-        static void setDefault (inout ULocale locale)
+        static void setDefault (ref ULocale locale)
         {
                 ICU.UErrorCode e;
                 
@@ -188,43 +188,8 @@
 
         ***********************************************************************/    
         
-        private static void* library;
-
-        /***********************************************************************
-
-        ***********************************************************************/
-
-        private static extern (C) 
-        {
-                char* function () uloc_getDefault;
-                void  function (char*, inout ICU.UErrorCode) uloc_setDefault;
-        }
-
-        /**********************************************************************
-
-        ***********************************************************************/
-
-        static  FunctionLoader.Bind[] targets = 
-                [
-                {cast(void**) &uloc_getDefault, "uloc_getDefault"}, 
-                {cast(void**) &uloc_setDefault, "uloc_setDefault"},
-                ];
-
-        /***********************************************************************
-
-        ***********************************************************************/
-
-        static this ()
-        {
-                library = FunctionLoader.bind (ICU.icuuc, targets);
-        }
-
-        /***********************************************************************
-
-        ***********************************************************************/
-
-        static ~this ()
-        {
-                FunctionLoader.unbind (library);
-        }
+        mixin(/*ICU.*/genICUNative!("uc"
+                ,"char* function ()", "uloc_getDefault"
+                ,"void  function (char*, ref ICU.UErrorCode)", "uloc_setDefault"
+        ));
 }
--- a/com.ibm.icu/src/com/ibm/icu/mangoicu/UMessageFormat.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/com.ibm.icu/src/com/ibm/icu/mangoicu/UMessageFormat.d	Sat Jul 09 15:50:20 2011 +0300
@@ -88,6 +88,7 @@
                 com.ibm.icu.mangoicu.UString;
 
 public  import  com.ibm.icu.mangoicu.ULocale;
+private import java.lang.util;
 
 /*******************************************************************************
 
@@ -112,7 +113,7 @@
 
         ***********************************************************************/
 
-        this (wchar[] pattern, inout ULocale locale = ULocale.Default)
+        this (wchar[] pattern, ref ULocale locale = ULocale.Default)
         {       
                 UErrorCode e;
 
@@ -127,7 +128,7 @@
 
         ***********************************************************************/
 
-        this (UStringView pattern, inout ULocale locale = ULocale.Default)
+        this (UStringView pattern, ref ULocale locale = ULocale.Default)
         {
                 this (pattern.get, locale);
         }
@@ -150,7 +151,7 @@
 
         ***********************************************************************/
 
-        UMessageFormat setLocale (inout ULocale locale)
+        UMessageFormat setLocale (ref ULocale locale)
         {
                 umsg_setLocale (handle, toString(locale.name));
                 return this;
@@ -163,9 +164,9 @@
 
         ***********************************************************************/
 
-        UMessageFormat getLocale (inout ULocale locale)
+        UMessageFormat getLocale (ref ULocale locale)
         {
-                locale.name = toArray (umsg_getLocale (handle));
+                locale.name = cast(String) toArray (umsg_getLocale (handle));
                 return this;
         }
 
@@ -192,7 +193,7 @@
 
         UMessageFormat getPattern (UString s)
         {
-                uint fmt (wchar* dst, uint length, inout UErrorCode e)
+                uint fmt (wchar* dst, uint length, ref UErrorCode e)
                 {
                         return umsg_toPattern (handle, dst, length, e);
                 }
@@ -212,7 +213,7 @@
 
         UMessageFormat format (UString s, Args* list)
         {
-                uint fmt (wchar* dst, uint length, inout UErrorCode e)
+                uint fmt (wchar* dst, uint length, ref UErrorCode e)
                 {
                         return umsg_vformat (handle, dst, length, list.args.ptr, e);
                 }
@@ -349,56 +350,15 @@
 
         ***********************************************************************/
 
-        private static void* library;
-
-        /***********************************************************************
-
-        ***********************************************************************/
-
-        private static extern (C) 
-        {
-                Handle  function (wchar*, uint, char*, void*, inout UErrorCode) umsg_open;
-                void    function (Handle) umsg_close;
-                void    function (Handle, char*) umsg_setLocale;
-                char*   function (Handle) umsg_getLocale;
-                uint    function (Handle, wchar*, uint, inout UErrorCode) umsg_toPattern;
-                void    function (Handle, wchar*, uint, void*, inout UErrorCode) umsg_applyPattern;
-                uint    function (Handle, wchar*, uint, void*, inout UErrorCode) umsg_vformat;
-        }
-
-        /***********************************************************************
-
-        ***********************************************************************/
-
-        static  FunctionLoader.Bind[] targets = 
-                [
-                {cast(void**) &umsg_open,               "umsg_open"}, 
-                {cast(void**) &umsg_close,              "umsg_close"},
-                {cast(void**) &umsg_setLocale,          "umsg_setLocale"},
-                {cast(void**) &umsg_getLocale,          "umsg_getLocale"},
-                {cast(void**) &umsg_toPattern,          "umsg_toPattern"},
-                {cast(void**) &umsg_applyPattern,       "umsg_applyPattern"},
-                {cast(void**) &umsg_vformat,            "umsg_vformat"},
-                ];
-
-        /***********************************************************************
-
-        ***********************************************************************/
-
-        static this ()
-        {
-                library = FunctionLoader.bind (icuin, targets);
-                //test ();
-        }
-
-        /***********************************************************************
-
-        ***********************************************************************/
-
-        static ~this ()
-        {
-                FunctionLoader.unbind (library);
-        }
+        mixin(genICUNative!("in"
+                ,"Handle  function (wchar*, uint, char*, void*, ref UErrorCode)", "umsg_open"
+                ,"void    function (Handle)", "umsg_close"
+                ,"void    function (Handle, char*)", "umsg_setLocale"
+                ,"char*   function (Handle)", "umsg_getLocale"
+                ,"uint    function (Handle, wchar*, uint, ref UErrorCode)", "umsg_toPattern"
+                ,"void    function (Handle, wchar*, uint, void*, ref UErrorCode)", "umsg_applyPattern"
+                ,"uint    function (Handle, wchar*, uint, void*, ref UErrorCode)", "umsg_vformat"
+        ));
 
         /***********************************************************************
 
--- a/com.ibm.icu/src/com/ibm/icu/mangoicu/UNormalize.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/com.ibm.icu/src/com/ibm/icu/mangoicu/UNormalize.d	Sat Jul 09 15:50:20 2011 +0300
@@ -222,7 +222,7 @@
 
         static void normalize (UStringView src, UString dst, Mode mode, Options o = Options.None)
         {
-                uint fmt (wchar* dst, uint len, inout UErrorCode e)
+                uint fmt (wchar* dst, uint len, ref UErrorCode e)
                 {
                         return unorm_normalize (src.get.ptr, src.len, mode, o, dst, len, e);
                 }
@@ -297,7 +297,7 @@
 
         static void concatenate (UStringView left, UStringView right, UString dst, Mode mode, Options o = Options.None)
         {      
-                uint fmt (wchar* p, uint len, inout UErrorCode e)
+                uint fmt (wchar* p, uint len, ref UErrorCode e)
                 {
                         return unorm_concatenate (left.get.ptr, left.len, right.get.ptr, right.len, p, len, mode, o, e);
                 }
@@ -343,49 +343,11 @@
 
         ***********************************************************************/
 
-        private static void* library;
-
-        /***********************************************************************
-
-        ***********************************************************************/
-
-        private static extern (C) 
-        {
-                uint  function (wchar*, uint, uint, uint, wchar*, uint, inout UErrorCode) unorm_normalize;
-                uint  function (wchar*, uint, uint, uint, inout UErrorCode) unorm_quickCheckWithOptions;
-                byte  function (wchar*, uint, uint, uint, inout UErrorCode) unorm_isNormalizedWithOptions;
-                uint  function (wchar*, uint, wchar*, uint, wchar*, uint, uint, uint, inout UErrorCode) unorm_concatenate;
-                uint  function (wchar*, uint, wchar*, uint, uint, inout UErrorCode) unorm_compare;
-        }
-
-        /***********************************************************************
-
-        ***********************************************************************/
-
-        static  FunctionLoader.Bind[] targets = 
-                [
-                {cast(void**) &unorm_normalize,                 "unorm_normalize"},
-                {cast(void**) &unorm_quickCheckWithOptions,     "unorm_quickCheckWithOptions"},
-                {cast(void**) &unorm_isNormalizedWithOptions,   "unorm_isNormalizedWithOptions"},
-                {cast(void**) &unorm_concatenate,               "unorm_concatenate"},
-                {cast(void**) &unorm_compare,                   "unorm_compare"},
-                ];
-
-        /***********************************************************************
-
-        ***********************************************************************/
-
-        static this ()
-        {
-                library = FunctionLoader.bind (icuuc, targets);
-        }
-
-        /***********************************************************************
-
-        ***********************************************************************/
-
-        static ~this ()
-        {
-                FunctionLoader.unbind (library);
-        }
+        mixin(genICUNative!("uc"
+                ,"uint  function (wchar*, uint, uint, uint, wchar*, uint, ref UErrorCode)", "unorm_normalize"
+                ,"uint  function (wchar*, uint, uint, uint, ref UErrorCode)", "unorm_quickCheckWithOptions"
+                ,"byte  function (wchar*, uint, uint, uint, ref UErrorCode)", "unorm_isNormalizedWithOptions"
+                ,"uint  function (wchar*, uint, wchar*, uint, wchar*, uint, uint, uint, ref UErrorCode)", "unorm_concatenate"
+                ,"uint  function (wchar*, uint, wchar*, uint, uint, ref UErrorCode)", "unorm_compare"
+        ));
 }
--- a/com.ibm.icu/src/com/ibm/icu/mangoicu/UNumberFormat.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/com.ibm.icu/src/com/ibm/icu/mangoicu/UNumberFormat.d	Sat Jul 09 15:50:20 2011 +0300
@@ -99,7 +99,7 @@
         
         ***********************************************************************/
 
-        this (inout ULocale locale)
+        this (ref ULocale locale)
         {
                 super (Style.Decimal, null, locale);
         }
@@ -130,7 +130,7 @@
         
         ***********************************************************************/
 
-        this (inout ULocale locale)
+        this (ref ULocale locale)
         {
                 super (Style.Currency, null, locale);
         }
@@ -147,7 +147,7 @@
         
         ***********************************************************************/
 
-        this (inout ULocale locale)
+        this (ref ULocale locale)
         {
                 super (Style.Percent, null, locale);
         }
@@ -164,7 +164,7 @@
         
         ***********************************************************************/
 
-        this (inout ULocale locale)
+        this (ref ULocale locale)
         {
                 super (Style.Scientific, null, locale);
         }
@@ -181,7 +181,7 @@
         
         ***********************************************************************/
 
-        this (inout ULocale locale)
+        this (ref ULocale locale)
         {
                 super (Style.Spellout, null, locale);
         }
@@ -198,7 +198,7 @@
         
         ***********************************************************************/
 
-        this (inout ULocale locale)
+        this (ref ULocale locale)
         {
                 super (Style.Duration, null, locale);
         }
@@ -215,7 +215,7 @@
         
         ***********************************************************************/
 
-        this (inout ULocale locale)
+        this (ref ULocale locale)
         {
                 super (Style.RuleBased, null, locale);
         }
@@ -251,7 +251,7 @@
         
         ***********************************************************************/
 
-        this (Style style, char[] pattern, inout ULocale locale)
+        this (Style style, char[] pattern, ref ULocale locale)
         {
                 super (style, pattern, locale);
         }
@@ -648,7 +648,7 @@
 
         void getPattern (UString dst, bool localize)
         {
-                uint fmat (wchar* result, uint len, inout UErrorCode e)
+                uint fmat (wchar* result, uint len, ref UErrorCode e)
                 {
                         return unum_toPattern (handle, localize, result, len, e);
                 }
@@ -768,7 +768,7 @@
         
         ***********************************************************************/
 
-        this (Style style, char[] pattern, inout ULocale locale)
+        this (Style style, char[] pattern, ref ULocale locale)
         {
                 UErrorCode e;
 
@@ -791,7 +791,7 @@
 
         void format (UString dst, int number, UFieldPos p = null)
         {
-                uint fmat (wchar* result, uint len, inout UErrorCode e)
+                uint fmat (wchar* result, uint len, ref UErrorCode e)
                 {
                         return unum_format (handle, number, result, len, p, e);
                 }
@@ -805,7 +805,7 @@
 
         void format (UString dst, long number, UFieldPos p = null)
         {
-                uint fmat (wchar* result, uint len, inout UErrorCode e)
+                uint fmat (wchar* result, uint len, ref UErrorCode e)
                 {
                         return unum_formatInt64 (handle, number, result, len, p, e);
                 }
@@ -819,7 +819,7 @@
 
         void format (UString dst, double number, UFieldPos p = null)
         {
-                uint fmat (wchar* result, uint len, inout UErrorCode e)
+                uint fmat (wchar* result, uint len, ref UErrorCode e)
                 {
                         return unum_formatDouble (handle, number, result, len, p, e);
                 }
@@ -870,64 +870,20 @@
 
         ***********************************************************************/
 
-        private static void* library;
-
-        /***********************************************************************
-
-        ***********************************************************************/
-
-        private static extern (C) 
-        {
-                Handle function (uint, char*, uint, char*, ParseError, inout UErrorCode) unum_open;
-                void   function (Handle) unum_close;
-                int    function (Handle, int,    wchar*, uint, UFieldPos, inout UErrorCode) unum_format;
-                int    function (Handle, long,   wchar*, uint, UFieldPos, inout UErrorCode) unum_formatInt64;
-                int    function (Handle, double, wchar*, uint, UFieldPos, inout UErrorCode) unum_formatDouble;
-                int    function (Handle, wchar*, uint, uint*, inout UErrorCode) unum_parse;
-                long   function (Handle, wchar*, uint, uint*, inout UErrorCode) unum_parseInt64;
-                double function (Handle, wchar*, uint, uint*, inout UErrorCode) unum_parseDouble;
-                int    function (Handle, uint) unum_getAttribute;
-                void   function (Handle, uint, uint) unum_setAttribute;
-                uint   function (Handle, byte, wchar*, uint, inout UErrorCode) unum_toPattern;
-                void   function (Handle, byte, wchar*, uint, ParseError, inout UErrorCode) unum_applyPattern;
-        }
-
-        /***********************************************************************
-
-        ***********************************************************************/
-
-        static  FunctionLoader.Bind[] targets = 
-                [
-                {cast(void**) &unum_open,        "unum_open"}, 
-                {cast(void**) &unum_close,       "unum_close"},
-                {cast(void**) &unum_format,      "unum_format"},
-                {cast(void**) &unum_formatInt64  "unum_formatInt64"},
-                {cast(void**) &unum_formatDouble "unum_formatDouble"},
-                {cast(void**) &unum_parse,       "unum_parse"},
-                {cast(void**) &unum_parseInt64   "unum_parseInt64"},
-                {cast(void**) &unum_parseDouble  "unum_parseDouble"},
-                {cast(void**) &unum_getAttribute "unum_getAttribute"},
-                {cast(void**) &unum_setAttribute "unum_setAttribute"},
-                {cast(void**) &unum_toPattern    "unum_toPattern"},
-                ];
-
-        /***********************************************************************
-
-        ***********************************************************************/
-
-        static this ()
-        {
-                library = FunctionLoader.bind (icuin, targets);
-        }
-
-        /***********************************************************************
-
-        ***********************************************************************/
-
-        static ~this ()
-        {
-                FunctionLoader.unbind (library);
-        }
+        mixin(genICUNative!("in"
+                ,"Handle function (uint, char*, uint, char*, ParseError, ref UErrorCode)", "unum_open"
+                ,"void   function (Handle)", "unum_close"
+                ,"int    function (Handle, int,    wchar*, uint, UFieldPos, ref UErrorCode)", "unum_format"
+                ,"int    function (Handle, long,   wchar*, uint, UFieldPos, ref UErrorCode)", "unum_formatInt64"
+                ,"int    function (Handle, double, wchar*, uint, UFieldPos, ref UErrorCode)", "unum_formatDouble"
+                ,"int    function (Handle, wchar*, uint, uint*, ref UErrorCode)", "unum_parse"
+                ,"long   function (Handle, wchar*, uint, uint*, ref UErrorCode)", "unum_parseInt64"
+                ,"double function (Handle, wchar*, uint, uint*, ref UErrorCode)", "unum_parseDouble"
+                ,"int    function (Handle, uint)", "unum_getAttribute"
+                ,"void   function (Handle, uint, uint)", "unum_setAttribute"
+                ,"uint   function (Handle, byte, wchar*, uint, ref UErrorCode)", "unum_toPattern"
+                ,"void   function (Handle, byte, wchar*, uint, ParseError, ref UErrorCode)", "unum_applyPattern"
+        ));
 }
 
 
--- a/com.ibm.icu/src/com/ibm/icu/mangoicu/URegex.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/com.ibm.icu/src/com/ibm/icu/mangoicu/URegex.d	Sat Jul 09 15:50:20 2011 +0300
@@ -360,7 +360,7 @@
 
         void group (UString s, uint index)
         {       
-                uint fmt (wchar* dst, uint length, inout UErrorCode e)
+                uint fmt (wchar* dst, uint length, ref UErrorCode e)
                 {
                         return uregex_group (handle, index, dst, length, e);
                 }
@@ -626,75 +626,24 @@
         
         ***********************************************************************/
               
-        private static void* library;
-
-        /***********************************************************************
-
-        ***********************************************************************/
-
-        private static extern (C) 
-        {
-                Handle  function (wchar*, uint, uint, ParseError*, inout UErrorCode) uregex_open;
-                void    function (Handle) uregex_close;
-                Handle  function (Handle, inout UErrorCode) uregex_clone;
-                wchar*  function (Handle, inout uint, inout UErrorCode) uregex_pattern;
-                uint    function (Handle, inout UErrorCode) uregex_flags;
-                void    function (Handle, wchar*, uint, inout UErrorCode) uregex_setText;
-                wchar*  function (Handle, inout uint, inout UErrorCode) uregex_getText;
-                uint    function (Handle, uint, wchar*, uint, inout UErrorCode) uregex_group;
-                uint    function (Handle, inout UErrorCode) uregex_groupCount;
-                uint    function (Handle, uint, inout UErrorCode) uregex_start;
-                uint    function (Handle, uint, inout UErrorCode) uregex_end;
-                void    function (Handle, uint, inout UErrorCode) uregex_reset;
-                bool    function (Handle, uint, inout UErrorCode) uregex_matches;
-                bool    function (Handle, uint, inout UErrorCode) uregex_lookingAt;
-                bool    function (Handle, uint, inout UErrorCode) uregex_find;
-                bool    function (Handle, inout UErrorCode) uregex_findNext;
-                uint    function (Handle, wchar*, uint, wchar*, uint, inout UErrorCode) uregex_replaceAll;
-                uint    function (Handle, wchar*, uint, wchar*, uint, inout UErrorCode) uregex_replaceFirst;
-        }
-
-        /***********************************************************************
-
-        ***********************************************************************/
-
-        static  FunctionLoader.Bind[] targets = 
-                [
-                {cast(void**) &uregex_open,             "uregex_open"}, 
-                {cast(void**) &uregex_close,            "uregex_close"},
-                {cast(void**) &uregex_clone,            "uregex_clone"},
-                {cast(void**) &uregex_pattern,          "uregex_pattern"},
-                {cast(void**) &uregex_flags,            "uregex_flags"},
-                {cast(void**) &uregex_setText,          "uregex_setText"},
-                {cast(void**) &uregex_getText,          "uregex_getText"},
-                {cast(void**) &uregex_group,            "uregex_group"},
-                {cast(void**) &uregex_groupCount,       "uregex_groupCount"},
-                {cast(void**) &uregex_start,            "uregex_start"},
-                {cast(void**) &uregex_end,              "uregex_end"},
-                {cast(void**) &uregex_reset,            "uregex_reset"},
-                {cast(void**) &uregex_matches,          "uregex_matches"},
-                {cast(void**) &uregex_lookingAt,        "uregex_lookingAt"},
-                {cast(void**) &uregex_find,             "uregex_find"},
-                {cast(void**) &uregex_findNext,         "uregex_findNext"},
-                {cast(void**) &uregex_replaceAll,       "uregex_replaceAll"},
-                {cast(void**) &uregex_replaceFirst,     "uregex_replaceFirst"},
-                ];
-
-        /***********************************************************************
-
-        ***********************************************************************/
-
-        static this ()
-        {
-                library = FunctionLoader.bind (icuin, targets);
-        }
-
-        /***********************************************************************
-
-        ***********************************************************************/
-
-        static ~this ()
-        {
-                FunctionLoader.unbind (library);
-        }
+        mixin(genICUNative!("in"
+                ,"Handle  function (wchar*, uint, uint, ParseError*, ref UErrorCode)", "uregex_open"
+                ,"void    function (Handle)", "uregex_close"
+                ,"Handle  function (Handle, ref UErrorCode)", "uregex_clone"
+                ,"wchar*  function (Handle, ref uint, ref UErrorCode)", "uregex_pattern"
+                ,"uint    function (Handle, ref UErrorCode)", "uregex_flags"
+                ,"void    function (Handle, wchar*, uint, ref UErrorCode)", "uregex_setText"
+                ,"wchar*  function (Handle, ref uint, ref UErrorCode)", "uregex_getText"
+                ,"uint    function (Handle, uint, wchar*, uint, ref UErrorCode)", "uregex_group"
+                ,"uint    function (Handle, ref UErrorCode)", "uregex_groupCount"
+                ,"uint    function (Handle, uint, ref UErrorCode)", "uregex_start"
+                ,"uint    function (Handle, uint, ref UErrorCode)", "uregex_end"
+                ,"void    function (Handle, uint, ref UErrorCode)", "uregex_reset"
+                ,"bool    function (Handle, uint, ref UErrorCode)", "uregex_matches"
+                ,"bool    function (Handle, uint, ref UErrorCode)", "uregex_lookingAt"
+                ,"bool    function (Handle, uint, ref UErrorCode)", "uregex_find"
+                ,"bool    function (Handle, ref UErrorCode)", "uregex_findNext"
+                ,"uint    function (Handle, wchar*, uint, wchar*, uint, ref UErrorCode)", "uregex_replaceAll"
+                ,"uint    function (Handle, wchar*, uint, wchar*, uint, ref UErrorCode)", "uregex_replaceFirst"
+        ));
 }
--- a/com.ibm.icu/src/com/ibm/icu/mangoicu/UResourceBundle.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/com.ibm.icu/src/com/ibm/icu/mangoicu/UResourceBundle.d	Sat Jul 09 15:50:20 2011 +0300
@@ -88,6 +88,7 @@
                 com.ibm.icu.mangoicu.UString;
 
 public  import  com.ibm.icu.mangoicu.ULocale;
+private import java.lang.util;
 
 /*******************************************************************************
 
@@ -168,7 +169,7 @@
 
         ***********************************************************************/
 
-        this (inout ULocale locale, char[] path = null)
+        this (ref ULocale locale, char[] path = null)
         {
                 UErrorCode e;
 
@@ -387,7 +388,7 @@
 
         ***********************************************************************/
 
-        void getVersion (inout Version info)
+        void getVersion (ref Version info)
         {
                 ures_getVersion (handle, info);
         }
@@ -398,11 +399,11 @@
 
         ***********************************************************************/
 
-        void getLocale (inout ULocale locale)
+        void getLocale (ref ULocale locale)
         {
                 UErrorCode e;
 
-                locale.name = toArray (ures_getLocale (handle, e));
+                locale.name = cast(String) toArray (ures_getLocale (handle, e));
                 testError (e, "failed to get resource locale");
         }
 
@@ -438,7 +439,7 @@
 
         ***********************************************************************/
 
-        private static final UResourceBundle get (Handle handle, inout UErrorCode e)
+        private static final UResourceBundle get (Handle handle, ref UErrorCode e)
         {
                 testError (e, "failed to create resource bundle");
                 if (handle)
@@ -455,90 +456,38 @@
 
         ***********************************************************************/
 
-        private static void* library;
-
-        /***********************************************************************
-
-        ***********************************************************************/
-
-        private static extern (C) 
-        {
-                Handle  function (char*, char*, inout UErrorCode) ures_open;
-                void    function (Handle) ures_close;
-                char*   function (Handle, inout UErrorCode) ures_getLocale;
-                void    function (Handle, inout Version) ures_getVersion;
-                uint    function (Handle) ures_getSize;
-                int     function (Handle, inout UErrorCode) ures_getInt;
-                wchar*  function (Handle, inout uint, inout UErrorCode) ures_getString;
-                wchar*  function (Handle, uint, inout uint, inout UErrorCode) ures_getStringByIndex;
-                wchar*  function (Handle, char*, inout uint, inout UErrorCode) ures_getStringByKey;
-                void*   function (Handle, inout uint, inout UErrorCode) ures_getBinary;
-                int*    function (Handle, inout uint, inout UErrorCode) ures_getIntVector;
-                byte    function (Handle) ures_hasNext;
-                void    function (Handle) ures_resetIterator;
-                wchar*  function (Handle, inout uint, inout char*, inout UErrorCode) ures_getNextString;
-                char*   function (Handle) ures_getKey;
-                int     function (Handle) ures_getType;
-                Handle  function (Handle, Handle, inout UErrorCode) ures_getNextResource;
-                Handle  function (Handle, uint, Handle, inout UErrorCode) ures_getByIndex;
-                Handle  function (Handle, char*, Handle, inout UErrorCode) ures_getByKey;
-        }
+        mixin(genICUNative!("uc"
+                ,"Handle  function (char*, char*, ref UErrorCode)", "ures_open"
+                ,"void    function (Handle)", "ures_close"
+                ,"char*   function (Handle, ref UErrorCode)", "ures_getLocale"
+                ,"void    function (Handle, ref Version)", "ures_getVersion"
+                ,"uint    function (Handle)", "ures_getSize"
+                ,"int     function (Handle, ref UErrorCode)", "ures_getInt"
+                ,"wchar*  function (Handle, ref uint, ref UErrorCode)", "ures_getString"
+                ,"wchar*  function (Handle, uint, ref uint, ref UErrorCode)", "ures_getStringByIndex"
+                ,"wchar*  function (Handle, char*, ref uint, ref UErrorCode)", "ures_getStringByKey"
+                ,"void*   function (Handle, ref uint, ref UErrorCode)", "ures_getBinary"
+                ,"int*    function (Handle, ref uint, ref UErrorCode)", "ures_getIntVector"
+                ,"byte    function (Handle)", "ures_hasNext"
+                ,"void    function (Handle)", "ures_resetIterator"
+                ,"wchar*  function (Handle, ref uint, ref char*, ref UErrorCode)", "ures_getNextString"
+                ,"char*   function (Handle)", "ures_getKey"
+                ,"int     function (Handle)", "ures_getType"
+                ,"Handle  function (Handle, Handle, ref UErrorCode)", "ures_getNextResource"
+                ,"Handle  function (Handle, uint, Handle, ref UErrorCode)", "ures_getByIndex"
+                ,"Handle  function (Handle, char*, Handle, ref UErrorCode)", "ures_getByKey"
+        ));
 
         /***********************************************************************
 
         ***********************************************************************/
 
-        static  FunctionLoader.Bind[] targets = 
-                [
-                {cast(void**) &ures_open,               "ures_open"}, 
-                {cast(void**) &ures_close,              "ures_close"},
-                {cast(void**) &ures_getLocale,          "ures_getLocale"},
-                {cast(void**) &ures_getVersion,         "ures_getVersion"},
-                {cast(void**) &ures_getSize,            "ures_getSize"},
-                {cast(void**) &ures_getInt,             "ures_getInt"},
-                {cast(void**) &ures_getString,          "ures_getString"},
-                {cast(void**) &ures_getStringByIndex,   "ures_getStringByIndex"},
-                {cast(void**) &ures_getStringByKey,     "ures_getStringByKey"},
-                {cast(void**) &ures_getBinary,          "ures_getBinary"},
-                {cast(void**) &ures_hasNext,            "ures_hasNext"},
-                {cast(void**) &ures_resetIterator,      "ures_resetIterator"},
-                {cast(void**) &ures_getNextString,      "ures_getNextString"},
-                {cast(void**) &ures_getKey,             "ures_getKey"},
-                {cast(void**) &ures_getType,            "ures_getType"},
-                {cast(void**) &ures_getNextResource,    "ures_getNextResource"},
-                {cast(void**) &ures_getByIndex,         "ures_getByIndex"},
-                {cast(void**) &ures_getByKey,           "ures_getByKey"},
-                ];
-
-        /***********************************************************************
-
-        ***********************************************************************/
-
-        static this ()
-        {
-                library = FunctionLoader.bind (icuuc, targets);
-                //test ();
-        }
-
-        /***********************************************************************
-
-        ***********************************************************************/
-
-        static ~this ()
-        {
-                FunctionLoader.unbind (library);
-        }
-
-        /***********************************************************************
-
-        ***********************************************************************/
-
-        static void test()
+        /*static void test()
         {
                 UResourceBundle b = new UResourceBundle (ULocale.Default);
                 UStringView t = b.getNextString();
                 UResourceBundle b1 = b.getNextResource ();
-        }
+        }*/
 }
 
 
--- a/com.ibm.icu/src/com/ibm/icu/mangoicu/USearch.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/com.ibm.icu/src/com/ibm/icu/mangoicu/USearch.d	Sat Jul 09 15:50:20 2011 +0300
@@ -205,7 +205,7 @@
 
         ***********************************************************************/
 
-        this (UStringView pattern, UStringView text, inout ULocale locale, UBreakIterator* iterator = null)
+        this (UStringView pattern, UStringView text, ref ULocale locale, UBreakIterator* iterator = null)
         {
                 UErrorCode e;
 
@@ -300,7 +300,7 @@
 
         void getMatchedText (UString s)
         {
-                uint fmt (wchar* dst, uint length, inout UErrorCode e)
+                uint fmt (wchar* dst, uint length, ref UErrorCode e)
                 {
                         return usearch_getMatchedText (handle, dst, length, e);
                 }
@@ -525,83 +525,28 @@
 
         ***********************************************************************/
 
-        private static void* library;
-
-        /***********************************************************************
-
-        ***********************************************************************/
-
-        private static extern (C)
-        {
-                Handle  function (wchar*, uint, wchar*, uint, char*, void*, inout UErrorCode) usearch_open;
-                Handle  function (wchar*, uint, wchar*, uint, Handle, void*, inout UErrorCode) usearch_openFromCollator;
-                void    function (Handle) usearch_close;
-                void    function (Handle, uint, inout UErrorCode) usearch_setOffset;
-                uint    function (Handle) usearch_getOffset;
-                uint    function (Handle) usearch_getMatchedStart;
-                uint    function (Handle) usearch_getMatchedLength;
-                uint    function (Handle, wchar*, uint, inout UErrorCode) usearch_getMatchedText;
-                void    function (Handle, wchar*, uint, inout UErrorCode) usearch_setText;
-                wchar*  function (Handle, uint*) usearch_getText;
-                void    function (Handle, wchar*, uint, inout UErrorCode) usearch_setPattern;
-                wchar*  function (Handle, uint*) usearch_getPattern;
-                uint    function (Handle, inout UErrorCode) usearch_first;
-                uint    function (Handle, inout UErrorCode) usearch_last;
-                uint    function (Handle, inout UErrorCode) usearch_next;
-                uint    function (Handle, inout UErrorCode) usearch_previous;
-                uint    function (Handle, uint, inout UErrorCode) usearch_following;
-                uint    function (Handle, uint, inout UErrorCode) usearch_preceding;
-                void    function (Handle) usearch_reset;
-                void    function (Handle, Handle, inout UErrorCode) usearch_setBreakIterator;
-                Handle  function (Handle) usearch_getCollator;
-                void    function (Handle, Handle, inout UErrorCode) usearch_setCollator;
-        }
-
-        /***********************************************************************
-
-        ***********************************************************************/
-
-        static  FunctionLoader.Bind[] targets =
-                [
-                {cast(void**) &usearch_open,             "usearch_open"},
-                {cast(void**) &usearch_openFromCollator, "usearch_openFromCollator"},
-                {cast(void**) &usearch_close,            "usearch_close"},
-                {cast(void**) &usearch_setOffset,        "usearch_setOffset"},
-                {cast(void**) &usearch_getOffset,        "usearch_getOffset"},
-                {cast(void**) &usearch_getMatchedStart,  "usearch_getMatchedStart"},
-                {cast(void**) &usearch_getMatchedLength, "usearch_getMatchedLength"},
-                {cast(void**) &usearch_getMatchedText,   "usearch_getMatchedText"},
-                {cast(void**) &usearch_setText,          "usearch_setText"},
-                {cast(void**) &usearch_getText,          "usearch_getText"},
-                {cast(void**) &usearch_setPattern,       "usearch_setPattern"},
-                {cast(void**) &usearch_getPattern,       "usearch_getPattern"},
-                {cast(void**) &usearch_first,            "usearch_first"},
-                {cast(void**) &usearch_last,             "usearch_last"},
-                {cast(void**) &usearch_next,             "usearch_next"},
-                {cast(void**) &usearch_previous,         "usearch_previous"},
-                {cast(void**) &usearch_following,        "usearch_following"},
-                {cast(void**) &usearch_preceding,        "usearch_preceding"},
-                {cast(void**) &usearch_reset,            "usearch_reset"},
-                {cast(void**) &usearch_setBreakIterator, "usearch_setBreakIterator"},
-                {cast(void**) &usearch_getCollator,      "usearch_getCollator"},
-                {cast(void**) &usearch_setCollator,      "usearch_setCollator"},
-                ];
-
-        /***********************************************************************
-
-        ***********************************************************************/
-
-        static this ()
-        {
-                library = FunctionLoader.bind (icuin, targets);
-        }
-
-        /***********************************************************************
-
-        ***********************************************************************/
-
-        static ~this ()
-        {
-                FunctionLoader.unbind (library);
-        }
+        mixin(genICUNative!("in"
+                ,"Handle  function (wchar*, uint, wchar*, uint, char*, void*, ref UErrorCode)", "usearch_open"
+                ,"Handle  function (wchar*, uint, wchar*, uint, Handle, void*, ref UErrorCode)", "usearch_openFromCollator"
+                ,"void    function (Handle)", "usearch_close"
+                ,"void    function (Handle, uint, ref UErrorCode)", "usearch_setOffset"
+                ,"uint    function (Handle)", "usearch_getOffset"
+                ,"uint    function (Handle)", "usearch_getMatchedStart"
+                ,"uint    function (Handle)", "usearch_getMatchedLength"
+                ,"uint    function (Handle, wchar*, uint, ref UErrorCode)", "usearch_getMatchedText"
+                ,"void    function (Handle, wchar*, uint, ref UErrorCode)", "usearch_setText"
+                ,"wchar*  function (Handle, uint*)", "usearch_getText"
+                ,"void    function (Handle, wchar*, uint, ref UErrorCode)", "usearch_setPattern"
+                ,"wchar*  function (Handle, uint*)", "usearch_getPattern"
+                ,"uint    function (Handle, ref UErrorCode)", "usearch_first"
+                ,"uint    function (Handle, ref UErrorCode)", "usearch_last"
+                ,"uint    function (Handle, ref UErrorCode)", "usearch_next"
+                ,"uint    function (Handle, ref UErrorCode)", "usearch_previous"
+                ,"uint    function (Handle, uint, ref UErrorCode)", "usearch_following"
+                ,"uint    function (Handle, uint, ref UErrorCode)", "usearch_preceding"
+                ,"void    function (Handle)", "usearch_reset"
+                ,"void    function (Handle, Handle, ref UErrorCode)", "usearch_setBreakIterator"
+                ,"Handle  function (Handle)", "usearch_getCollator"
+                ,"void    function (Handle, Handle, ref UErrorCode)", "usearch_setCollator"
+        ));
 }
--- a/com.ibm.icu/src/com/ibm/icu/mangoicu/USet.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/com.ibm.icu/src/com/ibm/icu/mangoicu/USet.d	Sat Jul 09 15:50:20 2011 +0300
@@ -210,7 +210,7 @@
         
         void toPattern (UString dst, bool escape)
         {
-                uint fmt (wchar* p, uint len, inout UErrorCode e)
+                uint fmt (wchar* p, uint len, ref UErrorCode e)
                 {
                         return uset_toPattern (handle, p, len, escape, e);
                 }
@@ -395,78 +395,26 @@
 
         ***********************************************************************/
 
-        private static void* library;
-
-        /***********************************************************************
-
-        ***********************************************************************/
-
-        private static extern (C) 
-        {
-                Handle function (wchar start, wchar end) uset_open;
-                void   function (Handle) uset_close;
-                Handle function (wchar* pattern, uint patternLength, uint options, inout UErrorCode e) uset_openPatternOptions;                        
-                uint   function (Handle, wchar* pattern, uint patternLength, uint options, inout UErrorCode e) uset_applyPattern;
-                uint   function (Handle, wchar* result, uint resultCapacity, byte escapeUnprintable, inout UErrorCode e) uset_toPattern;
-                void   function (Handle, wchar c) uset_add;
-                void   function (Handle, Handle additionalSet) uset_addAll;
-                void   function (Handle, wchar start, wchar end) uset_addRange;                        
-                void   function (Handle, wchar* str, uint strLen) uset_addString;
-                void   function (Handle, wchar c) uset_remove;
-                void   function (Handle, wchar start, wchar end) uset_removeRange;
-                void   function (Handle, wchar* str, uint strLen) uset_removeString;                       
-                void   function (Handle) uset_complement;
-                void   function (Handle) uset_clear;
-                byte   function (Handle) uset_isEmpty;
-                byte   function (Handle, wchar c) uset_contains;
-                byte   function (Handle, wchar start, wchar end) uset_containsRange;
-                byte   function (Handle, wchar* str, uint strLen) uset_containsString;
-                uint   function (Handle) uset_size;
-         }
-
-        /***********************************************************************
-
-        ***********************************************************************/
-
-        static  FunctionLoader.Bind[] targets = 
-                [
-                {cast(void**) &uset_open,               "uset_open"}, 
-                {cast(void**) &uset_close,              "uset_close"},
-                {cast(void**) &uset_openPatternOptions, "uset_openPatternOptions"},
-                {cast(void**) &uset_applyPattern,       "uset_applyPattern"},
-                {cast(void**) &uset_toPattern,          "uset_toPattern"},
-                {cast(void**) &uset_add,                "uset_add"},
-                {cast(void**) &uset_addAll,             "uset_addAll"},
-                {cast(void**) &uset_addRange,           "uset_addRange"},
-                {cast(void**) &uset_addString,          "uset_addString"},
-                {cast(void**) &uset_remove,             "uset_remove"},
-                {cast(void**) &uset_removeRange,        "uset_removeRange"},
-                {cast(void**) &uset_removeString,       "uset_removeString"},
-                {cast(void**) &uset_complement,         "uset_complement"},
-                {cast(void**) &uset_clear,              "uset_clear"},
-                {cast(void**) &uset_isEmpty,            "uset_isEmpty"},
-                {cast(void**) &uset_contains,           "uset_contains"},
-                {cast(void**) &uset_containsRange,      "uset_containsRange"},
-                {cast(void**) &uset_containsString,     "uset_containsString"},
-                {cast(void**) &uset_size,               "uset_size"},
-                ];
-
-        /***********************************************************************
-
-        ***********************************************************************/
-
-        static this ()
-        {
-                library = FunctionLoader.bind (icuuc, targets);
-        }
-
-        /***********************************************************************
-
-        ***********************************************************************/
-
-        static ~this ()
-        {
-                FunctionLoader.unbind (library);
-        }
+        mixin(genICUNative!("uc"
+                ,"Handle function (wchar start, wchar end)", "uset_open"
+                ,"void   function (Handle)", "uset_close"
+                ,"Handle function (wchar* pattern, uint patternLength, uint options, ref UErrorCode e)", "uset_openPatternOptions"                        
+                ,"uint   function (Handle, wchar* pattern, uint patternLength, uint options, ref UErrorCode e)", "uset_applyPattern"
+                ,"uint   function (Handle, wchar* result, uint resultCapacity, byte escapeUnprintable, ref UErrorCode e)", "uset_toPattern"
+                ,"void   function (Handle, wchar c)", "uset_add"
+                ,"void   function (Handle, Handle additionalSet)", "uset_addAll"
+                ,"void   function (Handle, wchar start, wchar end)", "uset_addRange"                        
+                ,"void   function (Handle, wchar* str, uint strLen)", "uset_addString"
+                ,"void   function (Handle, wchar c)", "uset_remove"
+                ,"void   function (Handle, wchar start, wchar end)", "uset_removeRange"
+                ,"void   function (Handle, wchar* str, uint strLen)", "uset_removeString"                       
+                ,"void   function (Handle)", "uset_complement"
+                ,"void   function (Handle)", "uset_clear"
+                ,"byte   function (Handle)", "uset_isEmpty"
+                ,"byte   function (Handle, wchar c)", "uset_contains"
+                ,"byte   function (Handle, wchar start, wchar end)", "uset_containsRange"
+                ,"byte   function (Handle, wchar* str, uint strLen)", "uset_containsString"
+                ,"uint   function (Handle)", "uset_size"
+        ));
 }
 
--- a/com.ibm.icu/src/com/ibm/icu/mangoicu/UString.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/com.ibm.icu/src/com/ibm/icu/mangoicu/UString.d	Sat Jul 09 15:50:20 2011 +0300
@@ -181,7 +181,7 @@
 
         ***********************************************************************/
 
-        this (CString16 content, bool mutable = true)
+        this (in wchar[] content, bool mutable = true)
         {
                 setTo (content, mutable);
         }
@@ -386,6 +386,18 @@
 
         /***********************************************************************
 
+                Append a single UTF32 unit to this UString
+
+        ***********************************************************************/
+
+        UString opCat (dchar chr)
+        {
+                dchar[1] chars = chr;
+                return opCat (chars);
+        }
+
+        /***********************************************************************
+
                 Append text to this UString
 
         ***********************************************************************/
@@ -403,7 +415,7 @@
 
         UString opCat (char[] chars)
         {
-                uint fmt (wchar* dst, uint len, inout UErrorCode e)
+                uint fmt (wchar* dst, uint len, ref UErrorCode e)
                 {
                         uint x;
 
@@ -417,6 +429,26 @@
 
         /***********************************************************************
 
+                Converts a sequence of UTF32 units to UChars (UTF-16)
+
+        ***********************************************************************/
+
+        UString opCat (dchar[] chars)
+        {
+                uint fmt (wchar* dst, uint len, ref UErrorCode e)
+                {
+                        uint x;
+
+                        u_strFromUTF32 (dst, len, &x, chars.ptr, chars.length, e);
+                        return x;
+                }
+
+                expand (chars.length);
+                return format (&fmt, "failed to append UTF dchar[]");
+        }
+
+        /***********************************************************************
+
                 Set a section of this UString to the specified character
 
         ***********************************************************************/
@@ -439,7 +471,7 @@
 
         ***********************************************************************/
 
-        UString setTo (CString16 chars, bool mutable = true)
+        UString setTo (in wchar[] chars, bool mutable = true)
         {
                 len = chars.length;
                 if ((this.mutable = mutable) == true)
@@ -621,9 +653,9 @@
 
         ***********************************************************************/
 
-        typedef uint delegate (wchar* dst, uint len, inout UErrorCode e) Formatter;
+        typedef uint delegate (wchar* dst, uint len, ref UErrorCode e) Formatter;
 
-        package final UString format (Formatter format, CString msg)
+        package final UString format (Formatter format, String msg)
         {
                 UErrorCode   e;
                 uint    length;
@@ -1101,9 +1133,9 @@
 
         ***********************************************************************/
 
-        final UString toLower (UString dst, inout ULocale locale)
+        final UString toLower (UString dst, ref ULocale locale)
         {
-                uint lower (wchar* dst, uint length, inout UErrorCode e)
+                uint lower (wchar* dst, uint length, ref UErrorCode e)
                 {
                         return u_strToLower (dst, length, content.ptr, len, ICU.toString(locale.name), e);
                 }
@@ -1141,9 +1173,9 @@
 
         ***********************************************************************/
 
-        final UString toUpper (UString dst, inout ULocale locale)
+        final UString toUpper (UString dst, ref ULocale locale)
         {
-                uint upper (wchar* dst, uint length, inout UErrorCode e)
+                uint upper (wchar* dst, uint length, ref UErrorCode e)
                 {
                         return u_strToUpper (dst, length, content.ptr, len, ICU.toString(locale.name), e);
                 }
@@ -1169,7 +1201,7 @@
 
         final UString toFolded (UString dst, CaseOption option = CaseOption.Default)
         {
-                uint fold (wchar* dst, uint length, inout UErrorCode e)
+                uint fold (wchar* dst, uint length, ref UErrorCode e)
                 {
                         return u_strFoldCase (dst, length, content.ptr, len, option, e);
                 }
@@ -1381,7 +1413,7 @@
 
         ***********************************************************************/
 
-        final private void pinIndex (inout uint x)
+        final private void pinIndex (ref uint x)
         {
                 if (x > len)
                     x = len;
@@ -1393,7 +1425,7 @@
 
         ***********************************************************************/
 
-        final private void pinIndices (inout uint start, inout uint length)
+        final private void pinIndices (ref uint start, ref uint length)
         {
                 if (start > len)
                     start = len;
@@ -1426,68 +1458,22 @@
 
         ***********************************************************************/
 
-        private static void* library;
-
-        /***********************************************************************
-
-        ***********************************************************************/
-
-        private static extern (C)
-        {
-                wchar* function (wchar*, uint, wchar*, uint) u_strFindFirst;
-                wchar* function (wchar*, uint, wchar*, uint) u_strFindLast;
-                wchar* function (wchar*, wchar, uint) u_memchr;
-                wchar* function (wchar*, wchar, uint) u_memrchr;
-                int    function (wchar*, uint, wchar*, uint, bool) u_strCompare;
-                int    function (wchar*, uint, wchar*, uint, uint, inout UErrorCode) u_strCaseCompare;
-                dchar  function (CharAt, uint*, uint, void*) u_unescapeAt;
-                uint   function (wchar*, uint) u_countChar32;
-                uint   function (wchar*, uint, wchar*, uint, char*, inout UErrorCode) u_strToUpper;
-                uint   function (wchar*, uint, wchar*, uint, char*, inout UErrorCode) u_strToLower;
-                uint   function (wchar*, uint, wchar*, uint, uint, inout UErrorCode) u_strFoldCase;
-                wchar* function (wchar*, uint, uint*, char*, uint, inout UErrorCode) u_strFromUTF8;
-                char*  function (char*, uint, uint*, wchar*, uint, inout UErrorCode) u_strToUTF8;
-        }
-
-        /***********************************************************************
-
-        ***********************************************************************/
-
-        static  FunctionLoader.Bind[] targets =
-                [
-                {cast(void**) &u_strFindFirst,      "u_strFindFirst"},
-                {cast(void**) &u_strFindLast,       "u_strFindLast"},
-                {cast(void**) &u_memchr,            "u_memchr"},
-                {cast(void**) &u_memrchr,           "u_memrchr"},
-                {cast(void**) &u_strCompare,        "u_strCompare"},
-                {cast(void**) &u_strCaseCompare,    "u_strCaseCompare"},
-                {cast(void**) &u_unescapeAt,        "u_unescapeAt"},
-                {cast(void**) &u_countChar32,       "u_countChar32"},
-                {cast(void**) &u_strToUpper,        "u_strToUpper"},
-                {cast(void**) &u_strToLower,        "u_strToLower"},
-                {cast(void**) &u_strFoldCase,       "u_strFoldCase"},
-                {cast(void**) &u_strFromUTF8,       "u_strFromUTF8"},
-                {cast(void**) &u_strToUTF8,         "u_strToUTF8"},
-                ];
-
-        /***********************************************************************
-
-        ***********************************************************************/
-
-        static this ()
-        {
-                library = FunctionLoader.bind (icuuc, targets);
-                //test ();
-        }
-
-        /***********************************************************************
-
-        ***********************************************************************/
-
-        static ~this ()
-        {
-                FunctionLoader.unbind (library);
-        }
+        mixin(genICUNative!("uc"
+                ,"wchar* function (wchar*, uint, wchar*, uint)", "u_strFindFirst"
+                ,"wchar* function (wchar*, uint, wchar*, uint)", "u_strFindLast"
+                ,"wchar* function (wchar*, wchar, uint)", "u_memchr"
+                ,"wchar* function (wchar*, wchar, uint)", "u_memrchr"
+                ,"int    function (wchar*, uint, wchar*, uint, bool)", "u_strCompare"
+                ,"int    function (wchar*, uint, wchar*, uint, uint, ref UErrorCode)", "u_strCaseCompare"
+                ,"dchar  function (CharAt, uint*, uint, void*)", "u_unescapeAt"
+                ,"uint   function (wchar*, uint)", "u_countChar32"
+                ,"uint   function (wchar*, uint, wchar*, uint, char*, ref UErrorCode)", "u_strToUpper"
+                ,"uint   function (wchar*, uint, wchar*, uint, char*, ref UErrorCode)", "u_strToLower"
+                ,"uint   function (wchar*, uint, wchar*, uint, uint, ref UErrorCode)", "u_strFoldCase"
+                ,"wchar* function (wchar*, uint, uint*, char*, uint, ref UErrorCode)", "u_strFromUTF8"
+                ,"wchar* function (wchar*, uint, uint*, dchar*, uint, ref UErrorCode)", "u_strFromUTF32"
+                ,"char*  function (char*, uint, uint*, wchar*, uint, ref UErrorCode)", "u_strToUTF8"
+        ));
 
         /***********************************************************************
 
@@ -1496,7 +1482,7 @@
         //private static void test()
         //{
         //        UString s = new UString (r"aaaqw \uabcd eaaa");
-        //        CString16 x = "dssfsdff";
+        //        const String16 x = "dssfsdff";
         //        s ~ x ~ x;
         //        wchar c = s[3];
         //        s[3] = 'Q';
--- a/com.ibm.icu/src/com/ibm/icu/mangoicu/UStringPrep.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/com.ibm.icu/src/com/ibm/icu/mangoicu/UStringPrep.d	Sat Jul 09 15:50:20 2011 +0300
@@ -187,7 +187,7 @@
 
         void prepare (UStringView src, UString dst, Options o = Options.Strict)
         {
-                uint fmt (wchar* p, uint len, inout UErrorCode e)
+                uint fmt (wchar* p, uint len, ref UErrorCode e)
                 {
                         return usprep_prepare (handle, src.get.ptr, src.len, p, len, o, null, e);
                 }
@@ -204,46 +204,10 @@
 
         ***********************************************************************/
 
-        private static void* library;
-
-        /***********************************************************************
-
-        ***********************************************************************/
-
-        private static extern (C) 
-        {
-                Handle  function (char*, char*, inout UErrorCode) usprep_open;
-                void    function (Handle) usprep_close;
-                uint    function (Handle, wchar*, uint, wchar*, uint, uint, void*, inout UErrorCode) usprep_prepare;
-        }
-
-        /***********************************************************************
-
-        ***********************************************************************/
-
-        static  FunctionLoader.Bind[] targets = 
-                [
-                {cast(void**) &usprep_open,             "usprep_open"}, 
-                {cast(void**) &usprep_close,            "usprep_close"},
-                {cast(void**) &usprep_prepare,          "usprep_prepare"},
-                ];
-
-        /***********************************************************************
-
-        ***********************************************************************/
-
-        static this ()
-        {
-                library = FunctionLoader.bind (icuuc, targets);
-        }
-
-        /***********************************************************************
-
-        ***********************************************************************/
-
-        static ~this ()
-        {
-                FunctionLoader.unbind (library);
-        }
+        mixin(genICUNative!("uc"
+                ,"Handle  function (char*, char*, ref UErrorCode)", "usprep_open"
+                ,"void    function (Handle)", "usprep_close"
+                ,"uint    function (Handle, wchar*, uint, wchar*, uint, uint, void*, ref UErrorCode)", "usprep_prepare"
+        ));
 }
 
--- a/com.ibm.icu/src/com/ibm/icu/mangoicu/UText.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/com.ibm.icu/src/com/ibm/icu/mangoicu/UText.d	Sat Jul 09 15:50:20 2011 +0300
@@ -149,101 +149,37 @@
 
         ***********************************************************************/
 
-        private static void* library;
-
-        /***********************************************************************
-
-        ***********************************************************************/
-    static extern(System){
-        UText * function(UText* ut) utext_close;
-        UText * function(UText* ut, char *s, long length, inout ICU.UErrorCode status) utext_openUTF8;
-//         UText * function(UText* ut, UChar *s, int64_t length, inout UErrorCode status) utext_openUChars;
-//         UText * function(UText* ut, U_NAMESPACE_QUALIFIER UnicodeString *s, inout UErrorCode status) utext_openUnicodeString;
-//         UText * function(UText* ut, U_NAMESPACE_QUALIFIER UnicodeString *s, inout UErrorCode status) utext_openConstUnicodeString;
-//         UText * function(UText* ut, U_NAMESPACE_QUALIFIER Replaceable *rep, inout UErrorCode status) utext_openReplaceable;
-//         UText * function(UText* ut, U_NAMESPACE_QUALIFIER CharacterIterator *ic, inout UErrorCode status) utext_openCharacterIterator;
-//         UText * function(UText* ut, UText *src, UBool deep, UBool readOnly, inout UErrorCode status) utext_clone;
-//         UBool function(const UText *a, const UText *b) utext_equals;
-//         int64_t function(UText* ut) utext_nativeLength;
-//         UBool function(UText* ut) utext_isLengthExpensive;
-//         UChar32 function(UText* ut, int64_t nativeIndex) utext_char32At;
-//         UChar32 function(UText* ut) utext_current32;
-//         UChar32 function(UText* ut) utext_next32;
-//         UChar32 function(UText* ut) utext_previous32;
-//         UChar32 function(UText* ut, int64_t nativeIndex) utext_next32From;
-//         UChar32 function(UText* ut, int64_t nativeIndex) utext_previous32From;
-//         int64_t function(UText* ut) utext_getNativeIndex;
-//         void function(UText* ut, int64_t nativeIndex) utext_setNativeIndex;
-//         UBool function(UText* ut, int delta) utext_moveIndex32;
-//         int64_t function(UText* ut) utext_getPreviousNativeIndex;
-//         int function(UText* ut, int64_t nativeStart, int64_t nativeLimit,
-//                 UChar *dest, int destCapacity,
-//                 inout UErrorCode status) utext_extract;
-//         UBool function(UText* ut) utext_isWritable;
-//         UBool function(UText* ut) utext_hasMetaData;
-//         int function(UText* ut,
-//                 int64_t nativeStart, int64_t nativeLimit,
-//                 UChar *replacementText, int replacementLength,
-//                 inout UErrorCode status) utext_replace;
-//         void function(UText* ut,
-//                 int64_t nativeStart, int64_t nativeLimit,
-//                 int64_t destIndex,
-//                 UBool move,
-//                 inout UErrorCode status) utext_copy;
-//         void function(UText* ut) utext_freeze;
-//         UText * function(UText* ut, int extraSpace, inout UErrorCode status) utext_setup;
-    }
-
-        /***********************************************************************
-
-        ***********************************************************************/
-        static  FunctionLoader.Bind[] targets = [
-            {cast(void**) &utext_close,                   "utext_close"},
-            {cast(void**) &utext_openUTF8,                "utext_openUTF8"},
-//         {cast(void**) &utext_openUChars,              "utext_openUChars"},
-//         {cast(void**) &utext_openUnicodeString,       "utext_openUnicodeString"},
-//         {cast(void**) &utext_openConstUnicodeString,  "utext_openConstUnicodeString"},
-//         {cast(void**) &utext_openReplaceable,         "utext_openReplaceable"},
-//         {cast(void**) &utext_openCharacterIterator,   "utext_openCharacterIterator"},
-//         {cast(void**) &utext_clone,                   "utext_clone"},
-//         {cast(void**) &utext_equals,                  "utext_equals"},
-//         {cast(void**) &utext_nativeLength,            "utext_nativeLength"},
-//         {cast(void**) &utext_isLengthExpensive,       "utext_isLengthExpensive"},
-//         {cast(void**) &utext_char32At,                "utext_char32At"},
-//         {cast(void**) &utext_current32,               "utext_current32"},
-//         {cast(void**) &utext_next32,                  "utext_next32"},
-//         {cast(void**) &utext_next32From,              "utext_next32From"},
-//         {cast(void**) &utext_previous32,              "utext_previous32"},
-//         {cast(void**) &utext_previous32From,          "utext_previous32From"},
-//         {cast(void**) &utext_setNativeIndex,          "utext_setNativeIndex"},
-//         {cast(void**) &utext_moveIndex32,             "utext_moveIndex32"},
-//         {cast(void**) &utext_getPreviousNativeIndex,  "utext_getPreviousNativeIndex"},
-//         {cast(void**) &utext_extract,                 "utext_extract"},
-//         {cast(void**) &utext_isWritable,              "utext_isWritable"},
-//         {cast(void**) &utext_hasMetaData,             "utext_hasMetaData"},
-//         {cast(void**) &utext_replace,                 "utext_replace"},
-//         {cast(void**) &utext_copy,                    "utext_copy"},
-//         {cast(void**) &utext_freeze,                  "utext_freeze"},
-//         {cast(void**) &utext_setup,                   "utext_setup"},
-        ];
-
-        /***********************************************************************
-
-        ***********************************************************************/
-
-        static this ()
-        {
-                library = FunctionLoader.bind (ICU.icuuc, targets);
-                //test ();
-        }
-
-        /***********************************************************************
-
-        ***********************************************************************/
-
-        static ~this ()
-        {
-                FunctionLoader.unbind (library);
-        }
-
+        /*extern(System)*/
+        mixin(genICUNative!("uc"
+            ,"UText * function(UText* ut)", "utext_close"
+            ,"UText * function(UText* ut, char *s, long length, ref ICU.UErrorCode status)", "utext_openUTF8"
+            /+
+            ,"UText * function(UText* ut, UChar *s, int64_t length, ref UErrorCode status)", "utext_openUChars"
+            ,"UText * function(UText* ut, U_NAMESPACE_QUALIFIER UnicodeString *s, ref UErrorCode status)", "utext_openUnicodeString"
+            ,"UText * function(UText* ut, U_NAMESPACE_QUALIFIER UnicodeString *s, ref UErrorCode status)", "utext_openConstUnicodeString"
+            ,"UText * function(UText* ut, U_NAMESPACE_QUALIFIER Replaceable *rep, ref UErrorCode status)", "utext_openReplaceable"
+            ,"UText * function(UText* ut, U_NAMESPACE_QUALIFIER CharacterIterator *ic, ref UErrorCode status)", "utext_openCharacterIterator"
+            ,"UText * function(UText* ut, UText *src, UBool deep, UBool readOnly, ref UErrorCode status)", "utext_clone"
+            ,"UBool function(const UText *a, const UText *b)", "utext_equals"
+            ,"int64_t function(UText* ut)", "utext_nativeLength"
+            ,"UBool function(UText* ut)", "utext_isLengthExpensive"
+            ,"UChar32 function(UText* ut, int64_t nativeIndex)", "utext_char32At"
+            ,"UChar32 function(UText* ut)", "utext_current32"
+            ,"UChar32 function(UText* ut)", "utext_next32"
+            ,"UChar32 function(UText* ut)", "utext_previous32"
+            ,"UChar32 function(UText* ut, int64_t nativeIndex)", "utext_next32From"
+            ,"UChar32 function(UText* ut, int64_t nativeIndex)", "utext_previous32From"
+            ,"int64_t function(UText* ut)", "utext_getNativeIndex"
+            ,"void function(UText* ut, int64_t nativeIndex)", "utext_setNativeIndex"
+            ,"UBool function(UText* ut, int delta)", "utext_moveIndex32"
+            ,"int64_t function(UText* ut)", "utext_getPreviousNativeIndex"
+            ,"int function(UText* ut, int64_t nativeStart, int64_t nativeLimit, UChar *dest, int destCapacity, ref UErrorCode status)", "utext_extract"
+            ,"UBool function(UText* ut)", "utext_isWritable"
+            ,"UBool function(UText* ut)", "utext_hasMetaData"
+            ,"int function(UText* ut, int64_t nativeStart, int64_t nativeLimit, UChar *replacementText, int replacementLength, ref UErrorCode status)", "utext_replace"
+            ,"void function(UText* ut, int64_t nativeStart, int64_t nativeLimit, int64_t destIndex, UBool move, ref UErrorCode status)", "utext_copy"
+            ,"void function(UText* ut)", "utext_freeze"
+            ,"UText * function(UText* ut, int extraSpace, ref UErrorCode status)", "utext_setup"
+            +/
+        ));
 }
--- a/com.ibm.icu/src/com/ibm/icu/mangoicu/UTimeZone.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/com.ibm.icu/src/com/ibm/icu/mangoicu/UTimeZone.d	Sat Jul 09 15:50:20 2011 +0300
@@ -99,7 +99,7 @@
 
 struct UTimeZone 
 {
-        public CString16  name;
+        public String16  name;
 
         public static UTimeZone Default =       {null};
         public static UTimeZone Gmt =           {"Etc/GMT"};
@@ -142,16 +142,16 @@
 
         ***********************************************************************/
 
-        static void getDefault (inout UTimeZone zone)
+        static void getDefault (ref UTimeZone zone)
         {       
-                uint format (wchar* dst, uint length, inout ICU.UErrorCode e)
+                uint format (wchar* dst, uint length, ref ICU.UErrorCode e)
                 {
                         return ucal_getDefaultTimeZone (dst, length, e);
                 }
 
                 UString s = new UString(64);
                 s.format (&format, "failed to get default time zone");
-                zone.name = s.get();
+                zone.name = cast(String16) s.get();
         }
 
         /***********************************************************************
@@ -160,7 +160,7 @@
 
         ***********************************************************************/
 
-        static void setDefault (inout UTimeZone zone)
+        static void setDefault (ref UTimeZone zone)
         {       
                 ICU.UErrorCode e;
 
@@ -177,7 +177,7 @@
 
         ***********************************************************************/
 
-        static uint getDSTSavings (inout UTimeZone zone)
+        static uint getDSTSavings (ref UTimeZone zone)
         {       
                 ICU.UErrorCode e;
 
@@ -193,7 +193,7 @@
 
         **********************************************************************/
 
-        static int opApply (int delegate(inout wchar[] element) dg)
+        static int opApply (int delegate(ref wchar[] element) dg)
         {
                 ICU.UErrorCode       e;
                 wchar[]         name;
@@ -218,47 +218,10 @@
 
         ***********************************************************************/
 
-        private static void* library;
-
-        /***********************************************************************
-
-        ***********************************************************************/
-
-        private static extern (C) 
-        {
-                void* function (inout ICU.UErrorCode) ucal_openTimeZones;
-                uint  function (wchar*, uint, inout ICU.UErrorCode) ucal_getDefaultTimeZone;
-                void  function (wchar*, inout ICU.UErrorCode) ucal_setDefaultTimeZone;
-                uint  function (wchar*, inout ICU.UErrorCode) ucal_getDSTSavings;
-        }
-
-        /***********************************************************************
-
-        ***********************************************************************/
-
-        static  FunctionLoader.Bind[] targets = 
-                [
-                {cast(void**) &ucal_openTimeZones,      "ucal_openTimeZones"}, 
-                {cast(void**) &ucal_getDefaultTimeZone, "ucal_getDefaultTimeZone"}, 
-                {cast(void**) &ucal_setDefaultTimeZone, "ucal_setDefaultTimeZone"}, 
-                {cast(void**) &ucal_getDSTSavings,      "ucal_getDSTSavings"}, 
-                ];
-
-        /***********************************************************************
-
-        ***********************************************************************/
-
-        static this ()
-        {
-                library = FunctionLoader.bind (ICU.icuin, targets);
-        }
-
-        /***********************************************************************
-
-        ***********************************************************************/
-
-        static ~this ()
-        {
-                FunctionLoader.unbind (library);
-        }
+        mixin(/*ICU.*/genICUNative!("in"
+                ,"void* function (ref ICU.UErrorCode)", "ucal_openTimeZones"
+                ,"uint  function (wchar*, uint, ref ICU.UErrorCode)", "ucal_getDefaultTimeZone"
+                ,"void  function (wchar*, ref ICU.UErrorCode)", "ucal_setDefaultTimeZone"
+                ,"uint  function (wchar*, ref ICU.UErrorCode)", "ucal_getDSTSavings"
+        ));
 }
--- a/com.ibm.icu/src/com/ibm/icu/mangoicu/UTransform.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/com.ibm.icu/src/com/ibm/icu/mangoicu/UTransform.d	Sat Jul 09 15:50:20 2011 +0300
@@ -190,50 +190,12 @@
 
         ***********************************************************************/
 
-        private static void* library;
-
-        /***********************************************************************
-
-        ***********************************************************************/
-
-        private static extern (C) 
-        {
-                Handle  function (wchar*, uint, uint, wchar*, uint, void*, inout UErrorCode) utrans_openU;
-                void    function (Handle) utrans_close;
-                wchar*  function (Handle, inout uint) utrans_getUnicodeID;
-                void    function (Handle, wchar*, uint, inout UErrorCode) utrans_setFilter;
-                void    function (Handle, wchar*, uint*, uint, uint, uint*, inout UErrorCode) utrans_transUChars;
-        }
-
-        /***********************************************************************
-
-        ***********************************************************************/
-
-        static  FunctionLoader.Bind[] targets = 
-                [
-                {cast(void**) &utrans_openU,            "utrans_openU"}, 
-                {cast(void**) &utrans_close,            "utrans_close"},
-                {cast(void**) &utrans_getUnicodeID,     "utrans_getUnicodeID"},
-                {cast(void**) &utrans_setFilter,        "utrans_setFilter"},
-                {cast(void**) &utrans_transUChars,      "utrans_transUChars"},
-                ];
-
-        /***********************************************************************
-
-        ***********************************************************************/
-
-        static this ()
-        {
-                library = FunctionLoader.bind (icuin, targets);
-        }
-
-        /***********************************************************************
-
-        ***********************************************************************/
-
-        static ~this ()
-        {
-                FunctionLoader.unbind (library);
-        }
+        mixin(genICUNative!("in"
+                ,"Handle  function (wchar*, uint, uint, wchar*, uint, void*, ref UErrorCode)", "utrans_openU"
+                ,"void    function (Handle)", "utrans_close"
+                ,"wchar*  function (Handle, ref uint)", "utrans_getUnicodeID"
+                ,"void    function (Handle, wchar*, uint, ref UErrorCode)", "utrans_setFilter"
+                ,"void    function (Handle, wchar*, uint*, uint, uint, uint*, ref UErrorCode)", "utrans_transUChars"
+        ));
 }
 
--- a/com.ibm.icu/src/com/ibm/icu/text/BreakIterator.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/com.ibm.icu/src/com/ibm/icu/text/BreakIterator.d	Sat Jul 09 15:50:20 2011 +0300
@@ -2,7 +2,7 @@
 module com.ibm.icu.text.BreakIterator;
 
 import com.ibm.icu.mangoicu.UBreakIterator;
-import tango.core.Thread;
+version(Tango) import tango.core.Thread;
 
 import java.lang.all;
 import java.text.CharacterIterator;
@@ -13,24 +13,35 @@
     public static const int Done = UBreakIterator.DONE;
 
     private UBreakIterator it;
-    private static tango.core.Thread.ThreadLocal!(BreakIterator) instLine;
-    private static tango.core.Thread.ThreadLocal!(BreakIterator) instWord;
+    version(Tango){
+        private static tango.core.Thread.ThreadLocal!(BreakIterator) instLine, instWord;
+    } else { // Phobos
+        private static BreakIterator instLine, instWord; //in tls
+    }
 
     private this( UBreakIterator it ){
         this.it = it;
     }
     public static BreakIterator getLineInstance() {
-        auto res = instLine.val();
-        if( res is null ){
-            res = new BreakIterator(
-                UBreakIterator.openLineIterator( ULocale.Default ));
-            instLine.val( res );
+        version(Tango){
+            auto res = instLine.val();
+            if( res is null ){
+                res = new BreakIterator(
+                    UBreakIterator.openLineIterator( ULocale.Default ));
+                instLine.val( res );
+            }
+            return res;
+        } else { // Phobos
+            if( instLine is null ){
+                instLine = new BreakIterator(
+                    UBreakIterator.openLineIterator( ULocale.Default ));
+            }
+            return instLine;
         }
-        return res;
     }
 
     public void setText(String line) {
-        it.setText(line);
+        it.setText(Unqual(line));
     }
 
     public int following(int currOffset) {
@@ -42,13 +53,21 @@
     }
 
     public static BreakIterator getWordInstance() {
-        auto res = instWord.val();
-        if( res is null ){
-            res = new BreakIterator(
-                UBreakIterator.openWordIterator( ULocale.Default ));
-            instWord.val( res );
+        version(Tango){
+            auto res = instWord.val();
+            if( res is null ){
+                res = new BreakIterator(
+                    UBreakIterator.openWordIterator( ULocale.Default ));
+                instWord.val( res );
+            }
+            return res;
+        } else { // Phobos
+            if( instWord is null ){
+                instWord = new BreakIterator(
+                    UBreakIterator.openLineIterator( ULocale.Default ));
+            }
+            return instWord;
         }
-        return res;
     }
 
     public int preceding(int position) {
--- a/com.ibm.icu/src/com/ibm/icu/text/Collator.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/com.ibm.icu/src/com/ibm/icu/text/Collator.d	Sat Jul 09 15:50:20 2011 +0300
@@ -3,7 +3,7 @@
 import com.ibm.icu.text.CollationKey;
 
 import java.lang.all;
-//import java.util.Comparator;
+import java.util.Comparator;
 //import java.util.Locale;
 
 public class Collator : Comparator {
--- a/com.ibm.icu/src/com/ibm/icu/text/MessageFormat.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/com.ibm.icu/src/com/ibm/icu/text/MessageFormat.d	Sat Jul 09 15:50:20 2011 +0300
@@ -10,7 +10,7 @@
     private UMessageFormat frm;
 
     public this(String pattern ) {
-        frm = new UMessageFormat( pattern.toWCharArray() );
+        frm = new UMessageFormat( Unqual(pattern.toWCharArray()) );
     }
 
     public static String format(String format, Object[] args) {
--- a/org.eclipse.draw2d/src/org/eclipse/draw2d/geometry/Geometry.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.draw2d/src/org/eclipse/draw2d/geometry/Geometry.d	Sat Jul 09 15:50:20 2011 +0300
@@ -65,7 +65,7 @@
 private static int productSign(long x, long y) {
     if (x is 0 || y is 0) {
         return 0;
-    } else if (x < 0 ^ y < 0) {
+    } else if ((x < 0) ^ (y < 0)) {
         return -1;
     }
     return 1;
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/DefaultDocumentAdapter.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/DefaultDocumentAdapter.d	Sat Jul 09 15:50:20 2011 +0300
@@ -579,7 +579,7 @@
         if( offset >= fDocument.getLength() ){
             return offset;
         }
-        while( fDocument.getChar(offset) & 0xC0 is 0x80 && offset > 0 ){
+        while( !isUTF8sequenceStart(fDocument.getChar(offset)) && offset > 0 ){
             offset--;
         }
         return offset;
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/accessibility/ACC.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/accessibility/ACC.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,8 +12,6 @@
  *******************************************************************************/
 module org.eclipse.swt.accessibility.ACC;
 
-import java.lang.all;
-
 
 /**
  * Class ACC contains all the constants used in defining an
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/accessibility/AccessibleAdapter.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/accessibility/AccessibleAdapter.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,8 +12,6 @@
  *******************************************************************************/
 module org.eclipse.swt.accessibility.AccessibleAdapter;
 
-import java.lang.all;
-
 import org.eclipse.swt.accessibility.AccessibleListener;
 import org.eclipse.swt.accessibility.AccessibleEvent;
 
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/accessibility/AccessibleControlAdapter.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/accessibility/AccessibleControlAdapter.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,8 +12,6 @@
  *******************************************************************************/
 module org.eclipse.swt.accessibility.AccessibleControlAdapter;
 
-import java.lang.all;
-
 import org.eclipse.swt.accessibility.AccessibleControlListener;
 import org.eclipse.swt.accessibility.AccessibleControlEvent;
 
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/accessibility/AccessibleControlEvent.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/accessibility/AccessibleControlEvent.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,11 +12,10 @@
  *******************************************************************************/
 module org.eclipse.swt.accessibility.AccessibleControlEvent;
 
-import java.lang.all;
-
 import org.eclipse.swt.accessibility.Accessible;
 
 import org.eclipse.swt.internal.SWTEventObject;
+import java.lang.all;
 
 /**
  * Instances of this class are sent as a result of
@@ -44,7 +43,7 @@
     public String result;           // OUT
     public Object children[];       // [OUT]
 
-    //static const long serialVersionUID = 3257281444169529141L;
+    //static final long serialVersionUID = 3257281444169529141L;
 
 /**
  * Constructs a new instance of this class.
@@ -61,8 +60,8 @@
  *
  * @return a string representation of the event
  */
-public override String toString () {
-    return Format( "AccessibleControlEvent {childID={} accessible={} x={} y={} width={} heigth={} detail={} result={}",
+public String toString () {
+    return Format( "AccessibleControlEvent {{childID={} accessible={} x={} y={} width={} heigth={} detail={} result={}}",
         childID, accessible, x, y, width, height, detail, result);
 }
 }
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/accessibility/AccessibleControlListener.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/accessibility/AccessibleControlListener.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,8 +12,6 @@
  *******************************************************************************/
 module org.eclipse.swt.accessibility.AccessibleControlListener;
 
-import java.lang.all;
-
 import org.eclipse.swt.accessibility.AccessibleControlEvent;
 import org.eclipse.swt.internal.SWTEventListener;
 
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/accessibility/AccessibleEvent.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/accessibility/AccessibleEvent.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,10 +12,9 @@
  *******************************************************************************/
 module org.eclipse.swt.accessibility.AccessibleEvent;
 
-import java.lang.all;
-
 
 import org.eclipse.swt.internal.SWTEventObject;
+import java.lang.all;
 
 /**
  * Instances of this class are sent as a result of
@@ -49,7 +48,7 @@
      */
     public String result;
 
-    //static const long serialVersionUID = 3257567304224026934L;
+    //static final long serialVersionUID = 3257567304224026934L;
 
 /**
  * Constructs a new instance of this class.
@@ -66,7 +65,7 @@
  *
  * @return a string representation of the event
  */
-public String toString () {
-    return Format( "AccessibleEvent {childID={} result={}}", childID, result );
+override public String toString () {
+    return Format( "AccessibleEvent {{childID={} result={}}", childID, result );
 }
 }
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/accessibility/AccessibleListener.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/accessibility/AccessibleListener.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,8 +12,6 @@
  *******************************************************************************/
 module org.eclipse.swt.accessibility.AccessibleListener;
 
-import java.lang.all;
-
 
 import org.eclipse.swt.internal.SWTEventListener;
 import org.eclipse.swt.accessibility.AccessibleEvent;
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/accessibility/AccessibleTextAdapter.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/accessibility/AccessibleTextAdapter.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,8 +12,6 @@
  *******************************************************************************/
 module org.eclipse.swt.accessibility.AccessibleTextAdapter;
 
-import java.lang.all;
-
 import org.eclipse.swt.accessibility.AccessibleTextEvent;
 import org.eclipse.swt.accessibility.AccessibleTextListener;
 
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/accessibility/AccessibleTextEvent.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/accessibility/AccessibleTextEvent.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,10 +12,9 @@
  *******************************************************************************/
 module org.eclipse.swt.accessibility.AccessibleTextEvent;
 
-import java.lang.all;
-
 
 import org.eclipse.swt.internal.SWTEventObject;
+import java.lang.all;
 
 /**
  * Instances of this class are sent as a result of
@@ -38,7 +37,7 @@
     public int childID;             // IN
     public int offset, length;      // OUT
 
-    //static const long serialVersionUID = 3977019530868308275L;
+    //static final long serialVersionUID = 3977019530868308275L;
 
 /**
  * Constructs a new instance of this class.
@@ -55,7 +54,7 @@
  *
  * @return a string representation of the event
  */
-public override String toString () {
+override public String toString () {
     return Format( "AccessibleTextEvent {{childID={} offset={} length={}}",
         childID,
         offset,
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/accessibility/AccessibleTextListener.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/accessibility/AccessibleTextListener.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,8 +12,6 @@
  *******************************************************************************/
 module org.eclipse.swt.accessibility.AccessibleTextListener;
 
-import java.lang.all;
-
 import org.eclipse.swt.accessibility.AccessibleTextEvent;
 
 import org.eclipse.swt.internal.SWTEventListener;
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/browser/AppFileLocProvider.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/browser/AppFileLocProvider.d	Sat Jul 09 15:50:20 2011 +0300
@@ -13,8 +13,9 @@
 module org.eclipse.swt.browser.AppFileLocProvider;
 
 version(Tango){
-import tango.sys.Environment;
+    import tango.sys.Environment;
 } else { // Phobos
+    import std.process: Environment = environment;
 }
 
 import java.lang.all;
@@ -124,12 +125,7 @@
         if (pluginDirs is null) {
             int index = 0;
             /* set the first value(s) to the MOZ_PLUGIN_PATH environment variable value if it's defined */
-            version(Tango){
-                String value = Environment.get (XPCOM.MOZILLA_PLUGIN_PATH);
-            } else { // Phobos
-                implMissing(__FILE__, __LINE__);
-                String value;
-            }
+            String value = Environment.get (XPCOM.MOZILLA_PLUGIN_PATH);
             if (value !is null) {
                 if (value.length > 0) {
                     String separator = System.getProperty ("path.separator"); // $NON-NLS-1$
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/browser/HelperAppLauncherDialog.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/browser/HelperAppLauncherDialog.d	Sat Jul 09 15:50:20 2011 +0300
@@ -14,11 +14,6 @@
 
 import java.lang.all;
 
-version(Tango){
-import Utf = tango.text.convert.Utf;
-} else { // Phobos
-}
-
 import org.eclipse.swt.SWT;
 
 import XPCOM = org.eclipse.swt.internal.mozilla.XPCOM;
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/browser/HelperAppLauncherDialog_1_9.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/browser/HelperAppLauncherDialog_1_9.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,10 +12,6 @@
  *******************************************************************************/
 module org.eclipse.swt.browser.HelperAppLauncherDialog_1_9;
 
-version(Tango){
-import tango.text.convert.Utf;
-} else { // Phobos
-}
 import java.lang.all;
 
 import org.eclipse.swt.SWT;
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/browser/LocationEvent.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/browser/LocationEvent.d	Sat Jul 09 15:50:20 2011 +0300
@@ -56,7 +56,7 @@
  * @return a string representation of the event
  */
 public override String toString() {
-    return Format( "{} {location = {}, top = {}, doit = {}}", 
-        super.toString[1 .. $-2], location, top, doit );  
+    return Format( "{} location = {}, top = {}, doit = {}}", 
+        super.toString()[0 .. $-1], location, top, doit );  
 }
 }
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/browser/Mozilla.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/browser/Mozilla.d	Sat Jul 09 15:50:20 2011 +0300
@@ -16,10 +16,11 @@
 
 
 version(Tango){
-import tango.text.locale.Core;
-import tango.sys.Environment;
-import tango.stdc.string;
+    import tango.text.locale.Core;
+    import tango.sys.Environment;
+    import tango.stdc.string;
 } else { // Phobos
+    import std.process: Environment = environment;
 }
 
 //import org.eclipse.swt.internal.c.gtk;
@@ -318,13 +319,8 @@
                         if (Device.DEBUG) getDwtLogger().error (__FILE__, __LINE__, "cannot use detected XULRunner: {}", mozillaPath); //$NON-NLS-1$
                         
                         /* attempt to XPCOMGlueStartup the GRE pointed at by MOZILLA_FIVE_HOME */
-                        version(Tango){
-                            auto ptr = Environment.get(XPCOM.MOZILLA_FIVE_HOME);
-                        } else { // Phobos
-                            implMissing(__FILE__, __LINE__);
-                            String ptr;
-                        }
-
+                        auto ptr = Environment.get(XPCOM.MOZILLA_FIVE_HOME);
+                        
                         if (ptr is null) {
                             IsXULRunner = false;
                         } else {
@@ -374,12 +370,7 @@
             }
 
             /* attempt to use the GRE pointed at by MOZILLA_FIVE_HOME */
-            version(Tango){
-                auto mozFiveHome = Environment.get(XPCOM.MOZILLA_FIVE_HOME);
-            } else { // Phobos
-                implMissing(__FILE__, __LINE__);
-                String mozFiveHome;
-            }
+            auto mozFiveHome = Environment.get(XPCOM.MOZILLA_FIVE_HOME);
             if (mozFiveHome !is null) {
                 mozillaPath = mozFiveHome;
             } else {
@@ -652,7 +643,7 @@
             String language = Culture.current.twoLetterLanguageName ();
             String country = Region.current.twoLetterRegionName ();
         } else { // Phobos
-            implMissing(__FILE__, __LINE__);
+            implMissingInPhobos();
             String language = "en";
             String country = "us";
         }
@@ -1461,7 +1452,7 @@
 }
 
 extern(D)
-static String error (int code, CString file, int line) {
+static void error (int code, String file, int line) {
     getDwtLogger().info( __FILE__, __LINE__,  "File: {}  Line: {}", file, line);
     throw new SWTError ("XPCOM error " ~ Integer.toString(code)); //$NON-NLS-1$
 }
@@ -2701,7 +2692,7 @@
 
                 //nsICategoryManager categoryManager = new nsICategoryManager (result[0]);
                 //result[0] = 0;
-                CCharPtr categoryBytes = "Gecko-Content-Viewers"; //$NON-NLS-1$
+                auto categoryBytes = "Gecko-Content-Viewers".ptr; //$NON-NLS-1$
                 char* result;
                 rc = categoryManager.GetCategoryEntry (categoryBytes, aContentType, &result);
                 categoryManager.Release ();
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/browser/ProgressEvent.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/browser/ProgressEvent.d	Sat Jul 09 15:50:20 2011 +0300
@@ -45,7 +45,7 @@
  * @return a string representation of the event
  */
 public override String toString() {
-    return Format( "{} {current = {}, total = {}}", 
-        super.toString[1 .. $-2], current, total );  
+    return Format( "{} current = {}, total = {}}", 
+        super.toString()[0 .. $-1], current, total );  
 }
 }
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/browser/StatusTextEvent.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/browser/StatusTextEvent.d	Sat Jul 09 15:50:20 2011 +0300
@@ -43,8 +43,8 @@
  * @return a string representation of the event
  */
 public override String toString() {
-    return Format( "{} {text = {}}", 
-        super.toString[1 .. $-2], text );  
+    return Format( "{} text = {}}", 
+        super.toString()[0 .. $-1], text );  
 }
 
 }
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/browser/TitleEvent.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/browser/TitleEvent.d	Sat Jul 09 15:50:20 2011 +0300
@@ -42,7 +42,7 @@
  * @return a string representation of the event
  */
 public override String toString() {
-    return Format( "{} {title = {}}", 
-        super.toString[1 .. $-2], title );  
+    return Format( "{} title = {}}", 
+        super.toString[0 .. $-1], title );  
 }
 }
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/browser/WindowEvent.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/browser/WindowEvent.d	Sat Jul 09 15:50:20 2011 +0300
@@ -202,8 +202,8 @@
  */
 
 public String toString() {
-    return Format( "{} {required = {}, browser = {}, location = {}, size = {}, addressbar = {}, menubar = {}, statusbar = {}, toolbar = {}}", 
-        super.toString[1 .. $-2], 
+    return Format( "{} required={} browser={} location={} size={} addressbar={} menubar={} statusbar={} toolbar={}}", 
+        super.toString[0 .. $-1], 
         required, browser, 
         location, size, addressBar, 
         menuBar, statusBar, toolBar ); 
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/AnimatedProgress.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/AnimatedProgress.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,8 +12,6 @@
  *******************************************************************************/
 module org.eclipse.swt.custom.AnimatedProgress;
 
-import java.lang.all;
-
 
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.SWTException;
@@ -30,6 +28,7 @@
 import org.eclipse.swt.widgets.Canvas;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Display;
+import java.lang.Runnable;
 
 /**
  * A control for showing progress feedback for a long running operation.
@@ -121,11 +120,11 @@
  * </ul>
  */
 public void clear(){
-	synchronized {
-	    checkWidget();
-	    if (active) stop();
-	    showStripes = false;
-	    redraw();
+    synchronized {
+        checkWidget();
+        if (active) stop();
+        showStripes = false;
+        redraw();
     }
 }
 public override Point computeSize(int wHint, int hHint, bool changed) {
@@ -212,41 +211,41 @@
 * </ul>
 */
 public void start() {
-	synchronized {
-	    checkWidget();
-	    if (active) return;
-	
-	    active = true;
-	    showStripes = true;
-	
-	    Display display = getDisplay();
-	    Runnable [] timer = new Runnable [1];
-	
-	    timer [0] = new class( display, timer ) Runnable {
-	        Display disp;
-	        Runnable [] runs;
-	        this( Display disp, Runnable[] runs ){
-	            this.disp = disp;
-	            this.runs = runs;
-	        }
-	        public void run () {
-	            if (!active) return;
-	            GC gc = new GC(this.outer);
-	            paintStripes(gc);
-	            gc.dispose();
-	            disp.timerExec (SLEEP, runs [0]);
-	        }
-	    };
-	    display.timerExec (SLEEP, timer [0]);
+    synchronized {
+        checkWidget();
+        if (active) return;
+
+        active = true;
+        showStripes = true;
+
+        Display display = getDisplay();
+        Runnable [] timer = new Runnable [1];
+
+        timer [0] = new class( display, timer ) Runnable {
+            Display disp;
+            Runnable [] runs;
+            this( Display disp, Runnable[] runs ){
+                this.disp = disp;
+                this.runs = runs;
+            }
+            public void run () {
+                if (!active) return;
+                GC gc = new GC(this.outer);
+                paintStripes(gc);
+                gc.dispose();
+                disp.timerExec (SLEEP, runs [0]);
+            }
+        };
+        display.timerExec (SLEEP, timer [0]);
     }
 }
 /**
 * Stop the animation.   Freeze the presentation at its current appearance.
 */
 public void stop() {
-	synchronized {
-    	//checkWidget();
-    	active = false;
-	}
+    synchronized {
+        //checkWidget();
+        active = false;
+    }
 }
 }
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/BidiSegmentListener.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/BidiSegmentListener.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,8 +12,6 @@
  *******************************************************************************/
 module org.eclipse.swt.custom.BidiSegmentListener;
 
-import java.lang.all;
-
 import org.eclipse.swt.internal.SWTEventListener;
 import org.eclipse.swt.custom.BidiSegmentEvent;
 
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/CBanner.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/CBanner.d	Sat Jul 09 15:50:20 2011 +0300
@@ -14,8 +14,6 @@
 
 import java.lang.all;
 
-
-
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.SWTException;
 import org.eclipse.swt.graphics.Color;
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/CBannerLayout.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/CBannerLayout.d	Sat Jul 09 15:50:20 2011 +0300
@@ -14,7 +14,6 @@
 
 import java.lang.all;
 
-
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.graphics.Point;
 import org.eclipse.swt.graphics.Rectangle;
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/CCombo.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/CCombo.d	Sat Jul 09 15:50:20 2011 +0300
@@ -48,11 +48,7 @@
 import org.eclipse.swt.widgets.Widget;
 
 import java.lang.all;
-version(Tango){
-static import tango.text.convert.Utf;
-static import tango.text.Unicode;
-} else { // Phobos
-}
+import java.nonstandard.UnsafeUtf;
 
 /**
  * The CCombo class represents a selectable user interface object
@@ -588,7 +584,7 @@
     do {
         while (index < length && str[index] !is '&') index++;
         if (++index >= length) return '\0';
-        if (str[index] !is '&') return Character.toLowerCase (str.dcharAt (index));
+        if (str[index] !is '&') return Character.toLowerCase( str.dcharAt(index) );
         index++;
     } while (index < length);
     return '\0';
@@ -1163,7 +1159,7 @@
              * In Windows, hiding the popup during the deactivate causes the deactivate
              * to be called twice and the selection event to be disappear.
              */
-            if (!"carbon".equals(SWT.getPlatform())) {
+            if ("carbon" != (SWT.getPlatform())) {
                 Point point = arrow.toControl(getDisplay().getCursorLocation());
                 Point size = arrow.getSize();
                 Rectangle rect = new Rectangle(0, 0, size.x, size.y);
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/CLabel.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/CLabel.d	Sat Jul 09 15:50:20 2011 +0300
@@ -38,13 +38,9 @@
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Control;
 import org.eclipse.swt.widgets.Display;
+
 import java.lang.all;
-
-version(Tango){
-static import tango.text.Unicode;
-static import tango.text.convert.Utf;
-} else { // Phobos
-}
+import java.nonstandard.UnsafeUtf;
 
 /**
  * A Label which supports aligned text and/or an image and different border styles.
@@ -179,7 +175,7 @@
 //protected void checkSubclass () {
 //  String name = getClass().getName ();
 //  String validName = CLabel.class.getName();
-//  if (!validName.equals(name)) {
+//  if (validName != (name)) {
 //      SWT.error (SWT.ERROR_INVALID_SUBCLASS);
 //  }
 //}
@@ -216,14 +212,14 @@
  * an '&' character in the given string. If there are no '&'
  * characters in the given string, return '\0'.
  */
-dchar _findMnemonic (String string) {
-    if (string is null) return '\0';
+dchar _findMnemonic (String str) {
+    if (str is null) return '\0';
     int index = 0;
-    int length = string.length;
+    int length = str.length;
     do {
-        while (index < length && string[index] !is '&') index++;
+        while (index < length && str[index] !is '&') index++;
         if (++index >= length) return '\0';
-        if (string[index] !is '&') return Character.toLowerCase (string.dcharAt (index));
+        if (str[index] !is '&') return Character.toLowerCase( str.dcharAt(index) );
         index++;
     } while (index < length);
     return '\0';
@@ -310,9 +306,7 @@
         public void getKeyboardShortcut(AccessibleEvent e) {
             dchar mnemonic = _findMnemonic(this.outer.text);
             if (mnemonic !is '\0') {
-                dchar[1] d;
-                d[0] = mnemonic;
-                e.result = Format("Alt+{}", d); //$NON-NLS-1$
+                e.result = "Alt+" ~ dcharToString(mnemonic); //$NON-NLS-1$
             }
         }
     });
@@ -828,8 +822,8 @@
     String[] lines = new String[1];
     int start = 0, pos;
     do {
-        pos = text.indexOf( '\n', start);
-        if (pos is -1 ) {
+        pos = text.indexOf('\n', start);
+        if (pos is -1) {
             lines[lines.length - 1] = text[start .. $ ];
         } else {
             bool crlf = (pos > 0) && (text[ pos - 1 ] is '\r');
@@ -839,7 +833,7 @@
             System.arraycopy(lines, 0, newLines, 0, lines.length);
             lines = newLines;
         }
-    } while (pos !is text.length);
+    } while (pos !is -1);
     return lines;
 }
 }
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/CLayoutData.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/CLayoutData.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,8 +12,6 @@
  *******************************************************************************/
 module org.eclipse.swt.custom.CLayoutData;
 
-import java.lang.all;
-
 
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.graphics.Point;
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/CTabFolder.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/CTabFolder.d	Sat Jul 09 15:50:20 2011 +0300
@@ -48,12 +48,7 @@
 import org.eclipse.swt.custom.CTabFolderEvent;
 
 import java.lang.all;
-version(Tango){
-    import tango.util.Convert;
-    static import tango.text.convert.Utf;
-} else { // Phobos
-    import std.conv;
-}
+import java.nonstandard.UnsafeUtf;
 
 /**
  *
@@ -890,7 +885,7 @@
         }
         count = items.length - showCount;
     }
-    String chevronString = count > 99 ? "99+" : to!(String)(count); //$NON-NLS-1$
+    String chevronString = count > 99 ? "99+" : String_valueOf(count); //$NON-NLS-1$
     switch (chevronImageState) {
         case NORMAL: {
             Color chevronBorder = single ? getSelectionForeground() : getForeground();
@@ -1109,7 +1104,7 @@
 
     // Draw Tab Header
     if (onBottom) {
-        int[] left, right;
+        TryConst!(int)[] left, right;
         if ((getStyle() & SWT.BORDER) !is 0) {
             left = simple ? SIMPLE_BOTTOM_LEFT_CORNER : BOTTOM_LEFT_CORNER;
             right = simple ? SIMPLE_BOTTOM_RIGHT_CORNER : BOTTOM_RIGHT_CORNER;
@@ -1134,7 +1129,7 @@
         shape[index++] = x+width;
         shape[index++] = y-highlight_header;
     } else {
-        int[] left, right;
+        TryConst!(int)[] left, right;
         if ((getStyle() & SWT.BORDER) !is 0) {
             left = simple ? SIMPLE_TOP_LEFT_CORNER : TOP_LEFT_CORNER;
             right = simple ? SIMPLE_TOP_RIGHT_CORNER : TOP_RIGHT_CORNER;
@@ -1314,7 +1309,7 @@
     do {
         while (index < length_ && string[index] !is '&') index++;
         if (++index >= length_) return '\0';
-        if (string[index] !is '&') return CharacterFirstToLower(string[index..$]);
+        if (string[index] !is '&') return Character.toLowerCase (string.dcharAt (index));
         index++;
     } while (index < length_);
     return '\0';
@@ -1687,7 +1682,7 @@
                 if (text !is null) {
                     dchar mnemonic = _findMnemonic(text);
                     if (mnemonic !is '\0') {
-                        shortcut = Format("Alt+{}", mnemonic); //$NON-NLS-1$
+                        shortcut = "Alt+"~dcharToString(mnemonic); //$NON-NLS-1$
                     }
                 }
             }
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/CTabFolder2Adapter.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/CTabFolder2Adapter.d	Sat Jul 09 15:50:20 2011 +0300
@@ -11,8 +11,6 @@
  *     Frank Benoit <benoit@tionex.de>
  *******************************************************************************/
 module org.eclipse.swt.custom.CTabFolder2Adapter;
-
-import java.lang.all;
 import org.eclipse.swt.custom.CTabFolder2Listener;
 import org.eclipse.swt.custom.CTabFolderEvent;
 
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/CTabFolder2Listener.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/CTabFolder2Listener.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,8 +12,6 @@
  *******************************************************************************/
 module org.eclipse.swt.custom.CTabFolder2Listener;
 
-import java.lang.all;
-
 import org.eclipse.swt.internal.SWTEventListener;
 import org.eclipse.swt.custom.CTabFolderEvent;
 
@@ -139,11 +137,11 @@
     version(Tango){
         alias ParameterTupleOf!(Dg) DgArgs;
         static assert( is(DgArgs == Tuple!(CTabFolderEvent,T)),
-                    "Delegate args not correct: "~DgArgs.stringof~" vs. (Event,"~T.stringof~")" );
+                "Delegate args not correct: "~DgArgs.stringof~" vs. (Event,"~T.stringof~")" );
     } else { // Phobos
         alias ParameterTypeTuple!(Dg) DgArgs;
         static assert( is(DgArgs == TypeTuple!(CTabFolderEvent,T)),
-                    "Delegate args not correct: "~DgArgs.stringof~" vs. (Event,"~T.stringof~")" );
+                "Delegate args not correct: "~DgArgs.stringof~" vs. (Event,"~T.stringof~")" );
     }
 
     Dg dg;
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/CTabFolderAdapter.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/CTabFolderAdapter.d	Sat Jul 09 15:50:20 2011 +0300
@@ -11,8 +11,6 @@
  *     Frank Benoit <benoit@tionex.de>
  *******************************************************************************/
 module org.eclipse.swt.custom.CTabFolderAdapter;
-
-import java.lang.all;
 import org.eclipse.swt.custom.CTabFolderEvent;
 import org.eclipse.swt.custom.CTabFolderListener;
 
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/CTabFolderEvent.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/CTabFolderEvent.d	Sat Jul 09 15:50:20 2011 +0300
@@ -19,11 +19,6 @@
 import org.eclipse.swt.events.TypedEvent;
 import org.eclipse.swt.widgets.Widget;
 
-version(Tango){
-    import tango.util.Convert;
-} else { // Phobos
-    import std.conv;
-}
 
 /**
  * This event is sent when an event is generated in the CTabFolder.
@@ -92,12 +87,12 @@
 public override String toString() {
     String string = super.toString ();
     return string[0.. $ - 1] // remove trailing '}'
-        ~ " item=" ~ to!(String)(item)
-        ~ " doit=" ~ to!(String)(doit)
-        ~ " x=" ~ to!(String)(x)
-        ~ " y=" ~ to!(String)(y)
-        ~ " width=" ~ to!(String)(width)
-        ~ " height=" ~ to!(String)(height)
+        ~ " item=" ~ String_valueOf(item)
+        ~ " doit=" ~ String_valueOf(doit)
+        ~ " x=" ~ String_valueOf(x)
+        ~ " y=" ~ String_valueOf(y)
+        ~ " width=" ~ String_valueOf(width)
+        ~ " height=" ~ String_valueOf(height)
         ~ "}";
 }
 }
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/CTabFolderListener.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/CTabFolderListener.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,8 +12,6 @@
  *******************************************************************************/
 module org.eclipse.swt.custom.CTabFolderListener;
 
-import java.lang.all;
-
 import org.eclipse.swt.internal.SWTEventListener;
 import org.eclipse.swt.custom.CTabFolderEvent;
 
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/CTabItem.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/CTabItem.d	Sat Jul 09 15:50:20 2011 +0300
@@ -32,14 +32,10 @@
 import org.eclipse.swt.widgets.Widget;
 import org.eclipse.swt.custom.CTabFolder;
 
-
-version (Tango)
+version(Tango){
     import tango.text.convert.Utf;
-    
-else
-{
+} else {
     import std.conv;
-
     alias to!(string) toString;
     alias to!(dstring) toString32;
 }
@@ -227,7 +223,7 @@
                                      x+9,y+2, x+7,y+4, x+7,y+5, x+9,y+7, x+9,y+9,
                                      x+7,y+9, x+5,y+7, x+4,y+7, x+2,y+9, x,y+9,
                                      x,y+7, x+2,y+5, x+2,y+4, x,y+2];
-            Color fill = new Color(display, cast(RGB)CTabFolder.CLOSE_FILL);
+            Color fill = new Color(display, CTabFolder.CLOSE_FILL);
             gc.setBackground(fill);
             gc.fillPolygon(shape);
             fill.dispose();
@@ -240,7 +236,7 @@
                                      x+10,y+3, x+8,y+5, x+8,y+6, x+10,y+8, x+10,y+10,
                                      x+8,y+10, x+6,y+8, x+5,y+8, x+3,y+10, x+1,y+10,
                                      x+1,y+8, x+3,y+6, x+3,y+5, x+1,y+3];
-            Color fill = new Color(display, cast(RGB)CTabFolder.CLOSE_FILL);
+            Color fill = new Color(display, CTabFolder.CLOSE_FILL);
             gc.setBackground(fill);
             gc.fillPolygon(shape);
             fill.dispose();
@@ -299,8 +295,8 @@
         // draw selected tab background and outline
         shape = null;
         if (this.parent.onBottom) {
-            int[] left = parent.simple ? CTabFolder.SIMPLE_BOTTOM_LEFT_CORNER : CTabFolder.BOTTOM_LEFT_CORNER;
-            int[] right = parent.simple ? cast(int[])CTabFolder.SIMPLE_BOTTOM_RIGHT_CORNER : parent.curve;
+            TryConst!(int)[] left = parent.simple ? CTabFolder.SIMPLE_BOTTOM_LEFT_CORNER : CTabFolder.BOTTOM_LEFT_CORNER;
+            TryConst!(int[]) right = parent.simple ? CTabFolder.SIMPLE_BOTTOM_RIGHT_CORNER : parent.curve;
             if (parent.borderLeft is 0 && parent.indexOf(this) is parent.firstIndex) {
                 left = [x, y+height];
             }
@@ -323,8 +319,8 @@
             shape[index++] = parent.simple ? rightEdge - 1 : rightEdge + parent.curveWidth - parent.curveIndent;
             shape[index++] = y - 1;
         } else {
-            int[] left = parent.simple ? CTabFolder.SIMPLE_TOP_LEFT_CORNER : CTabFolder.TOP_LEFT_CORNER;
-            int[] right = parent.simple ? cast(int[])CTabFolder.SIMPLE_TOP_RIGHT_CORNER : parent.curve;
+            TryConst!(int)[] left = parent.simple ? CTabFolder.SIMPLE_TOP_LEFT_CORNER : CTabFolder.TOP_LEFT_CORNER;
+            TryConst!(int[]) right = parent.simple ? CTabFolder.SIMPLE_TOP_RIGHT_CORNER : parent.curve;
             if (parent.borderLeft is 0 && parent.indexOf(this) is parent.firstIndex) {
                 left = [x, y];
             }
@@ -486,7 +482,7 @@
             rightEdge - parent.curveIndent,
             1 + y);
 
-    int[] leftHighlightCurve = CTabFolder.TOP_LEFT_CORNER_HILITE;
+    const int[] leftHighlightCurve = CTabFolder.TOP_LEFT_CORNER_HILITE;
 
     int d = parent.tabHeight - parent.topCurveHighlightEnd.length /2;
 
@@ -557,7 +553,7 @@
     int startX = x + width - 1;
 
     if (this.parent.onBottom) {
-        int[] right = parent.simple
+        TryConst!(int[]) right = parent.simple
             ? CTabFolder.SIMPLE_UNSELECTED_INNER_CORNER
             : CTabFolder.BOTTOM_RIGHT_CORNER;
 
@@ -571,7 +567,7 @@
         shape[index++] = startX;
         shape[index++] = y - 1;
     } else {
-        int[] right = parent.simple
+        TryConst!(int[]) right = parent.simple
             ? CTabFolder.SIMPLE_UNSELECTED_INNER_CORNER
             : CTabFolder.TOP_RIGHT_CORNER;
 
@@ -613,7 +609,7 @@
 
     int[] shape = null;
     if (this.parent.onBottom) {
-        int[] left = parent.simple
+        TryConst!(int[]) left = parent.simple
             ? CTabFolder.SIMPLE_UNSELECTED_INNER_CORNER
             : CTabFolder.BOTTOM_LEFT_CORNER;
 
@@ -626,7 +622,7 @@
             shape[index++] = y + height + left[2 * i + 1] - 1;
         }
     } else {
-        int[] left = parent.simple
+        TryConst!(int[]) left = parent.simple
             ? CTabFolder.SIMPLE_UNSELECTED_INNER_CORNER
             : CTabFolder.TOP_LEFT_CORNER;
 
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/DefaultContent.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/DefaultContent.d	Sat Jul 09 15:50:20 2011 +0300
@@ -21,7 +21,9 @@
 import org.eclipse.swt.custom.StyledTextEvent;
 import org.eclipse.swt.custom.StyledTextListener;
 import org.eclipse.swt.custom.StyledText;
+
 import java.lang.all;
+import java.nonstandard.UnsafeUtf;
 
 version(Tango){
     static import tango.io.model.IFile;
@@ -514,7 +516,7 @@
         while ((length_ - 1 >=0) && isDelimiter(buf.slice[length_ - 1])) {
             length_--;
         }
-        return buf.toString()[ 0 .. length_ ]._idup();
+        return buf.slice()[ 0 .. length_ ]._idup();
     }
 }
 /**
@@ -548,7 +550,7 @@
         int gapLength = gapEnd - gapStart;
         buffer.append(textStore[ start .. gapStart ]);
         buffer.append(textStore[ gapEnd .. gapEnd + length_ - gapLength - (gapStart - start) ]);
-        return buffer.toString()._idup();
+        return buffer.toString();
     }
 }
 /**
@@ -571,6 +573,7 @@
 }
 /**
  * Returns the line at the given offset.
+ * DWT: index can be an invalid UTF-8 index
  * <p>
  *
  * @param charPosition logical character offset (i.e., does not include gap)
@@ -733,7 +736,7 @@
     StringBuffer buf = new StringBuffer();
     buf.append(textStore[ start .. start + gapStart - start ] );
     buf.append(textStore[ gapEnd .. gapEnd + end - gapStart ] );
-    return buf.toString()._idup();
+    return buf.toString();
 }
 /**
  * Removes the specified <code>TextChangeListener</code>.
@@ -898,32 +901,5 @@
     gapLine = getLineAtPhysicalOffset(gapStart);
 }
 
-/++
- + SWT extension
- +/
-int utf8AdjustOffset( int offset ){
-    if (textStore is null)
-        return offset;
-    if (offset is 0)
-        return offset;
-    if( offset >= textStore.length ){
-        return offset;
-    }
-    if (!gapExists() || (offset < gapStart)){
-        while( (textStore[offset] & 0xC0) is 0x80 ){
-            offset--;
-        }
-        return offset;
-    }
-    int gapLength= gapEnd - gapStart;
-    if( offset+gapLength >= textStore.length ){
-        return offset;
-    }
-    while( (textStore[offset+gapLength] & 0xC0) is 0x80 ){
-        offset--;
-    }
-    return offset;
-}
-
 
 }
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/ExtendedModifyListener.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/ExtendedModifyListener.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,8 +12,6 @@
  *******************************************************************************/
 module org.eclipse.swt.custom.ExtendedModifyListener;
 
-import java.lang.all;
-
 import org.eclipse.swt.internal.SWTEventListener;
 import org.eclipse.swt.custom.ExtendedModifyEvent;
 
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/LineBackgroundListener.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/LineBackgroundListener.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,8 +12,6 @@
  *******************************************************************************/
 module org.eclipse.swt.custom.LineBackgroundListener;
 
-import java.lang.all;
-
 import org.eclipse.swt.internal.SWTEventListener;
 import org.eclipse.swt.custom.LineBackgroundEvent;
 
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/LineStyleListener.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/LineStyleListener.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,8 +12,6 @@
  *******************************************************************************/
 module org.eclipse.swt.custom.LineStyleListener;
 
-import java.lang.all;
-
 import org.eclipse.swt.internal.SWTEventListener;
 import org.eclipse.swt.custom.LineStyleEvent;
 
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/MovementListener.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/MovementListener.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,8 +12,6 @@
  *******************************************************************************/
 module org.eclipse.swt.custom.MovementListener;
 
-import java.lang.all;
-
 import org.eclipse.swt.internal.SWTEventListener;
 import org.eclipse.swt.custom.MovementEvent;
 
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/PaintObjectEvent.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/PaintObjectEvent.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,8 +12,6 @@
  *******************************************************************************/
 module org.eclipse.swt.custom.PaintObjectEvent;
 
-import java.lang.all;
-
 
 import org.eclipse.swt.events.TypedEvent;
 import org.eclipse.swt.graphics.GC;
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/PaintObjectListener.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/PaintObjectListener.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,8 +12,6 @@
  *******************************************************************************/
 module org.eclipse.swt.custom.PaintObjectListener;
 
-import java.lang.all;
-
 
 import org.eclipse.swt.internal.SWTEventListener;
 import org.eclipse.swt.custom.PaintObjectEvent;
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/PopupList.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/PopupList.d	Sat Jul 09 15:50:20 2011 +0300
@@ -228,7 +228,7 @@
     // specified string
     if (string !is null){
         for (int i = 0; i < items.length; i++) {
-            if ( items[i].startsWith( string) ){
+            if (items[i].startsWith(string)){
                 int index = list.indexOf(items[i]);
                 list.select(index);
                 break;
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/ST.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/ST.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,8 +12,6 @@
  *******************************************************************************/
 module org.eclipse.swt.custom.ST;
 
-import java.lang.all;
-
 
 /**
  * This class provides access to the public constants provided by <code>StyledText</code>.
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/SashFormData.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/SashFormData.d	Sat Jul 09 15:50:20 2011 +0300
@@ -14,21 +14,14 @@
 
 import java.lang.all;
 
-version(Tango){
-    static import tango.text.Util;
-    import tango.util.Convert;
-} else { // Phobos
-    import std.conv;
-}
-
 class SashFormData {
 
     long weight;
 
 String getName () {
     String str = this.classinfo.name;
-    int index = str.lastIndexOf( '.' );
-    if (index is -1 ) return str;
+    int index = str.lastIndexOf ('.');
+    if (index is -1) return str;
     return str[ index + 1 .. $ ];
 }
 
@@ -39,6 +32,6 @@
  * @return a string representation of the event
  */
 public override String toString () {
-    return getName()~" {weight="~to!(String)(weight)~"}"; //$NON-NLS-2$
+    return getName()~" {weight="~String_valueOf(weight)~"}"; //$NON-NLS-2$
 }
 }
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/ScrolledCompositeLayout.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/ScrolledCompositeLayout.d	Sat Jul 09 15:50:20 2011 +0300
@@ -14,7 +14,6 @@
 
 import java.lang.all;
 
-
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.graphics.Point;
 import org.eclipse.swt.graphics.Rectangle;
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/StackLayout.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/StackLayout.d	Sat Jul 09 15:50:20 2011 +0300
@@ -14,8 +14,6 @@
 
 import java.lang.all;
 
-
-
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.graphics.Point;
 import org.eclipse.swt.graphics.Rectangle;
@@ -23,12 +21,6 @@
 import org.eclipse.swt.widgets.Control;
 import org.eclipse.swt.widgets.Layout;
 
-version(Tango){
-    import tango.util.Convert;
-} else { // Phobos
-    import std.conv;
-}
-
 /**
  * This Layout stacks all the controls one on top of the other and resizes all controls
  * to have the same size and location.
@@ -139,7 +131,7 @@
 
 String getName () {
     String string = this.classinfo.name;
-    int index = string.lastIndexOf('.');
+    int index = string.lastIndexOf ('.');
     if (index is -1 ) return string;
     return string[ index + 1 .. $ ];
 }
@@ -152,9 +144,9 @@
  */
 public override String toString () {
     String string = getName ()~" {";
-    if (marginWidth !is 0) string ~= "marginWidth="~to!(String)(marginWidth)~" ";
-    if (marginHeight !is 0) string ~= "marginHeight="~to!(String)(marginHeight)~" ";
-    if (topControl !is null) string ~= "topControl="~to!(String)(topControl)~" ";
+    if (marginWidth !is 0) string ~= "marginWidth="~String_valueOf(marginWidth)~" ";
+    if (marginHeight !is 0) string ~= "marginHeight="~String_valueOf(marginHeight)~" ";
+    if (topControl !is null) string ~= "topControl="~String_valueOf(topControl)~" ";
     string = string.trim();
     string ~= "}";
     return string;
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/StyleRange.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/StyleRange.d	Sat Jul 09 15:50:20 2011 +0300
@@ -14,7 +14,6 @@
 
 import java.lang.all;
 
-
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.graphics.Color;
 import org.eclipse.swt.graphics.TextStyle;
@@ -23,7 +22,6 @@
 import org.eclipse.swt.custom.TextChangedEvent;
 import org.eclipse.swt.custom.TextChangingEvent;
 
-
 /**
  * <code>StyleRange</code> defines a set of styles for a specified
  * range of text.
@@ -219,7 +217,7 @@
     }
     String str = super.toString();
     int index = str.indexOf( '{');
-    str = str[ index + 1 .. $ ];
+    str = str.substring( index + 1 );
     if (str.length > 1) buffer.append(", ");
     buffer.append(str);
     return buffer.toString();
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/StyledText.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/StyledText.d	Sat Jul 09 15:50:20 2011 +0300
@@ -82,14 +82,14 @@
 import org.eclipse.swt.custom.StyledTextListener;
 import org.eclipse.swt.custom.ST;
 
+import java.lang.all;
+import java.nonstandard.UnsafeUtf;
+
 version(Tango){
     static import tango.io.model.IFile;
-    import tango.util.Convert;
 } else { // Phobos
-    import std.conv;
     static import std.string;
 }
-import java.lang.all;
 
 
 /**
@@ -150,6 +150,7 @@
  */
 public class StyledText : Canvas {
     alias Canvas.computeSize computeSize;
+package:
 
     static const char TAB = '\t';
     version(Tango){
@@ -196,17 +197,18 @@
     int rightMargin;
     int bottomMargin;
     int columnX;                        // keep track of the horizontal caret position when changing lines/pages. Fixes bug 5935
-    int caretOffset = 0;
+    int/*UTF8index*/ caretOffset = 0;
     int caretAlignment;
     Point selection;                    // x and y are start and end caret offsets of selection
     Point clipboardSelection;           // x and y are start and end caret offsets of previous selection
-    int selectionAnchor;                // position of selection anchor. 0 based offset from beginning of text
+    bool selectedTextValid = true;      // DWT: false if we just changed a text witch was selected
+    int/*UTF8index*/ selectionAnchor;   // position of selection anchor. 0 based offset from beginning of text
     Point doubleClickSelection;         // selection after last mouse double click
     bool editable = true;
     bool wordWrap = false;
-    bool doubleClickEnabled = true;  // see getDoubleClickEnabled
-    bool overwrite = false;          // insert/overwrite edit mode
-    int textLimit = -1;                 // limits the number of characters the user can type in the widget. Unlimited by default.
+    bool doubleClickEnabled = true;     // see getDoubleClickEnabled
+    bool overwrite = false;             // insert/overwrite edit mode
+    int/*UTF8index*/ textLimit = -1;           // limits the number of characters the user can type in the widget. Unlimited by default.
     int[int] keyActionMap;
     Color background = null;            // workaround for bug 4791
     Color foreground = null;            //
@@ -238,12 +240,12 @@
     int lineSpacing;
 
     const static bool IS_CARBON, IS_GTK, IS_MOTIF;
-    static this(){
+mixin(sharedStaticThis!(`{
         String platform = SWT.getPlatform();
         IS_CARBON = ("carbon" == platform);
         IS_GTK    = ("gtk"    == platform);
         IS_MOTIF  = ("motif"  == platform);
-    }
+    }`));
 
     /**
      * The Printing class : printing of a range of text.
@@ -512,6 +514,7 @@
         } else if (data.scope_ is PrinterData.SELECTION) {
             startLine = content.getLineAtOffset(selection.x);
             if (selection.y > 0) {
+                // DWT: index isn't a valid UTF-8 index
                 endLine = content.getLineAtOffset(selection.x + selection.y - 1);
             } else {
                 endLine = startLine - 1;
@@ -708,7 +711,7 @@
                     printLayout.setText("");
                 }
             } else {
-                printLayout.setText(to!(String)(index));
+                printLayout.setText(String_valueOf(index));
             }
             int paintX = x - printMargin - printLayout.getBounds().width;
             printLayout.draw(gc, paintX, y);
@@ -836,7 +839,7 @@
      * Determines if Unicode RTF should be written.
      * Don't write Unicode RTF on Windows 95/98/ME or NT.
      */
-    void setUnicode() {
+    void setUnicode() {/*!!!*/
 //         const String Win95 = "windows 95";
 //         const String Win98 = "windows 98";
 //         const String WinME = "windows me";
@@ -873,11 +876,9 @@
      * @param end end offset of segment
      */
     void write(String string, int start, int end) {
-        start = 0;
-        end = string.length;
-        int incr = 1;
-        for (int index = start; index < end; index+=incr) {
-            dchar ch = firstCodePoint( string[index .. $], incr );
+        int incr;
+        for (int index = start; index < end; index += incr) {
+            dchar ch = string.dcharAt(index, incr);
             if (ch > 0xFF && WriteUnicode) {
                 // write the sub string from the last escaped character
                 // to the current one. Fixes bug 21698.
@@ -885,7 +886,7 @@
                     write( string[start .. index ] );
                 }
                 write("\\u");
-                write( to!(String)( cast(short)ch ));
+                write( String_valueOf( cast(short)ch ));
                 write(' ');                     // control word delimiter
                 start = index + incr;
             } else if (ch is '}' || ch is '{' || ch is '\\') {
@@ -896,6 +897,7 @@
                 }
                 write('\\');
                 write(cast(char)ch); // ok because one of {}\
+                assert(incr == 1);
                 start = index + 1;
             }
         }
@@ -915,7 +917,7 @@
         // specify code page, necessary for copy to work in bidi
         // systems that don't support Unicode RTF.
         // PORTING_TODO: String cpg = System.getProperty("file.encoding").toLowerCase();
-        String cpg = "UTF16";
+        //String cpg = "UTF16";
         /+
         if (cpg.startsWith("cp") || cpg.startsWith("ms")) {
             cpg = cpg.substring(2, cpg.length());
@@ -1764,13 +1766,14 @@
         // therefore make sure redraw range is valid.
         int redrawStart = Math.min(selectionStart, length);
         int redrawEnd = Math.min(selectionEnd, length);
-        if (redrawEnd - redrawStart > 0) {
+        if (redrawEnd - redrawStart > 0 && selectedTextValid) {
             internalRedrawRange(redrawStart, redrawEnd - redrawStart);
         }
         if (sendEvent) {
             sendSelectionEvent();
         }
     }
+    selectedTextValid = true;
 }
 public override Point computeSize (int wHint, int hHint, bool changed) {
     checkWidget();
@@ -2243,13 +2246,13 @@
         int lineIndex = content.getLineAtOffset(caretOffset);
         int lineOffset = content.getOffsetAtLine(lineIndex);
         if (caretOffset is lineOffset) {
-            // SWT: on line start, delete line break
+            // DWT: on line start, delete line break
             lineOffset = content.getOffsetAtLine(lineIndex - 1);
             event.start = lineOffset + content.getLine(lineIndex - 1).length;
             event.end = caretOffset;
         } else {
             TextLayout layout = renderer.getTextLayout(lineIndex);
-            int start = layout.getPreviousOffset(caretOffset - lineOffset, SWT.MOVEMENT_CLUSTER);
+            int start = layout.getPreviousOffset(caretOffset - lineOffset, SWT.MOVEMENT_CHAR);
             renderer.disposeTextLayout(layout);
             event.start = start + lineOffset;
             event.end = caretOffset;
@@ -2287,7 +2290,7 @@
         // replace character at caret offset if the caret is not at the
         // end of the line
         if (event.end < lineOffset + line.length) {
-            event.end+=dcharToString( key ).length;
+            event.end += line.UTF8strideAt(event.end - lineOffset);
         }
         event.text = dcharToString( key );
     } else {
@@ -2772,7 +2775,7 @@
             if (index is -1 && lineIndex > 0) {
                 bottomOffset = content.getOffsetAtLine(lineIndex - 1) + content.getLine(lineIndex - 1).length;
             } else {
-                bottomOffset = content.getOffsetAtLine(lineIndex) + Math.max(0, layout.getLineOffsets()[index + 1] - 1);
+                bottomOffset = content.getOffsetAtLine(lineIndex) + Math.max(0, getPreviousCharOffset(lineIndex, layout.getLineOffsets()[index + 1]));
             }
             renderer.disposeTextLayout(layout);
         } else {
@@ -3968,7 +3971,7 @@
     if (point is null) {
         SWT.error(SWT.ERROR_NULL_ARGUMENT);
     }
-    int[] trailing = new int[1];
+    int[1] trailing;
     int offset = getOffsetAtPoint(point.x, point.y, trailing, true);
     if (offset is -1) {
         SWT.error(SWT.ERROR_INVALID_ARGUMENT);
@@ -4004,7 +4007,8 @@
             String line = content.getLine(lineIndex);
             int level;
             int offset = offsetInLine;
-            while (offset > 0 && Character.isDigit(line.dcharAt(offset))) offset--;
+            while (offset > 0 && Character.isDigit(line.dcharAt(offset)))
+                offset = line.offsetBefore(offset);
             if (offset is 0 && Character.isDigit(line.dcharAt(offset))) {
                 level = isMirrored() ? 1 : 0;
             } else {
@@ -4634,7 +4638,8 @@
     if (start < 0 || start >= contentLength || end < 0 || end >= contentLength || start > end) {
         SWT.error(SWT.ERROR_INVALID_RANGE);
     }
-    return content.getTextRange(start, end - start + 1);
+    auto res = content.getTextRange(start, content.getCharCount() - start);
+    return res[0 .. res.offsetAfter(end - start)];
 }
 /**
  * Returns the smallest bounding rectangle that includes the characters between two offsets.
@@ -4808,9 +4813,12 @@
     int offset = caretOffset - lineOffset;
     int lineLength = line.length;
     if (lineLength is 0) return isMirrored() ? SWT.RIGHT : SWT.LEFT;
-    if (caretAlignment is PREVIOUS_OFFSET_TRAILING && offset > 0) offset--;
-    if (offset is lineLength && offset > 0) offset--;
-    while (offset > 0 && Character.isDigit(line.dcharAt(offset))) offset--;
+    if (caretAlignment is PREVIOUS_OFFSET_TRAILING && offset > 0)
+        offset = line.offsetBefore(offset);
+    if (offset is lineLength && offset > 0)
+        offset = line.offsetBefore(offset);
+    while (offset > 0 && Character.isDigit(line.dcharAt(offset)))
+        offset = line.offsetBefore(offset);
     if (offset is 0 && Character.isDigit(line.dcharAt(offset))) {
         return isMirrored() ? SWT.RIGHT : SWT.LEFT;
     }
@@ -4904,8 +4912,8 @@
     int offsetInLine = offset - lineOffset;
     int lineLength = line.length;
     if (lineIndex < content.getLineCount() - 1) {
-        int endLineOffset = content.getOffsetAtLine(lineIndex + 1) - 1;
-        if (lineLength < offsetInLine && offsetInLine <= endLineOffset) {
+        int afterEndLineOffset = content.getOffsetAtLine(lineIndex + 1);
+        if (lineLength < offsetInLine && offsetInLine < afterEndLineOffset) {
             offsetInLine = lineLength;
         }
     }
@@ -4913,9 +4921,7 @@
     TextLayout layout = renderer.getTextLayout(lineIndex);
     if (lineLength !is 0  && offsetInLine <= lineLength) {
         if (offsetInLine is lineLength) {
-            // SWT: Instead of go back one byte, go back one codepoint
-            int offsetInLine_m1 = layout.getPreviousOffset(offsetInLine, SWT.MOVEMENT_CLUSTER);
-            point = layout.getLocation(offsetInLine_m1, true);
+            point = layout.getLocation(getPreviousCharOffset(lineIndex, offsetInLine), true);
         } else {
             switch (caretAlignment) {
                 case OFFSET_LEADING:
@@ -4926,9 +4932,7 @@
                     if (offsetInLine is 0) {
                         point = layout.getLocation(offsetInLine, false);
                     } else {
-                        // SWT: Instead of go back one byte, go back one codepoint
-                        int offsetInLine_m1 = layout.getPreviousOffset(offsetInLine, SWT.MOVEMENT_CLUSTER);
-                        point = layout.getLocation(offsetInLine_m1, true);
+                        point = layout.getLocation(getPreviousCharOffset(lineIndex, offsetInLine), true);
                     }
                     break;
             }
@@ -5077,7 +5081,7 @@
         int endIndex = layout.getLineIndex(Math.min(end, layout.getText().length));
         if (startIndex is endIndex) {
             /* Redraw rect between start and end offset if start and end offsets are in same wrapped line */
-            Rectangle rect = layout.getBounds(start, end - 1);
+            Rectangle rect = layout.getBounds( start, getPreviousCharOffset(startLine, end) );
             rect.x += lineX;
             rect.y += startLineY;
             super.redraw(rect.x, rect.y, rect.width, rect.height, false);
@@ -5087,7 +5091,7 @@
     }
 
     /* Redraw start line from the start offset to the end of client area */
-    Rectangle startRect = layout.getBounds(start, offsets[startIndex + 1] - 1);
+    Rectangle startRect = layout.getBounds( start, getPreviousCharOffset(startLine, offsets[startIndex + 1]) );
     if (startRect.height is 0) {
         Rectangle bounds = layout.getLineBounds(startIndex);
         startRect.x = bounds.width;
@@ -5106,7 +5110,7 @@
         offsets = layout.getLineOffsets();
     }
     int endIndex = layout.getLineIndex(Math.min(end, layout.getText().length));
-    Rectangle endRect = layout.getBounds(offsets[endIndex], end - 1);
+    Rectangle endRect = layout.getBounds(offsets[endIndex], getPreviousCharOffset(endLine, end));
     if (endRect.height is 0) {
         Rectangle bounds = layout.getLineBounds(endIndex);
         endRect.y = bounds.y;
@@ -5124,7 +5128,7 @@
     }
 }
 void handleCompositionOffset (Event event) {
-    int[] trailing = new int [1];
+    int[1] trailing;
     event.index = getOffsetAtPoint(event.x, event.y, trailing, true);
     event.count = trailing[0];
 }
@@ -5151,7 +5155,7 @@
             int lineIndex = getCaretLine();
             int lineOffset = content.getOffsetAtLine(lineIndex);
             TextLayout layout = renderer.getTextLayout(lineIndex);
-            caretWidth = layout.getBounds(start - lineOffset, start + length - 1 - lineOffset).width;
+            caretWidth = layout.getBounds(start - lineOffset, getPreviousCharOffset(lineIndex, start + length - lineOffset)).width;
             renderer.disposeTextLayout(layout);
         }
     }
@@ -5666,7 +5670,7 @@
                 if (text !is null) {
                     dchar mnemonic = _findMnemonic (text);
                     if (mnemonic !is '\0') {
-                        shortcut = Format("Alt+{}", mnemonic ); //$NON-NLS-1$
+                        shortcut = "Alt+"~dcharToString(mnemonic); //$NON-NLS-1$
                     }
                 }
             }
@@ -5747,7 +5751,7 @@
     do {
         while (index < length_ && string[index] !is '&') index++;
         if (++index >= length_) return '\0';
-        if (string[index] !is '&') return CharacterFirstToLower(string[index .. $ ] );
+        if (string[index] !is '&') return Character.toLowerCase (string.dcharAt (index));
         index++;
     } while (index < length_);
     return '\0';
@@ -7827,8 +7831,6 @@
  */
 void setSelection(int start, int length, bool sendEvent) {
     int end = start + length;
-    start = content.utf8AdjustOffset(start);
-    end = content.utf8AdjustOffset(end);
     if (start > end) {
         int temp = end;
         end = start;
@@ -8327,7 +8329,7 @@
     setCaretLocation();
     super.redraw();
 }
-// SWT: If necessary, scroll to show the location
+// DWT: If necessary, scroll to show the location
 bool showLocation(Rectangle rect, bool scrollPage) {
     int clientAreaWidth = this.clientAreaWidth - leftMargin - rightMargin;
     int clientAreaHeight = this.clientAreaHeight - topMargin - bottomMargin;
@@ -8444,6 +8446,7 @@
         int redrawStart = startOffset + newLength;
         internalRedrawRange(redrawStart, selection.y + netNewLength - redrawStart);
     }
+    selectedTextValid = false;
     if (selection.y > startOffset && selection.x < startOffset + replacedLength) {
         // selection intersects replaced text. set caret behind text change
         setSelection(startOffset + newLength, 0, true);
@@ -8453,4 +8456,14 @@
     }
     setCaretLocation();
 }
-}
+
+// DWT: to use instead of "offsetInLine - 1"
+int getPreviousCharOffset(String F = __FILE__, uint L = __LINE__)(int lineIndex, int offsetInLine) {
+    String line = content.getLine(lineIndex);
+    if(offsetInLine < 0 || offsetInLine > line.length) {
+        getDwtLogger().warn(F, L, Format("Clamped UTF-8 offset:\noffsetInLine = {}, line.length = {}, line = {}", offsetInLine, line.length, line));
+        return offsetInLine - 1;
+    }
+    return line.offsetBefore(offsetInLine);
+}
+}
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/StyledTextContent.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/StyledTextContent.d	Sat Jul 09 15:50:20 2011 +0300
@@ -209,9 +209,4 @@
  */
 public void setText(String text);
 
-/++
- + SWT Extension
- +/
-int utf8AdjustOffset( int offset );
-
 }
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/StyledTextEvent.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/StyledTextEvent.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,8 +12,6 @@
  *******************************************************************************/
 module org.eclipse.swt.custom.StyledTextEvent;
 
-import java.lang.all;
-
 
 import org.eclipse.swt.graphics.Color;
 import org.eclipse.swt.widgets.Event;
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/StyledTextListener.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/StyledTextListener.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,8 +12,6 @@
  *******************************************************************************/
 module org.eclipse.swt.custom.StyledTextListener;
 
-import java.lang.all;
-
 
 import org.eclipse.swt.events.VerifyEvent;
 import org.eclipse.swt.internal.SWTEventListener;
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/StyledTextRenderer.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/StyledTextRenderer.d	Sat Jul 09 15:50:20 2011 +0300
@@ -39,14 +39,7 @@
 import org.eclipse.swt.custom.StyledTextEvent;
 
 import java.lang.all;
-
-version(Tango){
-    static import tango.text.Util;
-    static import tango.text.convert.Utf;
-    import tango.util.Convert;
-} else { // Phobos
-    import std.conv;
-}
+import java.nonstandard.UnsafeUtf;
 
 /**
  * A StyledTextRenderer renders the content of a StyledText widget.
@@ -365,7 +358,7 @@
     int type = bullet.type & (ST.BULLET_DOT|ST.BULLET_NUMBER|ST.BULLET_LETTER_LOWER|ST.BULLET_LETTER_UPPER);
     switch (type) {
         case ST.BULLET_DOT: string = "\u2022"; break;
-        case ST.BULLET_NUMBER: string = to!(String)(index); break;
+        case ST.BULLET_NUMBER: string = String_valueOf(index); break;
         case ST.BULLET_LETTER_LOWER: string = [cast(char) (index % 26 + 97)]; break;
         case ST.BULLET_LETTER_UPPER: string = [cast(char) (index % 26 + 65)]; break;
         default:
@@ -406,7 +399,7 @@
         styledText.drawBackground(gc, client.x, paintY, client.width, height);
     }
     gc.setForeground(widgetForeground);
-    if (selectionStart is selectionEnd || (selectionEnd <= 0 && selectionStart > lineLength - 1)) {
+    if (selectionStart is selectionEnd || (selectionEnd <= 0 && selectionStart >= lineLength)) {
         layout.draw(gc, paintX, paintY);
     } else {
         int start = Math.max(0, selectionStart);
@@ -422,7 +415,7 @@
         if (selectionStart <= lineLength && lineLength < selectionEnd ) {
             flags |= SWT.LAST_LINE_SELECTION;
         }
-        layout.draw(gc, paintX, paintY, start, end - 1, selectionFg, selectionBg, flags);
+        layout.draw(gc, paintX, paintY, start, end > 0 ? line.offsetBefore(end) : end - 1, selectionFg, selectionBg, flags);
     }
 
     // draw objects
@@ -603,7 +596,7 @@
 }
 int[] getRanges(int start, int length) {
     int[] newRanges;
-    int end = start + length - 1;
+    int end = start + length - 1; //not a valid index, but OK
     if (ranges !is null) {
         int rangeCount = styleCount << 1;
         int rangeStart = getRangeIndex(start, -1, rangeCount);
@@ -635,7 +628,7 @@
 }
 StyleRange[] getStyleRanges(int start, int length, bool includeRanges) {
     StyleRange[] newStyles;
-    int end = start + length - 1;
+    int end = start + length - 1; //not a valid index, but OK
     if (ranges !is null) {
         int rangeCount = styleCount << 1;
         int rangeStart = getRangeIndex(start, -1, rangeCount);
@@ -854,7 +847,7 @@
                 }
                 if (start >= length) break;
                 if (lastOffset < start) {
-                    layout.setStyle(null, lastOffset, start - 1);
+                    layout.setStyle(null, lastOffset, line.offsetBefore(start));
                 }
                 layout.setStyle(getStyleRange(styles[i >> 1]), start, end);
                 lastOffset = Math.max(lastOffset, end);
@@ -871,7 +864,7 @@
                 }
                 if (start >= length) break;
                 if (lastOffset < start) {
-                    layout.setStyle(null, lastOffset, start - 1);
+                    layout.setStyle(null, lastOffset, line.offsetBefore(start));
                 }
                 layout.setStyle(getStyleRange(styles[i]), start, end);
                 lastOffset = Math.max(lastOffset, end);
@@ -912,11 +905,11 @@
                         }
                     } else {
                         int start = compositionOffset - lineOffset;
-                        int end = start + compositionLength - 1;
+                        int end = line.offsetBefore(start + compositionLength);
                         TextStyle userStyle = layout.getStyle(start);
                         if (userStyle is null) {
-                            if (start > 0) userStyle = layout.getStyle(start - 1);
-                            if (userStyle is null && end + 1 < length) userStyle = layout.getStyle(end + 1);
+                            if (start > 0) userStyle = layout.getStyle(line.offsetBefore(start));
+                            if (userStyle is null && line.offsetAfter(end) < length) userStyle = layout.getStyle(line.offsetAfter(end));
                             if (userStyle !is null) {
                                 TextStyle newStyle = new TextStyle();
                                 newStyle.font = userStyle.font;
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/TextChangeListener.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/TextChangeListener.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,8 +12,6 @@
  *******************************************************************************/
 module org.eclipse.swt.custom.TextChangeListener;
 
-import java.lang.all;
-
 
 import org.eclipse.swt.internal.SWTEventListener;
 import org.eclipse.swt.custom.TextChangingEvent;
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/TextChangedEvent.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/TextChangedEvent.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,8 +12,6 @@
  *******************************************************************************/
 module org.eclipse.swt.custom.TextChangedEvent;
 
-import java.lang.all;
-
 import org.eclipse.swt.events.TypedEvent;
 import org.eclipse.swt.custom.StyledTextContent;
 /**
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/VerifyKeyListener.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/VerifyKeyListener.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,8 +12,6 @@
  *******************************************************************************/
 module org.eclipse.swt.custom.VerifyKeyListener;
 
-import java.lang.all;
-
 
 import org.eclipse.swt.events.VerifyEvent;
 import org.eclipse.swt.internal.SWTEventListener;
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/ViewForm.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/ViewForm.d	Sat Jul 09 15:50:20 2011 +0300
@@ -201,7 +201,7 @@
 //protected void checkSubclass () {
 //  String name = getClass().getName ();
 //  String validName = ViewForm.class.getName();
-//  if (!validName.equals(name)) {
+//  if (validName != (name)) {
 //      SWT.error (SWT.ERROR_INVALID_SUBCLASS);
 //  }
 //}
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/all.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/all.d	Sat Jul 09 15:50:20 2011 +0300
@@ -1,7 +1,5 @@
 module org.eclipse.swt.custom.all;
 
-import java.lang.all;
-
 public import org.eclipse.swt.custom.AnimatedProgress;
 public import org.eclipse.swt.custom.BidiSegmentEvent;
 public import org.eclipse.swt.custom.BidiSegmentListener;
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/dnd/ImageTransfer.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/dnd/ImageTransfer.d	Sat Jul 09 15:50:20 2011 +0300
@@ -131,7 +131,7 @@
     if (transferData.type is  cast(void*)XBM_ID) typeStr = "xbm";
     if (transferData.type is  cast(void*)XPM_ID) typeStr = "xpm";
     if (transferData.type is  cast(void*)XV_ID) typeStr = "xv";
-    CCharPtr type = typeStr.ptr;
+    auto type = typeStr.ptr;
     char* buffer;
     uint len;
     if (type is null) return;
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/ArmEvent.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/ArmEvent.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,8 +12,6 @@
  *******************************************************************************/
 module org.eclipse.swt.events.ArmEvent;
 
-import java.lang.all;
-
 import org.eclipse.swt.widgets.Event;
 import org.eclipse.swt.events.TypedEvent;
 
@@ -27,7 +25,7 @@
 
 public final class ArmEvent : TypedEvent {
 
-    //static const long serialVersionUID = 3258126964249212217L;
+    //static final long serialVersionUID = 3258126964249212217L;
 
 /**
  * Constructs a new instance of this class based on the
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/ArmListener.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/ArmListener.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,8 +12,6 @@
  *******************************************************************************/
 module org.eclipse.swt.events.ArmListener;
 
-import java.lang.all;
-
 public import org.eclipse.swt.internal.SWTEventListener;
 public import org.eclipse.swt.events.ArmEvent;
 
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/ControlAdapter.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/ControlAdapter.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,8 +12,6 @@
  *******************************************************************************/
 module org.eclipse.swt.events.ControlAdapter;
 
-import java.lang.all;
-
 import org.eclipse.swt.events.ControlListener;
 /**
  * This adapter class provides default implementations for the
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/ControlEvent.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/ControlEvent.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,8 +12,6 @@
  *******************************************************************************/
 module org.eclipse.swt.events.ControlEvent;
 
-import java.lang.all;
-
 
 import org.eclipse.swt.widgets.Event;
 import org.eclipse.swt.events.TypedEvent;
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/ControlListener.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/ControlListener.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,8 +12,6 @@
  *******************************************************************************/
 module org.eclipse.swt.events.ControlListener;
 
-import java.lang.all;
-
 public import org.eclipse.swt.internal.SWTEventListener;
 public import org.eclipse.swt.events.ControlEvent;
 
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/DisposeEvent.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/DisposeEvent.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,8 +12,6 @@
  *******************************************************************************/
 module org.eclipse.swt.events.DisposeEvent;
 
-import java.lang.all;
-
 
 import org.eclipse.swt.widgets.Event;
 import org.eclipse.swt.events.TypedEvent;
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/DisposeListener.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/DisposeListener.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,8 +12,6 @@
  *******************************************************************************/
 module org.eclipse.swt.events.DisposeListener;
 
-import java.lang.all;
-
 
 public import org.eclipse.swt.internal.SWTEventListener;
 public import org.eclipse.swt.events.DisposeEvent;
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/DragDetectEvent.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/DragDetectEvent.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,8 +12,6 @@
  *******************************************************************************/
 module org.eclipse.swt.events.DragDetectEvent;
 
-import java.lang.all;
-
 import org.eclipse.swt.widgets.Event;
 import org.eclipse.swt.events.MouseEvent;
 
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/DragDetectListener.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/DragDetectListener.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,8 +12,6 @@
  *******************************************************************************/
 module org.eclipse.swt.events.DragDetectListener;
 
-import java.lang.all;
-
 
 public import org.eclipse.swt.internal.SWTEventListener;
 public import org.eclipse.swt.events.DragDetectEvent;
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/ExpandAdapter.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/ExpandAdapter.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,8 +12,6 @@
  *******************************************************************************/
 module org.eclipse.swt.events.ExpandAdapter;
 
-import java.lang.all;
-
 import org.eclipse.swt.events.ExpandListener;
 
 /**
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/ExpandEvent.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/ExpandEvent.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,8 +12,6 @@
  *******************************************************************************/
 module org.eclipse.swt.events.ExpandEvent;
 
-import java.lang.all;
-
 
 import org.eclipse.swt.widgets.Event;
 import org.eclipse.swt.events.SelectionEvent;
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/ExpandListener.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/ExpandListener.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,8 +12,6 @@
  *******************************************************************************/
 module org.eclipse.swt.events.ExpandListener;
 
-import java.lang.all;
-
 
 public import org.eclipse.swt.internal.SWTEventListener;
 public import org.eclipse.swt.events.ExpandEvent;
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/FocusAdapter.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/FocusAdapter.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,8 +12,6 @@
  *******************************************************************************/
 module org.eclipse.swt.events.FocusAdapter;
 
-import java.lang.all;
-
 import org.eclipse.swt.events.FocusListener;
 
 /**
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/FocusEvent.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/FocusEvent.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,8 +12,6 @@
  *******************************************************************************/
 module org.eclipse.swt.events.FocusEvent;
 
-import java.lang.all;
-
 
 import org.eclipse.swt.widgets.Event;
 import org.eclipse.swt.events.TypedEvent;
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/FocusListener.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/FocusListener.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,8 +12,6 @@
  *******************************************************************************/
 module org.eclipse.swt.events.FocusListener;
 
-import java.lang.all;
-
 
 public import org.eclipse.swt.internal.SWTEventListener;
 public import org.eclipse.swt.events.FocusEvent;
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/HelpEvent.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/HelpEvent.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,8 +12,6 @@
  *******************************************************************************/
 module org.eclipse.swt.events.HelpEvent;
 
-import java.lang.all;
-
 
 import org.eclipse.swt.widgets.Event;
 import org.eclipse.swt.events.TypedEvent;
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/HelpListener.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/HelpListener.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,8 +12,6 @@
  *******************************************************************************/
 module org.eclipse.swt.events.HelpListener;
 
-import java.lang.all;
-
 
 public import org.eclipse.swt.internal.SWTEventListener;
 public import org.eclipse.swt.events.HelpEvent;
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/KeyAdapter.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/KeyAdapter.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,8 +12,6 @@
  *******************************************************************************/
 module org.eclipse.swt.events.KeyAdapter;
 
-import java.lang.all;
-
 import org.eclipse.swt.events.KeyListener;
 
 /**
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/KeyEvent.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/KeyEvent.d	Sat Jul 09 15:50:20 2011 +0300
@@ -102,7 +102,7 @@
  */
 public override String toString() {
     return Format( "{} character={} keyCode={} stateMask={} doit={}}",
-        super.toString[ 0 .. $-2 ],
+        super.toString[ 0 .. $-1 ],
         character, keyCode, stateMask, doit );
 }
 }
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/KeyListener.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/KeyListener.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,8 +12,6 @@
  *******************************************************************************/
 module org.eclipse.swt.events.KeyListener;
 
-import java.lang.all;
-
 
 public import org.eclipse.swt.internal.SWTEventListener;
 public import org.eclipse.swt.events.KeyEvent;
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/MenuAdapter.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/MenuAdapter.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,8 +12,6 @@
  *******************************************************************************/
 module org.eclipse.swt.events.MenuAdapter;
 
-import java.lang.all;
-
 import org.eclipse.swt.events.MenuListener;
 
 /**
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/MenuDetectEvent.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/MenuDetectEvent.d	Sat Jul 09 15:50:20 2011 +0300
@@ -70,6 +70,6 @@
  * @return a string representation of the event
  */
 public override String toString() {
-    return Format( "{} x={} y={} doit={}}", super.toString[ 0 .. $-2 ], x, y, doit );
+    return Format( "{} x={} y={} doit={}}", super.toString[ 0 .. $-1 ], x, y, doit );
 }
 }
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/MenuDetectListener.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/MenuDetectListener.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,8 +12,6 @@
  *******************************************************************************/
 module org.eclipse.swt.events.MenuDetectListener;
 
-import java.lang.all;
-
 
 public import org.eclipse.swt.internal.SWTEventListener;
 public import org.eclipse.swt.events.MenuDetectEvent;
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/MenuEvent.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/MenuEvent.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,8 +12,6 @@
  *******************************************************************************/
 module org.eclipse.swt.events.MenuEvent;
 
-import java.lang.all;
-
 
 import org.eclipse.swt.widgets.Event;
 import org.eclipse.swt.events.TypedEvent;
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/MenuListener.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/MenuListener.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,8 +12,6 @@
  *******************************************************************************/
 module org.eclipse.swt.events.MenuListener;
 
-import java.lang.all;
-
 
 public import org.eclipse.swt.internal.SWTEventListener;
 public import org.eclipse.swt.events.MenuEvent;
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/ModifyEvent.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/ModifyEvent.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,8 +12,6 @@
  *******************************************************************************/
 module org.eclipse.swt.events.ModifyEvent;
 
-import java.lang.all;
-
 
 import org.eclipse.swt.widgets.Event;
 import org.eclipse.swt.events.TypedEvent;
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/ModifyListener.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/ModifyListener.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,8 +12,6 @@
  *******************************************************************************/
 module org.eclipse.swt.events.ModifyListener;
 
-import java.lang.all;
-
 
 public import org.eclipse.swt.internal.SWTEventListener;
 public import org.eclipse.swt.events.ModifyEvent;
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/MouseAdapter.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/MouseAdapter.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,8 +12,6 @@
  *******************************************************************************/
 module org.eclipse.swt.events.MouseAdapter;
 
-import java.lang.all;
-
 import org.eclipse.swt.events.MouseListener;
 
 /**
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/MouseListener.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/MouseListener.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,8 +12,6 @@
  *******************************************************************************/
 module org.eclipse.swt.events.MouseListener;
 
-import java.lang.all;
-
 
 public import org.eclipse.swt.internal.SWTEventListener;
 public import org.eclipse.swt.events.MouseEvent;
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/MouseMoveListener.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/MouseMoveListener.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,8 +12,6 @@
  *******************************************************************************/
 module org.eclipse.swt.events.MouseMoveListener;
 
-import java.lang.all;
-
 
 public import org.eclipse.swt.internal.SWTEventListener;
 public import org.eclipse.swt.events.MouseEvent;
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/MouseTrackAdapter.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/MouseTrackAdapter.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,8 +12,6 @@
  *******************************************************************************/
 module org.eclipse.swt.events.MouseTrackAdapter;
 
-import java.lang.all;
-
 import org.eclipse.swt.events.MouseTrackListener;
 
 /**
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/MouseTrackListener.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/MouseTrackListener.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,8 +12,6 @@
  *******************************************************************************/
 module org.eclipse.swt.events.MouseTrackListener;
 
-import java.lang.all;
-
 
 public import org.eclipse.swt.internal.SWTEventListener;
 public import org.eclipse.swt.events.MouseEvent;
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/MouseWheelListener.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/MouseWheelListener.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,8 +12,6 @@
  *******************************************************************************/
 module org.eclipse.swt.events.MouseWheelListener;
 
-import java.lang.all;
-
 
 public import org.eclipse.swt.internal.SWTEventListener;
 public import org.eclipse.swt.events.MouseEvent;
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/PaintListener.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/PaintListener.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,8 +12,6 @@
  *******************************************************************************/
 module org.eclipse.swt.events.PaintListener;
 
-import java.lang.all;
-
 
 public import org.eclipse.swt.internal.SWTEventListener;
 public import org.eclipse.swt.events.PaintEvent;
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/SelectionAdapter.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/SelectionAdapter.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,8 +12,6 @@
  *******************************************************************************/
 module org.eclipse.swt.events.SelectionAdapter;
 
-import java.lang.all;
-
 import org.eclipse.swt.events.SelectionListener;
 
 /**
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/SelectionEvent.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/SelectionEvent.d	Sat Jul 09 15:50:20 2011 +0300
@@ -132,7 +132,7 @@
  */
 public override String toString() {
     return Format( "{} item={} detail={} x={} y={} width={} height={} stateMask={} text={} doit={}}",
-        super.toString[ 0 .. $-2 ],
+        super.toString[ 0 .. $-1 ],
         item,
         detail,
         x,
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/SelectionListener.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/SelectionListener.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,8 +12,6 @@
  *******************************************************************************/
 module org.eclipse.swt.events.SelectionListener;
 
-import java.lang.all;
-
 
 public import org.eclipse.swt.internal.SWTEventListener;
 public import org.eclipse.swt.events.SelectionEvent;
@@ -85,11 +83,11 @@
     version(Tango){
         alias ParameterTupleOf!(Dg) DgArgs;
         static assert( is(DgArgs == Tuple!(SelectionEvent,T)),
-                    "Delegate args not correct: "~DgArgs.stringof~" vs. (Event,"~T.stringof~")" );
+                "Delegate args not correct: "~DgArgs.stringof~" vs. (Event,"~T.stringof~")" );
     } else { // Phobos
         alias ParameterTypeTuple!(Dg) DgArgs;
         static assert( is(DgArgs == TypeTuple!(SelectionEvent,T)),
-                    "Delegate args not correct: "~DgArgs.stringof~" vs. (Event,"~T.stringof~")" );
+                "Delegate args not correct: "~DgArgs.stringof~" vs. (Event,"~T.stringof~")" );
     }
 
     Dg dg;
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/ShellAdapter.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/ShellAdapter.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,8 +12,6 @@
  *******************************************************************************/
 module org.eclipse.swt.events.ShellAdapter;
 
-import java.lang.all;
-
 import org.eclipse.swt.events.ShellListener;
 
 /**
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/ShellEvent.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/ShellEvent.d	Sat Jul 09 15:50:20 2011 +0300
@@ -54,7 +54,7 @@
  * @return a string representation of the event
  */
 public override String toString() {
-    return Format( "{} doit={}}", super.toString[ 0 .. $-2 ], doit );
+    return Format( "{} doit={}}", super.toString[ 0 .. $-1 ], doit );
 }
 }
 
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/ShellListener.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/ShellListener.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,8 +12,6 @@
  *******************************************************************************/
 module org.eclipse.swt.events.ShellListener;
 
-import java.lang.all;
-
 
 public import org.eclipse.swt.internal.SWTEventListener;
 public import org.eclipse.swt.events.ShellEvent;
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/TraverseEvent.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/TraverseEvent.d	Sat Jul 09 15:50:20 2011 +0300
@@ -134,6 +134,6 @@
  * @return a string representation of the event
  */
 public override String toString() {
-    return Format( "{} detail={}}", super.toString[ 0 .. $-2 ], detail );
+    return Format( "{} detail={}}", super.toString[ 0 .. $-1 ], detail );
 }
 }
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/TraverseListener.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/TraverseListener.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,8 +12,6 @@
  *******************************************************************************/
 module org.eclipse.swt.events.TraverseListener;
 
-import java.lang.all;
-
 
 public import org.eclipse.swt.internal.SWTEventListener;
 public import org.eclipse.swt.events.TraverseEvent;
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/TreeAdapter.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/TreeAdapter.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,8 +12,6 @@
  *******************************************************************************/
 module org.eclipse.swt.events.TreeAdapter;
 
-import java.lang.all;
-
 import org.eclipse.swt.events.TreeListener;
 
 /**
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/TreeEvent.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/TreeEvent.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,8 +12,6 @@
  *******************************************************************************/
 module org.eclipse.swt.events.TreeEvent;
 
-import java.lang.all;
-
 
 import org.eclipse.swt.widgets.Event;
 import org.eclipse.swt.events.SelectionEvent;
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/TreeListener.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/TreeListener.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,8 +12,6 @@
  *******************************************************************************/
 module org.eclipse.swt.events.TreeListener;
 
-import java.lang.all;
-
 
 public import org.eclipse.swt.internal.SWTEventListener;
 public import org.eclipse.swt.events.TreeEvent;
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/TypedEvent.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/TypedEvent.d	Sat Jul 09 15:50:20 2011 +0300
@@ -103,6 +103,6 @@
 public override String toString() {
     String str_widget = widget is null ? "null" : widget.toString;
     String str_data   = data is null ? "null" : data.toString;
-    return Format( "{}{{time={} data={}}", str_widget, time, str_data );
+    return Format( "{}{{{} time={} data={}}", getName(), str_widget, time, str_data );
 }
 }
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/VerifyEvent.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/VerifyEvent.d	Sat Jul 09 15:50:20 2011 +0300
@@ -63,6 +63,6 @@
  * @return a string representation of the event
  */
 public override String toString() {
-    return Format( "{} start={} end={} text={}}", super.toString[ 0 .. $-2 ], start, end, text );
+    return Format( "{} start={} end={} text={}}", super.toString[ 0 .. $-1 ], start, end, text );
 }
 }
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/VerifyListener.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/VerifyListener.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,8 +12,6 @@
  *******************************************************************************/
 module org.eclipse.swt.events.VerifyListener;
 
-import java.lang.all;
-
 
 public import org.eclipse.swt.internal.SWTEventListener;
 public import org.eclipse.swt.events.VerifyEvent;
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/all.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/all.d	Sat Jul 09 15:50:20 2011 +0300
@@ -1,56 +1,54 @@
 module org.eclipse.swt.events.all;
 
-import java.lang.all;
-
+public import org.eclipse.swt.events.ArmEvent;
+public import org.eclipse.swt.events.ArmListener;
+public import org.eclipse.swt.events.ControlAdapter;
+public import org.eclipse.swt.events.ControlEvent;
+public import org.eclipse.swt.events.ControlListener;
+public import org.eclipse.swt.events.DisposeEvent;
+public import org.eclipse.swt.events.DisposeListener;
+public import org.eclipse.swt.events.DragDetectEvent;
+public import org.eclipse.swt.events.DragDetectListener;
+public import org.eclipse.swt.events.ExpandAdapter;
+public import org.eclipse.swt.events.ExpandEvent;
+public import org.eclipse.swt.events.ExpandListener;
+public import org.eclipse.swt.events.FocusAdapter;
 public import org.eclipse.swt.events.FocusEvent;
+public import org.eclipse.swt.events.FocusListener;
+public import org.eclipse.swt.events.HelpEvent;
+public import org.eclipse.swt.events.HelpListener;
+public import org.eclipse.swt.events.KeyAdapter;
+public import org.eclipse.swt.events.KeyEvent;
+public import org.eclipse.swt.events.KeyListener;
+public import org.eclipse.swt.events.MenuAdapter;
+public import org.eclipse.swt.events.MenuDetectEvent;
+public import org.eclipse.swt.events.MenuDetectListener;
+public import org.eclipse.swt.events.MenuEvent;
 public import org.eclipse.swt.events.MenuListener;
-public import org.eclipse.swt.events.ShellAdapter;
+public import org.eclipse.swt.events.ModifyEvent;
 public import org.eclipse.swt.events.ModifyListener;
+public import org.eclipse.swt.events.MouseAdapter;
+public import org.eclipse.swt.events.MouseEvent;
 public import org.eclipse.swt.events.MouseListener;
-public import org.eclipse.swt.events.MenuEvent;
-public import org.eclipse.swt.events.TraverseEvent;
-public import org.eclipse.swt.events.VerifyEvent;
-public import org.eclipse.swt.events.KeyEvent;
-public import org.eclipse.swt.events.FocusListener;
+public import org.eclipse.swt.events.MouseMoveListener;
+public import org.eclipse.swt.events.MouseTrackAdapter;
+public import org.eclipse.swt.events.MouseTrackListener;
+public import org.eclipse.swt.events.MouseWheelListener;
 public import org.eclipse.swt.events.PaintEvent;
-public import org.eclipse.swt.events.ModifyEvent;
-public import org.eclipse.swt.events.MouseWheelListener;
-public import org.eclipse.swt.events.DragDetectListener;
-public import org.eclipse.swt.events.MouseTrackAdapter;
-public import org.eclipse.swt.events.MouseEvent;
-public import org.eclipse.swt.events.ControlListener;
+public import org.eclipse.swt.events.PaintListener;
+public import org.eclipse.swt.events.SelectionAdapter;
+public import org.eclipse.swt.events.SelectionEvent;
+public import org.eclipse.swt.events.SelectionListener;
+public import org.eclipse.swt.events.ShellAdapter;
+public import org.eclipse.swt.events.ShellEvent;
+public import org.eclipse.swt.events.ShellListener;
+public import org.eclipse.swt.events.TraverseEvent;
 public import org.eclipse.swt.events.TraverseListener;
-public import org.eclipse.swt.events.ExpandAdapter;
-public import org.eclipse.swt.events.SelectionEvent;
-public import org.eclipse.swt.events.DragDetectEvent;
-public import org.eclipse.swt.events.KeyAdapter;
-public import org.eclipse.swt.events.MenuDetectEvent;
+public import org.eclipse.swt.events.TreeAdapter;
+public import org.eclipse.swt.events.TreeEvent;
+public import org.eclipse.swt.events.TreeListener;
 public import org.eclipse.swt.events.TypedEvent;
-public import org.eclipse.swt.events.ArmListener;
-public import org.eclipse.swt.events.ArmEvent;
-public import org.eclipse.swt.events.ShellListener;
-public import org.eclipse.swt.events.ControlEvent;
-public import org.eclipse.swt.events.MouseAdapter;
+public import org.eclipse.swt.events.VerifyEvent;
 public import org.eclipse.swt.events.VerifyListener;
-public import org.eclipse.swt.events.MouseTrackListener;
-public import org.eclipse.swt.events.KeyListener;
-public import org.eclipse.swt.events.ExpandEvent;
-public import org.eclipse.swt.events.ControlAdapter;
-public import org.eclipse.swt.events.MenuAdapter;
-public import org.eclipse.swt.events.FocusAdapter;
-public import org.eclipse.swt.events.ShellEvent;
-public import org.eclipse.swt.events.MouseMoveListener;
-public import org.eclipse.swt.events.SelectionAdapter;
-public import org.eclipse.swt.events.HelpListener;
-public import org.eclipse.swt.events.TreeAdapter;
-public import org.eclipse.swt.events.SelectionListener;
-public import org.eclipse.swt.events.TreeEvent;
-public import org.eclipse.swt.events.MenuDetectListener;
-public import org.eclipse.swt.events.DisposeListener;
-public import org.eclipse.swt.events.HelpEvent;
-public import org.eclipse.swt.events.PaintListener;
-public import org.eclipse.swt.events.DisposeEvent;
-public import org.eclipse.swt.events.TreeListener;
-public import org.eclipse.swt.events.ExpandListener;
 
 
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/graphics/Color.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/graphics/Color.d	Sat Jul 09 15:50:20 2011 +0300
@@ -110,7 +110,7 @@
  *
  * @see #dispose
  */
-public this(Device device, RGB rgb) {
+public this(Device device, in RGB rgb) {
     super(device);
     if (rgb is null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
     init_(rgb.red, rgb.green, rgb.blue);
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/graphics/Cursor.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/graphics/Cursor.d	Sat Jul 09 15:50:20 2011 +0300
@@ -442,7 +442,7 @@
     init_();
 }
 
-GdkCursor* createCursor(byte[] sourceData, byte[] maskData, int width, int height, int hotspotX, int hotspotY, bool reverse) {
+GdkCursor* createCursor(in byte[] sourceData, in byte[] maskData, int width, int height, int hotspotX, int hotspotY, bool reverse) {
     auto sourcePixmap = OS.gdk_bitmap_create_from_data(null, cast(char*)sourceData.ptr, width, height);
     auto maskPixmap = OS.gdk_bitmap_create_from_data(null, cast(char*)maskData.ptr, width, height);
     GdkCursor* cursor = null;
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/graphics/Font.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/graphics/Font.d	Sat Jul 09 15:50:20 2011 +0300
@@ -140,13 +140,13 @@
  *    <li>ERROR_NO_HANDLES - if a font could not be created from the given arguments</li>
  * </ul>
  */
-public this(Device device, in String name, int height, int style) {
+public this(Device device, String name, int height, int style) {
     super(device);
     init_(name, height, style, null);
     init_();
 }
 
-/*public*/ this(Device device, in String name, float height, int style) {
+/*public*/ this(Device device, String name, float height, int style) {
     super(device);
     init_(name, height, style, null);
     init_();
@@ -243,7 +243,7 @@
     return cast(hash_t)/*64*/handle;
 }
 
-void init_( in String name, float height, int style, in String fontString) {
+void init_( String name, float height, int style, String fontString) {
     if (name is null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
     if (height < 0) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
     if (fontString !is null) {
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/graphics/GC.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/graphics/GC.d	Sat Jul 09 15:50:20 2011 +0300
@@ -313,7 +313,7 @@
         }
         if ((state & LINE_STYLE) !is 0) {
             float dashesOffset = 0;
-            float[] dashes = null;
+            TryConst!(float)[] dashes = null;
             float width = data.lineWidth;
             switch (data.lineStyle) {
                 case SWT.LINE_SOLID: break;
@@ -386,7 +386,7 @@
         int join_style = 0;
         int width = cast(int)data.lineWidth;
         int line_style = 0;
-        float[] dashes = null;
+        TryConst!(float)[] dashes = null;
         switch (data.lineCap) {
             case SWT.CAP_ROUND: cap_style = OS.GDK_CAP_ROUND; break;
             case SWT.CAP_FLAT: cap_style = OS.GDK_CAP_BUTT; break;
@@ -724,7 +724,7 @@
         OS.gtk_widget_style_get1(data.device.shellHandle, OS.focus_line_width.ptr, &lineWidth );
         Cairo.cairo_save(cairo);
         Cairo.cairo_set_line_width(cairo, lineWidth);
-        double[] dashes = [1, 1];
+        double[2] dashes = 1;
         double dash_offset = -lineWidth / 2f;
         while (dash_offset < 0) dash_offset += 2;
         Cairo.cairo_set_dash(cairo, dashes.ptr, dashes.length, dash_offset);
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/graphics/ImageLoaderEvent.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/graphics/ImageLoaderEvent.d	Sat Jul 09 15:50:20 2011 +0300
@@ -88,7 +88,7 @@
  * @return a string representation of the event
  */
 public override String toString () {
-    return Format( "ImageLoaderEvent {source={} imageData={} incrementCount={} endOfImage={}}", source, imageData, incrementCount, endOfImage); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+    return Format( "ImageLoaderEvent {{source={} imageData={} incrementCount={} endOfImage={}}", source, imageData, incrementCount, endOfImage); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
 }
 
 }
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/graphics/TextLayout.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/graphics/TextLayout.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,8 +12,6 @@
  *******************************************************************************/
 module org.eclipse.swt.graphics.TextLayout;
 
-import java.lang.all;
-
 import org.eclipse.swt.internal.Compatibility;
 import org.eclipse.swt.internal.cairo.Cairo : Cairo;
 import org.eclipse.swt.internal.gtk.OS;
@@ -32,6 +30,7 @@
 import org.eclipse.swt.graphics.Resource;
 import org.eclipse.swt.graphics.TextStyle;
 import java.lang.all;
+import java.nonstandard.UnsafeUtf;
 
 version(Tango){
     import tango.stdc.string : memmove;
@@ -188,7 +187,7 @@
         int i = 0;
         while( i < chars.length ){
             int incr;
-            dchar c = firstCodePoint( chars[ i .. $ ], incr );
+            dchar c = chars.dcharAt(i, incr);
             if (c is LTR_MARK || c is RTL_MARK || c is ZWNBS || c is ZWS) {
                 offsetCount+=3;
             }
@@ -201,7 +200,7 @@
         int i = 0;
         while( i < chars.length ){
             int incr;
-            dchar c = firstCodePoint( chars[ i .. $ ], incr );
+            dchar c = chars.dcharAt(i, incr);
             if (c is LTR_MARK || c is RTL_MARK || c is ZWNBS || c is ZWS) {
                 invalidOffsets[offsetCount++] = i;
                 invalidOffsets[offsetCount++] = i+1;
@@ -617,7 +616,7 @@
                 if (color is null && style.foreground !is null) color = style.foreground.handle;
                 if (color is null) color = data.foreground;
                 int width = 1;
-                float[] dashes = null;
+                TryConst!(float)[] dashes = null;
                 switch (style.borderStyle) {
                     case SWT.BORDER_SOLID: break;
                     case SWT.BORDER_DASH: dashes = width !is 0 ? GC.LINE_DASH : GC.LINE_DASH_ZERO; break;
@@ -949,11 +948,11 @@
     end = translateOffset(end);
     auto ptr = OS.pango_layout_get_text(layout);
     auto cont = fromStringz(ptr);
-    start = cont.utf8AdjustOffset( start );
-    end = cont.utf8AdjustOffset( end );
+    cont.adjustUTF8index( start );
+    cont.adjustUTF8index( end );
     int incr = 1;
     if( end < cont.length ){
-        incr = cont.getRelativeCodePointOffset( end, 1 );
+        incr = cont.UTF8strideAt(end);
     }
     int byteStart = start;//(OS.g_utf8_offset_to_pointer (ptr, start) - ptr);
     int byteEnd = end + incr;//(OS.g_utf8_offset_to_pointer (ptr, end + 1) - ptr);
@@ -1289,7 +1288,7 @@
     offset = translateOffset(offset);
     auto ptr = OS.pango_layout_get_text(layout);
     auto cont = fromStringz(ptr);
-    offset = cont.utf8AdjustOffset(offset);
+    cont.adjustUTF8index(offset);
     // leading ZWS+ZWNBS are 2 codepoints in 6 bytes, so we miss 4 bytes here
     int byteOffset = offset;//(OS.g_utf8_offset_to_pointer(ptr, offset) - ptr);
     int slen = cont.length;
@@ -1345,8 +1344,8 @@
     if ((movement & SWT.MOVEMENT_CHAR) !is 0){
         //PORTING take care of utf8
         int toffset = translateOffset(offset);
-        toffset = dcont.utf8AdjustOffset( toffset );
-        int incr = dcont.getRelativeCodePointOffset( toffset, step );
+        dcont.adjustUTF8index( toffset );
+        int incr = dcont.toUTF8shift(toffset, step);
         return offset + incr;
     }
     PangoLogAttr* attrs;
@@ -1356,7 +1355,7 @@
     if (attrs is null) return offset + step;
     length_ = dcont.length;//OS.g_utf8_strlen(cont, -1);
     offset = translateOffset(offset);
-    offset = dcont.utf8AdjustOffset( offset );
+    dcont.adjustUTF8index( offset );
 
     PangoLogAttr* logAttr;
     offset = validateOffset( dcont, offset, step);
@@ -1971,8 +1970,8 @@
     if (start > end) return;
     start = Math.min(Math.max(0, start), length_ - 1);
     end = Math.min(Math.max(0, end), length_ - 1);
-    start = text.utf8AdjustOffset( start );
-    end = text.utf8AdjustOffset( end );
+    text.adjustUTF8index( start );
+    text.adjustUTF8index( end );
 
 
     /*
@@ -1982,12 +1981,11 @@
     *
     * NOTE that fix only LamAlef ligatures.
     */
-    int relIndex;
-    if ((start > 0 ) && isAlef(text[ start .. $ ].firstCodePoint()) && isLam(text.getRelativeCodePoint( start, -1, relIndex ))) {
-        start += relIndex;
+    if ((start > 0 ) && isAlef(text.dcharAt(start)) && isLam(text.dcharBefore(start))) {
+        start += text.offsetBefore(start);
     }
-    if ((end < length_ - 1) && isLam(text[ end .. $ ].firstCodePoint()) && isAlef(text.getRelativeCodePoint(end, 1,relIndex))) {
-        end += relIndex;
+    if ((end < length_ - 1) && isLam(text.dcharAt(end)) && isAlef(text.dcharAfter(end))) {
+        end = text.offsetAfter(end);
     }
 
     int low = -1;
@@ -2213,7 +2211,7 @@
     return offset - invalidOffsets.length;
 }
 
-int validateOffset( CString cont, int offset, int step) {
+int validateOffset( in char[] cont, int offset, int step) {
     if (invalidOffsets is null) return offset + step;
     int i = step > 0 ? 0 : invalidOffsets.length - 1;
     do {
@@ -2221,7 +2219,7 @@
             offset += step;
         }
         else{
-            offset += cont.getRelativeCodePointOffset( offset, step );
+            offset += cont.toUTF8shift( offset, step );
         }
         while (0 <= i && i < invalidOffsets.length) {
             if (invalidOffsets[i] is offset) break;
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/Compatibility.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/Compatibility.d	Sat Jul 09 15:50:20 2011 +0300
@@ -117,8 +117,9 @@
  * @param child the file's name
  * @return true if the file exists
  */
-public static bool fileExists(CString parent, CString child) {
-    return (new File (parent, child)).exists();
+public static bool fileExists(String parent, String child) {
+    scope f = new File(parent, child);
+    return f.exists();
 }
 
 /**
@@ -192,8 +193,8 @@
  * @return a stream on the file if it could be opened.
  * @exception IOException
  */
-public static InputStream newFileInputStream(CString filename) {
-    return new FileInputStream(filename._idup());
+public static InputStream newFileInputStream(String filename) {
+    return new FileInputStream(filename);
 }
 
 /**
@@ -203,8 +204,8 @@
  * @return a stream on the file if it could be opened.
  * @exception IOException
  */
-public static OutputStream newFileOutputStream(CString filename) {
-    return new FileOutputStream(filename._idup());
+public static OutputStream newFileOutputStream(String filename) {
+    return new FileOutputStream(filename);
 }
 
 /**
@@ -272,12 +273,12 @@
  * @exception ProcessException
  *  if the program cannot be executed
  */
-public static void exec(CString prog) {
+public static void exec(String prog) {
     version(Tango){
         auto proc = new Process( prog );
         proc.execute;
     } else { // Phobos
-        implMissing( __FILE__, __LINE__ );
+        implMissingInPhobos();
     }
 }
 
@@ -293,12 +294,12 @@
  * @exception ProcessException
  *  if the program cannot be executed
  */
-public static void exec(CString[] progArray) {
+public static void exec(String[] progArray) {
     version(Tango){
         auto proc = new Process( progArray );
         proc.execute;
     } else { // Phobos
-        implMissing( __FILE__, __LINE__ );
+        implMissingInPhobos();
     }
 }
 
@@ -341,8 +342,8 @@
  *
  * @see SWT#getMessage(String)
  */
-public static String getMessage(CString key) {
-    String answer = key._idup();
+public static String getMessage(String key) {
+    String answer = key;
 
     if (key is null) {
         SWT.error (SWT.ERROR_NULL_ARGUMENT);
@@ -351,7 +352,7 @@
         try {
             msgs = ResourceBundle.getBundle(SWTMessagesBundleData); //$NON-NLS-1$
         } catch (MissingResourceException ex) {
-            answer = cast(String)(key ~ " (no resource bundle)"); //$NON-NLS-1$
+            answer = key ~ " (no resource bundle)"; //$NON-NLS-1$
         }
     }
     if (msgs !is null) {
@@ -362,8 +363,8 @@
     return answer;
 }
 
-public static String getMessage(CString key, Object[] args) {
-    String answer = key._idup();
+public static String getMessage(String key, Object[] args) {
+    String answer = key;
 
     if (key is null || args is null) {
         SWT.error (SWT.ERROR_NULL_ARGUMENT);
@@ -372,7 +373,7 @@
         try {
             msgs = ResourceBundle.getBundle(SWTMessagesBundleData); //$NON-NLS-1$
         } catch (MissingResourceException ex) {
-            answer = cast(String)(key ~ " (no resource bundle)"); //$NON-NLS-1$
+            answer = key ~ " (no resource bundle)"; //$NON-NLS-1$
         }
     }
     if (msgs !is null) {
@@ -413,20 +414,8 @@
  * @param s2 string
  * @return true if the two instances of class String are equal
  */
-public static bool equalsIgnoreCase(CString s1, CString s2) {
-    version(Tango){
-        String s1b = new char[ s1.length ];
-        String s2b = new char[ s1.length ];
-        scope(exit){
-            delete s1b;
-            delete s2b;
-        }
-        String s1c = Unicode.toFold( s1, s1b );
-        String s2c = Unicode.toFold( s2, s2b );
-        return s1c == s2c;
-    } else { // Phobos
-        return std.string.icmp( s1, s2 ) is 0;
-    }
+public static bool equalsIgnoreCase(in char[] s1, in char[] s2) {
+    return .equalsIgnoreCase(s1, s2);
 }
 
 }
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/c/XInput.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/c/XInput.d	Sat Jul 09 15:50:20 2011 +0300
@@ -552,7 +552,7 @@
         Symbol("XUngrabDevice",  cast(void**)& XUngrabDevice),
         Symbol("XGrabDevice",  cast(void**)& XGrabDevice),
         Symbol("XChangePointerDevice",  cast(void**)& XChangePointerDevice),
-        Symbol("XChangeKeyboardDevice",  cast(void**)& XChangeKeyboardDevice),
+        Symbol("XChangeKeyboardDevice",  cast(void**)& XChangeKeyboardDevice)
     ];
 }
 
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/c/XTest.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/c/XTest.d	Sat Jul 09 15:50:20 2011 +0300
@@ -63,7 +63,7 @@
         Symbol("XTestFakeKeyEvent",  cast(void**)& XTestFakeKeyEvent),
         Symbol("XTestCompareCurrentCursorWithWindow",  cast(void**)& XTestCompareCurrentCursorWithWindow),
         Symbol("XTestCompareCursorWithWindow",  cast(void**)& XTestCompareCursorWithWindow),
-        Symbol("XTestQueryExtension",  cast(void**)& XTestQueryExtension),
+        Symbol("XTestQueryExtension",  cast(void**)& XTestQueryExtension)
     ];
 }
 
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/c/Xlib.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/c/Xlib.d	Sat Jul 09 15:50:20 2011 +0300
@@ -1782,7 +1782,7 @@
         Symbol("XQueryFont",  cast(void**)& XQueryFont),
         Symbol("XLoadQueryFont",  cast(void**)& XLoadQueryFont),
         Symbol("_Xdebug",  cast(void**)& _Xdebug),
-        Symbol("_Xmblen",  cast(void**)& _Xmblen),
+        Symbol("_Xmblen",  cast(void**)& _Xmblen)
     ];
 }
 
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/c/Xrender.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/c/Xrender.d	Sat Jul 09 15:50:20 2011 +0300
@@ -275,7 +275,7 @@
         Symbol("XRenderQuerySubpixelOrder",  cast(void**)& XRenderQuerySubpixelOrder),
         Symbol("XRenderQueryFormats",  cast(void**)& XRenderQueryFormats),
         Symbol("XRenderQueryVersion",  cast(void**)& XRenderQueryVersion),
-        Symbol("XRenderQueryExtension",  cast(void**)& XRenderQueryExtension),
+        Symbol("XRenderQueryExtension",  cast(void**)& XRenderQueryExtension)
     ];
 }
 
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/c/Xutil.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/c/Xutil.d	Sat Jul 09 15:50:20 2011 +0300
@@ -292,7 +292,7 @@
         Symbol("XAllocStandardColormap",  cast(void**)& XAllocStandardColormap),
         Symbol("XAllocSizeHints",  cast(void**)& XAllocSizeHints),
         Symbol("XAllocIconSize",  cast(void**)& XAllocIconSize),
-        Symbol("XAllocClassHint",  cast(void**)& XAllocClassHint),
+        Symbol("XAllocClassHint",  cast(void**)& XAllocClassHint)
     ];
 }
 
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/c/atk.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/c/atk.d	Sat Jul 09 15:50:20 2011 +0300
@@ -1289,7 +1289,7 @@
         Symbol("atk_role_register",  cast(void**)& atk_role_register),
         Symbol("atk_state_type_for_name",  cast(void**)& atk_state_type_for_name),
         Symbol("atk_state_type_get_name",  cast(void**)& atk_state_type_get_name),
-        Symbol("atk_state_type_register",  cast(void**)& atk_state_type_register),
+        Symbol("atk_state_type_register",  cast(void**)& atk_state_type_register)
     ];
 }
 
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/c/cairo.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/c/cairo.d	Sat Jul 09 15:50:20 2011 +0300
@@ -691,7 +691,7 @@
         Symbol("cairo_reference",  cast(void**)& cairo_reference),
         Symbol("cairo_create",  cast(void**)& cairo_create),
         Symbol("cairo_version_string",  cast(void**)& cairo_version_string),
-        Symbol("cairo_version",  cast(void**)& cairo_version),
+        Symbol("cairo_version",  cast(void**)& cairo_version)
     ];
 }
 
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/c/cairo_pdf.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/c/cairo_pdf.d	Sat Jul 09 15:50:20 2011 +0300
@@ -25,7 +25,7 @@
     symbols = [
         Symbol("cairo_pdf_surface_set_size",  cast(void**)& cairo_pdf_surface_set_size),
         Symbol("cairo_pdf_surface_create_for_stream",  cast(void**)& cairo_pdf_surface_create_for_stream),
-        Symbol("cairo_pdf_surface_create",  cast(void**)& cairo_pdf_surface_create),
+        Symbol("cairo_pdf_surface_create",  cast(void**)& cairo_pdf_surface_create)
     ];
 }
 
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/c/cairo_ps.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/c/cairo_ps.d	Sat Jul 09 15:50:20 2011 +0300
@@ -43,7 +43,7 @@
         Symbol("cairo_ps_surface_dsc_comment",  cast(void**)& cairo_ps_surface_dsc_comment),
         Symbol("cairo_ps_surface_set_size",  cast(void**)& cairo_ps_surface_set_size),
         Symbol("cairo_ps_surface_create_for_stream",  cast(void**)& cairo_ps_surface_create_for_stream),
-        Symbol("cairo_ps_surface_create",  cast(void**)& cairo_ps_surface_create),
+        Symbol("cairo_ps_surface_create",  cast(void**)& cairo_ps_surface_create)
     ];
 }
 
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/c/cairo_xlib.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/c/cairo_xlib.d	Sat Jul 09 15:50:20 2011 +0300
@@ -50,7 +50,7 @@
         Symbol("cairo_xlib_surface_set_drawable",  cast(void**)& cairo_xlib_surface_set_drawable),
         Symbol("cairo_xlib_surface_set_size",  cast(void**)& cairo_xlib_surface_set_size),
         Symbol("cairo_xlib_surface_create_for_bitmap",  cast(void**)& cairo_xlib_surface_create_for_bitmap),
-        Symbol("cairo_xlib_surface_create",  cast(void**)& cairo_xlib_surface_create),
+        Symbol("cairo_xlib_surface_create",  cast(void**)& cairo_xlib_surface_create)
     ];
 }
 
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/c/cairo_xlib_xrender.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/c/cairo_xlib_xrender.d	Sat Jul 09 15:50:20 2011 +0300
@@ -28,7 +28,7 @@
 Symbol[] symbols;
 static this () {
     symbols = [
-        Symbol("cairo_xlib_surface_create_with_xrender_format",  cast(void**)& cairo_xlib_surface_create_with_xrender_format),
+        Symbol("cairo_xlib_surface_create_with_xrender_format",  cast(void**)& cairo_xlib_surface_create_with_xrender_format)
     ];
 }
 
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/c/gdk.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/c/gdk.d	Sat Jul 09 15:50:20 2011 +0300
@@ -2752,7 +2752,7 @@
         Symbol("gdk_colormap_unref",  cast(void**)& gdk_colormap_unref),
         Symbol("gdk_colormap_ref",  cast(void**)& gdk_colormap_ref),
         Symbol("gdk_colormap_new",  cast(void**)& gdk_colormap_new),
-        Symbol("gdk_colormap_get_type",  cast(void**)& gdk_colormap_get_type),
+        Symbol("gdk_colormap_get_type",  cast(void**)& gdk_colormap_get_type)
     ];
 }
 
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/c/gdkx.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/c/gdkx.d	Sat Jul 09 15:50:20 2011 +0300
@@ -200,7 +200,7 @@
         Symbol("gdk_x11_image_get_xdisplay",  cast(void**)& gdk_x11_image_get_xdisplay),
         Symbol("gdk_x11_drawable_get_xid",  cast(void**)& gdk_x11_drawable_get_xid),
         Symbol("gdk_x11_drawable_get_xdisplay",  cast(void**)& gdk_x11_drawable_get_xdisplay),
-        Symbol("gdk_display",  cast(void**)& gdk_display),
+        Symbol("gdk_display",  cast(void**)& gdk_display)
     ];
 }
 
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/c/glib_object.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/c/glib_object.d	Sat Jul 09 15:50:20 2011 +0300
@@ -4413,7 +4413,7 @@
         Symbol("g_array_append_vals",  cast(void**)& g_array_append_vals),
         Symbol("g_array_free",  cast(void**)& g_array_free),
         Symbol("g_array_sized_new",  cast(void**)& g_array_sized_new),
-        Symbol("g_array_new",  cast(void**)& g_array_new),
+        Symbol("g_array_new",  cast(void**)& g_array_new)
     ];
 }
 
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/c/glx.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/c/glx.d	Sat Jul 09 15:50:20 2011 +0300
@@ -294,7 +294,7 @@
         Symbol("glXGetClientString",  cast(void**)& dwt_glXGetClientString),
         Symbol("glXQueryExtensionsString",  cast(void**)& dwt_glXQueryExtensionsString),
         Symbol("glXQueryVersion",  cast(void**)& dwt_glXQueryVersion),
-        Symbol("glXQueryExtension",  cast(void**)& dwt_glXQueryExtension),
+        Symbol("glXQueryExtension",  cast(void**)& dwt_glXQueryExtension)
     ];
 }
 
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/c/gmodule.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/c/gmodule.d	Sat Jul 09 15:50:20 2011 +0300
@@ -76,7 +76,7 @@
         Symbol("g_module_make_resident",  cast(void**)& g_module_make_resident),
         Symbol("g_module_close",  cast(void**)& g_module_close),
         Symbol("g_module_open",  cast(void**)& g_module_open),
-        Symbol("g_module_supported",  cast(void**)& g_module_supported),
+        Symbol("g_module_supported",  cast(void**)& g_module_supported)
     ];
 }
 
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/c/gtk.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/c/gtk.d	Sat Jul 09 15:50:20 2011 +0300
@@ -13085,7 +13085,7 @@
         Symbol( "gtk_accel_group_unlock",  cast(void**)& gtk_accel_group_unlock),
         Symbol( "gtk_accel_group_lock",  cast(void**)& gtk_accel_group_lock),
         Symbol( "gtk_accel_group_new",  cast(void**)& gtk_accel_group_new),
-        Symbol( "gtk_accel_group_get_type",  cast(void**)& gtk_accel_group_get_type),
+        Symbol( "gtk_accel_group_get_type",  cast(void**)& gtk_accel_group_get_type)
     ];
 }
 
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/c/gtk_unix_print_2_0.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/c/gtk_unix_print_2_0.d	Sat Jul 09 15:50:20 2011 +0300
@@ -312,7 +312,7 @@
         Symbol("gtk_page_setup_unix_dialog_get_page_setup",  cast(void**)& gtk_page_setup_unix_dialog_get_page_setup),
         Symbol("gtk_page_setup_unix_dialog_set_page_setup",  cast(void**)& gtk_page_setup_unix_dialog_set_page_setup),
         Symbol("gtk_page_setup_unix_dialog_new",  cast(void**)& gtk_page_setup_unix_dialog_new),
-        Symbol("gtk_page_setup_unix_dialog_get_type",  cast(void**)& gtk_page_setup_unix_dialog_get_type),
+        Symbol("gtk_page_setup_unix_dialog_get_type",  cast(void**)& gtk_page_setup_unix_dialog_get_type)
     ];
 }
 
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/c/pango.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/c/pango.d	Sat Jul 09 15:50:20 2011 +0300
@@ -1243,7 +1243,7 @@
         Symbol("pango_coverage_copy",  cast(void**)& pango_coverage_copy),
         Symbol("pango_coverage_unref",  cast(void**)& pango_coverage_unref),
         Symbol("pango_coverage_ref",  cast(void**)& pango_coverage_ref),
-        Symbol("pango_coverage_new",  cast(void**)& pango_coverage_new),
+        Symbol("pango_coverage_new",  cast(void**)& pango_coverage_new)
     ];
 }
 
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/c/pangocairo.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/c/pangocairo.d	Sat Jul 09 15:50:20 2011 +0300
@@ -130,7 +130,7 @@
         Symbol("pango_cairo_font_map_get_default",  cast(void**)& pango_cairo_font_map_get_default),
         Symbol("pango_cairo_font_map_new_for_font_type",  cast(void**)& pango_cairo_font_map_new_for_font_type),
         Symbol("pango_cairo_font_map_new",  cast(void**)& pango_cairo_font_map_new),
-        Symbol("pango_cairo_font_map_get_type",  cast(void**)& pango_cairo_font_map_get_type),
+        Symbol("pango_cairo_font_map_get_type",  cast(void**)& pango_cairo_font_map_get_type)
     ];
 }
 
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/GIFFileFormat.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/GIFFileFormat.d	Sat Jul 09 15:50:20 2011 +0300
@@ -39,8 +39,8 @@
     static const int GIF_EXTENSION_BLOCK_ID = 0x21;
     static const int GIF_IMAGE_BLOCK_ID = 0x2C;
     static const int GIF_TRAILER_ID = 0x3B;
-    static /+const+/ byte[] GIF89a = cast(byte[])"GIF89a";
-    static /+const+/ byte[] NETSCAPE2_0 = cast(byte[])"NETSCAPE2.0";
+    static const byte[] GIF89a = cast(byte[])"GIF89a";
+    static const byte[] NETSCAPE2_0 = cast(byte[])"NETSCAPE2.0";
 
     /**
      * Answer a palette containing numGrays
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/JPEGAppn.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/JPEGAppn.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,8 +12,6 @@
  *******************************************************************************/
 module org.eclipse.swt.internal.image.JPEGAppn;
 
-import java.lang.all;
-
 import org.eclipse.swt.internal.image.JPEGVariableSizeSegment;
 import org.eclipse.swt.internal.image.JPEGFileFormat;
 import org.eclipse.swt.internal.image.LEDataInputStream;
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/JPEGArithmeticConditioningTable.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/JPEGArithmeticConditioningTable.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,8 +12,6 @@
  *******************************************************************************/
 module org.eclipse.swt.internal.image.JPEGArithmeticConditioningTable;
 
-import java.lang.all;
-
 import org.eclipse.swt.internal.image.JPEGVariableSizeSegment;
 import org.eclipse.swt.internal.image.JPEGFileFormat;
 import org.eclipse.swt.internal.image.LEDataInputStream;
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/JPEGComment.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/JPEGComment.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,8 +12,6 @@
  *******************************************************************************/
 module org.eclipse.swt.internal.image.JPEGComment;
 
-import java.lang.all;
-
 import org.eclipse.swt.internal.image.JPEGVariableSizeSegment;
 import org.eclipse.swt.internal.image.JPEGFileFormat;
 import org.eclipse.swt.internal.image.LEDataInputStream;
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/JPEGDecoder.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/JPEGDecoder.d	Sat Jul 09 15:50:20 2011 +0300
@@ -22,11 +22,6 @@
 import org.eclipse.swt.graphics.RGB;
 import java.lang.all;
 
-version(Tango){
-    import tango.util.Convert;
-} else { // Phobos
-    import std.conv;
-}
 
 public class JPEGDecoder {
 
@@ -5835,7 +5830,7 @@
 
     /* For now, precision must match compiled-in value... */
     if (cinfo.data_precision !is BITS_IN_JSAMPLE)
-        error(" [data precision=" ~ to!(String)(cinfo.data_precision) ~ "]");
+        error(" [data precision=" ~ String_valueOf(cinfo.data_precision) ~ "]");
 //      ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo.data_precision);
 
     /* Check that number of components won't exceed internal array sizes */
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/JPEGEndOfImage.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/JPEGEndOfImage.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,8 +12,6 @@
  *******************************************************************************/
 module org.eclipse.swt.internal.image.JPEGEndOfImage;
 
-import java.lang.all;
-
 import org.eclipse.swt.internal.image.JPEGFixedSizeSegment;
 import org.eclipse.swt.internal.image.JPEGFileFormat;
 import org.eclipse.swt.internal.image.LEDataInputStream;
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/JPEGFixedSizeSegment.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/JPEGFixedSizeSegment.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,8 +12,6 @@
  *******************************************************************************/
 module org.eclipse.swt.internal.image.JPEGFixedSizeSegment;
 
-import java.lang.all;
-
 
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.internal.image.JPEGSegment;
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/JPEGHuffmanTable.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/JPEGHuffmanTable.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,12 +12,11 @@
  *******************************************************************************/
 module org.eclipse.swt.internal.image.JPEGHuffmanTable;
 
-import java.lang.all;
-
 import org.eclipse.swt.internal.image.JPEGVariableSizeSegment;
 import org.eclipse.swt.internal.image.LEDataInputStream;
 import org.eclipse.swt.internal.image.JPEGFileFormat;
 
+import java.lang.System;
 /**
  * JPEGHuffmanTable class actually represents two types of object:
  * 1) A DHT (Define Huffman Tables) segment, which may represent
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/JPEGQuantizationTable.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/JPEGQuantizationTable.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,12 +12,11 @@
  *******************************************************************************/
 module org.eclipse.swt.internal.image.JPEGQuantizationTable;
 
-import java.lang.all;
-
 import org.eclipse.swt.internal.image.LEDataInputStream;
 import org.eclipse.swt.internal.image.JPEGVariableSizeSegment;
 import org.eclipse.swt.internal.image.JPEGFileFormat;
 
+import java.lang.System;
 
 final class JPEGQuantizationTable : JPEGVariableSizeSegment {
     public static byte[] DefaultLuminanceQTable = [
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/JPEGRestartInterval.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/JPEGRestartInterval.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,8 +12,6 @@
  *******************************************************************************/
 module org.eclipse.swt.internal.image.JPEGRestartInterval;
 
-import java.lang.all;
-
 import org.eclipse.swt.internal.image.JPEGFixedSizeSegment;
 import org.eclipse.swt.internal.image.LEDataInputStream;
 import org.eclipse.swt.internal.image.JPEGFileFormat;
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/JPEGSegment.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/JPEGSegment.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,8 +12,6 @@
  *******************************************************************************/
 module org.eclipse.swt.internal.image.JPEGSegment;
 
-import java.lang.all;
-
 import org.eclipse.swt.internal.image.LEDataOutputStream;
 
 
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/JPEGStartOfImage.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/JPEGStartOfImage.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,8 +12,6 @@
  *******************************************************************************/
 module org.eclipse.swt.internal.image.JPEGStartOfImage;
 
-import java.lang.all;
-
 import org.eclipse.swt.internal.image.JPEGFixedSizeSegment;
 import org.eclipse.swt.internal.image.LEDataInputStream;
 import org.eclipse.swt.internal.image.JPEGFileFormat;
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/JPEGVariableSizeSegment.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/JPEGVariableSizeSegment.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,8 +12,6 @@
  *******************************************************************************/
 module org.eclipse.swt.internal.image.JPEGVariableSizeSegment;
 
-import java.lang.all;
-
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.internal.image.JPEGSegment;
 import org.eclipse.swt.internal.image.LEDataInputStream;
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/LEDataInputStream.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/LEDataInputStream.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,10 +12,9 @@
  *******************************************************************************/
 module org.eclipse.swt.internal.image.LEDataInputStream;
 
-import java.lang.all;
-
 
 import java.io.InputStream;
+import java.lang.all;
 
 final class LEDataInputStream : InputStream{
 
@@ -125,7 +124,7 @@
         if (offset < 0 || offset > buffer.length ||
             len < 0 || (len > buffer.length - offset)) {
             throw new ArrayIndexOutOfBoundsException(__FILE__,__LINE__);
-        }
+            }
 
         int cacheCopied = 0;
         int newOffset = offset;
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/LEDataOutputStream.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/LEDataOutputStream.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,8 +12,6 @@
  *******************************************************************************/
 module org.eclipse.swt.internal.image.LEDataOutputStream;
 
-import java.lang.all;
-
 
 import java.io.OutputStream;
 
@@ -30,7 +28,7 @@
  * Write the specified number of bytes of the given byte array,
  * starting at the specified offset, to the output stream.
  */
-public override void write(byte b[], int off, int len) {
+public override void write(in byte b[], int off, int len) {
     ostr.write(b, off, len);
 }
 /**
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/LZWNode.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/LZWNode.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,8 +12,6 @@
  *******************************************************************************/
 module org.eclipse.swt.internal.image.LZWNode;
 
-import java.lang.all;
-
 
 final class LZWNode {
     public LZWNode left, right, children;
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/PngChunk.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/PngChunk.d	Sat Jul 09 15:50:20 2011 +0300
@@ -44,22 +44,19 @@
     // Non-critical chunks.
     static const int CHUNK_tRNS = 5;
 
-    static /+const+/ byte[] TYPE_IHDR = cast(byte[])"IHDR";//{(byte) 'I', (byte) 'H', (byte) 'D', (byte) 'R'};
-    static /+const+/ byte[] TYPE_PLTE = cast(byte[])"PLTE";//{(byte) 'P', (byte) 'L', (byte) 'T', (byte) 'E'};
-    static /+const+/ byte[] TYPE_IDAT = cast(byte[])"IDAT";//{(byte) 'I', (byte) 'D', (byte) 'A', (byte) 'T'};
-    static /+const+/ byte[] TYPE_IEND = cast(byte[])"IEND";//{(byte) 'I', (byte) 'E', (byte) 'N', (byte) 'D'};
-    static /+const+/ byte[] TYPE_tRNS = cast(byte[])"tRNS";//{(byte) 't', (byte) 'R', (byte) 'N', (byte) 'S'};
+    static const byte[] TYPE_IHDR = cast(byte[])"IHDR";//{(byte) 'I', (byte) 'H', (byte) 'D', (byte) 'R'};
+    static const byte[] TYPE_PLTE = cast(byte[])"PLTE";//{(byte) 'P', (byte) 'L', (byte) 'T', (byte) 'E'};
+    static const byte[] TYPE_IDAT = cast(byte[])"IDAT";//{(byte) 'I', (byte) 'D', (byte) 'A', (byte) 'T'};
+    static const byte[] TYPE_IEND = cast(byte[])"IEND";//{(byte) 'I', (byte) 'E', (byte) 'N', (byte) 'D'};
+    static const byte[] TYPE_tRNS = cast(byte[])"tRNS";//{(byte) 't', (byte) 'R', (byte) 'N', (byte) 'S'};
 
     private static int[] _CRC_TABLE = null;
-
-    static int[] CRC_TABLE () {
-        if (!_CRC_TABLE)
-            static_this;
-            
+    static int[] CRC_TABLE() {
+        if (!_CRC_TABLE) static_this();
         return _CRC_TABLE;
     }
-
-    private static void static_this () {
+    //public static void static_this() {
+    private static void static_this() {
         _CRC_TABLE = new int[256];
         for (int i = 0; i < 256; i++) {
             _CRC_TABLE[i] = i;
@@ -193,7 +190,7 @@
  * The fourth byte is upper case if the chunk is unsafe to copy.
  * Public chunk types are defined by the PNG Development Group.
  */
-void setType(byte[] value) {
+void setType(in byte[] value) {
     if (value.length !is TYPE_FIELD_LENGTH) {
         SWT.error (SWT.ERROR_INVALID_ARGUMENT);
     }
@@ -221,7 +218,7 @@
  * 2. It will set the CRC field to the computed CRC
  *    value of the data array given.
  */
-void setData(byte[] data) {
+void setData(in byte[] data) {
     setLength(data.length);
     System.arraycopy(data, 0, reference, DATA_OFFSET, data.length);
     setCRC(computeCRC());
@@ -279,7 +276,7 @@
     return ~crc;
 }
 
-bool typeMatchesArray(byte[] array) {
+bool typeMatchesArray(in byte[] array) {
     for (int i = 0; i < TYPE_FIELD_LENGTH; i++) {
         if (reference[TYPE_OFFSET + i] !is array[i]){
             return false;
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/PngChunkReader.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/PngChunkReader.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,8 +12,6 @@
  *******************************************************************************/
 module org.eclipse.swt.internal.image.PngChunkReader;
 
-import java.lang.all;
-
 
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.internal.image.LEDataInputStream;
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/PngDecodingDataStream.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/PngDecodingDataStream.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,8 +12,6 @@
  *******************************************************************************/
 module org.eclipse.swt.internal.image.PngDecodingDataStream;
 
-import java.lang.all;
-
 
 import java.io.InputStream;
 
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/PngDeflater.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/PngDeflater.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,10 +12,9 @@
  *******************************************************************************/
 module org.eclipse.swt.internal.image.PngDeflater;
 
+import java.io.ByteArrayOutputStream;
 import java.lang.all;
 
-import java.io.ByteArrayOutputStream;
-
 public class PngDeflater {
 
     static const int BASE = 65521;
@@ -24,7 +23,7 @@
     static const int MAX_MATCHES = 32;
     static const int HASH = 8209;
 
-    byte[] istr;
+    TryConst!(byte)[] istr;
     int inLength;
 
     ByteArrayOutputStream bytes;
@@ -122,8 +121,8 @@
 
 }
 
-static /+const+/ Code lengthCodes[];
-static /+const+/ Code distanceCodes[];
+static TryConst!(Code[]) lengthCodes;
+static TryConst!(Code[]) distanceCodes;
 
 static this() {
     lengthCodes = [
@@ -221,7 +220,7 @@
 
 }
 
-int hash(byte[] bytes) {
+int hash(in byte[] bytes) {
 
     int hash = ((bytes[0] & 0xff) << 24 | (bytes[1] & 0xff) << 16 | (bytes[2] & 0xff) << 8) % HASH;
     if (hash < 0) {
@@ -270,7 +269,7 @@
 
 }
 
-Code findCode(int value, Code[] codes) {
+TryConst!(Code) findCode(int value, in Code[] codes) {
 
     int i, j, k;
 
@@ -293,7 +292,6 @@
 
 void outputMatch(int length, int distance) {
 
-    Code d, l;
     int thisLength;
 
     while (length > 0) {
@@ -315,7 +313,7 @@
         length = length - thisLength;
 
         // find length code
-        l = findCode(thisLength, lengthCodes);
+        auto l = findCode(thisLength, lengthCodes);
 
         // transmit the length code
         // 256 through 279 are 7 bits long starting at 0000000
@@ -333,7 +331,7 @@
         }
 
         // find distance code
-        d = findCode(distance, distanceCodes);
+        auto d = findCode(distance, distanceCodes);
 
         // transmit the distance code
         // 5 bits long starting at 00000
@@ -595,7 +593,7 @@
 
 }
 
-public byte[] deflate(byte[] input) {
+public byte[] deflate(in byte[] input) {
 
     istr = input;
     inLength = input.length;
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/PngEncoder.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/PngEncoder.d	Sat Jul 09 15:50:20 2011 +0300
@@ -78,7 +78,7 @@
 
     byte byte1 = cast(byte) ((theShort >> 8) & 0xff);
     byte byte2 = cast(byte) (theShort & 0xff);
-    byte[] temp = [byte1, byte2];
+    byte[2] temp = [byte1, byte2];
     baos.write(temp, 0, 2);
 
 }
@@ -89,12 +89,12 @@
     byte byte2 = cast(byte) ((theInt >> 16) & 0xff);
     byte byte3 = cast(byte) ((theInt >> 8) & 0xff);
     byte byte4 = cast(byte) (theInt & 0xff);
-    byte[] temp = [byte1, byte2, byte3, byte4];
+    byte[4] temp = [byte1, byte2, byte3, byte4];
     baos.write(temp, 0, 4);
 
 }
 
-void writeChunk(byte[] tag, byte[] buffer) {
+void writeChunk(in byte[] tag, in byte[] buffer) {
 
     int bufferLength = (buffer !is null) ? buffer.length : 0;
 
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/PngFileReadState.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/PngFileReadState.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,8 +12,6 @@
  *******************************************************************************/
 module org.eclipse.swt.internal.image.PngFileReadState;
 
-import java.lang.all;
-
 
 class PngFileReadState {
     bool readIHDR;
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/PngHuffmanTable.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/PngHuffmanTable.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,8 +12,6 @@
  *******************************************************************************/
 module org.eclipse.swt.internal.image.PngHuffmanTable;
 
-import java.lang.all;
-
 import org.eclipse.swt.internal.image.PngDecodingDataStream;
 
 public class PngHuffmanTable {
@@ -29,7 +27,7 @@
     generateTable(lengths);
 }
 
-private void initialize(int[] lengths) {
+private void initialize(in int[] lengths) {
     codeValues = new int[lengths.length];
     for (int i = 0; i < codeValues.length; i++) {
         codeValues[i] = i;
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/PngHuffmanTables.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/PngHuffmanTables.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,8 +12,6 @@
  *******************************************************************************/
 module org.eclipse.swt.internal.image.PngHuffmanTables;
 
-import java.lang.all;
-
 import org.eclipse.swt.internal.image.PngHuffmanTable;
 import org.eclipse.swt.internal.image.PngDecodingDataStream;
 import org.eclipse.swt.internal.image.PngLzBlockReader;
@@ -26,7 +24,7 @@
     static PngHuffmanTable FixedDistanceTable;
 
     static const int LiteralTableSize = 288;
-    static const int[] FixedLiteralLengths = [
+    static int[] FixedLiteralLengths = [
         8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
         8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
         8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
@@ -42,7 +40,7 @@
     ];
 
     static const int DistanceTableSize = 32;
-    static const int[] FixedDistanceLengths = [
+    static int[] FixedDistanceLengths = [
         5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
         5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
     ];
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/PngIendChunk.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/PngIendChunk.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,8 +12,6 @@
  *******************************************************************************/
 module org.eclipse.swt.internal.image.PngIendChunk;
 
-import java.lang.all;
-
 
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.internal.image.PngFileReadState;
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/PngIhdrChunk.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/PngIhdrChunk.d	Sat Jul 09 15:50:20 2011 +0300
@@ -14,7 +14,6 @@
 
 import java.lang.all;
 
-
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.graphics.PaletteData;
 import org.eclipse.swt.graphics.RGB;
@@ -349,7 +348,7 @@
             return 24;
         case COLOR_TYPE_GRAYSCALE:
         case COLOR_TYPE_PALETTE:
-            return Math.min(bitDepth, 8);
+            return Math.min(cast(int)bitDepth, 8);
         default:
             SWT.error(SWT.ERROR_INVALID_IMAGE);
             return 0;
@@ -374,7 +373,7 @@
 }
 
 PaletteData createGrayscalePalette() {
-    int depth = Math.min(bitDepth, 8);
+    int depth = Math.min(cast(int)bitDepth, 8);
     int max = (1 << depth) - 1;
     int delta = 255 / max;
     int gray = 0;
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/PngInputStream.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/PngInputStream.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,13 +12,12 @@
  *******************************************************************************/
 module org.eclipse.swt.internal.image.PngInputStream;
 
-import java.lang.all;
-
 import java.io.InputStream;
 import org.eclipse.swt.internal.image.PngIdatChunk;
 import org.eclipse.swt.internal.image.PngChunkReader;
 import org.eclipse.swt.internal.image.PngChunk;
 
+import java.lang.all;
 
 public class PngInputStream : InputStream {
 
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/PngLzBlockReader.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/PngLzBlockReader.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,8 +12,6 @@
  *******************************************************************************/
 module org.eclipse.swt.internal.image.PngLzBlockReader;
 
-import java.lang.all;
-
 import org.eclipse.swt.internal.image.PngDecodingDataStream;
 import org.eclipse.swt.internal.image.PngHuffmanTables;
 
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/PngTrnsChunk.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/PngTrnsChunk.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,8 +12,6 @@
  *******************************************************************************/
 module org.eclipse.swt.internal.image.PngTrnsChunk;
 
-import java.lang.all;
-
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.graphics.PaletteData;
 import org.eclipse.swt.graphics.RGB;
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/TIFFFileFormat.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/TIFFFileFormat.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,8 +12,6 @@
  *******************************************************************************/
 module org.eclipse.swt.internal.image.TIFFFileFormat;
 
-import java.lang.all;
-
 import org.eclipse.swt.internal.image.TIFFRandomFileAccess;
 import org.eclipse.swt.internal.image.TIFFDirectory;
 import org.eclipse.swt.SWT;
@@ -21,6 +19,7 @@
 import org.eclipse.swt.graphics.ImageLoader;
 import org.eclipse.swt.internal.image.FileFormat;
 
+import java.lang.all;
 
 /**
  * Baseline TIFF decoder revision 6.0
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/TIFFModifiedHuffmanCodec.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/TIFFModifiedHuffmanCodec.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,10 +12,9 @@
  *******************************************************************************/
 module org.eclipse.swt.internal.image.TIFFModifiedHuffmanCodec;
 
+import org.eclipse.swt.SWT;
 import java.lang.all;
 
-import org.eclipse.swt.SWT;
-
 /*
 * Decoder for
 * - CCITT Group 3 1-Dimensional Modified Huffman run length encoding
@@ -146,7 +145,7 @@
 int decodeRunLength() {
     int runLength = 0;
     int partialRun = 0;
-    short[][][] huffmanCode = isWhite ? WHITE_CODE : BLACK_CODE;
+    TryConst!(short[][][]) huffmanCode = isWhite ? WHITE_CODE : BLACK_CODE;
     while (true) {
         bool found = false;
         nbrBits = isWhite ? WHITE_MIN_BITS : BLACK_MIN_BITS;
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/TIFFRandomFileAccess.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/TIFFRandomFileAccess.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,10 +12,9 @@
  *******************************************************************************/
 module org.eclipse.swt.internal.image.TIFFRandomFileAccess;
 
+import org.eclipse.swt.internal.image.LEDataInputStream;
 import java.lang.all;
 
-import org.eclipse.swt.internal.image.LEDataInputStream;
-
 final class TIFFRandomFileAccess {
 
     LEDataInputStream inputStream;
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/mozilla/XPCOMInit.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/mozilla/XPCOMInit.d	Sat Jul 09 15:50:20 2011 +0300
@@ -38,9 +38,9 @@
     align(4):
 
     struct GREVersionRange {
-        CCharPtr    lower;
+        TryConst!(char)* lower;
         int         lowerInclusive;
-        CCharPtr    upper;
+        TryConst!(char)* upper;
         int         upperInclusive;
     }
 
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/mozilla/nsID.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/mozilla/nsID.d	Sat Jul 09 15:50:20 2011 +0300
@@ -44,11 +44,7 @@
 
 }
 
-version(D_Version2){
-    mixin("alias const(nsID) cnsID;");
-} else { // D1
-    alias nsID cnsID;
-}
+alias TryConst!(nsID) cnsID;
 alias nsID  nsCID;
 alias nsID  nsIID;
 alias cnsID cnsCID;
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/mozilla/nsStringAPI.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/mozilla/nsStringAPI.d	Sat Jul 09 15:50:20 2011 +0300
@@ -2,10 +2,6 @@
 
 import java.lang.all;
 
-version(Tango){
-import Utf = tango.text.convert.Utf;
-} else { // Phobos
-}
 import org.eclipse.swt.internal.mozilla.Common;
 
 extern (System):
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/layout/FillData.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/layout/FillData.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,8 +12,6 @@
  *******************************************************************************/
 module org.eclipse.swt.layout.FillData;
 
-import java.lang.all;
-
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.graphics.Point;
 import org.eclipse.swt.widgets.Control;
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/layout/FillLayout.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/layout/FillLayout.d	Sat Jul 09 15:50:20 2011 +0300
@@ -22,11 +22,6 @@
 import org.eclipse.swt.layout.FillData;
 
 import java.lang.all;
-version(Tango){
-    import tango.util.Convert;
-} else { // Phobos
-    import std.conv;
-}
 
 /**
  * <code>FillLayout</code> is the simplest layout class. It lays out
@@ -242,9 +237,9 @@
 override public String toString () {
     String string = getName () ~ " {";
     string ~= "type="~((type is SWT.VERTICAL) ? "SWT.VERTICAL" : "SWT.HORIZONTAL")~" ";
-    if (marginWidth !is 0) string ~= "marginWidth="~to!(String)(marginWidth)~" ";
-    if (marginHeight !is 0) string ~= "marginHeight="~to!(String)(marginHeight)~" ";
-    if (spacing !is 0) string ~= "spacing="~to!(String)(spacing)~" ";
+    if (marginWidth !is 0) string ~= "marginWidth="~String_valueOf(marginWidth)~" ";
+    if (marginHeight !is 0) string ~= "marginHeight="~String_valueOf(marginHeight)~" ";
+    if (spacing !is 0) string ~= "spacing="~String_valueOf(spacing)~" ";
     string = string.trim();
     string ~= "}";
     return string;
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/layout/FormData.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/layout/FormData.d	Sat Jul 09 15:50:20 2011 +0300
@@ -19,11 +19,6 @@
 import org.eclipse.swt.layout.FormAttachment;
 
 import java.lang.all;
-version(Tango){
-    import tango.util.Convert;
-} else { // Phobos
-    import std.conv;
-}
 
 /**
  * Instances of this class are used to define the attachments
@@ -340,12 +335,12 @@
  */
 override public String toString () {
     String string = getName()~" {";
-    if (width !is SWT.DEFAULT) string ~= "width="~to!(String)(width)~" ";
-    if (height !is SWT.DEFAULT) string ~= "height="~to!(String)(height)~" ";
-    if (left !is null) string ~= "left="~to!(String)(left)~" ";
-    if (right !is null) string ~= "right="~to!(String)(right)~" ";
-    if (top !is null) string ~= "top="~to!(String)(top)~" ";
-    if (bottom !is null) string ~= "bottom="~to!(String)(bottom)~" ";
+    if (width !is SWT.DEFAULT) string ~= "width="~String_valueOf(width)~" ";
+    if (height !is SWT.DEFAULT) string ~= "height="~String_valueOf(height)~" ";
+    if (left !is null) string ~= "left="~String_valueOf(left)~" ";
+    if (right !is null) string ~= "right="~String_valueOf(right)~" ";
+    if (top !is null) string ~= "top="~String_valueOf(top)~" ";
+    if (bottom !is null) string ~= "bottom="~String_valueOf(bottom)~" ";
     string = string.trim();
     string ~= "}";
     return string;
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/layout/FormLayout.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/layout/FormLayout.d	Sat Jul 09 15:50:20 2011 +0300
@@ -23,11 +23,6 @@
 import org.eclipse.swt.widgets.Scrollable;
 
 import java.lang.all;
-version(Tango){
-    import tango.util.Convert;
-} else { // Phobos
-    import std.conv;
-}
 
 /**
  * Instances of this class control the position and size of the
@@ -386,13 +381,13 @@
  */
 override public String toString () {
     String string =  getName ()~" {";
-    if (marginWidth !is 0) string ~= "marginWidth="~to!(String)(marginWidth)~" ";
-    if (marginHeight !is 0) string ~= "marginHeight="~to!(String)(marginHeight)~" ";
-    if (marginLeft !is 0) string ~= "marginLeft="~to!(String)(marginLeft)~" ";
-    if (marginRight !is 0) string ~= "marginRight="~to!(String)(marginRight)~" ";
-    if (marginTop !is 0) string ~= "marginTop="~to!(String)(marginTop)~" ";
-    if (marginBottom !is 0) string ~= "marginBottom="~to!(String)(marginBottom)~" ";
-    if (spacing !is 0) string ~= "spacing="~to!(String)(spacing)~" ";
+    if (marginWidth !is 0) string ~= "marginWidth="~String_valueOf(marginWidth)~" ";
+    if (marginHeight !is 0) string ~= "marginHeight="~String_valueOf(marginHeight)~" ";
+    if (marginLeft !is 0) string ~= "marginLeft="~String_valueOf(marginLeft)~" ";
+    if (marginRight !is 0) string ~= "marginRight="~String_valueOf(marginRight)~" ";
+    if (marginTop !is 0) string ~= "marginTop="~String_valueOf(marginTop)~" ";
+    if (marginBottom !is 0) string ~= "marginBottom="~String_valueOf(marginBottom)~" ";
+    if (spacing !is 0) string ~= "spacing="~String_valueOf(spacing)~" ";
     string = string.trim();
     string ~= "}";
     return string;
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/layout/GridData.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/layout/GridData.d	Sat Jul 09 15:50:20 2011 +0300
@@ -17,11 +17,6 @@
 import org.eclipse.swt.widgets.Control;
 
 import java.lang.all;
-version(Tango){
-    import tango.util.Convert;
-} else { // Phobos
-    import std.conv;
-}
 
 /**
  * <code>GridData</code> is the layout data object associated with
@@ -536,7 +531,7 @@
         case SWT.RIGHT: hAlign = "SWT.RIGHT"; break;
         case SWT.CENTER: hAlign = "SWT.CENTER"; break;
         case CENTER: hAlign = "GridData.CENTER"; break;
-        default: hAlign = "Undefined "~to!(String)(horizontalAlignment); break;
+        default: hAlign = "Undefined "~String_valueOf(horizontalAlignment); break;
     }
     String vAlign = "";
     switch (verticalAlignment) {
@@ -548,22 +543,22 @@
         case SWT.BOTTOM: vAlign = "SWT.BOTTOM"; break;
         case SWT.CENTER: vAlign = "SWT.CENTER"; break;
         case CENTER: vAlign = "GridData.CENTER"; break;
-        default: vAlign = "Undefined "~to!(String)(verticalAlignment); break;
+        default: vAlign = "Undefined "~String_valueOf(verticalAlignment); break;
     }
     String string = getName()~" {";
-    string ~= "horizontalAlignment="~to!(String)(hAlign)~" ";
-    if (horizontalIndent !is 0) string ~= "horizontalIndent="~to!(String)(horizontalIndent)~" ";
-    if (horizontalSpan !is 1) string ~= "horizontalSpan="~to!(String)(horizontalSpan)~" ";
-    if (grabExcessHorizontalSpace) string ~= "grabExcessHorizontalSpace="~to!(String)(grabExcessHorizontalSpace)~" ";
-    if (widthHint !is SWT.DEFAULT) string ~= "widthHint="~to!(String)(widthHint)~" ";
-    if (minimumWidth !is 0) string ~= "minimumWidth="~to!(String)(minimumWidth)~" ";
+    string ~= "horizontalAlignment="~hAlign~" ";
+    if (horizontalIndent !is 0) string ~= "horizontalIndent="~String_valueOf(horizontalIndent)~" ";
+    if (horizontalSpan !is 1) string ~= "horizontalSpan="~String_valueOf(horizontalSpan)~" ";
+    if (grabExcessHorizontalSpace) string ~= "grabExcessHorizontalSpace="~String_valueOf(grabExcessHorizontalSpace)~" ";
+    if (widthHint !is SWT.DEFAULT) string ~= "widthHint="~String_valueOf(widthHint)~" ";
+    if (minimumWidth !is 0) string ~= "minimumWidth="~String_valueOf(minimumWidth)~" ";
     string ~= "verticalAlignment="~vAlign~" ";
-    if (verticalIndent !is 0) string ~= "verticalIndent="~to!(String)(verticalIndent)~" ";
-    if (verticalSpan !is 1) string ~= "verticalSpan="~to!(String)(verticalSpan)~" ";
-    if (grabExcessVerticalSpace) string ~= "grabExcessVerticalSpace="~to!(String)(grabExcessVerticalSpace)~" ";
-    if (heightHint !is SWT.DEFAULT) string ~= "heightHint="~to!(String)(heightHint)~" ";
-    if (minimumHeight !is 0) string ~= "minimumHeight="~to!(String)(minimumHeight)~" ";
-    if (exclude) string ~= "exclude="~to!(String)(exclude)~" ";
+    if (verticalIndent !is 0) string ~= "verticalIndent="~String_valueOf(verticalIndent)~" ";
+    if (verticalSpan !is 1) string ~= "verticalSpan="~String_valueOf(verticalSpan)~" ";
+    if (grabExcessVerticalSpace) string ~= "grabExcessVerticalSpace="~String_valueOf(grabExcessVerticalSpace)~" ";
+    if (heightHint !is SWT.DEFAULT) string ~= "heightHint="~String_valueOf(heightHint)~" ";
+    if (minimumHeight !is 0) string ~= "minimumHeight="~String_valueOf(minimumHeight)~" ";
+    if (exclude) string ~= "exclude="~String_valueOf(exclude)~" ";
     string = string.trim();
     string ~= "}";
     return string;
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/layout/GridLayout.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/layout/GridLayout.d	Sat Jul 09 15:50:20 2011 +0300
@@ -21,13 +21,9 @@
 import org.eclipse.swt.widgets.Layout;
 import org.eclipse.swt.widgets.Scrollable;
 
+import java.lang.System;
 
 import java.lang.all;
-version(Tango){
-    import tango.util.Convert;
-} else { // Phobos
-    import std.conv;
-}
 
 
 /**
@@ -746,16 +742,16 @@
  */
 override public String toString () {
     String string = getName ()~" {";
-    if (numColumns !is 1) string ~= "numColumns="~to!(String)(numColumns)~" ";
-    if (makeColumnsEqualWidth) string ~= "makeColumnsEqualWidth="~to!(String)(makeColumnsEqualWidth)~" ";
-    if (marginWidth !is 0) string ~= "marginWidth="~to!(String)(marginWidth)~" ";
-    if (marginHeight !is 0) string ~= "marginHeight="~to!(String)(marginHeight)~" ";
-    if (marginLeft !is 0) string ~= "marginLeft="~to!(String)(marginLeft)~" ";
-    if (marginRight !is 0) string ~= "marginRight="~to!(String)(marginRight)~" ";
-    if (marginTop !is 0) string ~= "marginTop="~to!(String)(marginTop)~" ";
-    if (marginBottom !is 0) string ~= "marginBottom="~to!(String)(marginBottom)~" ";
-    if (horizontalSpacing !is 0) string ~= "horizontalSpacing="~to!(String)(horizontalSpacing)~" ";
-    if (verticalSpacing !is 0) string ~= "verticalSpacing="~to!(String)(verticalSpacing)~" ";
+    if (numColumns !is 1) string ~= "numColumns="~String_valueOf(numColumns)~" ";
+    if (makeColumnsEqualWidth) string ~= "makeColumnsEqualWidth="~String_valueOf(makeColumnsEqualWidth)~" ";
+    if (marginWidth !is 0) string ~= "marginWidth="~String_valueOf(marginWidth)~" ";
+    if (marginHeight !is 0) string ~= "marginHeight="~String_valueOf(marginHeight)~" ";
+    if (marginLeft !is 0) string ~= "marginLeft="~String_valueOf(marginLeft)~" ";
+    if (marginRight !is 0) string ~= "marginRight="~String_valueOf(marginRight)~" ";
+    if (marginTop !is 0) string ~= "marginTop="~String_valueOf(marginTop)~" ";
+    if (marginBottom !is 0) string ~= "marginBottom="~String_valueOf(marginBottom)~" ";
+    if (horizontalSpacing !is 0) string ~= "horizontalSpacing="~String_valueOf(horizontalSpacing)~" ";
+    if (verticalSpacing !is 0) string ~= "verticalSpacing="~String_valueOf(verticalSpacing)~" ";
     string = string.trim();
     string ~= "}";
     return string;
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/layout/RowData.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/layout/RowData.d	Sat Jul 09 15:50:20 2011 +0300
@@ -17,11 +17,6 @@
 import org.eclipse.swt.widgets.Control;
 
 import java.lang.all;
-version(Tango){
-    import tango.util.Convert;
-} else { // Phobos
-    import std.conv;
-}
 
 /**
  * Each control controlled by a <code>RowLayout</code> can have its initial
@@ -125,9 +120,9 @@
  */
 override public String toString () {
     String string = getName ()~" {";
-    if (width !is SWT.DEFAULT) string ~= "width="~to!(String)(width)~" ";
-    if (height !is SWT.DEFAULT) string ~= "height="~to!(String)(height)~" ";
-    if (exclude) string ~= "exclude="~to!(String)(exclude)~" ";
+    if (width !is SWT.DEFAULT) string ~= "width="~String_valueOf(width)~" ";
+    if (height !is SWT.DEFAULT) string ~= "height="~String_valueOf(height)~" ";
+    if (exclude) string ~= "exclude="~String_valueOf(exclude)~" ";
     string = string.trim();
     string ~= "}";
     return string;
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/layout/RowLayout.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/layout/RowLayout.d	Sat Jul 09 15:50:20 2011 +0300
@@ -20,11 +20,6 @@
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.layout.RowData;
 import java.lang.all;
-version(Tango){
-    import tango.util.Convert;
-} else { // Phobos
-    import std.conv;
-}
 
 
 /**
@@ -501,17 +496,17 @@
 override public String toString () {
     String string = getName ()~" {";
     string ~= "type="~((type !is SWT.HORIZONTAL) ? "SWT.VERTICAL" : "SWT.HORIZONTAL")~" ";
-    if (marginWidth !is 0) string ~= "marginWidth="~to!(String)(marginWidth)~" ";
-    if (marginHeight !is 0) string ~= "marginHeight="~to!(String)(marginHeight)~" ";
-    if (marginLeft !is 0) string ~= "marginLeft="~to!(String)(marginLeft)~" ";
-    if (marginTop !is 0) string ~= "marginTop="~to!(String)(marginTop)~" ";
-    if (marginRight !is 0) string ~= "marginRight="~to!(String)(marginRight)~" ";
-    if (marginBottom !is 0) string ~= "marginBottom="~to!(String)(marginBottom)~" ";
-    if (spacing !is 0) string ~= "spacing="~to!(String)(spacing)~" ";
-    string ~= "wrap="~to!(String)(wrap)~" ";
-    string ~= "pack="~to!(String)(pack)~" ";
-    string ~= "fill="~to!(String)(fill)~" ";
-    string ~= "justify="~to!(String)(justify)~" ";
+    if (marginWidth !is 0) string ~= "marginWidth="~String_valueOf(marginWidth)~" ";
+    if (marginHeight !is 0) string ~= "marginHeight="~String_valueOf(marginHeight)~" ";
+    if (marginLeft !is 0) string ~= "marginLeft="~String_valueOf(marginLeft)~" ";
+    if (marginTop !is 0) string ~= "marginTop="~String_valueOf(marginTop)~" ";
+    if (marginRight !is 0) string ~= "marginRight="~String_valueOf(marginRight)~" ";
+    if (marginBottom !is 0) string ~= "marginBottom="~String_valueOf(marginBottom)~" ";
+    if (spacing !is 0) string ~= "spacing="~String_valueOf(spacing)~" ";
+    string ~= "wrap="~String_valueOf(wrap)~" ";
+    string ~= "pack="~String_valueOf(pack)~" ";
+    string ~= "fill="~String_valueOf(fill)~" ";
+    string ~= "justify="~String_valueOf(justify)~" ";
     string = string.trim();
     string ~= "}";
     return string;
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/layout/all.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/layout/all.d	Sat Jul 09 15:50:20 2011 +0300
@@ -1,7 +1,5 @@
 module org.eclipse.swt.layout.all;
 
-import java.lang.all;
-
 public import org.eclipse.swt.layout.FillData;
 public import org.eclipse.swt.layout.FillLayout;
 public import org.eclipse.swt.layout.FormAttachment;
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/opengl/GLData.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/opengl/GLData.d	Sat Jul 09 15:50:20 2011 +0300
@@ -10,18 +10,10 @@
  * Port to the D Programming Language:
  *     John Reimer <terminal.node@gmail.com>
  *******************************************************************************/
-
 module org.eclipse.swt.opengl.GLData;
 
 import java.lang.all;
 
-version(Tango){
-    import tango.text.Util;
-    import tango.util.Convert;
-} else { // Phobos
-    import std.conv;
-}
-
 /**
  * The GLData class is a device-independent description
  * of the pixel format attributes of a GL drawable.
@@ -29,7 +21,7 @@
  * @see GLCanvas
  * @see <a href="http://www.eclipse.org/swt/snippets/#opengl">OpenGL snippets</a>
  * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a>
- * 
+ *
  * @since 3.2
  */
 
@@ -37,13 +29,13 @@
     /**
      * Specifies a double-buffered surface.  During context
      * creation, only double-buffered formats are considered
-     * when set to true. 
+     * when set to true.
      */
     public bool doubleBuffer;
 
     /**
      * Specifies a stereo surface.  During context creation,
-     * only stereo formats are considered when set to true. 
+     * only stereo formats are considered when set to true.
      */
     public bool stereo;
 
@@ -133,23 +125,22 @@
      * are preferred.
      */
     public int samples;
-    
+
 /**
  * Returns a string containing a concise, human-readable
  * description of the receiver.
  *
  * @return a string representation of the data
  */
-
-    override public String toString() {
-        String string = doubleBuffer ? "doubleBuffer," : "";
-        string ~= stereo ? "stereo," : "";
-        string ~= "r:" ~     to!(String)(redSize)  ~ " g:" ~ to!(String)(greenSize) ~ 
-                  " b:" ~    to!(String)(blueSize) ~ " a:" ~ to!(String)(alphaSize) ~ "," ~
-                  "depth:" ~ to!(String)(depthSize) ~ ",stencil:" ~ to!(String)(stencilSize) ~
-                  ",accum r:" ~ to!(String)(accumRedSize) ~ "g:" ~ to!(String)(accumGreenSize) ~ 
-                  "b:" ~ to!(String)(accumBlueSize) ~ "a:" ~ to!(String)(accumAlphaSize) ~
-                  ",sampleBuffers:" ~ to!(String)(sampleBuffers) ~ ",samples:" ~ to!(String)(samples);
-        return string;
-    }
+override public String toString() {
+    String string = doubleBuffer ? "doubleBuffer," : "";
+    string ~= stereo ? "stereo," : "";
+    string ~= "r:" ~     String_valueOf(redSize)  ~ " g:" ~ String_valueOf(greenSize) ~
+              " b:" ~    String_valueOf(blueSize) ~ " a:" ~ String_valueOf(alphaSize) ~ "," ~
+              "depth:" ~ String_valueOf(depthSize) ~ ",stencil:" ~ String_valueOf(stencilSize) ~
+              ",accum r:" ~ String_valueOf(accumRedSize) ~ "g:" ~ String_valueOf(accumGreenSize) ~
+              "b:" ~ String_valueOf(accumBlueSize) ~ "a:" ~ String_valueOf(accumAlphaSize) ~
+              ",sampleBuffers:" ~ String_valueOf(sampleBuffers) ~ ",samples:" ~ String_valueOf(samples);
+    return string;
 }
+}
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/opengl/all.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/opengl/all.d	Sat Jul 09 15:50:20 2011 +0300
@@ -1,7 +1,5 @@
 module org.eclipse.swt.opengl.all;
 
-import java.lang.all;
-
 public import org.eclipse.swt.opengl.GLCanvas;
 public import org.eclipse.swt.opengl.GLData;
 
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/program/Program.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/program/Program.d	Sat Jul 09 15:50:20 2011 +0300
@@ -499,7 +499,7 @@
             else {
                 /* Use white space for the delimiters. */
                 eIndex = sIndex;
-                while (eIndex < cmd.length && !Compatibility.isWhitespace( firstCodePoint( cmd[ eIndex .. $ ]))) eIndex++;
+                while (eIndex < cmd.length && !Compatibility.isWhitespace(cmd.charAt(eIndex))) eIndex++;
                 args ~= cmd.substring(sIndex, eIndex);
                 sIndex = eIndex + 1;
             }
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/widgets/DateTime.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/widgets/DateTime.d	Sat Jul 09 15:50:20 2011 +0300
@@ -44,6 +44,7 @@
     static import tango.time.chrono.Calendar;
 } else { // Phobos
     import std.conv;
+    static import std.datetime;
 }
 
 
@@ -97,7 +98,13 @@
             this.month      = greg.getMonth( time );
             this.year       = greg.getYear( time );
         } else { // Phobos
-            implMissing( __FILE__, __LINE__ );
+            auto time = std.datetime.Clock.currTime();
+            this.second     = time.second;
+            this.minute     = time.minute;
+            this.hour       = time.hour;
+            this.dayofmonth = time.day;
+            this.month      = time.month;
+            this.year       = time.year;
         }
     }
     int getActualMaximum(int field){
@@ -299,7 +306,7 @@
 
 private class DateFormatSymbols {
     private const String[] ampm = [ "AM"[], "PM" ];
-    String[] getAmPmStrings(){
+    TryConst!(String[]) getAmPmStrings(){
         return ampm;
     }
 }
@@ -565,8 +572,7 @@
 
 String formattedStringValue(int fieldName, int value, bool adjust) {
     if (fieldName is Calendar.AM_PM) {
-        String[] ampm = formatSymbols.getAmPmStrings();
-        return ampm[value];
+        return formatSymbols.getAmPmStrings()[value];
     }
     if (adjust) {
         if (fieldName is Calendar.HOUR && value is 0) {
@@ -598,7 +604,7 @@
 
 String getFormattedString(int style) {
     if ((style & SWT.TIME) !is 0) {
-        String[] ampm = formatSymbols.getAmPmStrings();
+        auto ampm = formatSymbols.getAmPmStrings();
         int h = calendar.get(Calendar.HOUR); if (h is 0) h = 12;
         int m = calendar.get(Calendar.MINUTE);
         int s = calendar.get(Calendar.SECOND);
@@ -911,7 +917,7 @@
     int length_ = end - start;
     String newText = event.text;
     if (fieldName is Calendar.AM_PM) {
-        String[] ampm = formatSymbols.getAmPmStrings();
+        auto ampm = formatSymbols.getAmPmStrings();
         if (newText.equalsIgnoreCase(ampm[Calendar.AM].substring(0, 1)) || newText.equalsIgnoreCase(ampm[Calendar.AM])) {
             setTextField(fieldName, Calendar.AM, true, false);
         } else if (newText.equalsIgnoreCase(ampm[Calendar.PM].substring(0, 1)) || newText.equalsIgnoreCase(ampm[Calendar.PM])) {
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/widgets/Display.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/widgets/Display.d	Sat Jul 09 15:50:20 2011 +0300
@@ -930,8 +930,8 @@
     }
     OS.gtk_set_locale();
     int cnt = 2;
-    CCharPtr[] args = [ "name".ptr, "--sync".ptr, "".ptr ];
-    CCharPtr* a = args.ptr;
+    auto args = [ "name".ptr, "--sync".ptr, "".ptr ];
+    auto a = args.ptr;
     if (!OS.gtk_init_check (&cnt, &a )) {
     }
     assert( cnt is 1 );
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/widgets/Link.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/widgets/Link.d	Sat Jul 09 15:50:20 2011 +0300
@@ -40,11 +40,7 @@
 import org.eclipse.swt.widgets.TypedListener;
 import org.eclipse.swt.widgets.Event;
 import java.lang.all;
-
-version(Tango){
-import tango.text.Unicode;
-} else { // Phobos
-}
+import java.nonstandard.UnsafeUtf;
 
 
 /**
@@ -551,7 +547,7 @@
     int start = 0, tagStart = 0, linkStart = 0, endtagStart = 0, refStart = 0;
     while (index < length_) {
         int increment;
-        dchar c = CharacterFirstToLower (buffer [index .. $ ], increment );
+        dchar c = Character.toLowerCase (buffer.dcharAt (index, increment));
 
         switch (state) {
             case 0:
@@ -684,7 +680,7 @@
                 mnemonic = result.length();
             }
         } else {
-            result.append ( firstCodePointStr( buffer [index .. $ ], incr ));
+            result.append (buffer.dcharAsStringAt(index, incr));
         }
         index+=incr;
     }
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/widgets/Widget.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/widgets/Widget.d	Sat Jul 09 15:50:20 2011 +0300
@@ -14,6 +14,7 @@
 
 import org.eclipse.swt.SWT;
 import java.lang.all;
+import java.nonstandard.UnsafeUtf;
 
 import org.eclipse.swt.events.DisposeListener;
 import org.eclipse.swt.internal.Converter;
@@ -26,10 +27,6 @@
 import org.eclipse.swt.widgets.TypedListener;
 
 import java.lang.Thread;
-version(Tango){
-import tango.stdc.string;
-} else { // Phobos
-}
 
 
 /**
@@ -961,31 +958,28 @@
 }
 
 char [] fixMnemonic (String str, bool replace) {
-    int len = str.length;
-    auto text = str[0 .. len].dup;
+    char[] text = str.dup;
     int i = 0, j = 0;
-    char [] result = new char [len * 2];
-    while (i < len) {
+    char [] result = new char [str.length * 2];
+    while (i < str.length) {
         switch (text [i]) {
             case '&':
-                if (i + 1 < len && text [i + 1] is '&') {
-                    i++;
+                if (i + 1 < str.length && text [i + 1] == '&') {
+                    result [j++] = text [i++];
                 } else {
-                    if (replace) {
-                        text [i] = '_';
-                    } else {
-                        i++;
-                    }
+                    if (replace) result [j++] = '_';
                 }
+                i++;
                 break;
             case '_':
                 if (replace) result [j++] = '_';
-                break;
+                //FALL THROUGH
             default:
+                result [j++] = text [i++];
         }
-        result [j++] = text [i++];
     }
-    return result[0..j];
+    if (j < result.length) result [j++] = 0;
+    return result[0 .. j];
 }
 
 /**
@@ -1345,14 +1339,14 @@
     while (index < chars.length) {
         Event event = new Event ();
         //PORTING take care of utf8
-        if (keyEvent !is null && chars.codepointCount() <= 1) {
+        if (keyEvent !is null && chars.UCScount() <= 1) {
             setKeyState (event, keyEvent);
         } else {
             setInputState (event, state);
         }
         //PORTING take care of utf8
         int incr;
-        event.character = cast(wchar) firstCodePoint( chars [index..$], incr );
+        event.character = cast(wchar) chars.dcharAt(index, incr);
         sendEvent (type, event);
 
         /*
--- a/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet10.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet10.d	Sat Jul 09 15:50:20 2011 +0300
@@ -45,7 +45,7 @@
     gc.setBackground(display.getSystemColor(SWT.COLOR_RED));
     gc.fillOval(rect.x, rect.y, rect.width, rect.height);
     gc.dispose();
-    shell.addListener(SWT.Paint, new class() Listener {
+    shell.addListener(SWT.Paint, new class Listener {
             public void handleEvent(Event event) {
                 GC gc = event.gc;               
                 Transform tr = new Transform(display);
--- a/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet108.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet108.d	Sat Jul 09 15:50:20 2011 +0300
@@ -30,41 +30,43 @@
 
 import java.lang.all;
 
-void main(String[] args){
-    Snippet108.main(args);
+version(Tango){
+    import tango.io.Stdout;
+    void writeln(in char[] line) {
+        Stdout(line)("\n").flush();
+    }
+} else { // Phobos
+    import std.stdio;
 }
 
-public class Snippet108 {
-
-    public static void main (String [] args) {
-        Display display = new Display ();
-        Shell shell = new Shell (display);
-        Label label = new Label (shell, SWT.NONE);
-        label.setText ("Enter your name:");
-        Text text = new Text (shell, SWT.BORDER);
-        text.setLayoutData (new RowData (100, SWT.DEFAULT));
-        Button ok = new Button (shell, SWT.PUSH);
-        ok.setText ("OK");
-        ok.addSelectionListener(new class() SelectionAdapter {
-            public void widgetSelected(SelectionEvent e) {
-                getDwtLogger().info( __FILE__, __LINE__, "OK");
-            }
-        });
-        Button cancel = new Button (shell, SWT.PUSH);
-        cancel.setText ("Cancel");
-        cancel.addSelectionListener(new class() SelectionAdapter {
-            public void widgetSelected(SelectionEvent e) {
-                getDwtLogger().info( __FILE__, __LINE__, "Cancel");
-            }
-        });
-        shell.setDefaultButton (cancel);
-        shell.setLayout (new RowLayout ());
-        shell.pack ();
-        shell.open ();
-        while (!shell.isDisposed ()) {
-            if (!display.readAndDispatch ()) display.sleep ();
+void main () {
+    Display display = new Display ();
+    Shell shell = new Shell (display);
+    Label label = new Label (shell, SWT.NONE);
+    label.setText ("Enter your name:");
+    Text text = new Text (shell, SWT.BORDER);
+    text.setLayoutData (new RowData (100, SWT.DEFAULT));
+    Button ok = new Button (shell, SWT.PUSH);
+    ok.setText ("OK");
+    ok.addSelectionListener(new class SelectionAdapter {
+        public void widgetSelected(SelectionEvent e) {
+            writeln("OK");
         }
-        display.dispose ();
+    });
+    Button cancel = new Button (shell, SWT.PUSH);
+    cancel.setText ("Cancel");
+    cancel.addSelectionListener(new class SelectionAdapter {
+        public void widgetSelected(SelectionEvent e) {
+            writeln("Cancel");
+        }
+    });
+    shell.setDefaultButton (cancel);
+    shell.setLayout (new RowLayout ());
+    shell.pack ();
+    shell.open ();
+    while (!shell.isDisposed ()) {
+        if (!display.readAndDispatch ()) display.sleep ();
     }
+    display.dispose ();
 }
 
--- a/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet115.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet115.d	Sat Jul 09 15:50:20 2011 +0300
@@ -30,7 +30,7 @@
 
 import java.lang.all;
 
-void main (String [] args) {
+void main () {
     Display display = new Display ();
     Shell shell = new Shell (display);
     shell.setLayout (new RowLayout (SWT.VERTICAL));
@@ -39,7 +39,7 @@
     Composite c2 = new Composite (shell, SWT.BORDER | SWT.NO_RADIO_GROUP);
     c2.setLayout (new RowLayout ());
     Composite [] composites = [c1, c2];
-    Listener radioGroup = new class() Listener{
+    Listener radioGroup = new class Listener{
         public void handleEvent (Event event) {
             for (int i=0; i<composites.length; i++) {
                 Composite composite = composites [i];
--- a/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet118.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet118.d	Sat Jul 09 15:50:20 2011 +0300
@@ -33,16 +33,16 @@
 
 import java.lang.all;
 
-void main (String [] args) {
+void main () {
     Display display = new Display();
     Shell shell = new Shell(display);
     shell.setSize(150, 150);
-    Cursor[] cursor = new Cursor[1];
+    Cursor[1] cursor;
     Button button = new Button(shell, SWT.PUSH);
     button.setText("Change cursor");
     Point size = button.computeSize(SWT.DEFAULT, SWT.DEFAULT);
     button.setSize(size);
-    button.addListener(SWT.Selection, new class() Listener{
+    button.addListener(SWT.Selection, new class Listener{
         public void handleEvent(Event e) {
             FileDialog dialog = new FileDialog(shell);
             dialog.setFilterExtensions(["*.ico", "*.gif", "*.*"]);
--- a/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet119.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet119.d	Sat Jul 09 15:50:20 2011 +0300
@@ -35,7 +35,7 @@
 
 
 
-static byte[] srcData = [
+auto srcData = [
         cast(byte)0x11, cast(byte)0x11, cast(byte)0x11, cast(byte)0x00, cast(byte)0x00, cast(byte)0x11, cast(byte)0x11, cast(byte)0x11,
         cast(byte)0x11, cast(byte)0x10, cast(byte)0x00, cast(byte)0x01, cast(byte)0x10, cast(byte)0x00, cast(byte)0x01, cast(byte)0x11,
         cast(byte)0x11, cast(byte)0x00, cast(byte)0x22, cast(byte)0x01, cast(byte)0x10, cast(byte)0x33, cast(byte)0x00, cast(byte)0x11,
@@ -54,7 +54,7 @@
         cast(byte)0x11, cast(byte)0x11, cast(byte)0x11, cast(byte)0x00, cast(byte)0x00, cast(byte)0x11, cast(byte)0x11, cast(byte)0x11,
 ];
 
-static byte[] mskData = [
+auto mskData = [
         cast(byte)0x03, cast(byte)0xc0,
         cast(byte)0x1f, cast(byte)0xf8,
         cast(byte)0x3f, cast(byte)0xfc,
@@ -85,11 +85,11 @@
     //Create a source ImageData of depth 4
     PaletteData palette = new PaletteData ([black.getRGB(), white.getRGB(), yellow.getRGB(),
                                             red.getRGB(), blue.getRGB(), green.getRGB()]);
-    ImageData sourceData = new ImageData (16, 16, 4, palette, 1, srcData);
+    ImageData sourceData = new ImageData (16, 16, 4, palette, 1, srcData[]);
 
     //Create a mask ImageData of depth 1 (monochrome)
     palette = new PaletteData ([black.getRGB(), white.getRGB()]);
-    ImageData maskData = new ImageData (16, 16, 1, palette, 1, mskData);
+    ImageData maskData = new ImageData (16, 16, 1, palette, 1, mskData[]);
 
     //Set mask
     sourceData.maskData = maskData.data;
@@ -105,7 +105,7 @@
     Shell shell = new Shell(display);
     Image source = new Image (display,sourceData);
     Image mask = new Image (display, maskData);
-    shell.addPaintListener(new class() PaintListener{
+    shell.addPaintListener(new class PaintListener{
         public void paintControl(PaintEvent e) {
             GC gc = e.gc;
             int x = 10, y = 10;
--- a/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet122.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet122.d	Sat Jul 09 15:50:20 2011 +0300
@@ -37,7 +37,7 @@
 
 import java.lang.all;
 
-public static void main(String[] args) {
+void main() {
     Display display = new Display();
     Clipboard cb = new Clipboard(display);
     Shell shell = new Shell(display);
@@ -46,7 +46,7 @@
     Menu menu = new Menu(shell, SWT.POP_UP);
     MenuItem copyItem = new MenuItem(menu, SWT.PUSH);
     copyItem.setText("Copy");
-    copyItem.addSelectionListener(new class() SelectionAdapter{
+    copyItem.addSelectionListener(new class SelectionAdapter{
         public void widgetSelected(SelectionEvent e) {
             String selection = text.getSelectionText();
             if (selection.length == 0) return;
@@ -57,13 +57,13 @@
     });
     MenuItem pasteItem = new MenuItem(menu, SWT.PUSH);
     pasteItem.setText ("Paste");
-    pasteItem.addSelectionListener(new class() SelectionAdapter{
+    pasteItem.addSelectionListener(new class SelectionAdapter{
         public void widgetSelected(SelectionEvent e) {
             String string = stringcast(cb.getContents(TextTransfer.getInstance()));
             if (string !is null) text.insert(string);
         }
     });
-    menu.addMenuListener(new class() MenuAdapter{
+    menu.addMenuListener(new class MenuAdapter{
         public void menuShown(MenuEvent e) {
             // is copy valid?
             String selection = text.getSelectionText();
--- a/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet127.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet127.d	Sat Jul 09 15:50:20 2011 +0300
@@ -30,19 +30,19 @@
 
 import java.lang.all;
 
-void main (String [] args) {
+void main () {
     Display display = new Display ();
     Shell shell = new Shell (display);
     shell.setLayout(new RowLayout ());
     Button button1 = new Button(shell, SWT.PUSH);
     button1.setText("Can't Traverse");
-    button1.addTraverseListener(new class() TraverseListener{
+    button1.addTraverseListener(new class TraverseListener{
         public void keyTraversed(TraverseEvent e) {
             switch (e.detail) {
             case SWT.TRAVERSE_TAB_NEXT:
-            case SWT.TRAVERSE_TAB_PREVIOUS: {
-                    e.doit = false;
-                }
+            case SWT.TRAVERSE_TAB_PREVIOUS:
+                e.doit = false;
+            default:
             }
         }
     });
--- a/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet128.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet128.d	Sat Jul 09 15:50:20 2011 +0300
@@ -57,7 +57,7 @@
 import org.eclipse.swt.widgets.Listener;
 import org.eclipse.swt.widgets.Event;
 
-public static void main(String [] args) {
+void main() {
     Display display = new Display();
     Shell shell = new Shell(display);
     GridLayout gridLayout = new GridLayout();
@@ -115,7 +115,7 @@
     progressBar.setLayoutData(data);
 
     /* event handling */
-    Listener listener = new class() Listener {
+    Listener listener = new class Listener {
         public void handleEvent(Event event) {
             ToolItem item = cast(ToolItem)event.widget;
             String string = item.getText();
@@ -126,7 +126,7 @@
             else if (string.equals("Go")) browser.setUrl(location.getText());
        }
     };
-    browser.addProgressListener(new class() ProgressListener {
+    browser.addProgressListener(new class ProgressListener {
         public void changed(ProgressEvent event) {
                 if (event.total == 0) return;                            
                 int ratio = event.current * 100 / event.total;
@@ -136,12 +136,12 @@
             progressBar.setSelection(0);
         }
     });
-    browser.addStatusTextListener(new class() StatusTextListener {
+    browser.addStatusTextListener(new class StatusTextListener {
         public void changed(StatusTextEvent event) {
             status.setText(event.text); 
         }
     });
-    browser.addLocationListener(new class() LocationListener {
+    browser.addLocationListener(new class LocationListener {
         public void changed(LocationEvent event) {
             if (event.top) location.setText(event.location);
         }
@@ -153,7 +153,7 @@
     itemStop.addListener(SWT.Selection, listener);
     itemRefresh.addListener(SWT.Selection, listener);
     itemGo.addListener(SWT.Selection, listener);
-    location.addListener(SWT.DefaultSelection, new class() Listener {
+    location.addListener(SWT.DefaultSelection, new class Listener {
         public void handleEvent(Event e) {
             browser.setUrl(location.getText());
         }
--- a/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet130.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet130.d	Sat Jul 09 15:50:20 2011 +0300
@@ -34,89 +34,84 @@
 import java.lang.all;
 import java.lang.Thread;
 
-void main(String[] args){
-    Snippet130.main(args);
+void main() {
+    Display display = new Display();
+    Shell shell = new Shell(display);
+    shell.setLayout(new GridLayout());
+    Text text = new Text(shell, SWT.MULTI | SWT.BORDER | SWT.V_SCROLL);
+    text.setLayoutData(new GridData(GridData.FILL_BOTH));
+    int[] nextId = new int[1];
+    Button b = new Button(shell, SWT.PUSH);
+    b.setText("invoke long running job");
+
+    b.addSelectionListener(new class SelectionAdapter {
+        public void widgetSelected(SelectionEvent e) {
+            Runnable longJob = new class Runnable {
+                bool done = false;
+                int id;
+                public void run() {
+                    Thread thread = new Thread({
+                        id = nextId[0]++;
+                        display.syncExec(new class Runnable {
+                            public void run() {
+                            if (text.isDisposed()) return;
+                            text.append(Format("\nStart long running task {}", id));
+                            }
+                            }); // display.syncExec
+                        /*
+                         * This crashes when more than 1 thread gets created. THD
+                         for (int i = 0; i < 100000; i++) {
+                         if (display.isDisposed()) return;
+                         getDwtLogger().info(__FILE__, __LINE__, "do task that takes a long time in a separate thread {}", id);
+                         }
+                         */
+                        // This runs fine
+                        for (int i = 0; i < 6; i++) {
+                            if (display.isDisposed()) return;
+                            getDwtLogger().info( __FILE__, __LINE__, "do task that takes a long time in a separate thread {} {}/6", id, i);
+                            Thread.sleep(500);
+                        }
+
+                        if (display.isDisposed()) return;
+                        display.syncExec(new class Runnable {
+                            public void run() {
+                                if (text.isDisposed()) return;
+                                text.append(Format("\nCompleted long running task {}", id));
+                            }
+                        }); // display.syncExec
+                        done = true;
+                        display.wake();
+                    }); // thread = ...
+                    thread.start();
+
+                    while (!done && !shell.isDisposed()) {
+                        if (!display.readAndDispatch())
+                            display.sleep();
+                    }
+                }
+            };  // Runnable longJob = ...
+            BusyIndicator.showWhile(display, longJob);
+        } // widgetSelected();
+    }); // addSelectionListener
+
+
+    shell.setSize(250, 150);
+    shell.open();
+    while (!shell.isDisposed()) {
+        if (!display.readAndDispatch())
+            display.sleep();
+    }
+    display.dispose();
 }
 
-public class Snippet130 {
-
-    public static void main(String[] args) {
-        Display display = new Display();
-        Shell shell = new Shell(display);
-        shell.setLayout(new GridLayout());
-        Text text = new Text(shell, SWT.MULTI | SWT.BORDER | SWT.V_SCROLL);
-        text.setLayoutData(new GridData(GridData.FILL_BOTH));
-        int[] nextId = new int[1];
-        Button b = new Button(shell, SWT.PUSH);
-        b.setText("invoke long running job");
-
-        b.addSelectionListener(new class() SelectionAdapter {
-            public void widgetSelected(SelectionEvent e) {
-                Runnable longJob = new class() Runnable {
-                    bool done = false;
-                    int id;
-                    public void run() {
-                        Thread thread = new Thread({
-                            id = nextId[0]++;
-                            display.syncExec(new class() Runnable {
-                                public void run() {
-                                if (text.isDisposed()) return;
-                                text.append(Format("\nStart long running task {}", id));
-                                }
-                                }); // display.syncExec
-                            /*
-                             * This crashes when more than 1 thread gets created. THD
-                             for (int i = 0; i < 100000; i++) {
-                             if (display.isDisposed()) return;
-                             getDwtLogger().info(__FILE__, __LINE__, "do task that takes a long time in a separate thread {}", id);
-                             }
-                             */
-                            // This runs fine
-                            for (int i = 0; i < 6; i++) {
-                                if (display.isDisposed()) return;
-                                getDwtLogger().info( __FILE__, __LINE__, "do task that takes a long time in a separate thread {} {}/6", id, i);
-                                Thread.sleep(500);
-                            }
+void printStart(Text text, int id ) {
+    if (text.isDisposed()) return;
+    getDwtLogger().info( __FILE__, __LINE__, "Start long running task {}", id );
+    text.append(Format("\nStart long running task {}", id));
+}
 
-                            if (display.isDisposed()) return;
-                            display.syncExec(new class() Runnable {
-                                public void run() {
-                                    if (text.isDisposed()) return;
-                                    text.append(Format("\nCompleted long running task {}", id));
-                                }
-                            }); // display.syncExec
-                            done = true;
-                            display.wake();
-                        }); // thread = ...
-                        thread.start();
-
-                        while (!done && !shell.isDisposed()) {
-                            if (!display.readAndDispatch())
-                                display.sleep();
-                        }
-                    }
-                };  // Runnable longJob = ...
-                BusyIndicator.showWhile(display, longJob);
-            } // widgetSelected();
-        }); // addSelectionListener
-
-
-        shell.setSize(250, 150);
-        shell.open();
-        while (!shell.isDisposed()) {
-            if (!display.readAndDispatch())
-                display.sleep();
-        }
-        display.dispose();
-    }
-    private void printStart(Text text, int id ) {
-        if (text.isDisposed()) return;
-        getDwtLogger().info( __FILE__, __LINE__, "Start long running task {}", id );
-        text.append(Format("\nStart long running task {}", id));
-    }
-    private void printEnd(Text text, int id ) {
-        if (text.isDisposed()) return;
-        getDwtLogger().info( __FILE__, __LINE__, "Completed long running task {}", id );
-        text.append(Format("\nCompleted long running task {}", id));
-    }
+void printEnd(Text text, int id ) {
+    if (text.isDisposed()) return;
+    getDwtLogger().info( __FILE__, __LINE__, "Completed long running task {}", id );
+    text.append(Format("\nCompleted long running task {}", id));
 }
--- a/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet130a.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet130a.d	Sat Jul 09 15:50:20 2011 +0300
@@ -44,88 +44,83 @@
 }
 
 
-void main(String[] args){
-    Snippet130.main(args);
+void main() {
+    Display display = new Display();
+    Shell shell = new Shell(display);
+    shell.setLayout(new GridLayout());
+    Text text = new Text(shell, SWT.MULTI | SWT.BORDER | SWT.V_SCROLL);
+    text.setLayoutData(new GridData(GridData.FILL_BOTH));
+    int[] nextId = new int[1];
+    Button b = new Button(shell, SWT.PUSH);
+    b.setText("invoke long running job");
+
+    b.addSelectionListener(new class SelectionAdapter {
+        public void widgetSelected(SelectionEvent e) {
+            Runnable longJob = new class Runnable {
+                bool done = false;
+                int id;
+                public void run() {
+                    Thread thread = new Thread({
+                        id = nextId[0]++;
+                        display.syncExec( dgRunnable( &printStart, text, id ));
+                        for (int i = 0; i < 6; i++) {
+                        if (display.isDisposed()) return;
+                        version(Tango){
+                            Trace.formatln("do task that takes a long time in a separate thread {} {}/6", id, i);
+                        } else { // Phobos
+                            writefln("do task that takes a long time in a separate thread %s %s/6", id, i);
+                        }
+                        Thread.sleep(500);
+                        }
+                        /*
+                        for (int i = 0; i < 100000; i++) {
+                            if (display.isDisposed()) return;
+                            Stdout.formatln("do task that takes a long time in a separate thread {}", id);
+                        }
+                        */
+                        if (display.isDisposed()) return;
+                        display.syncExec( dgRunnable( &printEnd, text, id ));
+                        done = true;
+                        display.wake();
+                    }); // thread = ...
+                    thread.start();
+
+                    while (!done && !shell.isDisposed()) {
+                        if (!display.readAndDispatch())
+                            display.sleep();
+                    }
+                }
+            };  // Runnable longJob = ...
+            BusyIndicator.showWhile(display, longJob);
+        } // widgetSelected();
+    }); // addSelectionListener
+
+
+    shell.setSize(250, 150);
+    shell.open();
+    while (!shell.isDisposed()) {
+        if (!display.readAndDispatch())
+            display.sleep();
+    }
+    display.dispose();
 }
 
-public class Snippet130 {
-
-    public static void main(String[] args) {
-        Display display = new Display();
-        Shell shell = new Shell(display);
-        shell.setLayout(new GridLayout());
-        Text text = new Text(shell, SWT.MULTI | SWT.BORDER | SWT.V_SCROLL);
-        text.setLayoutData(new GridData(GridData.FILL_BOTH));
-        int[] nextId = new int[1];
-        Button b = new Button(shell, SWT.PUSH);
-        b.setText("invoke long running job");
+void printStart(Text text, int id ) {
+    if (text.isDisposed()) return;
+    version(Tango){
+        Trace.formatln( "Start long running task {}", id );
+    } else { // Phobos
+        writefln( "Start long running task %s", id );
+    }
+    text.append("\nStart long running task "~to!(String)(id));
+}
 
-        b.addSelectionListener(new class() SelectionAdapter {
-            public void widgetSelected(SelectionEvent e) {
-                Runnable longJob = new class() Runnable {
-                    bool done = false;
-                    int id;
-                    public void run() {
-                        Thread thread = new Thread({
-                            id = nextId[0]++;
-                            display.syncExec( dgRunnable( &printStart, text, id ));
-                            for (int i = 0; i < 6; i++) {
-                            if (display.isDisposed()) return;
-                            version(Tango){
-                                Trace.formatln("do task that takes a long time in a separate thread {} {}/6", id, i);
-                            } else { // Phobos
-                                writefln("do task that takes a long time in a separate thread %s %s/6", id, i);
-                            }
-                            Thread.sleep(500);
-                            }
-                            /*
-                            for (int i = 0; i < 100000; i++) {
-                                if (display.isDisposed()) return;
-                                Stdout.formatln("do task that takes a long time in a separate thread {}", id);
-                            }
-                            */
-                            if (display.isDisposed()) return;
-                            display.syncExec( dgRunnable( &printEnd, text, id ));
-                            done = true;
-                            display.wake();
-                        }); // thread = ...
-                        thread.start();
-
-                        while (!done && !shell.isDisposed()) {
-                            if (!display.readAndDispatch())
-                                display.sleep();
-                        }
-                    }
-                };  // Runnable longJob = ...
-                BusyIndicator.showWhile(display, longJob);
-            } // widgetSelected();
-        }); // addSelectionListener
-
-
-        shell.setSize(250, 150);
-        shell.open();
-        while (!shell.isDisposed()) {
-            if (!display.readAndDispatch())
-                display.sleep();
-        }
-        display.dispose();
+void printEnd(Text text, int id ) {
+    if (text.isDisposed()) return;
+    version(Tango){
+        Trace.formatln( "Completed long running task {}", id );
+    } else { // Phobos
+        writefln( "Completed long running task %s", id );
     }
-    private static void printStart(Text text, int id ) {
-        if (text.isDisposed()) return;
-        version(Tango){
-            Trace.formatln( "Start long running task {}", id );
-        } else { // Phobos
-            writefln( "Start long running task %s", id );
-        }
-        text.append("\nStart long running task "~to!(String)(id));
-    }
-    private static void printEnd(Text text, int id ) {
-        if (text.isDisposed()) return;
-        version(Tango){
-            Trace.formatln( "Completed long running task {}", id );
-        } else { // Phobos
-            writefln( "Completed long running task %s", id );
-        }
-        text.append("\nCompleted long running task "~to!(String)(id));
-    }
+    text.append("\nCompleted long running task "~to!(String)(id));
 }
--- a/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet132.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet132.d	Sat Jul 09 15:50:20 2011 +0300
@@ -36,8 +36,7 @@
 // java
 import java.lang.all;
 
-public void 
-main(String [] args){
+void main(){
     Display display = new Display();
     Shell shell = new Shell(display);
     shell.open();
--- a/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet133.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet133.d	Sat Jul 09 15:50:20 2011 +0300
@@ -61,8 +61,7 @@
     alias isprint isPrintable;
 }
 
-public void 
-main(String[] args){
+void main(){
     (new Snippet133).open();
 }
 
@@ -104,28 +103,28 @@
             item = new MenuItem(fileMenu, SWT.PUSH);
             item.setText("&Open...");
             item.setAccelerator(SWT.CTRL + 'O');
-            item.addSelectionListener(new class() SelectionAdapter{
+            item.addSelectionListener(new class SelectionAdapter{
                 public void widgetSelected(SelectionEvent event) {
                     menuOpen();
                 }
             });
             item = new MenuItem(fileMenu, SWT.PUSH);
             item.setText("Font...");
-            item.addSelectionListener(new class() SelectionAdapter{
+            item.addSelectionListener(new class SelectionAdapter{
                 public void widgetSelected(SelectionEvent event){
                     menuFont();
                 }
             });
             item = new MenuItem(fileMenu, SWT.PUSH);
             item.setText("Foreground Color...");
-            item.addSelectionListener(new class() SelectionAdapter{
+            item.addSelectionListener(new class SelectionAdapter{
                 public void widgetSelected(SelectionEvent event){
                     menuForegroundColor();
                 }
             });
             item = new MenuItem(fileMenu, SWT.PUSH);
             item.setText("Background Color...");
-            item.addSelectionListener(new class() SelectionAdapter{
+            item.addSelectionListener(new class SelectionAdapter{
                 public void widgetSelected(SelectionEvent event) {
                     menuBackgroundColor();
                 }
@@ -133,7 +132,7 @@
             item = new MenuItem(fileMenu, SWT.PUSH);
             item.setText("&Print...");
             item.setAccelerator(SWT.CTRL + 'P');
-            item.addSelectionListener(new class() SelectionAdapter{
+            item.addSelectionListener(new class SelectionAdapter{
                 public void widgetSelected(SelectionEvent event) {
                     menuPrint();
                 }
@@ -141,7 +140,7 @@
             new MenuItem(fileMenu, SWT.SEPARATOR);
             item = new MenuItem(fileMenu, SWT.PUSH);
             item.setText("E&xit");
-            item.addSelectionListener(new class() SelectionAdapter{
+            item.addSelectionListener(new class SelectionAdapter{
                 public void widgetSelected(SelectionEvent event){
                     System.exit(0);
                 }
--- a/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet134.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet134.d	Sat Jul 09 15:50:20 2011 +0300
@@ -50,13 +50,10 @@
     return polygon;
 }
 
-Display display;
-Shell shell;
-
-void main(char[][] args) {
-    display = new Display();
+void main() {
+    auto display = new Display();
     //Shell must be created with style SWT.NO_TRIM
-    shell = new Shell(display, SWT.NO_TRIM | SWT.ON_TOP);
+    auto shell = new Shell(display, SWT.NO_TRIM | SWT.ON_TOP);
     shell.setBackground(display.getSystemColor(SWT.COLOR_RED));
     //define a region that looks like a key hole
     Region region = new Region();
--- a/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet14.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet14.d	Sat Jul 09 15:50:20 2011 +0300
@@ -28,42 +28,30 @@
 
 version(Tango){
     import tango.io.Stdout;
+    void writeln(in char[] line) {
+        Stdout(line)("\n").flush();
+    }
 } else { // Phobos
     import std.stdio;
 }
 
-void main (String [] args) {
+void main () {
     Display display = new Display ();
     Shell shell = new Shell (display);
     shell.setSize (100, 100);
-    shell.addListener (SWT.MouseEnter, new class() Listener{
+    shell.addListener (SWT.MouseEnter, new class Listener{
         public void handleEvent (Event e) {
-            version(Tango){
-                Stdout("ENTER\n");
-                Stdout.flush();
-            } else { // Phobos
-                writeln("ENTER");
-            }
+            writeln("ENTER");
         }
     });
-    shell.addListener (SWT.MouseExit, new class() Listener{
+    shell.addListener (SWT.MouseExit, new class Listener{
         public void handleEvent (Event e) {
-            version(Tango){
-                Stdout("EXIT\n");
-                Stdout.flush();
-            } else { // Phobos
-                writeln("EXIT");
-            }
+            writeln("EXIT");
         }
     });
-    shell.addListener (SWT.MouseHover, new class() Listener{
+    shell.addListener (SWT.MouseHover, new class Listener{
         public void handleEvent (Event e) {
-            version(Tango){
-                Stdout("HOVER\n");
-                Stdout.flush();
-            } else { // Phobos
-                writeln("HOVER");
-            }
+            writeln("HOVER");
         }
     });
     shell.open ();
--- a/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet140.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet140.d	Sat Jul 09 15:50:20 2011 +0300
@@ -41,17 +41,14 @@
     import std.conv;
 }
 
-static Display display;
-static Shell shell;
-static CoolBar coolBar;
-static Menu chevronMenu = null;
-
 
 void main () {
-    display = new Display ();
-    shell = new Shell (display);
+    Menu chevronMenu = null;
+    
+    auto display = new Display ();
+    auto shell = new Shell (display);
     shell.setLayout(new GridLayout());
-    coolBar = new CoolBar(shell, SWT.FLAT | SWT.BORDER);
+    auto coolBar = new CoolBar(shell, SWT.FLAT | SWT.BORDER);
     coolBar.setLayoutData(new GridData(GridData.FILL_BOTH));
     ToolBar toolBar = new ToolBar(coolBar, SWT.FLAT | SWT.WRAP);
     int minWidth = 0;
@@ -70,7 +67,7 @@
     coolItem.setMinimumSize(minWidth, coolSize.y);
     coolItem.setPreferredSize(coolSize);
     coolItem.setSize(coolSize);
-    coolItem.addSelectionListener(new class() SelectionAdapter {
+    coolItem.addSelectionListener(new class SelectionAdapter {
         public void widgetSelected(SelectionEvent event) {
             if (event.detail == SWT.ARROW) {
                 CoolItem item = cast(CoolItem) event.widget;
--- a/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet142.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet142.d	Sat Jul 09 15:50:20 2011 +0300
@@ -33,11 +33,14 @@
 version(Tango){
     //import tango.core.Thread;
     import tango.io.Stdout;
+    void writeln(in char[] line) {
+        Stdout(line)("\n").flush();
+    }
 } else { // Phobos
     import std.stdio;
 }
 
-void main(String[] args) {
+void main() {
     Display display = new Display();
     Shell shell = new Shell(display);
     Button button = new Button(shell,SWT.NONE);
@@ -46,11 +49,7 @@
     shell.pack();
     shell.open();
     button.addListener(SWT.MouseDown, dgListener( (Event e){
-        version(Tango){
-            Stdout.formatln("Mouse Down  (Button: {} x: {} y: {})",e.button,e.x,e.y);
-        } else { // Phobos
-            writefln("Mouse Down  (Button: %s x: %s y: %s)",e.button,e.x,e.y);
-        }
+        writeln(Format("Mouse Down  (Button: {} x: {} y: {})", e.button, e.x, e.y));
     }));
     Point pt = display.map(shell, null, 50, 50);
     Thread thread = new Thread({
--- a/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet143.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet143.d	Sat Jul 09 15:50:20 2011 +0300
@@ -33,85 +33,58 @@
 import java.lang.all;
 version(Tango){
     import tango.io.Stdout;
-    import tango.text.convert.Format;
+    void writeln(in char[] line) {
+        Stdout(line)("\n").flush();
+    }
 } else { // Phobos
     import std.stdio;
-    import std.string;
 }
 
-TrayItem item;
-Menu menu;
+void main() {
+    TrayItem item;
+    Menu menu;
 
-void main(String[] args) {
     Display display = new Display ();
     Shell shell = new Shell (display);
     Image image = new Image (display, 16, 16);
     Tray tray = display.getSystemTray ();
     if (tray is null) {
-        version(Tango){
-            Stdout.formatln ("The system tray is not available");
-        } else { // Phobos
-            writefln("The system tray is not available");
-        }
+        writeln("The system tray is not available");
     } else {
         item = new TrayItem (tray, SWT.NONE);
         item.setToolTipText("SWT TrayItem");
-        item.addListener (SWT.Show, new class() Listener {
+        item.addListener (SWT.Show, new class Listener {
             public void handleEvent (Event event) {
-                version(Tango){
-                    Stdout.formatln("show");
-                } else { // Phobos
-                    writefln("show");
-                }
+                writeln("show");
             }
         });
-        item.addListener (SWT.Hide, new class() Listener {
+        item.addListener (SWT.Hide, new class Listener {
             public void handleEvent (Event event) {
-                version(Tango){
-                    Stdout.formatln("hide");
-                } else { // Phobos
-                    writefln("hide");
-                }
+                writeln("hide");
             }
         });
-        item.addListener (SWT.Selection, new class() Listener {
+        item.addListener (SWT.Selection, new class Listener {
             public void handleEvent (Event event) {
-                version(Tango){
-                    Stdout.formatln("selection");
-                } else { // Phobos
-                    writefln("selection");
-                }
+                writeln("selection");
             }
         });
-        item.addListener (SWT.DefaultSelection, new class() Listener {
+        item.addListener (SWT.DefaultSelection, new class Listener {
             public void handleEvent (Event event) {
-                version(Tango){
-                    Stdout.formatln("default selection");
-                } else { // Phobos
-                    writefln("default selection");
-                }
+                writeln("default selection");
             }
         });
         menu = new Menu (shell, SWT.POP_UP);
         for (int i = 0; i < 8; i++) {
             MenuItem mi = new MenuItem (menu, SWT.PUSH);
-            version(Tango){
-                mi.setText ( Format( "Item{}", i ));
-            } else { // Phobos
-                mi.setText ( format( "Item%s", i ));
-            }
-            mi.addListener (SWT.Selection, new class() Listener {
+            mi.setText ( Format( "Item{}", i ));
+            mi.addListener (SWT.Selection, new class Listener {
                 public void handleEvent (Event event) {
-                    version(Tango){
-                        Stdout.formatln("selection {}", event.widget);
-                    } else { // Phobos
-                        writefln("selection %s", event.widget);
-                    }
+                    writeln ( Format( "selection {}", event.widget ) );
                 }
             });
             if (i == 0) menu.setDefaultItem(mi);
         }
-        item.addListener (SWT.MenuDetect, new class() Listener {
+        item.addListener (SWT.MenuDetect, new class Listener {
             public void handleEvent (Event event) {
                 menu.setVisible (true);
             }
--- a/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet144.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet144.d	Sat Jul 09 15:50:20 2011 +0300
@@ -35,6 +35,9 @@
 
 version(Tango){
     import tango.io.Stdout;
+    void writeln(in char[] line) {
+        Stdout(line)("\n").flush();
+    }
     import tango.time.StopWatch;
     import tango.util.Convert;
 } else {
@@ -55,11 +58,7 @@
             auto item = cast(TableItem) event.item;
             auto index = table.indexOf (item);
             item.setText ("Item " ~ to!(String)(index));
-            version(Tango){
-                Stdout(item.getText ()).newline;
-            } else { // Phobos
-                writeln(item.getText ());
-            }
+            writeln(item.getText ());
         }
     });
     table.setLayoutData (new RowData (200, 200));
@@ -68,20 +67,17 @@
     auto label = new Label(shell, SWT.NONE);
     button.addListener (SWT.Selection, new class Listener {
         public void handleEvent (Event event) {
+            StopWatch elapsed; //Tango or Phobos StopWatch
+            elapsed.start();
+            table.setItemCount (COUNT);
             version(Tango){
-                StopWatch elapsed;
-                elapsed.start;
-                table.setItemCount (COUNT);
-                auto t = elapsed.stop;
+                auto t = elapsed.stop() * 1_000;
             } else { // Phobos
-                StopWatch elapsed;
-                elapsed.start;
-                table.setItemCount (COUNT);
-                elapsed.stop;
+                elapsed.stop();
                 auto t = elapsed.peek.msecs;
             }
             label.setText ("Items: " ~ to!(String)(COUNT) ~
-                           ", Time: " ~ to!(String)(t) ~ " (sec)");
+                           ", Time: " ~ to!(String)(t) ~ " (msec)");
             shell.layout ();
         }
     });
--- a/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet146.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet146.d	Sat Jul 09 15:50:20 2011 +0300
@@ -37,7 +37,7 @@
     alias isUniUpper isUpper;
 }
 
-void main(String[] args) {
+void main() {
     Display display = new Display();
     Shell shell = new Shell(display);
     Text text = new Text(shell, SWT.BORDER);
--- a/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet147.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet147.d	Sat Jul 09 15:50:20 2011 +0300
@@ -31,27 +31,26 @@
 
 version(Tango){
     import tango.io.Stdout;
+    void writeln(in char[] line) {
+        Stdout(line)("\n").flush();
+    }
 } else { // Phobos
     import std.stdio;
 }
 
-void main(String[] args) {
+void main() {
     Display display = new Display();
     Shell shell = new Shell(display);
     shell.setLayout(new GridLayout());
     Combo combo = new Combo(shell, SWT.NONE);
     combo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
     combo.setText("Here is some text");
-    combo.addSelectionListener(new class() SelectionAdapter{
+    combo.addSelectionListener(new class SelectionAdapter{
         public void widgetDefaultSelected(SelectionEvent e) {
-            version(Tango){
-                Stdout("Combo default selected (overrides default button)\n");
-            } else { // Phobos
-                writeln("Combo default selected (overrides default button)");
-            }
+            writeln("Combo default selected (overrides default button)");
         }
     });
-    combo.addTraverseListener(new class() TraverseListener{
+    combo.addTraverseListener(new class TraverseListener{
         public void keyTraversed(TraverseEvent e) {
             if (e.detail == SWT.TRAVERSE_RETURN) {
                 e.doit = false;
@@ -61,13 +60,9 @@
     });
     Button button = new Button(shell, SWT.PUSH);
     button.setText("Ok");
-    button.addSelectionListener(new class() SelectionAdapter{
+    button.addSelectionListener(new class SelectionAdapter{
         public void widgetSelected(SelectionEvent e) {
-            version(Tango){
-                Stdout("Button selected\n");
-            } else { // Phobos
-                writeln("Button selected");
-            }
+            writeln("Button selected");
         }
     });
     shell.setDefaultButton(button);
--- a/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet150.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet150.d	Sat Jul 09 15:50:20 2011 +0300
@@ -48,7 +48,7 @@
     ToolBar toolBar = new ToolBar(coolBar, SWT.FLAT);
     for (int i = 0; i < count; i++) {
         ToolItem item = new ToolItem(toolBar, SWT.PUSH);
-        item.setText(to!(String)(itemCount++) ~"");
+        item.setText(to!(String)(itemCount++));
     }
     toolBar.pack();
     Point size = toolBar.getSize();
@@ -77,7 +77,7 @@
     coolData.right = new FormAttachment(100);
     coolData.top = new FormAttachment(0);
     coolBar.setLayoutData(coolData);
-    coolBar.addListener(SWT.Resize, new class() Listener {
+    coolBar.addListener(SWT.Resize, new class Listener {
         void handleEvent(Event event) {
             shell.layout();
         }
--- a/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet153.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet153.d	Sat Jul 09 15:50:20 2011 +0300
@@ -29,22 +29,23 @@
 import org.eclipse.swt.widgets.Label;
 import java.lang.all;
 
-static String statusText = "";
 void main() {
+    String statusText = "";
+    
     Display display = new Display();
     Shell shell = new Shell(display);
     shell.setBounds(10, 10, 200, 200);
     ToolBar bar = new ToolBar(shell, SWT.BORDER);
-    bar.setBounds(10, 10, 150, 50);
+    bar.setBounds(10, 10, 170, 50);
     Label statusLine = new Label(shell, SWT.BORDER);
-    statusLine.setBounds(10, 90, 150, 30);
+    statusLine.setBounds(10, 90, 170, 30);
     (new ToolItem(bar, SWT.NONE)).setText("item 1");
     (new ToolItem(bar, SWT.NONE)).setText("item 2");
     (new ToolItem(bar, SWT.NONE)).setText("item 3");
     bar.addMouseMoveListener(new class MouseMoveListener {
         void mouseMove(MouseEvent e) {
             ToolItem item = bar.getItem(new Point(e.x, e.y));
-           String name = "";
+            String name = "";
             if (item !is null) {
                 name = item.getText();
             }
--- a/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet16.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet16.d	Sat Jul 09 15:50:20 2011 +0300
@@ -27,6 +27,9 @@
 
 version(Tango){
     import tango.io.Stdout;
+    void writeln(in char[] line) {
+        Stdout(line)("\n").flush();
+    }
 } else { // Phobos
     import std.stdio;
 }
@@ -39,19 +42,10 @@
     timer = dgRunnable( {
         Point point = display.getCursorLocation ();
         Rectangle rect = shell.getBounds ();
-        version(Tango){
-            if (rect.contains (point)) {
-                Stdout("In\n");
-            } else {
-                Stdout("Out\n");
-            }
-            Stdout.flush();
-        } else { // Phobos
-            if (rect.contains (point)) {
-                writeln("In");
-            } else {
-                writeln("Out");
-            }
+        if (rect.contains (point)) {
+            writeln("In");
+        } else {
+            writeln("Out");
         }
         display.timerExec (time, timer);
     });
--- a/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet162.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet162.d	Sat Jul 09 15:50:20 2011 +0300
@@ -40,117 +40,110 @@
 import java.lang.all;
 
 
-void main(String[] args){
-    Snippet162.main(args);
-}
+const STATE = "CheckedIndices";
 
-public class Snippet162 {
-
-    const static String STATE = "CheckedIndices";
+void main () {
+    Display display = new Display ();
+    Image checkedImage = getCheckedImage (display);
+    Image uncheckedImage = getUncheckedImage (display);
+    Shell shell = new Shell (display);
+    shell.setLayout (new FillLayout ());
+    Table table = new Table (shell, SWT.BORDER);
+    TableColumn column1 = new TableColumn (table, SWT.NONE);
+    TableColumn column2 = new TableColumn (table, SWT.NONE);
+    TableColumn column3 = new TableColumn (table, SWT.NONE);
+    TableItem item1 = new TableItem (table, SWT.NONE);
+    item1.setText ( ["first item", "a", "b"]);
+    item1.setImage (1, uncheckedImage);
+    item1.setImage (2, uncheckedImage);
+    item1.setData (STATE, null);
+    TableItem item2 = new TableItem (table, SWT.NONE);
+    item2.setText ( ["second item", "c", "d"]);
+    item2.setImage (1, uncheckedImage);
+    item2.setImage (2, checkedImage);
+    item2.setData (STATE,  new ArrayWrapperInt([2]));
+    TableItem item3 = new TableItem (table, SWT.NONE);
+    item3.setText ( ["third", "e", "f"]);
+    item3.setImage (1, checkedImage);
+    item3.setImage (2, checkedImage);
+    item3.setData (STATE, new ArrayWrapperInt( [1, 2]));
+    column1.pack ();
+    column2.pack ();
+    column3.pack ();
 
-    public static void main (String [] args) {
-        Display display = new Display ();
-        Image checkedImage = getCheckedImage (display);
-        Image uncheckedImage = getUncheckedImage (display);
-        Shell shell = new Shell (display);
-        shell.setLayout (new FillLayout ());
-        Table table = new Table (shell, SWT.BORDER);
-        TableColumn column1 = new TableColumn (table, SWT.NONE);
-        TableColumn column2 = new TableColumn (table, SWT.NONE);
-        TableColumn column3 = new TableColumn (table, SWT.NONE);
-        TableItem item1 = new TableItem (table, SWT.NONE);
-        item1.setText ( ["first item", "a", "b"]);
-        item1.setImage (1, uncheckedImage);
-        item1.setImage (2, uncheckedImage);
-        item1.setData (STATE, null);
-        TableItem item2 = new TableItem (table, SWT.NONE);
-        item2.setText ( ["second item", "c", "d"]);
-        item2.setImage (1, uncheckedImage);
-        item2.setImage (2, checkedImage);
-        item2.setData (STATE,  new ArrayWrapperInt([2]));
-        TableItem item3 = new TableItem (table, SWT.NONE);
-        item3.setText ( ["third", "e", "f"]);
-        item3.setImage (1, checkedImage);
-        item3.setImage (2, checkedImage);
-        item3.setData (STATE, new ArrayWrapperInt( [1, 2]));
-        column1.pack ();
-        column2.pack ();
-        column3.pack ();
+    Accessible accessible = table.getAccessible ();
+    accessible.addAccessibleListener( new class AccessibleAdapter  {
+        public void getName (AccessibleEvent e) {
+            super.getName (e);
+            if (e.childID >= 0 && e.childID < table.getItemCount ()) {
+                TableItem item = table.getItem (e.childID);
+                Point pt = display.getCursorLocation ();
+                pt = display.map (null, table, pt);
+                for (int i = 0; i < table.getColumnCount (); i++) {
+                    if (item.getBounds (i).contains (pt)) {
+                        int [] data = (cast(ArrayWrapperInt)item.getData (STATE)).array;
+                        bool checked = false;
+                        if (data !is null) {
+                            for (int j = 0; j < data.length; j++) {
+                                if (data [j] == i) {
+                                    checked = true;
+                                    break;
+                                }
+                            }
+                        }
+                        e.result = item.getText (i) ~ " " ~ (checked ? "checked" : "unchecked");
+                        break;
+                    }
+                }
+            }
+        }
+    });
 
-        Accessible accessible = table.getAccessible ();
-        accessible.addAccessibleListener( new class() AccessibleAdapter  {
-            public void getName (AccessibleEvent e) {
-                super.getName (e);
-                if (e.childID >= 0 && e.childID < table.getItemCount ()) {
-                    TableItem item = table.getItem (e.childID);
+    accessible.addAccessibleControlListener (new class AccessibleControlAdapter  {
+        public void getState (AccessibleControlEvent e) {
+            super.getState (e);
+            if (e.childID >= 0 && e.childID < table.getItemCount ()) {
+                TableItem item = table.getItem (e.childID);
+                int [] data =(cast(ArrayWrapperInt)item.getData (STATE)).array;
+                if (data !is null) {
                     Point pt = display.getCursorLocation ();
                     pt = display.map (null, table, pt);
-                    for (int i = 0; i < table.getColumnCount (); i++) {
-                        if (item.getBounds (i).contains (pt)) {
-                            int [] data = (cast(ArrayWrapperInt)item.getData (STATE)).array;
-                            bool checked = false;
-                            if (data !is null) {
-                                for (int j = 0; j < data.length; j++) {
-                                    if (data [j] == i) {
-                                        checked = true;
-                                        break;
-                                    }
-                                }
-                            }
-                            e.result = item.getText (i) ~ " " ~ (checked ? "checked" : "unchecked");
+                    for (int i = 0; i < data.length; i++) {
+                        if (item.getBounds (data [i]).contains (pt)) {
+                            e.detail |= ACC.STATE_CHECKED;
                             break;
                         }
                     }
                 }
             }
-        });
+        }
+    });
+    shell.open ();
+    while (!shell.isDisposed ()) {
+        if (!display.readAndDispatch ()) display.sleep ();
+    }
+    checkedImage.dispose ();
+    uncheckedImage.dispose ();
+    display.dispose ();
+}
 
-        accessible.addAccessibleControlListener (new class() AccessibleControlAdapter  {
-            public void getState (AccessibleControlEvent e) {
-                super.getState (e);
-                if (e.childID >= 0 && e.childID < table.getItemCount ()) {
-                    TableItem item = table.getItem (e.childID);
-                    int [] data =(cast(ArrayWrapperInt)item.getData (STATE)).array;
-                    if (data !is null) {
-                        Point pt = display.getCursorLocation ();
-                        pt = display.map (null, table, pt);
-                        for (int i = 0; i < data.length; i++) {
-                            if (item.getBounds (data [i]).contains (pt)) {
-                                e.detail |= ACC.STATE_CHECKED;
-                                break;
-                            }
-                        }
-                    }
-                }
-            }
-        });
-        shell.open ();
-        while (!shell.isDisposed ()) {
-            if (!display.readAndDispatch ()) display.sleep ();
-        }
-        checkedImage.dispose ();
-        uncheckedImage.dispose ();
-        display.dispose ();
-    }
+Image getCheckedImage (Display display) {
+    Image image = new Image (display, 16, 16);
+    GC gc = new GC (image);
+    gc.setBackground (display.getSystemColor (SWT.COLOR_YELLOW));
+    gc.fillOval (0, 0, 16, 16);
+    gc.setForeground (display.getSystemColor (SWT.COLOR_DARK_GREEN));
+    gc.drawLine (0, 0, 16, 16);
+    gc.drawLine (16, 0, 0, 16);
+    gc.dispose ();
+    return image;
+}
 
-    static Image getCheckedImage (Display display) {
-        Image image = new Image (display, 16, 16);
-        GC gc = new GC (image);
-        gc.setBackground (display.getSystemColor (SWT.COLOR_YELLOW));
-        gc.fillOval (0, 0, 16, 16);
-        gc.setForeground (display.getSystemColor (SWT.COLOR_DARK_GREEN));
-        gc.drawLine (0, 0, 16, 16);
-        gc.drawLine (16, 0, 0, 16);
-        gc.dispose ();
-        return image;
-    }
-
-    static Image getUncheckedImage (Display display) {
-        Image image = new Image (display, 16, 16);
-        GC gc = new GC (image);
-        gc.setBackground (display.getSystemColor (SWT.COLOR_YELLOW));
-        gc.fillOval (0, 0, 16, 16);
-        gc.dispose ();
-        return image;
-    }
+Image getUncheckedImage (Display display) {
+    Image image = new Image (display, 16, 16);
+    GC gc = new GC (image);
+    gc.setBackground (display.getSystemColor (SWT.COLOR_YELLOW));
+    gc.fillOval (0, 0, 16, 16);
+    gc.dispose ();
+    return image;
 }
--- a/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet169.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet169.d	Sat Jul 09 15:50:20 2011 +0300
@@ -37,39 +37,32 @@
     import std.conv;
 }
 
-void main(String[] args){
-    Snippet169.main(args);
+void main () {
+    Display display = new Display ();
+    Shell shell = new Shell (display);
+    shell.setLayout (new FillLayout ());
+    Listener listener = new class Listener {
+        public void handleEvent (Event e) {
+            Control [] children = shell.getChildren ();
+            for (int i=0; i<children.length; i++) {
+                Control child = children [i];
+                if (e.widget !is child && cast(Button)child !is null && (child.getStyle () & SWT.TOGGLE) != 0) {
+                    (cast(Button) child).setSelection (false);
+                }
+            }
+            (cast(Button) e.widget).setSelection (true);
+        }
+    };
+    for (int i=0; i<20; i++) {
+        Button button = new Button (shell, SWT.TOGGLE);
+        button.setText ("B" ~to!(String)(i));
+        button.addListener (SWT.Selection, listener);
+        if (i == 0) button.setSelection (true);
+    }
+    shell.pack ();
+    shell.open ();
+    while (!shell.isDisposed ()) {
+        if (!display.readAndDispatch ()) display.sleep ();
+    }
+    display.dispose ();
 }
-
-
-public class Snippet169 {
-    public static void main (String [] args) {
-        Display display = new Display ();
-        Shell shell = new Shell (display);
-        shell.setLayout (new FillLayout ());
-        Listener listener = new class() Listener {
-            public void handleEvent (Event e) {
-                Control [] children = shell.getChildren ();
-                for (int i=0; i<children.length; i++) {
-                    Control child = children [i];
-                    if (e.widget !is child && cast(Button)child !is null && (child.getStyle () & SWT.TOGGLE) != 0) {
-                        (cast(Button) child).setSelection (false);
-                    }
-                }
-                (cast(Button) e.widget).setSelection (true);
-            }
-        };
-        for (int i=0; i<20; i++) {
-            Button button = new Button (shell, SWT.TOGGLE);
-            button.setText ("B" ~to!(String)(i));
-            button.addListener (SWT.Selection, listener);
-            if (i == 0) button.setSelection (true);
-        }
-        shell.pack ();
-        shell.open ();
-        while (!shell.isDisposed ()) {
-            if (!display.readAndDispatch ()) display.sleep ();
-        }
-        display.dispose ();
-    }
-}
--- a/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet174.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet174.d	Sat Jul 09 15:50:20 2011 +0300
@@ -45,7 +45,7 @@
     import Math = std.algorithm;
 }
 
-public static void main() 
+void main() 
 {
     DerelictGL.load();
     DerelictGLU.load();
@@ -78,7 +78,7 @@
     display.dispose();
 }
 
-static void init(GLCanvas canvas) {
+void init(GLCanvas canvas) {
     canvas.setCurrent();
     resize(canvas);
     glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
@@ -88,7 +88,7 @@
     glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
 }
 
-static void render() {
+void render() {
     static int rot = 0;
     glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
     glLoadIdentity();
@@ -103,7 +103,7 @@
     glEnd();
 }
 
-static void resize(GLCanvas canvas) {
+void resize(GLCanvas canvas) {
     canvas.setCurrent();
     Rectangle rect = canvas.getClientArea();
     int width = rect.width;
--- a/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet190.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet190.d	Sat Jul 09 15:50:20 2011 +0300
@@ -53,7 +53,7 @@
     spinner.setIncrement(10);
     // set the seletion to 3.456
     spinner.setSelection(3456);
-    spinner.addSelectionListener(new class() SelectionAdapter {
+    spinner.addSelectionListener(new class SelectionAdapter {
         public void widgetSelected(SelectionEvent e) {
             int selection = spinner.getSelection();
             float digits = spinner.getDigits();
--- a/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet195.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet195.d	Sat Jul 09 15:50:20 2011 +0300
@@ -87,7 +87,7 @@
 
     canvas.setCurrent();
 
-    canvas.addListener(SWT.Resize, new class() Listener {
+    canvas.addListener(SWT.Resize, new class Listener {
         public void handleEvent(Event event) {
             Rectangle bounds = canvas.getBounds();
             float fAspect = cast(float) bounds.width / cast(float) bounds.height;
@@ -112,7 +112,7 @@
     shell.setSize(640, 480);
     shell.open();
 
-    display.asyncExec(new class() Runnable {
+    display.asyncExec(new class Runnable {
         int rot = 0;
         public void run() {
             if (!canvas.isDisposed()) {
--- a/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet206.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet206.d	Sat Jul 09 15:50:20 2011 +0300
@@ -30,24 +30,18 @@
 
 import java.lang.all;
 
-void main(String[] args){
-    Snippet206.main(args);
+void main() {
+    Display display = new Display();
+    Image image = display.getSystemImage(SWT.ICON_QUESTION);
+    Shell shell = new Shell(display);
+    shell.setLayout (new GridLayout());
+    Button button = new Button(shell, SWT.PUSH);
+    button.setImage(image);
+    button.setText("Button");
+    shell.setSize(300, 300);
+    shell.open();
+    while (!shell.isDisposed ()) {
+        if (!display.readAndDispatch ()) display.sleep ();
+    }
+    display.dispose ();
 }
-
-public class Snippet206 {
-    public static void main(String[] args) {
-        Display display = new Display();
-        Image image = display.getSystemImage(SWT.ICON_QUESTION);
-        Shell shell = new Shell(display);
-        shell.setLayout (new GridLayout());
-        Button button = new Button(shell, SWT.PUSH);
-        button.setImage(image);
-        button.setText("Button");
-        shell.setSize(300, 300);
-        shell.open();
-        while (!shell.isDisposed ()) {
-            if (!display.readAndDispatch ()) display.sleep ();
-        }
-        display.dispose ();
-    }
-}
--- a/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet207.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet207.d	Sat Jul 09 15:50:20 2011 +0300
@@ -56,7 +56,7 @@
     shell.setText("Matrix Tranformations");
     shell.setLayout(new FillLayout());
     Canvas canvas = new Canvas(shell, SWT.DOUBLE_BUFFERED);
-    canvas.addPaintListener(new class() PaintListener {
+    canvas.addPaintListener(new class PaintListener {
             public void paintControl(PaintEvent e) {    
                 GC gc = e.gc;
                 gc.setAdvanced(true);
--- a/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet208.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet208.d	Sat Jul 09 15:50:20 2011 +0300
@@ -33,7 +33,7 @@
 
 import java.lang.all;
 
-void main (String [] args) {
+void main () {
     PaletteData palette = new PaletteData(0xff, 0xff00, 0xff0000);
 
     // ImageData showing variations of hue
--- a/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet21.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet21.d	Sat Jul 09 15:50:20 2011 +0300
@@ -30,6 +30,9 @@
 
 version(Tango){
     import tango.io.Stdout;
+    void writeln(in char[] line) {
+        Stdout(line)("\n").flush();
+    }
 } else { // Phobos
     import std.stdio;
 }
@@ -58,7 +61,7 @@
         case SWT.TRAVERSE_PAGE_NEXT:	
         case SWT.TRAVERSE_PAGE_PREVIOUS:
             e.doit = true;
-            break;
+        default:
         }
     }
 
@@ -71,11 +74,7 @@
     }
 
     void onKeyDown (Event e, Canvas c) {
-        version(Tango){
-            Stdout("KEY").newline;
-        } else { // Phobos
-            writeln("KEY");
-        }
+        writeln("KEY");
         for (int i=0; i<64; i++) {
             Color c1 = red, c2 = blue;
             if (c.isFocusControl ()) {
--- a/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet212.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet212.d	Sat Jul 09 15:50:20 2011 +0300
@@ -10,32 +10,7 @@
  * Port to the D programming language:
  *     yidabu at gmail dot com  ( D China http://www.d-programming-language-china.org/ )
  *******************************************************************************/
-/*
-Unhandled Exception: EXCEPTION_ACCESS_VIOLATION(0xc0000005) at ntdll.dll (0x7c90316c) thread(1480)
-->us
-#0 ?? () at org.eclipse.swt\graphics\TextLayout.d:2915 from ntdll.dll
-#1 0x77f205bf in ?? () at org.eclipse.swt\graphics\TextLayout.d:2915 from GDI32.dll
-#2 0x00483c72 in  org.eclipse.swt.graphics.TextLayout.TextLayout.shape () at dwt\graphics\TextLayout.d:2915
-#3 0x0047bfff in  org.eclipse.swt.graphics.TextLayout.TextLayout.computeRuns () at dwt\graphics\TextLayout.d:267
-#4 0x00480474 in  org.eclipse.swt.graphics.Rectangle.Rectangle dwt.graphics.TextLayout.TextLayout.getBounds () at dwt\graphics\TextLayout.d:1387
-#5 0x00411ea7 in  org.eclipse.swt.graphics.Point.Point dwt.custom.StyledText.StyledText.computeSize () at dwt\custom\StyledText.d:1784
-#6 0x0041f24b in  org.eclipse.swt.layout.GridData.GridData.computeSize () at dwt\layout\GridData.d:484
-#7 0x0043258f in  org.eclipse.swt.graphics.Point.Point dwt.layout.GridLayout.GridLayout.layout () at dwt\layout\GridLayout.d:232
-#8 0x00432325 in  org.eclipse.swt.layout.GridLayout.GridLayout.layout () at dwt\layout\GridLayout.d:208
-#9 0x004999af in  org.eclipse.swt.widgets.Composite.Composite.updateLayout () at dwt\widgets\Composite.d:1170
-#10 0x00498eba in  org.eclipse.swt.widgets.Composite.Composite.sendResize () at dwt\widgets\Composite.d:879
-#11 0x00499053 in  org.eclipse.swt.widgets.Composite.Composite.setBounds () at dwt\widgets\Composite.d:924
-#12 0x004d959d in  org.eclipse.swt.widgets.Decorations.Decorations.setBounds () at dwt\widgets\Decorations.d:888
-#13 0x0042f9a2 in  org.eclipse.swt.widgets.Shell.Shell.setBounds () at dwt\widgets\Shell.d:1460
-#14 0x004733f3 in  org.eclipse.swt.widgets.Control.Control.setBounds () at dwt\widgets\Control.d:2639
-#15 0x00473d27 in  org.eclipse.swt.widgets.Control.Control.setSize () at dwt\widgets\Control.d:3153
-#16 0x004042c8 in _Dmain () at Snippet212.d:171
-#17 0x00645778 in extern (C) int dmain2.main(int, char**) . void runMain(void*) () from dmain2
-#18 0x006457af in extern (C) int dmain2.main(int, char**) . void runAll(void*) () from dmain2
-#19 0x006454f0 in _main () from dmain2
-#20 0x0065f801 in _mainCRTStartup () from constart
-#21 0x7c816fd7 in ?? () from KERNEL32.dll
-*/
+
 module org.eclipse.swt.snippets.Snippet212;
 /**
  * StyledText snippet: embed images
@@ -129,13 +104,7 @@
     // use a verify listener to keep the offsets up to date
     styledText.addListener(SWT.Verify, dgListener(&onVerify));
 
-    styledText.addPaintObjectListener(new class(images, offsets) PaintObjectListener {
-        Image[] images;
-        int[] offsets;
-        this( Image[] images_, int[] offsets_) {
-            this.images = images_;
-            this.offsets = offsets_;
-        }
+    styledText.addPaintObjectListener(new class PaintObjectListener {
         public void paintObject(PaintObjectEvent event) {
             GC gc = event.gc;
             StyleRange style = event.style;
--- a/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet214.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet214.d	Sat Jul 09 15:50:20 2011 +0300
@@ -43,8 +43,9 @@
     import std.conv;
 }
 
-static Image oldImage;
 void main(String [] args) {
+    Image oldImage;
+    
     Display display = new Display ();
     Shell shell = new Shell (display);
     shell.setBackgroundMode (SWT.INHERIT_DEFAULT);
@@ -60,7 +61,7 @@
         Button button = new Button (group, SWT.RADIO);
         button.setText ("Button " ~ to!(String)(i));
     }
-    shell.addListener (SWT.Resize, new class() Listener {
+    shell.addListener (SWT.Resize, new class Listener {
        public void handleEvent (Event event) {
            Rectangle rect = shell.getClientArea ();
            Image newImage = new Image (display, Math.max (1, rect.width), 1);
--- a/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet215.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet215.d	Sat Jul 09 15:50:20 2011 +0300
@@ -31,15 +31,15 @@
 import org.eclipse.swt.layout.FillLayout;
 import org.eclipse.swt.events.PaintListener;
 
-Image image;
-
 void main() {
+    Image image;
+    
     Display display = new Display();
     Shell shell = new Shell(display);
     shell.setLayout(new FillLayout());
     Button button = new Button(shell, SWT.PUSH);
     button.setText("Capture");
-    button.addListener(SWT.Selection, new class() Listener {
+    button.addListener(SWT.Selection, new class Listener {
         public void handleEvent(Event event) {
 
             /* Take the screen shot */
@@ -52,7 +52,7 @@
             popup.setLayout(new FillLayout());
             popup.setText("Image");
             popup.setBounds(50, 50, 200, 200);
-            popup.addListener(SWT.Close, new class() Listener {
+            popup.addListener(SWT.Close, new class Listener {
                     public void handleEvent(Event e) {
                         image.dispose();
                     }
@@ -62,7 +62,7 @@
             Canvas canvas = new Canvas(sc, SWT.NONE);
             sc.setContent(canvas);
             canvas.setBounds(display.getBounds ());
-            canvas.addPaintListener(new class() PaintListener {
+            canvas.addPaintListener(new class PaintListener {
                     public void paintControl(PaintEvent e) {
                         e.gc.drawImage(image, 0, 0);
                     }
--- a/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet217.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet217.d	Sat Jul 09 15:50:20 2011 +0300
@@ -48,7 +48,7 @@
     import jive.stacktrace;
 }
 
-const String OBJ_MARKER = "\uFFFC";
+const OBJ_MARKER = "\uFFFC";
 void main() {
     static StyledText styledText;
     static String text =
@@ -56,9 +56,9 @@
         "Here is one: " ~ OBJ_MARKER ~ ", and here is another: " ~ OBJ_MARKER ~ ".";
     static int[] offsets;
     static Control[] controls;
-    static int MARGIN = 5;
+    static const int MARGIN = 5;
 
-    void addControl(Control control, int offset) {
+    static void addControl(Control control, int offset) {
         StyleRange style = new StyleRange ();
         style.start = offset;
         style.length = OBJ_MARKER.length;
@@ -118,11 +118,7 @@
     styledText.addListener(SWT.Verify, dgListener(&onVerify));
 
     // reposition widgets on paint event
-    styledText.addPaintObjectListener(new class(offsets) PaintObjectListener {
-        int[] offsets;
-        this(int[] offsets_) {
-            this.offsets = offsets_;
-        }
+    styledText.addPaintObjectListener(new class PaintObjectListener {
         public void paintObject(PaintObjectEvent event) {
             StyleRange style = event.style;
             int start = style.start;
--- a/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet222.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet222.d	Sat Jul 09 15:50:20 2011 +0300
@@ -91,7 +91,7 @@
     styledText.setLineBullet(13, 2, bullet1);
     styledText.setLineBullet(16, 4, bullet3);
 
-    styledText.addPaintObjectListener(new class() PaintObjectListener {
+    styledText.addPaintObjectListener(new class PaintObjectListener {
         public void paintObject(PaintObjectEvent event) {
             Display display = event.display;
             StyleRange style = event.style;
--- a/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet224.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet224.d	Sat Jul 09 15:50:20 2011 +0300
@@ -38,41 +38,34 @@
     import std.conv;
 }
 
-void main(String[] args){
-    Snippet224.main(args);
-}
-
-
-public class Snippet224 {
-    public static void main (String [] args) {
-        Display display = new Display ();
-        Shell shell = new Shell (display);
-        shell.setLayout (new RowLayout (SWT.VERTICAL));
-        for (int i=0; i<8; i++) {
-            Button button = new Button (shell, SWT.RADIO);
-            button.setText ("B" ~ to!(String)(i));
-            if (i == 0) button.setSelection (true);
+void main () {
+    Display display = new Display ();
+    Shell shell = new Shell (display);
+    shell.setLayout (new RowLayout (SWT.VERTICAL));
+    for (int i=0; i<8; i++) {
+        Button button = new Button (shell, SWT.RADIO);
+        button.setText ("B" ~ to!(String)(i));
+        if (i == 0) button.setSelection (true);
+    }
+    Button button = new Button (shell, SWT.PUSH);
+    button.setText ("Set Selection to B4");
+    button.addListener (SWT.Selection, new class Listener{
+        public void handleEvent (Event event) {
+            Control [] children = shell.getChildren ();
+            Button newButton = cast(Button) children [4];
+            for (int i=0; i<children.length; i++) {
+                Control child = children [i];
+                if ( cast(Button)child !is null && (child.getStyle () & SWT.RADIO) != 0) {
+                    (cast(Button)child).setSelection (false);
+                }
+            }
+            newButton.setSelection (true);
         }
-        Button button = new Button (shell, SWT.PUSH);
-        button.setText ("Set Selection to B4");
-        button.addListener (SWT.Selection, new class() Listener{
-            public void handleEvent (Event event) {
-                Control [] children = shell.getChildren ();
-                Button newButton = cast(Button) children [4];
-                for (int i=0; i<children.length; i++) {
-                    Control child = children [i];
-                    if ( cast(Button)child !is null && (child.getStyle () & SWT.RADIO) != 0) {
-                        (cast(Button)child).setSelection (false);
-                    }
-                }
-                newButton.setSelection (true);
-            }
-        });
-        shell.pack ();
-        shell.open ();
-        while (!shell.isDisposed ()) {
-            if (!display.readAndDispatch ()) display.sleep ();
-        }
-        display.dispose ();
+    });
+    shell.pack ();
+    shell.open ();
+    while (!shell.isDisposed ()) {
+        if (!display.readAndDispatch ()) display.sleep ();
     }
+    display.dispose ();
 }
--- a/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet235.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet235.d	Sat Jul 09 15:50:20 2011 +0300
@@ -35,7 +35,7 @@
 
 import java.lang.all;
 
-void main(String [] args) {
+void main() {
     Display display = new Display();
     Shell shell = new Shell(display);
     shell.setText("The SWT.Settings Event");
@@ -78,7 +78,7 @@
     }
     display.dispose();
 }
-static int[] colorIds = 
+const int[19] colorIds = 
     [ 
     SWT.COLOR_INFO_BACKGROUND, 
     SWT.COLOR_INFO_FOREGROUND, 
@@ -100,7 +100,7 @@
     SWT.COLOR_WIDGET_LIGHT_SHADOW,
     SWT.COLOR_WIDGET_NORMAL_SHADOW,
     ];
-static String [] colorNames = 
+const String[19] colorNames = 
     [
     "SWT.COLOR_INFO_BACKGROUND",
     "SWT.COLOR_INFO_FOREGROUND", 
--- a/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet237.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet237.d	Sat Jul 09 15:50:20 2011 +0300
@@ -34,58 +34,54 @@
 
 import java.lang.all;
 
-void main(String[] args){
-    Snippet237.main(args);
-}
-public class Snippet237 {
 
-    public static void main(String[] args) {
-        Display display = new Display();
-        Shell shell = new Shell(display);
-        shell.setText("Composite.setBackgroundMode()");
-        shell.setLayout(new RowLayout(SWT.VERTICAL));
+void main() {
+    Display display = new Display();
+    Shell shell = new Shell(display);
+    shell.setText("Composite.setBackgroundMode()");
+    shell.setLayout(new RowLayout(SWT.VERTICAL));
+
+    Color color = display.getSystemColor(SWT.COLOR_CYAN);
 
-        Color color = display.getSystemColor(SWT.COLOR_CYAN);
+    Group group = new Group(shell, SWT.NONE);
+    group.setText("SWT.INHERIT_NONE");
+    group.setBackground(color);
+    group.setBackgroundMode(SWT.INHERIT_NONE);
+    createChildren(group);
 
-        Group group = new Group(shell, SWT.NONE);
-        group.setText("SWT.INHERIT_NONE");
-        group.setBackground(color);
-        group.setBackgroundMode(SWT.INHERIT_NONE);
-        createChildren(group);
-
-        group = new Group(shell, SWT.NONE);
-        group.setBackground(color);
-        group.setText("SWT.INHERIT_DEFAULT");
-        group.setBackgroundMode(SWT.INHERIT_DEFAULT);
-        createChildren(group);
+    group = new Group(shell, SWT.NONE);
+    group.setBackground(color);
+    group.setText("SWT.INHERIT_DEFAULT");
+    group.setBackgroundMode(SWT.INHERIT_DEFAULT);
+    createChildren(group);
 
-        group = new Group(shell, SWT.NONE);
-        group.setBackground(color);
-        group.setText("SWT.INHERIT_FORCE");
-        group.setBackgroundMode(SWT.INHERIT_FORCE);
-        createChildren(group);
+    group = new Group(shell, SWT.NONE);
+    group.setBackground(color);
+    group.setText("SWT.INHERIT_FORCE");
+    group.setBackgroundMode(SWT.INHERIT_FORCE);
+    createChildren(group);
 
-        shell.pack();
-        shell.open();
-        while(!shell.isDisposed()) {
-            if(!display.readAndDispatch()) display.sleep();
-        }
-        display.dispose();
+    shell.pack();
+    shell.open();
+    while(!shell.isDisposed()) {
+        if(!display.readAndDispatch()) display.sleep();
     }
-    static void createChildren(Composite parent) {
-        parent.setLayout(new RowLayout());
-        List list = new List(parent, SWT.BORDER | SWT.MULTI);
-        list.add("List item 1");
-        list.add("List item 2");
-        Label label = new Label(parent, SWT.NONE);
-        label.setText("Label");
-        Button button = new Button(parent, SWT.RADIO);
-        button.setText("Radio Button");
-        button = new Button(parent, SWT.CHECK);
-        button.setText("Check box Button");
-        button = new Button(parent, SWT.PUSH);
-        button.setText("Push Button");
-        Text text = new Text(parent, SWT.BORDER);
-        text.setText("Text");
-    }
+    display.dispose();
 }
+
+void createChildren(Composite parent) {
+    parent.setLayout(new RowLayout());
+    List list = new List(parent, SWT.BORDER | SWT.MULTI);
+    list.add("List item 1");
+    list.add("List item 2");
+    Label label = new Label(parent, SWT.NONE);
+    label.setText("Label");
+    Button button = new Button(parent, SWT.RADIO);
+    button.setText("Radio Button");
+    button = new Button(parent, SWT.CHECK);
+    button.setText("Check box Button");
+    button = new Button(parent, SWT.PUSH);
+    button.setText("Push Button");
+    Text text = new Text(parent, SWT.BORDER);
+    text.setText("Text");
+}
--- a/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet24.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet24.d	Sat Jul 09 15:50:20 2011 +0300
@@ -30,11 +30,14 @@
 import java.lang.all;
 version(Tango){
     import tango.io.Stdout;
+    void writeln(in char[] line) {
+        Stdout(line)("\n").flush();
+    }
 } else { // Phobos
     import std.stdio;
 }
 
-void main (String [] args) {
+void main() {
     Display display = new Display ();
     Shell shell = new Shell (display);
     shell.setLayout (new RowLayout ());
@@ -42,22 +45,14 @@
     combo.setItems (["A-1", "B-1", "C-1"]);
     Text text = new Text (shell, SWT.SINGLE | SWT.BORDER);
     text.setText ("some text");
-    combo.addListener (SWT.DefaultSelection, new class() Listener{
+    combo.addListener (SWT.DefaultSelection, new class Listener{
         public void handleEvent (Event e) {
-            version(Tango){
-                Stdout(e.widget.toString() ~ " - Default Selection\n");
-            } else { // Phobos
-                writeln(e.widget.toString() ~ " - Default Selection");
-            }
+            writeln(e.widget.toString() ~ " - Default Selection");
         }
     });
-    text.addListener (SWT.DefaultSelection, new class() Listener{
+    text.addListener (SWT.DefaultSelection, new class Listener{
         public void handleEvent (Event e) {
-            version(Tango){
-                Stdout(e.widget.toString() ~ " - Default Selection\n");
-            } else { // Phobos
-                writeln(e.widget.toString() ~ " - Default Selection");
-            }
+            writeln(e.widget.toString() ~ " - Default Selection");
         }
     });
     shell.pack ();
--- a/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet242.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet242.d	Sat Jul 09 15:50:20 2011 +0300
@@ -38,7 +38,7 @@
     shell.setBounds(10, 10, 200, 200);
     Canvas canvas = new Canvas(shell, SWT.BORDER);
     canvas.setBounds(10,50,150,100);
-    canvas.addPaintListener(new class() PaintListener{
+    canvas.addPaintListener(new class PaintListener{
         public void paintControl(PaintEvent e) {
             e.gc.drawString("hide Cursor here", 10, 10);
         }
--- a/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet244.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet244.d	Sat Jul 09 15:50:20 2011 +0300
@@ -36,7 +36,7 @@
 }
 
 void main() {
-    static String SEARCH_STRING = "box";
+    const String SEARCH_STRING = "box";
     Display display = new Display();
     Color RED = display.getSystemColor(SWT.COLOR_RED);
     Shell shell = new Shell(display);
--- a/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet245.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet245.d	Sat Jul 09 15:50:20 2011 +0300
@@ -29,9 +29,7 @@
 {
 	Display display = new Display();
 	Shell shell = new Shell(display);
-	shell.addPaintListener(new class(shell) PaintListener {
-        Shell shell;
-        this(Shell s) { this.shell = s; }
+	shell.addPaintListener(new class PaintListener {
         public void paintControl(PaintEvent event) {
             Rectangle rect = shell.getClientArea();
             event.gc.drawOval(0, 0, rect.width - 1, rect.height - 1);
--- a/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet247.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet247.d	Sat Jul 09 15:50:20 2011 +0300
@@ -38,14 +38,14 @@
     import std.stdio;
 }
 
-void main (String [] args) {
+void main () {
     Display display = new Display ();
     Shell shell = new Shell (display);
     shell.setLayout(new RowLayout());
     Text text = new Text(shell, SWT.MULTI | SWT.BORDER);
     String modifier = SWT.MOD1 == SWT.CTRL ? "Ctrl" : "Command";
     text.setText("Hit " ~ modifier ~ "+Return\nto see\nthe default button\nrun");
-    text.addTraverseListener(new class() TraverseListener{
+    text.addTraverseListener(new class TraverseListener{
         public void keyTraversed(TraverseEvent e) {
           switch (e.detail) {
           case SWT.TRAVERSE_RETURN:
@@ -57,7 +57,7 @@
     Button button = new Button (shell, SWT.PUSH);
     button.pack();
     button.setText("OK");
-    button.addSelectionListener(new class() SelectionAdapter{
+    button.addSelectionListener(new class SelectionAdapter{
         public void widgetSelected(SelectionEvent e) {
             version(Tango){
                 Stdout("OK selected\n");
--- a/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet25.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet25.d	Sat Jul 09 15:50:20 2011 +0300
@@ -28,16 +28,17 @@
 import java.lang.all;
 
 version(Tango){
+    import tango.util.Convert;
     import tango.io.Stdout;
-    import tango.text.convert.Format;
-    import tango.util.Convert;
+    void writeln(in char[] line) {
+        Stdout(line)("\n").flush();
+    }
 } else { // Phobos
     import std.stdio;
-    import std.string;
     import std.conv;
 }
 
-static String stateMask (int stateMask) {
+String stateMask (int stateMask) {
 	String string = "";
 	if ((stateMask & SWT.CTRL) != 0) string ~= " CTRL";
 	if ((stateMask & SWT.ALT) != 0) string ~= " ALT";
@@ -46,7 +47,7 @@
 	return string;
 }
 
-static String character (wchar character) {
+String character (wchar character) {
 	switch (character) {
     case 0: 		return "'\\0'";
     case SWT.BS:	return "'\\b'";
@@ -60,7 +61,7 @@
 	}
 }
 
-static String keyCode (int keyCode) {
+String keyCode (int keyCode) {
 	switch (keyCode) {
 		
 		/* Keyboard and Mouse Masks */
@@ -144,18 +145,12 @@
 	Shell shell = new Shell (display);
 	Listener listener = new class Listener {
 		public void handleEvent (Event e) {
-			String string = e.type == SWT.KeyDown ? "DOWN:" : "UP  :";
-			version(Tango){
-				string ~= Format("stateMask=0x{:x}{},", e.stateMask, stateMask (e.stateMask));
-				string ~= Format(" keyCode=0x{:x} {},", e.keyCode, keyCode (e.keyCode));
-				string ~= Format(" character=0x{:x} {}", e.character, character (e.character));
-				Stdout.formatln (string);
-			} else { // Phobos
-				string ~= format("stateMask=0x%x%s,", e.stateMask, stateMask (e.stateMask));
-				string ~= format(" keyCode=0x%x %s,", e.keyCode, keyCode (e.keyCode));
-				string ~= format(" character=0x%x %s", e.character, character (e.character));
-				writefln (string);
-			}
+			String string = Format("{} stateMask=0x{:x}{}, keyCode=0x{:x} {}, character=0x{:x} {}",
+				e.type == SWT.KeyDown ? "DOWN:" : "UP  :",
+				e.stateMask, stateMask (e.stateMask),
+				e.keyCode, keyCode (e.keyCode),
+				e.character, character (e.character));
+			writeln(string);
 		}
 	};
 	shell.addListener (SWT.KeyDown, listener);
--- a/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet250.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet250.d	Sat Jul 09 15:50:20 2011 +0300
@@ -34,13 +34,13 @@
     import std.stdio;
 }
 
-void main (String [] args) {
+void main () {
     Display display = new Display ();
     Shell shell = new Shell (display);
     shell.setLayout (new RowLayout ());
 
     DateTime calendar = new DateTime (shell, SWT.CALENDAR);
-    calendar.addSelectionListener (new class() SelectionAdapter{
+    calendar.addSelectionListener (new class SelectionAdapter{
         void widgetSelected (SelectionEvent e) {
             version(Tango){
                 Stdout("calendar date changed\n");
@@ -52,7 +52,7 @@
     });
 
     DateTime time = new DateTime (shell, SWT.TIME);
-    time.addSelectionListener (new class() SelectionAdapter{
+    time.addSelectionListener (new class SelectionAdapter{
         void widgetSelected (SelectionEvent e) {
             version(Tango){
                 Stdout("time changed\n");
--- a/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet251.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet251.d	Sat Jul 09 15:50:20 2011 +0300
@@ -39,7 +39,7 @@
     import std.stdio;
 }
 
-void main (String [] args) {
+void main () {
     /* These cannot be local in the
      * listener, hence we put it here and not at the
      * constructor. (THD)
@@ -54,7 +54,7 @@
 
     Button open = new Button (shell, SWT.PUSH);
     open.setText ("Open Dialog");
-    open.addSelectionListener (new class() SelectionAdapter{
+    open.addSelectionListener (new class SelectionAdapter{
         public void widgetSelected (SelectionEvent e) {
             dialog = new Shell (shell, SWT.DIALOG_TRIM);
             dialog.setLayout (new GridLayout (3, false));
@@ -68,7 +68,7 @@
             Button ok = new Button (dialog, SWT.PUSH);
             ok.setText ("OK");
             ok.setLayoutData(new GridData (SWT.FILL, SWT.CENTER, false, false));
-            ok.addSelectionListener (new class() SelectionAdapter{
+            ok.addSelectionListener (new class SelectionAdapter{
                 void widgetSelected (SelectionEvent e) {
                     version(Tango){
                         Stdout.formatln("Calendar date selected (MM/DD/YYYY) = {:d02}/{:d02}/{:d04}",
--- a/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet268.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet268.d	Sat Jul 09 15:50:20 2011 +0300
@@ -35,7 +35,6 @@
 version(Tango){
     import tango.io.Stdout;
     import tango.util.Convert;
-    //import tango.core.Thread;
 } else { // Phobos
     import std.stdio;
     import std.conv;
@@ -56,10 +55,10 @@
     shell.open();
     styledText.addListener(SWT.MouseWheel, dgListener( (Event e){
         version(Tango){
-            Stdout.formatln("Mouse Wheel event \n"); //" + e);
+            Stdout.formatln("Mouse Wheel event {}\n", e);
             Stdout.flush();
         } else {
-            writeln("Mouse Wheel event "); //" + e);
+            writefln("Mouse Wheel event %s", e);
         }
     }));
     Point pt = display.map(shell, null, 50, 50);
--- a/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet269.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet269.d	Sat Jul 09 15:50:20 2011 +0300
@@ -27,7 +27,7 @@
 
 import java.lang.all;
 
-void main(String[] args) {
+void main() {
     Display display = new Display ();
     Shell shell = new Shell (display);
     shell.setLayout (new FillLayout ());
--- a/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet275.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet275.d	Sat Jul 09 15:50:20 2011 +0300
@@ -37,8 +37,8 @@
     import std.conv;
 }
 
-static String value;
-public static void main () {
+void main () {
+    String value;
 	int INTERVAL = 888;
 	Display display = new Display ();
 	Image image = new Image (display, 750, 750);
--- a/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet276.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet276.d	Sat Jul 09 15:50:20 2011 +0300
@@ -35,7 +35,7 @@
     import std.stdio;
 }
 
-void main (String[] args) {
+void main () {
     Display display = new Display ();
     Shell shell = new Shell (display);
     shell.setBounds (200, 200, 400, 400);
--- a/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet282.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet282.d	Sat Jul 09 15:50:20 2011 +0300
@@ -38,7 +38,13 @@
 
 import java.lang.all;
 
-public static void main(String[] args) {
+void main() {
+    //An org.eclipse.swt.graphics.Resource in DWT Windows (as against SWT) checks
+    //in destructor if it has been disposed, so we are to watch imageButton's
+    //image and dispose it after shell.isDisposed() or just disable this check
+    version(Windows)
+        Image.globalDisposeChecking = false;
+    
     Display display = new Display();
     Clipboard clipboard = new Clipboard(display);
     Shell shell = new Shell(display, SWT.SHELL_TRIM);
@@ -55,7 +61,7 @@
     buttons.setLayout(new GridLayout(4, true));
     Button button = new Button(buttons, SWT.PUSH);
     button.setText("Open");
-    button.addListener(SWT.Selection, new class() Listener {
+    button.addListener(SWT.Selection, new class Listener {
             public void handleEvent(Event event) {
             FileDialog dialog = new FileDialog (shell, SWT.OPEN);
             dialog.setText("Open an image file or cancel");
@@ -71,7 +77,7 @@
 
     button = new Button(buttons, SWT.PUSH);
     button.setText("Copy");
-    button.addListener(SWT.Selection, new class() Listener {
+    button.addListener(SWT.Selection, new class Listener {
             public void handleEvent(Event event) {
             Image image = imageButton.getImage();
             if (image !is null) {
@@ -86,7 +92,7 @@
             });
     button = new Button(buttons, SWT.PUSH);
     button.setText("Paste");
-    button.addListener(SWT.Selection, new class() Listener {
+    button.addListener(SWT.Selection, new class Listener {
             public void handleEvent(Event event) {
             ImageTransfer transfer = ImageTransfer.getInstance();
             ImageData imageData = cast(ImageData)clipboard.getContents(transfer);
@@ -104,7 +110,7 @@
 
     button = new Button(buttons, SWT.PUSH);
     button.setText("Clear");
-    button.addListener(SWT.Selection, new class() Listener {
+    button.addListener(SWT.Selection, new class Listener {
             public void handleEvent(Event event) {
             imageButton.setText("");
             Image image = imageButton.getImage();
--- a/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet288.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet288.d	Sat Jul 09 15:50:20 2011 +0300
@@ -50,16 +50,18 @@
     }
 }
 
-static Display display;
-static Shell shell;
-static GC shellGC;
-static Color shellBackground;
-static ImageLoader[] loader;
-static ImageData[][] imageDataArray;
-static Thread[] animateThread;
-static Image[][] image;
-private static ToolItem[] item;
-static const bool useGIFBackground = false;
+mixin(gshared!("
+Display display;
+Shell shell;
+GC shellGC;
+Color shellBackground;
+ImageLoader[] loader;
+ImageData[][] imageDataArray;
+Thread[] animateThread;
+Image[][] image;
+ToolItem[] item;
+"));
+const bool useGIFBackground = false;
 
 void main () {
     display = new Display();
@@ -112,7 +114,7 @@
     Thread.joinAll();
 }
 
-private static void loadAllImages(String directory, String[] filenames) {
+void loadAllImages(String directory, String[] filenames) {
     int numItems = filenames.length;
     loader.length = numItems;
     imageDataArray.length = numItems;
@@ -180,7 +182,7 @@
     }
 }
 
-private static void startAnimationThreads() {
+void startAnimationThreads() {
     animateThread = new Thread[image.length];
     for (int ii = 0; ii < image.length; ii++) {
         animateThread[ii] = new class(ii) Thread {
--- a/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet289.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet289.d	Sat Jul 09 15:50:20 2011 +0300
@@ -28,14 +28,14 @@
 import org.eclipse.swt.widgets.Shell;
 import java.lang.all;
 
-void main(String[] args) {
+void main() {
     Display display = new Display();
     Shell shell = new Shell(display);
     shell.setLayout(new FillLayout());
     Combo combo = new Combo(shell, SWT.NONE);
     combo.setItems(["1111", "2222", "3333", "4444"]);
     combo.setText(combo.getItem(0));
-    combo.addVerifyListener(new class() VerifyListener{
+    combo.addVerifyListener(new class VerifyListener{
         public void verifyText(VerifyEvent e) {
             String newText = e.text;
             try {
@@ -45,7 +45,7 @@
             }
         }
     });
-    combo.addTraverseListener(new class() TraverseListener {
+    combo.addTraverseListener(new class TraverseListener {
         public void keyTraversed(TraverseEvent e) {
             if (e.detail == SWT.TRAVERSE_RETURN) {
                 e.doit = false;
--- a/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet293.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet293.d	Sat Jul 09 15:50:20 2011 +0300
@@ -42,7 +42,7 @@
     b3.setSelection(true);
 
     // This function does not appear in the api for swt 3.3
-    //	b3.setGrayed(true);
+    b3.setGrayed(true);
 
     shell.pack();
     shell.open();
--- a/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet294.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet294.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,7 +12,14 @@
  *******************************************************************************/
 module org.eclipse.swt.snippets.Snippet294;
 
-/* Port OK */
+/*
+ * Region on a control: create a non-rectangular button
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ *
+ * @since 3.4
+ */
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.graphics.Image;
 import org.eclipse.swt.graphics.Region;
@@ -30,69 +37,53 @@
     import std.conv;
 }
 
-void main(String[] args){
-    Snippet294.main(args);
+int[] circle(int r, int offsetX, int offsetY) {
+    int[] polygon = new int[8 * r + 4];
+    // x^2 + y^2 = r^2
+    for (int i = 0; i < 2 * r + 1; i++) {
+        int x = i - r;
+        int y = cast(int)Math.sqrt(cast(real)(r*r - x*x));
+        polygon[2*i] = offsetX + x;
+        polygon[2*i+1] = offsetY + y;
+        polygon[8*r - 2*i - 2] = offsetX + x;
+        polygon[8*r - 2*i - 1] = offsetY - y;
+    }
+    return polygon;
 }
 
-/*
- * Region on a control: create a non-rectangular button
- *
- * For a list of all SWT example snippets see
- * http://www.eclipse.org/swt/snippets/
- *
- * @since 3.4
- */
-
-public class Snippet294 {
+void main() {
+    Display display = new Display();
+    Shell shell = new Shell(display);
+    shell.setText("Regions on a Control");
+    shell.setLayout(new FillLayout());
+    shell.setBackground(display.getSystemColor(SWT.COLOR_DARK_RED));
 
-    static int[] circle(int r, int offsetX, int offsetY) {
-        int[] polygon = new int[8 * r + 4];
-        // x^2 + y^2 = r^2
-        for (int i = 0; i < 2 * r + 1; i++) {
-            int x = i - r;
-            int y = cast(int)Math.sqrt(cast(real)(r*r - x*x));
-            polygon[2*i] = offsetX + x;
-            polygon[2*i+1] = offsetY + y;
-            polygon[8*r - 2*i - 2] = offsetX + x;
-            polygon[8*r - 2*i - 1] = offsetY - y;
-        }
-        return polygon;
-    }
+    Button b2 = new Button(shell, SWT.PUSH);
+    b2.setText("Button with Regions");
+
+    // define a region that looks like a circle with two holes in ot
+    Region region = new Region();
+    region.add(circle(67, 87, 77));
+    region.subtract(circle(20, 87, 47));
+    region.subtract(circle(20, 87, 113));
 
-    public static void main(String[] args) {
-        Display display = new Display();
-        Shell shell = new Shell(display);
-        shell.setText("Regions on a Control");
-        shell.setLayout(new FillLayout());
-        shell.setBackground(display.getSystemColor(SWT.COLOR_DARK_RED));
+    // define the shape of the button using setRegion
+    b2.setRegion(region);
+    b2.setLocation(100,50);
 
-        Button b2 = new Button(shell, SWT.PUSH);
-        b2.setText("Button with Regions");
-
-        // define a region that looks like a circle with two holes in ot
-        Region region = new Region();
-        region.add(circle(67, 87, 77));
-        region.subtract(circle(20, 87, 47));
-        region.subtract(circle(20, 87, 113));
+    b2.addListener(SWT.Selection, new class Listener {
+        public void handleEvent(Event e) {
+            shell.close();
+        }
+    });
 
-        // define the shape of the button using setRegion
-        b2.setRegion(region);
-        b2.setLocation(100,50);
-
-        b2.addListener(SWT.Selection, new class() Listener {
-                public void handleEvent(Event e) {
-                shell.close();
-                }
-                });
+    shell.setSize(200,200);
+    shell.open();
 
-        shell.setSize(200,200);
-        shell.open();
-
-        while (!shell.isDisposed()) {
-            if (!display.readAndDispatch())
-                display.sleep();
-        }
-        region.dispose();
-        display.dispose();
+    while (!shell.isDisposed()) {
+        if (!display.readAndDispatch())
+            display.sleep();
     }
+    region.dispose();
+    display.dispose();
 }
--- a/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet33.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet33.d	Sat Jul 09 15:50:20 2011 +0300
@@ -27,6 +27,9 @@
 version(Tango){
     import tango.sys.Environment;
     import tango.io.Stdout;
+    void writeln(in char[] line) {
+        Stdout(line)("\n").flush();
+    }
     import tango.util.Convert;
 } else { // Phobos
     import std.file;
@@ -41,11 +44,10 @@
     auto dialog = new DirectoryDialog (shell);
     version(Tango){
         dialog.setFilterPath (Environment.cwd());
-        Stdout("RESULT=" ~ to!(String)(dialog.open())).newline;
     } else {
         dialog.setFilterPath (getcwd());
-        writeln("RESULT=" ~ to!(String)(dialog.open()));
     }
+    writeln("RESULT=" ~ to!(String)(dialog.open()));
     while (!shell.isDisposed()) {
         if (!display.readAndDispatch ()) display.sleep ();
     }
--- a/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet39.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet39.d	Sat Jul 09 15:50:20 2011 +0300
@@ -30,12 +30,16 @@
 import java.lang.all;
 version(Tango){
     import tango.io.Stdout;
+    void writeln(in char[] line) {
+        Stdout(line)("\n").flush();
+    }
     import tango.util.Convert;
 } else { // Phobos
     import std.stdio;
     import std.conv;
 }
-public static void main(String[] args) {
+
+void main() {
     Display display = new Display();
     Shell shell = new Shell(display);
     shell.setLayout(new GridLayout());
@@ -47,13 +51,9 @@
     }
     combo.setText("item0");
 
-    combo.addSelectionListener(new class() SelectionAdapter {
+    combo.addSelectionListener(new class SelectionAdapter {
         public void widgetSelected(SelectionEvent e) {
-            version(Tango){
-                Stdout.formatln("Item selected");
-            } else { // Phobos
-                writeln("Item selected");
-            }
+            writeln("Item selected");
         };
     });
 
--- a/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet42.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet42.d	Sat Jul 09 15:50:20 2011 +0300
@@ -24,17 +24,16 @@
 
 version(Tango){
     import tango.io.Stdout;
+    void writeln(in char[] line) {
+        Stdout(line)("\n").flush();
+    }
 } else { // Phobos
     import std.stdio;
 }
-void main (String [] args) {
+
+void main () {
     Display display = new Display ();
-    version(Tango){
-        Stdout.formatln("Display Bounds= {}  Display ClientArea= {}" 
-                        ,display.getBounds(),display.getClientArea());
-    } else { // Phobos
-        writefln("Display Bounds= %s  Display ClientArea= %s" 
-                 ,display.getBounds().toString(),display.getClientArea().toString());
-    }
+    writeln(Format("Display Bounds={} Display ClientArea={}",
+        display.getBounds(), display.getClientArea()));
     display.dispose ();
 }
--- a/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet43.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet43.d	Sat Jul 09 15:50:20 2011 +0300
@@ -25,13 +25,14 @@
 import org.eclipse.swt.widgets.Caret;
 import org.eclipse.swt.widgets.Display;
 import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
 
 import java.lang.all;
 
-void main (String [] args) {
+void main () {
     Display display = new Display ();
     Shell shell = new Shell (display);
-    shell.open ();
     Caret caret = new Caret (shell, SWT.NONE);
     Color white = display.getSystemColor (SWT.COLOR_WHITE);
     Color black = display.getSystemColor (SWT.COLOR_BLACK);
@@ -45,12 +46,16 @@
     gc.dispose ();
     caret.setLocation (10, 10);
     caret.setImage (image);
-    gc = new GC (shell);
-    gc.drawImage (image, 10, 64);
-    caret.setVisible (false);
-    gc.drawString ("Test", 12, 12);
     caret.setVisible (true);
-    gc.dispose ();
+    shell.addListener(SWT.Paint, new class Listener {
+        public void handleEvent(Event event) {
+            GC gc = event.gc;
+            gc.drawImage (image, 10, 64);
+            gc.drawString ("Test", 12, 12);
+        }
+    });
+    shell.open ();
+     
     while (!shell.isDisposed ()) {
         if (!display.readAndDispatch ()) display.sleep ();
     }
--- a/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet44.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet44.d	Sat Jul 09 15:50:20 2011 +0300
@@ -28,50 +28,16 @@
 
 import java.lang.all;
 
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.IJobChangeListener;
-version(Tango){
-    import tango.io.Stdout;
-} else { // Phobos
-    import std.stdio;
-}
-
-class MyJob : Job {
-    this(char[] name) {
-        super(name);
-    }
-    public IStatus run(IProgressMonitor monitor) {
-        version(Tango){
-            Stdout.formatln("doing job");
-        } else { // Phobos
-            writeln("doing job");
-        }
-        return Status.OK_STATUS;
-    }
-}
-
-
-void main (String [] args) {
+void main () {
     Display display = new Display ();
     Cursor cursor = new Cursor (display, SWT.CURSOR_HAND);
     Shell shell = new Shell (display);
     shell.open ();
     Button b = new Button (shell, 0);
     b.setBounds (10, 10, 200, 200);
-    b.addListener (SWT.Selection, new class() Listener{
+    b.addListener (SWT.Selection, new class Listener{
         public void handleEvent (Event e) {
-            //b.setCursor (cursor);
-            auto job = new MyJob("test");
-            job.schedule();
-            job.join;
-            version(Tango){
-                Stdout.formatln("job done");
-            } else { // Phobos
-                writeln("job done");
-            }
+            b.setCursor (cursor);
         }
     });
     while (!shell.isDisposed ()) {
--- a/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet45.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet45.d	Sat Jul 09 15:50:20 2011 +0300
@@ -18,7 +18,7 @@
 import java.lang.all;
 
 
-public static void main (String [] args) {
+void main () {
     Display display = new Display ();
     Shell shell = new Shell (display);
     Scale scale = new Scale (shell, SWT.BORDER);
--- a/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet46.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet46.d	Sat Jul 09 15:50:20 2011 +0300
@@ -31,7 +31,7 @@
 
 import java.lang.all;
 
-void main (String [] args) {
+void main () {
     Display display = new Display ();
     Shell shell = new Shell (display);
     Composite composite = new Composite (shell, SWT.NONE);
@@ -41,8 +41,8 @@
     button.setText ("Button");
     composite.pack ();
     composite.setLocation (10, 10);
-    Point [] offset = new Point [1];
-    Listener listener = new class() Listener{
+    Point[1] offset;
+    Listener listener = new class Listener{
         public void handleEvent (Event event) {
             switch (event.type) {
                 case SWT.MouseDown:
--- a/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet60.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet60.d	Sat Jul 09 15:50:20 2011 +0300
@@ -25,28 +25,23 @@
 
 version(Tango){
     import tango.io.Stdout;
+    void writeln(in char[] line) {
+        Stdout(line)("\n").flush();
+    }
 } else { // Phobos
     import std.stdio;
 }
 
-void main (String [] args) {
+void main () {
     Display display = new Display ();
     Shell shell = new Shell (display);
     shell.setSize (200, 200);
     shell.open ();
     display.timerExec (5000, dgRunnable({
-        version(Tango){
-            Stdout("5000\n").flush();
-        } else { // Phobos
-            writeln("5000");
-        }
+        writeln("5000");
     }));
     display.timerExec (2000, dgRunnable({
-        version(Tango){
-            Stdout("2000\n").flush();
-        } else { // Phobos
-            writeln("2000");
-        }
+        writeln("2000");
     }));
     while (!shell.isDisposed ()) {
         if (!display.readAndDispatch ()) display.sleep ();
--- a/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet62.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet62.d	Sat Jul 09 15:50:20 2011 +0300
@@ -29,13 +29,16 @@
 
 version(Tango){
     import tango.io.Stdout;
+    void writeln(in char[] line) {
+        Stdout(line)("\n").flush();
+    }
     import tango.util.Convert;
 } else { // Phobos
     import std.stdio;
     import std.conv;
 }
 
-static String stateMask (int stateMask) {
+String stateMask (int stateMask) {
     String str = "";
     if ((stateMask & SWT.CTRL) != 0) str ~= " CTRL";
     if ((stateMask & SWT.ALT) != 0) str ~= " ALT";
@@ -54,21 +57,16 @@
             case SWT.MouseDown: str = "DOWN"; break;
             case SWT.MouseMove: str = "MOVE"; break;
             case SWT.MouseUp: str = "UP"; break;
+            default:
             }
-            str ~=": button: " ~ to!(String)(e.button) ~ ", ";
-            str ~= "stateMask=0x" ~ to!(String)(e.stateMask) 
-            ~ stateMask (e.stateMask) 
-            ~ ", x=" ~ to!(String)(e.x) ~ ", y=" ~ to!(String)(e.y);
+            str ~= Format(": button: {}, stateMask=0x{:x}{}, x={}, y={}",
+                e.button, e.stateMask, stateMask (e.stateMask), e.x, e.y);
             if ((e.stateMask & SWT.BUTTON1) != 0) str ~= " BUTTON1";
             if ((e.stateMask & SWT.BUTTON2) != 0) str ~= " BUTTON2";
             if ((e.stateMask & SWT.BUTTON3) != 0) str ~= " BUTTON3";
             if ((e.stateMask & SWT.BUTTON4) != 0) str ~= " BUTTON4";
             if ((e.stateMask & SWT.BUTTON5) != 0) str ~= " BUTTON5";
-            version(Tango){
-                Stdout.formatln (str);
-            } else { // Phobos
-                writeln(str);
-            }
+            writeln(str);
         }
     };
     shell.addListener (SWT.MouseDown, listener);
--- a/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet66.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet66.d	Sat Jul 09 15:50:20 2011 +0300
@@ -28,7 +28,7 @@
 void main () {
     Display display = new Display ();
     Shell shell = new Shell (display);
-    Listener listener = new class() Listener {
+    Listener listener = new class Listener {
         int lastX = 0, lastY = 0;
         public void handleEvent (Event event) {
             switch (event.type) {
--- a/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet68.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet68.d	Sat Jul 09 15:50:20 2011 +0300
@@ -32,7 +32,7 @@
 import org.eclipse.swt.layout.RowData;
 import org.eclipse.swt.layout.RowLayout;
 
-void main (String [] args) {
+void main () {
     Display display = new Display ();
     Color red = display.getSystemColor (SWT.COLOR_RED);
     Color blue = display.getSystemColor (SWT.COLOR_BLUE);
--- a/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet7.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet7.d	Sat Jul 09 15:50:20 2011 +0300
@@ -38,7 +38,7 @@
     import std.conv;
 }
 
-void main (String [] args) {
+void main () {
     Display display = new Display ();
     Image image = new Image (display, 16, 16);
     GC gc = new GC (image);
@@ -56,7 +56,7 @@
             if (table.isDisposed ()) return;
 
             int [] index =  [i];
-            display.syncExec (new class() Runnable{
+            display.syncExec (new class Runnable{
                 public void run () {
                     if (table.isDisposed ()) return;
                     TableItem item = new TableItem (table, SWT.NONE);
--- a/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet72.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet72.d	Sat Jul 09 15:50:20 2011 +0300
@@ -23,8 +23,13 @@
 import org.eclipse.swt.widgets.Shell;
 import org.eclipse.swt.widgets.FileDialog;
 
+import java.lang.all;
+
 version(Tango){
     import tango.io.Stdout;
+    void writeln(in char[] line) {
+        Stdout(line)("\n").flush();
+    }
 } else { // Phobos
     import std.stdio;
 }
@@ -34,15 +39,18 @@
     Shell shell = new Shell (display);
     shell.open ();
     FileDialog dialog = new FileDialog (shell, SWT.SAVE);
-    dialog.setFilterNames (["Batch Files", "All Files (*.*)"]);
-    dialog.setFilterExtensions (["*.bat", "*.*"]); //Windows wild cards
-    dialog.setFilterPath ("c:\\"); //Windows path
-    dialog.setFileName ("fred.bat");
-    version(Tango){
-        Stdout.formatln ("Save to: {}", dialog.open ());
-    } else { // Phobos
-        writeln ("Save to: %s", dialog.open ());
+    version(Windows) {
+        dialog.setFilterNames (["Batch Files", "All Files (*.*)"]);
+        dialog.setFilterExtensions (["*.bat", "*.*"]); //Windows wild cards
+        dialog.setFilterPath ("c:\\"); //Windows path
+        dialog.setFileName ("fred.bat");
+    } else {
+        dialog.setFilterNames (["Shell Script", "All Files (*.*)"]);
+        dialog.setFilterExtensions (["*.sh", "*.*"]); //Posix wild cards
+        dialog.setFilterPath ("/"); //Posix path
+        dialog.setFileName ("fred.sh");
     }
+    writeln ( Format("Save to: {}", dialog.open ()) );
     while (!shell.isDisposed ()) {
         if (!display.readAndDispatch ()) display.sleep ();
     }
--- a/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet74.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet74.d	Sat Jul 09 15:50:20 2011 +0300
@@ -25,7 +25,7 @@
 
 import java.lang.all;
 
-void main (String [] args) {
+void main () {
     Display display = new Display ();
     Shell shell = new Shell (display);
     Caret caret = new Caret (shell, SWT.NONE);
--- a/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet75.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet75.d	Sat Jul 09 15:50:20 2011 +0300
@@ -37,7 +37,7 @@
 import java.lang.all;
 
 
-void main (String [] args) {
+void main () {
     Display display = new Display ();
     Shell shell = new Shell (display);
     shell.setLayout (new RowLayout ());
--- a/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet81.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet81.d	Sat Jul 09 15:50:20 2011 +0300
@@ -94,7 +94,7 @@
     return iRes;
 }
 
-private static void printTypeInfo(OleAutomation oOleAutoObj, FormatOutput!(char) oOut)
+void printTypeInfo(OleAutomation oOleAutoObj, FormatOutput!(char) oOut)
 {
     org.eclipse.swt.internal.ole.win32.OAIDL.TYPEATTR * pTypeAttr = oOleAutoObj.getTypeInfoAttributes();
     if (pTypeAttr !is null) {
@@ -156,7 +156,8 @@
         }
     }
 }
-private static String getTypeName(int iType) {
+
+String getTypeName(int iType) {
     int iBase = iType & ~OLE.VT_BYREF;
     String sDsc = null;
     switch (iBase) {
@@ -217,7 +218,8 @@
     }
     return sDirString;
 }
-private static String getInvokeKind(int iInvKind) {
+
+String getInvokeKind(int iInvKind) {
     switch (iInvKind) {
         case OLE.INVOKE_FUNC : return "METHOD";
         case OLE.INVOKE_PROPERTYGET : return "PROPERTY GET";
--- a/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet82.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet82.d	Sat Jul 09 15:50:20 2011 +0300
@@ -40,7 +40,7 @@
     import std.conv;
 }
 
-void main(String[] args) {
+void main() {
     Display display = new Display();
     Shell shell = new Shell(display);
     shell.setLayout(new FillLayout());
@@ -59,7 +59,7 @@
     text.setText("This tab can never be closed");
     specialItem.setControl(text);
 
-    folder.addCTabFolder2Listener(new class() CTabFolder2Adapter {
+    folder.addCTabFolder2Listener(new class CTabFolder2Adapter {
         public void close(CTabFolderEvent event) {
             if (event.item == specialItem) {
                 event.doit = false;
--- a/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet92.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet92.d	Sat Jul 09 15:50:20 2011 +0300
@@ -33,7 +33,7 @@
 import java.lang.all;
 
 
-void main (String [] args) {
+void main () {
     Display display = new Display();
     Color white = display.getSystemColor (SWT.COLOR_WHITE);
     Color black = display.getSystemColor (SWT.COLOR_BLACK);
@@ -62,7 +62,7 @@
     Image source = new Image (display,sourceData);
     Image mask = new Image (display, maskData);
     //Draw source and mask just to show what they look like
-    shell.addPaintListener(new class() PaintListener{
+    shell.addPaintListener(new class PaintListener{
         void paintControl(PaintEvent e) {
             GC gc = e.gc;
             gc.drawString("source: ", 10, 10);
--- a/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet94.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet94.d	Sat Jul 09 15:50:20 2011 +0300
@@ -36,7 +36,7 @@
 import java.lang.all;
 
 
-public static void main( String[] args) {
+void main() {
     Display display = new Display ();
     Clipboard cb = new Clipboard(display);
     Shell shell = new Shell (display);
@@ -45,7 +45,7 @@
 
     Button copy = new Button(shell, SWT.PUSH);
     copy.setText("Copy");
-    copy.addListener (SWT.Selection, new class() Listener {
+    copy.addListener (SWT.Selection, new class Listener {
         public void handleEvent (Event e) {
             String textData = text.getSelectionText();
             if (textData.length > 0) {
@@ -60,7 +60,7 @@
 
     Button paste = new Button(shell, SWT.PUSH);
     paste.setText("Paste");
-    paste.addListener (SWT.Selection, new class() Listener {
+    paste.addListener (SWT.Selection, new class Listener {
         public void handleEvent (Event e) {
             TextTransfer transfer = TextTransfer.getInstance();
             String data = stringcast(cb.getContents(transfer));
--- a/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet96.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet96.d	Sat Jul 09 15:50:20 2011 +0300
@@ -86,20 +86,9 @@
     editor.grabHorizontal = true;
     editor.grabVertical = true;
 
-    cursor.addSelectionListener(new class(table, editor, cursor) SelectionAdapter {
+    cursor.addSelectionListener(new class SelectionAdapter {
         // when the TableEditor is over a cell, select the corresponding row in
         // the table
-
-        Table table;
-        ControlEditor editor;
-        TableCursor cursor;
-        this(Table table_, ControlEditor editor_, TableCursor cursor_)
-        {
-            table = table_;
-            editor = editor_;
-            cursor = cursor_;
-        }
-
         public void widgetSelected(SelectionEvent e) {
             table.setSelection([cursor.getRow()]);
         }
@@ -150,12 +139,7 @@
     });
     // Hide the TableCursor when the user hits the "CTRL" or "SHIFT" key.
     // This alows the user to select multiple items in the table.
-    cursor.addKeyListener(new class(cursor) KeyAdapter {
-        TableCursor cursor;
-        this(TableCursor cursor_)
-        {
-            cursor = cursor_;
-        }
+    cursor.addKeyListener(new class KeyAdapter {
         public void keyPressed(KeyEvent e) {
             if (e.keyCode == SWT.CTRL
                 || e.keyCode == SWT.SHIFT
@@ -167,15 +151,7 @@
     });
     // When the user double clicks in the TableCursor, pop up a text editor so that
     // they can change the text of the cell
-    cursor.addMouseListener(new class(cursor, editor) MouseAdapter {
-        ControlEditor editor;
-        TableCursor cursor;
-        this(TableCursor cursor_, ControlEditor editor_)
-        {
-            cursor = cursor_;
-            editor = editor_;
-        }
-
+    cursor.addMouseListener(new class MouseAdapter {
         public void mouseDown(MouseEvent e) {
             Text text = new Text(cursor, SWT.NONE);
             TableItem row = cursor.getRow();
@@ -222,14 +198,7 @@
 
     // Show the TableCursor when the user releases the "SHIFT" or "CTRL" key.
     // This signals the end of the multiple selection task.
-    table.addKeyListener(new class(table, cursor) KeyAdapter {
-        Table table;
-        TableCursor cursor;
-        this(Table table_, TableCursor cursor_)
-        {
-            table = table_;
-            cursor = cursor_;
-        }
+    table.addKeyListener(new class KeyAdapter {
         public void keyReleased(KeyEvent e) {
             if (e.keyCode == SWT.CONTROL && (e.stateMask & SWT.SHIFT) != 0)
                 return;
--- a/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet98.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet98.d	Sat Jul 09 15:50:20 2011 +0300
@@ -38,10 +38,10 @@
     import std.conv;
 }
 
-static int pageNum = 0;
-static Composite pageComposite;
+void main() {
+    int pageNum = 0;
+    Composite pageComposite;
 
-void main(String args[]) {
     Display display = new Display();
     Shell shell = new Shell(display);
     shell.setLayout(new GridLayout());
@@ -51,7 +51,7 @@
     pageComposite.setLayout(new GridLayout());
     pageComposite.setLayoutData(new GridData());
 
-    button.addListener(SWT.Selection, new class() Listener{
+    button.addListener(SWT.Selection, new class Listener{
         public void handleEvent(Event event) {
             if ((pageComposite !is null) && (!pageComposite.isDisposed())) {
                 pageComposite.dispose();
--- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/accessibility/AccessibleControlEvent.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/accessibility/AccessibleControlEvent.d	Sat Jul 09 15:50:20 2011 +0300
@@ -61,7 +61,7 @@
  * @return a string representation of the event
  */
 public String toString () {
-    return Format( "AccessibleControlEvent {childID={} accessible={} x={} y={} width={} heigth={} detail={} result={}",
+    return Format( "AccessibleControlEvent {{childID={} accessible={} x={} y={} width={} heigth={} detail={} result={}}",
         childID, accessible, x, y, width, height, detail, result);
 }
 }
--- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/accessibility/AccessibleEvent.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/accessibility/AccessibleEvent.d	Sat Jul 09 15:50:20 2011 +0300
@@ -66,6 +66,6 @@
  * @return a string representation of the event
  */
 override public String toString () {
-    return Format( "AccessibleEvent {childID={} result={}}", childID, result );
+    return Format( "AccessibleEvent {{childID={} result={}}", childID, result );
 }
 }
--- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/custom/Bullet.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/custom/Bullet.d	Sat Jul 09 15:50:20 2011 +0300
@@ -17,7 +17,6 @@
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.custom.StyleRange;
 import org.eclipse.swt.custom.ST;
-import java.lang.System;
 
 /**
  * Instances of this class represent bullets in the <code>StyledText</code>.
--- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/custom/BusyIndicator.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/custom/BusyIndicator.d	Sat Jul 09 15:50:20 2011 +0300
@@ -18,7 +18,6 @@
 import org.eclipse.swt.graphics.Cursor;
 import org.eclipse.swt.widgets.Display;
 import org.eclipse.swt.widgets.Shell;
-import java.lang.Runnable;
 import java.lang.all;
 
 /**
--- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/custom/CCombo.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/custom/CCombo.d	Sat Jul 09 15:50:20 2011 +0300
@@ -48,7 +48,7 @@
 import org.eclipse.swt.widgets.Widget;
 
 import java.lang.all;
-import java.lang.Runnable;
+import java.nonstandard.UnsafeUtf;
 
 /**
  * The CCombo class represents a selectable user interface object
@@ -577,17 +577,14 @@
  * an '&' character in the given string. If there are no '&'
  * characters in the given string, return '\0'.
  */
-dchar _findMnemonic (String string) {
-    if (string is null) return '\0';
+dchar _findMnemonic (String str) {
+    if (str is null) return '\0';
     int index = 0;
-    int length = string.length;
+    int length = str.length;
     do {
-        while (index < length && string[index] !is '&') index++;
+        while (index < length && str[index] !is '&') index++;
         if (++index >= length) return '\0';
-        dchar c = string[index..$].firstCodePoint();
-        if (c !is '&') {
-            return Character.toLowerCase(c);
-        }
+        if (str[index] !is '&') return Character.toLowerCase( str.dcharAt(index) );
         index++;
     } while (index < length);
     return '\0';
@@ -1162,7 +1159,7 @@
              * In Windows, hiding the popup during the deactivate causes the deactivate
              * to be called twice and the selection event to be disappear.
              */
-            if (!"carbon".equals(SWT.getPlatform())) {
+            if ("carbon" != (SWT.getPlatform())) {
                 Point point = arrow.toControl(getDisplay().getCursorLocation());
                 Point size = arrow.getSize();
                 Rectangle rect = new Rectangle(0, 0, size.x, size.y);
--- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/custom/CLabel.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/custom/CLabel.d	Sat Jul 09 15:50:20 2011 +0300
@@ -38,7 +38,9 @@
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Control;
 import org.eclipse.swt.widgets.Display;
+
 import java.lang.all;
+import java.nonstandard.UnsafeUtf;
 
 /**
  * A Label which supports aligned text and/or an image and different border styles.
@@ -173,7 +175,7 @@
 //protected void checkSubclass () {
 //  String name = getClass().getName ();
 //  String validName = CLabel.class.getName();
-//  if (!validName.equals(name)) {
+//  if (validName != (name)) {
 //      SWT.error (SWT.ERROR_INVALID_SUBCLASS);
 //  }
 //}
@@ -210,17 +212,14 @@
  * an '&' character in the given string. If there are no '&'
  * characters in the given string, return '\0'.
  */
-dchar _findMnemonic (String string) {
-    if (string is null) return '\0';
+dchar _findMnemonic (String str) {
+    if (str is null) return '\0';
     int index = 0;
-    int length = string.length;
+    int length = str.length;
     do {
-        while (index < length && string[index] !is '&') index++;
+        while (index < length && str[index] !is '&') index++;
         if (++index >= length) return '\0';
-        dchar d = string[index..$].firstCodePoint();
-        if (d !is '&') {
-            return Character.toLowerCase( d );
-        }
+        if (str[index] !is '&') return Character.toLowerCase( str.dcharAt(index) );
         index++;
     } while (index < length);
     return '\0';
@@ -825,10 +824,10 @@
     do {
         pos = text.indexOf('\n', start);
         if (pos is -1) {
-            lines[lines.length - 1] = text.substring(start);
+            lines[lines.length - 1] = text[start .. $ ];
         } else {
-            bool crlf = (pos > 0) && (text.charAt(pos - 1) is '\r');
-            lines[lines.length - 1] = text.substring(start, pos - (crlf ? 1 : 0));
+            bool crlf = (pos > 0) && (text[ pos - 1 ] is '\r');
+            lines[lines.length - 1] = text[ start .. pos - (crlf ? 1 : 0)];
             start = pos + 1;
             String[] newLines = new String[lines.length+1];
             System.arraycopy(lines, 0, newLines, 0, lines.length);
--- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/custom/CTabFolder.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/custom/CTabFolder.d	Sat Jul 09 15:50:20 2011 +0300
@@ -48,6 +48,7 @@
 import org.eclipse.swt.custom.CTabFolderEvent;
 
 import java.lang.all;
+import java.nonstandard.UnsafeUtf;
 
 /**
  *
@@ -1103,7 +1104,7 @@
 
     // Draw Tab Header
     if (onBottom) {
-        int[] left, right;
+        TryConst!(int)[] left, right;
         if ((getStyle() & SWT.BORDER) !is 0) {
             left = simple ? SIMPLE_BOTTOM_LEFT_CORNER : BOTTOM_LEFT_CORNER;
             right = simple ? SIMPLE_BOTTOM_RIGHT_CORNER : BOTTOM_RIGHT_CORNER;
@@ -1128,7 +1129,7 @@
         shape[index++] = x+width;
         shape[index++] = y-highlight_header;
     } else {
-        int[] left, right;
+        TryConst!(int)[] left, right;
         if ((getStyle() & SWT.BORDER) !is 0) {
             left = simple ? SIMPLE_TOP_LEFT_CORNER : TOP_LEFT_CORNER;
             right = simple ? SIMPLE_TOP_RIGHT_CORNER : TOP_RIGHT_CORNER;
@@ -1308,7 +1309,7 @@
     do {
         while (index < length_ && string[index] !is '&') index++;
         if (++index >= length_) return '\0';
-        if (string[index] !is '&') return CharacterFirstToLower(string[index..$]);
+        if (string[index] !is '&') return Character.toLowerCase (string.dcharAt (index));
         index++;
     } while (index < length_);
     return '\0';
--- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/custom/CTabItem.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/custom/CTabItem.d	Sat Jul 09 15:50:20 2011 +0300
@@ -295,8 +295,8 @@
         // draw selected tab background and outline
         shape = null;
         if (this.parent.onBottom) {
-            int[] left = parent.simple ? cast(int[])CTabFolder.SIMPLE_BOTTOM_LEFT_CORNER : cast(int[])CTabFolder.BOTTOM_LEFT_CORNER;
-            int[] right = parent.simple ? cast(int[])CTabFolder.SIMPLE_BOTTOM_RIGHT_CORNER : parent.curve;
+            TryConst!(int)[] left = parent.simple ? CTabFolder.SIMPLE_BOTTOM_LEFT_CORNER : CTabFolder.BOTTOM_LEFT_CORNER;
+            TryConst!(int[]) right = parent.simple ? CTabFolder.SIMPLE_BOTTOM_RIGHT_CORNER : parent.curve;
             if (parent.borderLeft is 0 && parent.indexOf(this) is parent.firstIndex) {
                 left = [x, y+height];
             }
@@ -319,8 +319,8 @@
             shape[index++] = parent.simple ? rightEdge - 1 : rightEdge + parent.curveWidth - parent.curveIndent;
             shape[index++] = y - 1;
         } else {
-            int[] left = parent.simple ? cast(int[])CTabFolder.SIMPLE_TOP_LEFT_CORNER : cast(int[])CTabFolder.TOP_LEFT_CORNER;
-            int[] right = parent.simple ? cast(int[])CTabFolder.SIMPLE_TOP_RIGHT_CORNER : parent.curve;
+            TryConst!(int)[] left = parent.simple ? CTabFolder.SIMPLE_TOP_LEFT_CORNER : CTabFolder.TOP_LEFT_CORNER;
+            TryConst!(int[]) right = parent.simple ? CTabFolder.SIMPLE_TOP_RIGHT_CORNER : parent.curve;
             if (parent.borderLeft is 0 && parent.indexOf(this) is parent.firstIndex) {
                 left = [x, y];
             }
@@ -482,7 +482,7 @@
             rightEdge - parent.curveIndent,
             1 + y);
 
-    int[] leftHighlightCurve = CTabFolder.TOP_LEFT_CORNER_HILITE;
+    const int[] leftHighlightCurve = CTabFolder.TOP_LEFT_CORNER_HILITE;
 
     int d = parent.tabHeight - parent.topCurveHighlightEnd.length /2;
 
@@ -553,7 +553,7 @@
     int startX = x + width - 1;
 
     if (this.parent.onBottom) {
-        int[] right = parent.simple
+        TryConst!(int[]) right = parent.simple
             ? CTabFolder.SIMPLE_UNSELECTED_INNER_CORNER
             : CTabFolder.BOTTOM_RIGHT_CORNER;
 
@@ -567,7 +567,7 @@
         shape[index++] = startX;
         shape[index++] = y - 1;
     } else {
-        int[] right = parent.simple
+        TryConst!(int[]) right = parent.simple
             ? CTabFolder.SIMPLE_UNSELECTED_INNER_CORNER
             : CTabFolder.TOP_RIGHT_CORNER;
 
@@ -609,7 +609,7 @@
 
     int[] shape = null;
     if (this.parent.onBottom) {
-        int[] left = parent.simple
+        TryConst!(int[]) left = parent.simple
             ? CTabFolder.SIMPLE_UNSELECTED_INNER_CORNER
             : CTabFolder.BOTTOM_LEFT_CORNER;
 
@@ -622,7 +622,7 @@
             shape[index++] = y + height + left[2 * i + 1] - 1;
         }
     } else {
-        int[] left = parent.simple
+        TryConst!(int[]) left = parent.simple
             ? CTabFolder.SIMPLE_UNSELECTED_INNER_CORNER
             : CTabFolder.TOP_LEFT_CORNER;
 
--- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/custom/DefaultContent.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/custom/DefaultContent.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,8 +12,6 @@
  *******************************************************************************/
 module org.eclipse.swt.custom.DefaultContent;
 
-import java.lang.all;
-
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.SWTException;
 import org.eclipse.swt.internal.Compatibility;
@@ -24,8 +22,22 @@
 import org.eclipse.swt.custom.StyledTextListener;
 import org.eclipse.swt.custom.StyledText;
 
+import java.lang.all;
+import java.nonstandard.UnsafeUtf;
+
+version(Tango){
+    static import tango.io.model.IFile;
+} else { // Phobos
+    static import std.string;
+}
+
+
 class DefaultContent : StyledTextContent {
-    private const static String LineDelimiter = "\r\n";
+    version(Tango){
+        private const static String LineDelimiter = tango.io.model.IFile.FileConst.NewlineString;
+    } else { // Phobos
+        private const static String LineDelimiter = std.string.newline;
+    }
 
     StyledTextListener[] textListeners; // stores text listeners for event sending
     char[] textStore; // stores the actual text
@@ -498,13 +510,13 @@
         // gap is in the specified range, strip out the gap
         StringBuffer buf = new StringBuffer();
         int gapLength = gapEnd - gapStart;
-        buf.append(textStore, start, gapStart - start);
-        buf.append(textStore, gapEnd, length_ - gapLength - (gapStart - start));
-        length_ = buf.length();
-        while ((length_ - 1 >=0) && isDelimiter(buf.charAt(length_ - 1))) {
+        buf.append(textStore[ start .. gapStart ] );
+        buf.append(textStore[ gapEnd .. gapEnd + length_ - gapLength - (gapStart - start) ]);
+        length_ = buf.length;
+        while ((length_ - 1 >=0) && isDelimiter(buf.slice[length_ - 1])) {
             length_--;
         }
-        return buf.toString().substring(0, length_);
+        return buf.slice()[ 0 .. length_ ]._idup();
     }
 }
 /**
@@ -538,7 +550,7 @@
         int gapLength = gapEnd - gapStart;
         buffer.append(textStore[ start .. gapStart ]);
         buffer.append(textStore[ gapEnd .. gapEnd + length_ - gapLength - (gapStart - start) ]);
-        return buffer.toString()._idup();
+        return buffer.toString();
     }
 }
 /**
@@ -561,6 +573,7 @@
 }
 /**
  * Returns the line at the given offset.
+ * DWT: index can be an invalid UTF-8 index
  * <p>
  *
  * @param charPosition logical character offset (i.e., does not include gap)
@@ -723,7 +736,7 @@
     StringBuffer buf = new StringBuffer();
     buf.append(textStore[ start .. start + gapStart - start ] );
     buf.append(textStore[ gapEnd .. gapEnd + end - gapStart ] );
-    return buf.toString()._idup();
+    return buf.toString();
 }
 /**
  * Removes the specified <code>TextChangeListener</code>.
@@ -888,32 +901,5 @@
     gapLine = getLineAtPhysicalOffset(gapStart);
 }
 
-/++
- + SWT extension
- +/
-int utf8AdjustOffset( int offset ){
-    if (textStore is null)
-        return offset;
-    if (offset is 0)
-        return offset;
-    if( offset >= textStore.length ){
-        return offset;
-    }
-    if (!gapExists() || (offset < gapStart)){
-        while( (textStore[offset] & 0xC0) is 0x80 ){
-            offset--;
-        }
-        return offset;
-    }
-    int gapLength= gapEnd - gapStart;
-    if( offset+gapLength >= textStore.length ){
-        return offset;
-    }
-    while( (textStore[offset+gapLength] & 0xC0) is 0x80 ){
-        offset--;
-    }
-    return offset;
-}
-
 
 }
--- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/custom/SashFormData.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/custom/SashFormData.d	Sat Jul 09 15:50:20 2011 +0300
@@ -22,7 +22,7 @@
     String str = this.classinfo.name;
     int index = str.lastIndexOf ('.');
     if (index is -1) return str;
-    return str.substring (index + 1, str.length ());
+    return str[ index + 1 .. $ ];
 }
 
 /**
--- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/custom/StackLayout.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/custom/StackLayout.d	Sat Jul 09 15:50:20 2011 +0300
@@ -133,7 +133,7 @@
     String string = this.classinfo.name;
     int index = string.lastIndexOf ('.');
     if (index is -1 ) return string;
-    return string.substring (index + 1, string.length );
+    return string[ index + 1 .. $ ];
 }
 
 /**
--- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/custom/StyledText.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/custom/StyledText.d	Sat Jul 09 15:50:20 2011 +0300
@@ -81,9 +81,16 @@
 import org.eclipse.swt.custom.StyledTextDropTargetEffect;
 import org.eclipse.swt.custom.StyledTextListener;
 import org.eclipse.swt.custom.ST;
-import java.lang.Runnable;
 
 import java.lang.all;
+import java.nonstandard.UnsafeUtf;
+
+version(Tango){
+    static import tango.io.model.IFile;
+} else { // Phobos
+    static import std.string;
+}
+
 
 /**
  * A StyledText is an editable user interface object that displays lines
@@ -143,9 +150,14 @@
  */
 public class StyledText : Canvas {
     alias Canvas.computeSize computeSize;
+package:
 
     static const char TAB = '\t';
-    static const String PlatformLineDelimiter = "\r\n";
+    version(Tango){
+        static const String PlatformLineDelimiter = tango.io.model.IFile.FileConst.NewlineString;
+    } else { // Phobos
+        static const String PlatformLineDelimiter = std.string.newline;
+    }
     static const int BIDI_CARET_WIDTH = 3;
     static const int DEFAULT_WIDTH  = 64;
     static const int DEFAULT_HEIGHT = 64;
@@ -185,17 +197,18 @@
     int rightMargin;
     int bottomMargin;
     int columnX;                        // keep track of the horizontal caret position when changing lines/pages. Fixes bug 5935
-    int caretOffset = 0;
+    int/*UTF8index*/ caretOffset = 0;
     int caretAlignment;
     Point selection;                    // x and y are start and end caret offsets of selection
     Point clipboardSelection;           // x and y are start and end caret offsets of previous selection
-    int selectionAnchor;                // position of selection anchor. 0 based offset from beginning of text
+    bool selectedTextValid = true;      // DWT: false if we just changed a text witch was selected
+    int/*UTF8index*/ selectionAnchor;   // position of selection anchor. 0 based offset from beginning of text
     Point doubleClickSelection;         // selection after last mouse double click
     bool editable = true;
     bool wordWrap = false;
-    bool doubleClickEnabled = true;  // see getDoubleClickEnabled
-    bool overwrite = false;          // insert/overwrite edit mode
-    int textLimit = -1;                 // limits the number of characters the user can type in the widget. Unlimited by default.
+    bool doubleClickEnabled = true;     // see getDoubleClickEnabled
+    bool overwrite = false;             // insert/overwrite edit mode
+    int/*UTF8index*/ textLimit = -1;           // limits the number of characters the user can type in the widget. Unlimited by default.
     int[int] keyActionMap;
     Color background = null;            // workaround for bug 4791
     Color foreground = null;            //
@@ -227,12 +240,12 @@
     int lineSpacing;
 
     const static bool IS_CARBON, IS_GTK, IS_MOTIF;
-    static this(){
+mixin(sharedStaticThis!(`{
         String platform = SWT.getPlatform();
         IS_CARBON = ("carbon" == platform);
         IS_GTK    = ("gtk"    == platform);
         IS_MOTIF  = ("motif"  == platform);
-    }
+    }`));
 
     /**
      * The Printing class : printing of a range of text.
@@ -501,6 +514,7 @@
         } else if (data.scope_ is PrinterData.SELECTION) {
             startLine = content.getLineAtOffset(selection.x);
             if (selection.y > 0) {
+                // DWT: index isn't a valid UTF-8 index
                 endLine = content.getLineAtOffset(selection.x + selection.y - 1);
             } else {
                 endLine = startLine - 1;
@@ -825,7 +839,7 @@
      * Determines if Unicode RTF should be written.
      * Don't write Unicode RTF on Windows 95/98/ME or NT.
      */
-    void setUnicode() {
+    void setUnicode() {/*!!!*/
 //         const String Win95 = "windows 95";
 //         const String Win98 = "windows 98";
 //         const String WinME = "windows me";
@@ -862,11 +876,9 @@
      * @param end end offset of segment
      */
     void write(String string, int start, int end) {
-        start = 0;
-        end = string.length;
-        int incr = 1;
-        for (int index = start; index < end; index+=incr) {
-            dchar ch = firstCodePoint( string[index .. $], incr );
+        int incr;
+        for (int index = start; index < end; index += incr) {
+            dchar ch = string.dcharAt(index, incr);
             if (ch > 0xFF && WriteUnicode) {
                 // write the sub string from the last escaped character
                 // to the current one. Fixes bug 21698.
@@ -885,6 +897,7 @@
                 }
                 write('\\');
                 write(cast(char)ch); // ok because one of {}\
+                assert(incr == 1);
                 start = index + 1;
             }
         }
@@ -904,7 +917,7 @@
         // specify code page, necessary for copy to work in bidi
         // systems that don't support Unicode RTF.
         // PORTING_TODO: String cpg = System.getProperty("file.encoding").toLowerCase();
-        String cpg = "UTF16";
+        //String cpg = "UTF16";
         /+
         if (cpg.startsWith("cp") || cpg.startsWith("ms")) {
             cpg = cpg.substring(2, cpg.length());
@@ -1218,7 +1231,7 @@
         if (offset < 0 || offset > buffer.length()) {
             return;
         }
-        buffer.insert(offset, string);
+        buffer.insert( offset, string );
     }
     /**
      * Appends the given int to the data.
@@ -1753,13 +1766,14 @@
         // therefore make sure redraw range is valid.
         int redrawStart = Math.min(selectionStart, length);
         int redrawEnd = Math.min(selectionEnd, length);
-        if (redrawEnd - redrawStart > 0) {
+        if (redrawEnd - redrawStart > 0 && selectedTextValid) {
             internalRedrawRange(redrawStart, redrawEnd - redrawStart);
         }
         if (sendEvent) {
             sendSelectionEvent();
         }
     }
+    selectedTextValid = true;
 }
 public override Point computeSize (int wHint, int hHint, bool changed) {
     checkWidget();
@@ -2232,13 +2246,13 @@
         int lineIndex = content.getLineAtOffset(caretOffset);
         int lineOffset = content.getOffsetAtLine(lineIndex);
         if (caretOffset is lineOffset) {
-            // SWT: on line start, delete line break
+            // DWT: on line start, delete line break
             lineOffset = content.getOffsetAtLine(lineIndex - 1);
             event.start = lineOffset + content.getLine(lineIndex - 1).length;
             event.end = caretOffset;
         } else {
             TextLayout layout = renderer.getTextLayout(lineIndex);
-            int start = layout.getPreviousOffset(caretOffset - lineOffset, SWT.MOVEMENT_CLUSTER);
+            int start = layout.getPreviousOffset(caretOffset - lineOffset, SWT.MOVEMENT_CHAR);
             renderer.disposeTextLayout(layout);
             event.start = start + lineOffset;
             event.end = caretOffset;
@@ -2276,7 +2290,7 @@
         // replace character at caret offset if the caret is not at the
         // end of the line
         if (event.end < lineOffset + line.length) {
-            event.end+=dcharToString( key ).length;
+            event.end += line.UTF8strideAt(event.end - lineOffset);
         }
         event.text = dcharToString( key );
     } else {
@@ -2761,7 +2775,7 @@
             if (index is -1 && lineIndex > 0) {
                 bottomOffset = content.getOffsetAtLine(lineIndex - 1) + content.getLine(lineIndex - 1).length;
             } else {
-                bottomOffset = content.getOffsetAtLine(lineIndex) + Math.max(0, layout.getLineOffsets()[index + 1] - 1);
+                bottomOffset = content.getOffsetAtLine(lineIndex) + Math.max(0, getPreviousCharOffset(lineIndex, layout.getLineOffsets()[index + 1]));
             }
             renderer.disposeTextLayout(layout);
         } else {
@@ -3957,7 +3971,7 @@
     if (point is null) {
         SWT.error(SWT.ERROR_NULL_ARGUMENT);
     }
-    int[] trailing = new int[1];
+    int[1] trailing;
     int offset = getOffsetAtPoint(point.x, point.y, trailing, true);
     if (offset is -1) {
         SWT.error(SWT.ERROR_INVALID_ARGUMENT);
@@ -3993,7 +4007,8 @@
             String line = content.getLine(lineIndex);
             int level;
             int offset = offsetInLine;
-            while (offset > 0 && Character.isDigit(line.dcharAt(offset))) offset--;
+            while (offset > 0 && Character.isDigit(line.dcharAt(offset)))
+                offset = line.offsetBefore(offset);
             if (offset is 0 && Character.isDigit(line.dcharAt(offset))) {
                 level = isMirrored() ? 1 : 0;
             } else {
@@ -4623,7 +4638,8 @@
     if (start < 0 || start >= contentLength || end < 0 || end >= contentLength || start > end) {
         SWT.error(SWT.ERROR_INVALID_RANGE);
     }
-    return content.getTextRange(start, end - start + 1);
+    auto res = content.getTextRange(start, content.getCharCount() - start);
+    return res[0 .. res.offsetAfter(end - start)];
 }
 /**
  * Returns the smallest bounding rectangle that includes the characters between two offsets.
@@ -4797,9 +4813,12 @@
     int offset = caretOffset - lineOffset;
     int lineLength = line.length;
     if (lineLength is 0) return isMirrored() ? SWT.RIGHT : SWT.LEFT;
-    if (caretAlignment is PREVIOUS_OFFSET_TRAILING && offset > 0) offset--;
-    if (offset is lineLength && offset > 0) offset--;
-    while (offset > 0 && Character.isDigit(line.dcharAt(offset))) offset--;
+    if (caretAlignment is PREVIOUS_OFFSET_TRAILING && offset > 0)
+        offset = line.offsetBefore(offset);
+    if (offset is lineLength && offset > 0)
+        offset = line.offsetBefore(offset);
+    while (offset > 0 && Character.isDigit(line.dcharAt(offset)))
+        offset = line.offsetBefore(offset);
     if (offset is 0 && Character.isDigit(line.dcharAt(offset))) {
         return isMirrored() ? SWT.RIGHT : SWT.LEFT;
     }
@@ -4893,8 +4912,8 @@
     int offsetInLine = offset - lineOffset;
     int lineLength = line.length;
     if (lineIndex < content.getLineCount() - 1) {
-        int endLineOffset = content.getOffsetAtLine(lineIndex + 1) - 1;
-        if (lineLength < offsetInLine && offsetInLine <= endLineOffset) {
+        int afterEndLineOffset = content.getOffsetAtLine(lineIndex + 1);
+        if (lineLength < offsetInLine && offsetInLine < afterEndLineOffset) {
             offsetInLine = lineLength;
         }
     }
@@ -4902,9 +4921,7 @@
     TextLayout layout = renderer.getTextLayout(lineIndex);
     if (lineLength !is 0  && offsetInLine <= lineLength) {
         if (offsetInLine is lineLength) {
-            // SWT: Instead of go back one byte, go back one codepoint
-            int offsetInLine_m1 = layout.getPreviousOffset(offsetInLine, SWT.MOVEMENT_CLUSTER);
-            point = layout.getLocation(offsetInLine_m1, true);
+            point = layout.getLocation(getPreviousCharOffset(lineIndex, offsetInLine), true);
         } else {
             switch (caretAlignment) {
                 case OFFSET_LEADING:
@@ -4915,9 +4932,7 @@
                     if (offsetInLine is 0) {
                         point = layout.getLocation(offsetInLine, false);
                     } else {
-                        // SWT: Instead of go back one byte, go back one codepoint
-                        int offsetInLine_m1 = layout.getPreviousOffset(offsetInLine, SWT.MOVEMENT_CLUSTER);
-                        point = layout.getLocation(offsetInLine_m1, true);
+                        point = layout.getLocation(getPreviousCharOffset(lineIndex, offsetInLine), true);
                     }
                     break;
             }
@@ -5066,7 +5081,7 @@
         int endIndex = layout.getLineIndex(Math.min(end, layout.getText().length));
         if (startIndex is endIndex) {
             /* Redraw rect between start and end offset if start and end offsets are in same wrapped line */
-            Rectangle rect = layout.getBounds(start, end - 1);
+            Rectangle rect = layout.getBounds( start, getPreviousCharOffset(startLine, end) );
             rect.x += lineX;
             rect.y += startLineY;
             super.redraw(rect.x, rect.y, rect.width, rect.height, false);
@@ -5076,7 +5091,7 @@
     }
 
     /* Redraw start line from the start offset to the end of client area */
-    Rectangle startRect = layout.getBounds(start, offsets[startIndex + 1] - 1);
+    Rectangle startRect = layout.getBounds( start, getPreviousCharOffset(startLine, offsets[startIndex + 1]) );
     if (startRect.height is 0) {
         Rectangle bounds = layout.getLineBounds(startIndex);
         startRect.x = bounds.width;
@@ -5095,7 +5110,7 @@
         offsets = layout.getLineOffsets();
     }
     int endIndex = layout.getLineIndex(Math.min(end, layout.getText().length));
-    Rectangle endRect = layout.getBounds(offsets[endIndex], end - 1);
+    Rectangle endRect = layout.getBounds(offsets[endIndex], getPreviousCharOffset(endLine, end));
     if (endRect.height is 0) {
         Rectangle bounds = layout.getLineBounds(endIndex);
         endRect.y = bounds.y;
@@ -5113,7 +5128,7 @@
     }
 }
 void handleCompositionOffset (Event event) {
-    int[] trailing = new int [1];
+    int[1] trailing;
     event.index = getOffsetAtPoint(event.x, event.y, trailing, true);
     event.count = trailing[0];
 }
@@ -5140,7 +5155,7 @@
             int lineIndex = getCaretLine();
             int lineOffset = content.getOffsetAtLine(lineIndex);
             TextLayout layout = renderer.getTextLayout(lineIndex);
-            caretWidth = layout.getBounds(start - lineOffset, start + length - 1 - lineOffset).width;
+            caretWidth = layout.getBounds(start - lineOffset, getPreviousCharOffset(lineIndex, start + length - lineOffset)).width;
             renderer.disposeTextLayout(layout);
         }
     }
@@ -5736,7 +5751,7 @@
     do {
         while (index < length_ && string[index] !is '&') index++;
         if (++index >= length_) return '\0';
-        if (string[index] !is '&') return CharacterFirstToLower(string[index .. $ ] );
+        if (string[index] !is '&') return Character.toLowerCase (string.dcharAt (index));
         index++;
     } while (index < length_);
     return '\0';
@@ -7816,8 +7831,6 @@
  */
 void setSelection(int start, int length, bool sendEvent) {
     int end = start + length;
-    start = content.utf8AdjustOffset(start);
-    end = content.utf8AdjustOffset(end);
     if (start > end) {
         int temp = end;
         end = start;
@@ -8316,7 +8329,7 @@
     setCaretLocation();
     super.redraw();
 }
-// SWT: If necessary, scroll to show the location
+// DWT: If necessary, scroll to show the location
 bool showLocation(Rectangle rect, bool scrollPage) {
     int clientAreaWidth = this.clientAreaWidth - leftMargin - rightMargin;
     int clientAreaHeight = this.clientAreaHeight - topMargin - bottomMargin;
@@ -8433,6 +8446,7 @@
         int redrawStart = startOffset + newLength;
         internalRedrawRange(redrawStart, selection.y + netNewLength - redrawStart);
     }
+    selectedTextValid = false;
     if (selection.y > startOffset && selection.x < startOffset + replacedLength) {
         // selection intersects replaced text. set caret behind text change
         setSelection(startOffset + newLength, 0, true);
@@ -8442,4 +8456,14 @@
     }
     setCaretLocation();
 }
-}
+
+// DWT: to use instead of "offsetInLine - 1"
+int getPreviousCharOffset(String F = __FILE__, uint L = __LINE__)(int lineIndex, int offsetInLine) {
+    String line = content.getLine(lineIndex);
+    if(offsetInLine < 0 || offsetInLine > line.length) {
+        getDwtLogger().warn(F, L, Format("Clamped UTF-8 offset:\noffsetInLine = {}, line.length = {}, line = {}", offsetInLine, line.length, line));
+        return offsetInLine - 1;
+    }
+    return line.offsetBefore(offsetInLine);
+}
+}
--- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/custom/StyledTextContent.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/custom/StyledTextContent.d	Sat Jul 09 15:50:20 2011 +0300
@@ -209,9 +209,4 @@
  */
 public void setText(String text);
 
-/++
- + SWT Extension
- +/
-int utf8AdjustOffset( int offset );
-
 }
--- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/custom/StyledTextRenderer.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/custom/StyledTextRenderer.d	Sat Jul 09 15:50:20 2011 +0300
@@ -39,6 +39,7 @@
 import org.eclipse.swt.custom.StyledTextEvent;
 
 import java.lang.all;
+import java.nonstandard.UnsafeUtf;
 
 /**
  * A StyledTextRenderer renders the content of a StyledText widget.
@@ -398,7 +399,7 @@
         styledText.drawBackground(gc, client.x, paintY, client.width, height);
     }
     gc.setForeground(widgetForeground);
-    if (selectionStart is selectionEnd || (selectionEnd <= 0 && selectionStart > lineLength - 1)) {
+    if (selectionStart is selectionEnd || (selectionEnd <= 0 && selectionStart >= lineLength)) {
         layout.draw(gc, paintX, paintY);
     } else {
         int start = Math.max(0, selectionStart);
@@ -414,7 +415,7 @@
         if (selectionStart <= lineLength && lineLength < selectionEnd ) {
             flags |= SWT.LAST_LINE_SELECTION;
         }
-        layout.draw(gc, paintX, paintY, start, end - 1, selectionFg, selectionBg, flags);
+        layout.draw(gc, paintX, paintY, start, end > 0 ? line.offsetBefore(end) : end - 1, selectionFg, selectionBg, flags);
     }
 
     // draw objects
@@ -595,7 +596,7 @@
 }
 int[] getRanges(int start, int length) {
     int[] newRanges;
-    int end = start + length - 1;
+    int end = start + length - 1; //not a valid index, but OK
     if (ranges !is null) {
         int rangeCount = styleCount << 1;
         int rangeStart = getRangeIndex(start, -1, rangeCount);
@@ -627,7 +628,7 @@
 }
 StyleRange[] getStyleRanges(int start, int length, bool includeRanges) {
     StyleRange[] newStyles;
-    int end = start + length - 1;
+    int end = start + length - 1; //not a valid index, but OK
     if (ranges !is null) {
         int rangeCount = styleCount << 1;
         int rangeStart = getRangeIndex(start, -1, rangeCount);
@@ -846,7 +847,7 @@
                 }
                 if (start >= length) break;
                 if (lastOffset < start) {
-                    layout.setStyle(null, lastOffset, start - 1);
+                    layout.setStyle(null, lastOffset, line.offsetBefore(start));
                 }
                 layout.setStyle(getStyleRange(styles[i >> 1]), start, end);
                 lastOffset = Math.max(lastOffset, end);
@@ -863,7 +864,7 @@
                 }
                 if (start >= length) break;
                 if (lastOffset < start) {
-                    layout.setStyle(null, lastOffset, start - 1);
+                    layout.setStyle(null, lastOffset, line.offsetBefore(start));
                 }
                 layout.setStyle(getStyleRange(styles[i]), start, end);
                 lastOffset = Math.max(lastOffset, end);
@@ -904,11 +905,11 @@
                         }
                     } else {
                         int start = compositionOffset - lineOffset;
-                        int end = start + compositionLength - 1;
+                        int end = line.offsetBefore(start + compositionLength);
                         TextStyle userStyle = layout.getStyle(start);
                         if (userStyle is null) {
-                            if (start > 0) userStyle = layout.getStyle(start - 1);
-                            if (userStyle is null && end + 1 < length) userStyle = layout.getStyle(end + 1);
+                            if (start > 0) userStyle = layout.getStyle(line.offsetBefore(start));
+                            if (userStyle is null && line.offsetAfter(end) < length) userStyle = layout.getStyle(line.offsetAfter(end));
                             if (userStyle !is null) {
                                 TextStyle newStyle = new TextStyle();
                                 newStyle.font = userStyle.font;
--- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/custom/TableEditor.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/custom/TableEditor.d	Sat Jul 09 15:50:20 2011 +0300
@@ -26,7 +26,6 @@
 import org.eclipse.swt.widgets.TableColumn;
 import org.eclipse.swt.widgets.TableItem;
 import org.eclipse.swt.custom.ControlEditor;
-import java.lang.Runnable;
 
 /**
 *
--- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/custom/TableTreeEditor.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/custom/TableTreeEditor.d	Sat Jul 09 15:50:20 2011 +0300
@@ -28,7 +28,6 @@
 import org.eclipse.swt.custom.TableTree;
 import org.eclipse.swt.custom.TableTreeItem;
 
-import java.lang.Runnable;
 
 /**
 *
--- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/custom/TreeEditor.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/custom/TreeEditor.d	Sat Jul 09 15:50:20 2011 +0300
@@ -27,7 +27,6 @@
 import org.eclipse.swt.widgets.TreeColumn;
 import org.eclipse.swt.widgets.TreeItem;
 import org.eclipse.swt.custom.ControlEditor;
-import java.lang.Runnable;
 
 /**
 *
--- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/custom/ViewForm.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/custom/ViewForm.d	Sat Jul 09 15:50:20 2011 +0300
@@ -201,7 +201,7 @@
 //protected void checkSubclass () {
 //  String name = getClass().getName ();
 //  String validName = ViewForm.class.getName();
-//  if (!validName.equals(name)) {
+//  if (validName != (name)) {
 //      SWT.error (SWT.ERROR_INVALID_SUBCLASS);
 //  }
 //}
--- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/events/ControlEvent.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/events/ControlEvent.d	Sat Jul 09 15:50:20 2011 +0300
@@ -26,7 +26,7 @@
 
 public final class ControlEvent : TypedEvent {
 
-    //static final long serialVersionUID = 3258132436155119161L;
+    //static const long serialVersionUID = 3258132436155119161L;
 
 /**
  * Constructs a new instance of this class based on the
--- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/events/DisposeEvent.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/events/DisposeEvent.d	Sat Jul 09 15:50:20 2011 +0300
@@ -26,7 +26,7 @@
 
 public final class DisposeEvent : TypedEvent {
 
-    //static final long serialVersionUID = 3257566187633521206L;
+    //static const long serialVersionUID = 3257566187633521206L;
 
 /**
  * Constructs a new instance of this class based on the
--- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/events/DragDetectEvent.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/events/DragDetectEvent.d	Sat Jul 09 15:50:20 2011 +0300
@@ -27,7 +27,7 @@
 
 public final class DragDetectEvent : MouseEvent {
 
-    //private static final long serialVersionUID = -7229172519733647232L;
+    //private static const long serialVersionUID = -7229172519733647232L;
 
 /**
  * Constructs a new instance of this class based on the
--- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/events/ExpandEvent.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/events/ExpandEvent.d	Sat Jul 09 15:50:20 2011 +0300
@@ -28,7 +28,7 @@
 
 public class ExpandEvent : SelectionEvent {
 
-    //static final long serialVersionUID = 3976735856884987356L;
+    //static const long serialVersionUID = 3976735856884987356L;
 
 /**
  * Constructs a new instance of this class based on the
--- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/events/FocusEvent.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/events/FocusEvent.d	Sat Jul 09 15:50:20 2011 +0300
@@ -26,7 +26,7 @@
 
 public final class FocusEvent : TypedEvent {
 
-    //static final long serialVersionUID = 3258134643684227381L;
+    //static const long serialVersionUID = 3258134643684227381L;
 
 /**
  * Constructs a new instance of this class based on the
--- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/events/HelpEvent.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/events/HelpEvent.d	Sat Jul 09 15:50:20 2011 +0300
@@ -26,7 +26,7 @@
 
 public final class HelpEvent : TypedEvent {
 
-    //static final long serialVersionUID = 3257001038606251315L;
+    //static const long serialVersionUID = 3257001038606251315L;
 
 /**
  * Constructs a new instance of this class based on the
--- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/events/KeyEvent.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/events/KeyEvent.d	Sat Jul 09 15:50:20 2011 +0300
@@ -102,7 +102,7 @@
  */
 public override String toString() {
     return Format( "{} character={} keyCode={} stateMask={} doit={}}",
-        super.toString[ 0 .. $-2 ],
+        super.toString[ 0 .. $-1 ],
         character, keyCode, stateMask, doit );
 }
 }
--- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/events/MenuDetectEvent.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/events/MenuDetectEvent.d	Sat Jul 09 15:50:20 2011 +0300
@@ -48,7 +48,7 @@
      */
     public bool doit;
 
-    //private static final long serialVersionUID = -3061660596590828941L;
+    //private static const long serialVersionUID = -3061660596590828941L;
 
 /**
  * Constructs a new instance of this class based on the
@@ -70,6 +70,6 @@
  * @return a string representation of the event
  */
 public override String toString() {
-    return Format( "{} x={} y={} doit={}}", super.toString[ 0 .. $-2 ], x, y, doit );
+    return Format( "{} x={} y={} doit={}}", super.toString[ 0 .. $-1 ], x, y, doit );
 }
 }
--- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/events/MenuEvent.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/events/MenuEvent.d	Sat Jul 09 15:50:20 2011 +0300
@@ -26,7 +26,7 @@
 
 public final class MenuEvent : TypedEvent {
 
-    //static final long serialVersionUID = 3258132440332383025L;
+    //static const long serialVersionUID = 3258132440332383025L;
 
 /**
  * Constructs a new instance of this class based on the
--- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/events/ModifyEvent.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/events/ModifyEvent.d	Sat Jul 09 15:50:20 2011 +0300
@@ -26,7 +26,7 @@
 
 public final class ModifyEvent : TypedEvent {
 
-    //static final long serialVersionUID = 3258129146227011891L;
+    //static const long serialVersionUID = 3258129146227011891L;
 
 /**
  * Constructs a new instance of this class based on the
--- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/events/MouseEvent.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/events/MouseEvent.d	Sat Jul 09 15:50:20 2011 +0300
@@ -71,7 +71,7 @@
      */
     public int count;
 
-    //static final long serialVersionUID = 3257288037011566898L;
+    //static const long serialVersionUID = 3257288037011566898L;
 
 /**
  * Constructs a new instance of this class based on the
--- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/events/PaintEvent.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/events/PaintEvent.d	Sat Jul 09 15:50:20 2011 +0300
@@ -69,7 +69,7 @@
      */
     public int count;
 
-    //static final long serialVersionUID = 3256446919205992497L;
+    //static const long serialVersionUID = 3256446919205992497L;
 
 /**
  * Constructs a new instance of this class based on the
--- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/events/SelectionEvent.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/events/SelectionEvent.d	Sat Jul 09 15:50:20 2011 +0300
@@ -103,7 +103,7 @@
      */
     public bool doit;
 
-    //static final long serialVersionUID = 3976735856884987953L;
+    //static const long serialVersionUID = 3976735856884987953L;
 
 /**
  * Constructs a new instance of this class based on the
@@ -132,7 +132,7 @@
  */
 public override String toString() {
     return Format( "{} item={} detail={} x={} y={} width={} height={} stateMask={} text={} doit={}}",
-        super.toString[ 0 .. $-2 ],
+        super.toString[ 0 .. $-1 ],
         item,
         detail,
         x,
--- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/events/ShellEvent.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/events/ShellEvent.d	Sat Jul 09 15:50:20 2011 +0300
@@ -34,7 +34,7 @@
      */
     public bool doit;
 
-    //static final long serialVersionUID = 3257569490479888441L;
+    //static const long serialVersionUID = 3257569490479888441L;
 
 /**
  * Constructs a new instance of this class based on the
@@ -54,7 +54,7 @@
  * @return a string representation of the event
  */
 public override String toString() {
-    return Format( "{} doit={}}", super.toString[ 0 .. $-2 ], doit );
+    return Format( "{} doit={}}", super.toString[ 0 .. $-1 ], doit );
 }
 }
 
--- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/events/TraverseEvent.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/events/TraverseEvent.d	Sat Jul 09 15:50:20 2011 +0300
@@ -114,7 +114,7 @@
      */
     public int detail;
 
-    //static final long serialVersionUID = 3257565105301239349L;
+    //static const long serialVersionUID = 3257565105301239349L;
 
 /**
  * Constructs a new instance of this class based on the
@@ -134,6 +134,6 @@
  * @return a string representation of the event
  */
 public override String toString() {
-    return Format( "{} detail={}}", super.toString[ 0 .. $-2 ], detail );
+    return Format( "{} detail={}}", super.toString[ 0 .. $-1 ], detail );
 }
 }
--- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/events/TreeEvent.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/events/TreeEvent.d	Sat Jul 09 15:50:20 2011 +0300
@@ -26,7 +26,7 @@
 
 public final class TreeEvent : SelectionEvent {
 
-    //static final long serialVersionUID = 3257282548009677109L;
+    //static const long serialVersionUID = 3257282548009677109L;
 
 /**
  * Constructs a new instance of this class based on the
--- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/events/TypedEvent.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/events/TypedEvent.d	Sat Jul 09 15:50:20 2011 +0300
@@ -12,6 +12,7 @@
  *******************************************************************************/
 module org.eclipse.swt.events.TypedEvent;
 
+
 import org.eclipse.swt.widgets.Event;
 import org.eclipse.swt.widgets.Display;
 import org.eclipse.swt.widgets.Widget;
@@ -55,7 +56,7 @@
      */
     public Object data;
 
-    //static final long serialVersionUID = 3257285846578377524L;
+    //static const long serialVersionUID = 3257285846578377524L;
 
 /**
  * Constructs a new instance of this class.
@@ -87,10 +88,10 @@
  * @return the name of the event
  */
 String getName () {
-    String str = this.classinfo.name;
-    int index = str.lastIndexOf ('.');
-    if (index is -1) return str;
-    return str.substring (index + 1, str.length );
+    String string = this.classinfo.name;
+    int index = string.lastIndexOf ('.');
+    if (index is -1) return string;
+    return string.substring (index + 1, string.length ());
 }
 
 /**
@@ -102,6 +103,6 @@
 public override String toString() {
     String str_widget = widget is null ? "null" : widget.toString;
     String str_data   = data is null ? "null" : data.toString;
-    return Format( "{}{{time={} data={}}", str_widget, time, str_data );
+    return Format( "{}{{{} time={} data={}}", getName(), str_widget, time, str_data );
 }
 }
--- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/events/VerifyEvent.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/events/VerifyEvent.d	Sat Jul 09 15:50:20 2011 +0300
@@ -41,7 +41,7 @@
      */
     public String text;
 
-    //static final long serialVersionUID = 3257003246269577014L;
+    //static const long serialVersionUID = 3257003246269577014L;
 
 /**
  * Constructs a new instance of this class based on the
@@ -63,6 +63,6 @@
  * @return a string representation of the event
  */
 public override String toString() {
-    return Format( "{} start={} end={} text={}}", super.toString[ 0 .. $-2 ], start, end, text );
+    return Format( "{} start={} end={} text={}}", super.toString[ 0 .. $-1 ], start, end, text );
 }
 }
--- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/graphics/Color.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/graphics/Color.d	Sat Jul 09 15:50:20 2011 +0300
@@ -150,7 +150,7 @@
  *
  * @see #hashCode
  */
-public bool equals (Object object) {
+public override equals_t opEquals (Object object) {
     if (object is this) return true;
     if (!(cast(Color)object)) return false;
     Color color = cast(Color) object;
--- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/graphics/GC.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/graphics/GC.d	Sat Jul 09 15:50:20 2011 +0300
@@ -244,7 +244,7 @@
             }
         }
         if ((state & LINE_STYLE) !is 0) {
-            float[] dashes = null;
+            TryConst!(float)[] dashes = null;
             float dashOffset = 0;
             int dashStyle = Gdip.DashStyleSolid;
             switch (data.lineStyle) {
@@ -256,12 +256,13 @@
                 case SWT.LINE_CUSTOM: {
                     if (data.lineDashes !is null) {
                         dashOffset = data.lineDashesOffset / Math.max (1.0f, width);
-                        dashes = new float[data.lineDashes.length * 2];
+                        float[] dashes_ = new float[data.lineDashes.length * 2];
                         for (int i = 0; i < data.lineDashes.length; i++) {
                             float dash = data.lineDashes[i] / Math.max (1.0f, width);
-                            dashes[i] = dash;
-                            dashes[i + data.lineDashes.length] = dash;
+                            dashes_[i] = dash;
+                            dashes_[i + data.lineDashes.length] = dash;
                         }
+                        dashes = dashes_;
                     }
                 }
                 default:
@@ -2443,7 +2444,7 @@
  *
  * @see #hashCode
  */
-public bool equals (Object object) {
+public override equals_t opEquals (Object object) {
     return (object is this) || (null !is (cast(GC)object) && (handle is (cast(GC)object).handle));
 }
 
@@ -2966,8 +2967,7 @@
     }
     int tch = ch;
     if (ch > 0x7F) {
-        char[1] str;
-        str[0] = ch;
+        TryImmutable!(char)[1] str = ch;
         StringT buffer = StrToTCHARs( str );
         tch = buffer[0];
     }
@@ -3112,8 +3112,7 @@
     static if (!OS.IsWinCE) {
         int tch = ch;
         if (ch > 0x7F) {
-            char[1] str;
-            str[0] = ch;
+            TryImmutable!(char)[1] str = ch;
             StringT buffer = StrToTCHARs( str );
             tch = buffer[0];
         }
@@ -3127,8 +3126,7 @@
     TEXTMETRIC lptm;
     OS.GetTextMetrics(handle, &lptm);
     SIZE size;
-    char[1] str;
-    str[0] = ch;
+    TryImmutable!(char)[1] str = ch;
     OS.GetTextExtentPoint32W(handle, StrToWCHARz( str ), 1, &size);
     return size.cx - lptm.tmOverhang;
 }
--- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/graphics/Image.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/graphics/Image.d	Sat Jul 09 15:50:20 2011 +0300
@@ -708,7 +708,7 @@
                                         RGB[] rgbs = new RGB[colorPalette.Count];
                                         paletteData = new PaletteData(rgbs);
                                         for (int i = 0; i < colorPalette.Count; i++) {
-                                            // SWT: access palette.Entries without array bounds checking
+                                            // DWT: access palette.Entries without array bounds checking
                                             if (((*(palette.Entries.ptr + i) >> 24) & 0xFF) is 0 && (colorPalette.Flags & Gdip.PaletteFlagsHasAlpha) !is 0) {
                                                 transparentPixel = i;
                                             }
--- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/graphics/ImageLoader.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/graphics/ImageLoader.d	Sat Jul 09 15:50:20 2011 +0300
@@ -21,7 +21,6 @@
 import org.eclipse.swt.internal.Compatibility;
 import org.eclipse.swt.internal.image.FileFormat;
 
-//import tango.core.Array;
 import java.util.Vector;
 import java.lang.all;
 
--- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/graphics/ImageLoaderEvent.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/graphics/ImageLoaderEvent.d	Sat Jul 09 15:50:20 2011 +0300
@@ -87,7 +87,7 @@
  * @return a string representation of the event
  */
 public override String toString () {
-    return Format( "ImageLoaderEvent {source={} imageData={} incrementCount={} endOfImage={}}", source, imageData, incrementCount, endOfImage); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+    return Format( "ImageLoaderEvent {{source={} imageData={} incrementCount={} endOfImage={}}", source, imageData, incrementCount, endOfImage); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
 }
 
 }
--- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/graphics/RGB.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/graphics/RGB.d	Sat Jul 09 15:50:20 2011 +0300
@@ -230,9 +230,5 @@
 
 }
 
-version(D_Version2){
-    mixin("alias const(RGB) constRGB;");
-} else { // D1
-    alias RGB constRGB;
-}
+alias TryConst!(RGB) constRGB;
 
--- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/graphics/TextLayout.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/graphics/TextLayout.d	Sat Jul 09 15:50:20 2011 +0300
@@ -23,7 +23,7 @@
  + 'text' is the original user text, 'segmentsText' is the user text stuffed with
  + RTL/LTR markers for each line or in addition for User supplied segments. A segment
  + is a range where Bidi char reordering can happen.
- + The 'runs' are those ranges with an idiviual style.
+ + The 'runs' are those ranges with an idividual style.
  +/
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.SWTException;
@@ -46,6 +46,7 @@
 import org.eclipse.swt.graphics.TextStyle;
 
 import java.lang.all;
+import java.nonstandard.SafeUtf;
 
 
 /**
@@ -68,8 +69,8 @@
  * @since 3.0
  */
 public final class TextLayout : Resource {
-
     alias Resource.init_ init_;
+private:
 
 /++
  +  SWT doku
@@ -89,8 +90,8 @@
     String16 wtext;
     String  segmentsText;
     String16 segmentsWText; // DWT
-    int[]   index8to16; // DWT
-    int[]   index16to8; // DWT
+    UTF16index[] index8to16; // DWT
+    UTF8index[] index16to8; // DWT
     int lineSpacing;
     int ascent, descent;
     int alignment;
@@ -99,36 +100,40 @@
     int indent;
     bool justify;
     int[] tabs;
-    int[] segments; // indices in 'text'
-    int[] wsegments; // SWT indices in 'wtext'
+    UTF8index[] segments; // indices in 'text'
+    UTF16index[] wsegments; // SWT indices in 'wtext'
     StyleItem[] styles;
     int stylesCount;
 
     StyleItem[] allRuns;
     StyleItem[][] runs;
-    int[] lineOffset, lineY, lineWidth;
+    UTF8index[] lineOffset;
+    int[] lineY, lineWidth;
     void* mLangFontLink2;
 
     static const dchar LTR_MARK = '\u200E', RTL_MARK = '\u200F';
     static const wchar LTR_MARKw = '\u200E', RTL_MARKw = '\u200F';
     static const String STR_LTR_MARK = "\u200E", STR_RTL_MARK = "\u200F";
     static const wchar[] WSTR_LTR_MARK = "\u200E"w, WSTR_RTL_MARK = "\u200F"w;
-    static const int MARK_SIZE = 3;
-    static const int WMARK_SIZE = 1;
+    static const UTF8shift MARK_SIZE = { STR_LTR_MARK.length };
+    static const UTF16shift WMARK_SIZE = WSTR_LTR_MARK.length;
+    static assert(MARK_SIZE.internalValue == 3 && WMARK_SIZE == 1);
     static const int SCRIPT_VISATTR_SIZEOF = 2;
     static const int GOFFSET_SIZEOF = 8;
-    private static byte[16] CLSID_CMultiLanguage;
-    private static byte[16] IID_IMLangFontLink2;
-    private static bool static_this_completed = false;
-    private static void static_this() {
+mixin(gshared!("
+    static byte[16] CLSID_CMultiLanguage;
+    static byte[16] IID_IMLangFontLink2;
+    static bool static_this_completed = false;
+"));
+    static void static_this() {
         // in case of allready initialized, we can check and leave without lock
         if( static_this_completed ){
             return;
         }
         synchronized {
             if( !static_this_completed ){
-                OS.IIDFromString("{275c23e2-3747-11d0-9fea-00aa003f8646}\0".toWCharArray().ptr, CLSID_CMultiLanguage.ptr);
-                OS.IIDFromString("{DCCFC162-2B38-11d2-B7EC-00C04F8F5D9A}\0".toWCharArray().ptr, IID_IMLangFontLink2.ptr);
+                OS.IIDFromString("{275c23e2-3747-11d0-9fea-00aa003f8646}\0"w.ptr, CLSID_CMultiLanguage.ptr);
+                OS.IIDFromString("{DCCFC162-2B38-11d2-B7EC-00C04F8F5D9A}\0"w.ptr, IID_IMLangFontLink2.ptr);
                 static_this_completed = true;
             }
         }
@@ -139,10 +144,14 @@
     static const int UNDERLINE_IME_DASH = 2 << 16;
     static const int UNDERLINE_IME_THICK = 3 << 16;
 
-    class StyleItem {
+    static class StyleItem {
         TextStyle style;
-        // SWT: start, lenght relative to segmentsText
-        int start, length;
+        // DWT: start, lenght relative to segmentsText
+        UTF8index UTF8start;
+        UTF8shift UTF8length;
+        UTF8index UTF8end() {
+            return UTF8start + UTF8length;
+        }
         bool lineBreak, softBreak, tab;
 
         /*Script cache and analysis */
@@ -221,7 +230,7 @@
         lineBreak = softBreak = false;
     }
     override public String toString () {
-        return Format( "StyleItem {{{}, {}}", start, style );
+        return Format( "StyleItem {{{}, {}}", UTF8start, style );
     }
     }
 
@@ -261,11 +270,11 @@
 
 void breakRun(StyleItem run) {
     if (run.psla !is null) return;
-    String16 chars = segmentsWText[ index8to16[ run.start ] .. index8to16[ run.start + run.length ] ];
+    String16 wchars = segmentsWText[ getUTF16index(run.UTF8start) .. getUTF16index(run.UTF8start + run.UTF8length) ];
     auto hHeap = OS.GetProcessHeap();
-    run.psla = cast(SCRIPT_LOGATTR*)OS.HeapAlloc(hHeap, OS.HEAP_ZERO_MEMORY, SCRIPT_LOGATTR.sizeof * chars.length);
+    run.psla = cast(SCRIPT_LOGATTR*)OS.HeapAlloc(hHeap, OS.HEAP_ZERO_MEMORY, SCRIPT_LOGATTR.sizeof * wchars.length);
     if (run.psla is null) SWT.error(SWT.ERROR_NO_HANDLES);
-    OS.ScriptBreak(chars.ptr, chars.length, &run.analysis, run.psla);
+    OS.ScriptBreak(wchars.ptr, wchars.length, &run.analysis, run.psla);
 }
 
 void checkLayout () {
@@ -276,7 +285,13 @@
 *  Compute the runs: itemize, shape, place, and reorder the runs.
 *   Break paragraphs into lines, wraps the text, and initialize caches.
 */
-void computeRuns (GC gc) {
+void computeRuns (GC gc)
+out {
+    foreach(run; allRuns) {
+        segmentsText.validateUTF8index(run.UTF8start);
+        segmentsText.validateUTF8index(run.UTF8start + run.UTF8length);
+    }
+} body {
     if (runs !is null) return;
     auto hDC = gc !is null ? gc.handle : device.internal_new_GC(null);
     auto srcHdc = OS.CreateCompatibleDC(hDC);
@@ -291,8 +306,9 @@
     int lineWidth = indent, lineStart = 0, lineCount = 1;
     for (int i=0; i<allRuns.length - 1; i++) {
         StyleItem run = allRuns[i];
-        if (run.length is 1) {
-            char ch = segmentsText.charAt(run.start);
+        if (run.UTF8length.internalValue is 1) {
+            char ch = segmentsText.charAt( run.UTF8start.internalValue );
+            assert(ch == segmentsText.dcharAt(run.UTF8start));
             switch (ch) {
                 case '\t': {
                     run.tab = true;
@@ -321,8 +337,8 @@
                 case '\r': {
                     run.lineBreak = true;
                     StyleItem next = allRuns[i + 1];
-                    if (next.length !is 0 && segmentsText.charAt(next.start) is '\n') {
-                        run.length += 1;
+                    if (next.UTF8length.internalValue !is 0 && segmentsText.charAt( next.UTF8start.internalValue ) is '\n') {
+                        run.UTF8length.internalValue += 1;
                         next.free();
                         StyleItem[] newAllRuns = new StyleItem[allRuns.length - 1];
                         System.arraycopy(allRuns, 0, newAllRuns, 0, i + 1);
@@ -335,26 +351,27 @@
             }
         }
         if (wrapWidth !is -1 && lineWidth + run.width > wrapWidth && !run.tab) {
-            int start = 0;
-            int[] piDx = new int[run.length];
+            UTF16index wstart = 0;
+            UTF16shift cChars = getUTF16length(run);
+            int[] piDx = new int[cChars];
             if (run.style !is null && run.style.metrics !is null) {
                 piDx[0] = run.width;
             } else {
-                OS.ScriptGetLogicalWidths(&run.analysis, run.length, run.glyphCount, run.advances, run.clusters, run.visAttrs, piDx.ptr);
+                OS.ScriptGetLogicalWidths(&run.analysis, cChars, run.glyphCount, run.advances, run.clusters, run.visAttrs, piDx.ptr);
             }
             int width = 0, maxWidth = wrapWidth - lineWidth;
-            while (width + piDx[start] < maxWidth) {
-                width += piDx[start++];
+            while (width + piDx[wstart] < maxWidth) {
+                width += piDx[wstart++];
             }
-            int firstStart = start;
+            UTF16index firstWstart = wstart;
             int firstIndice = i;
             while (i >= lineStart) {
                 breakRun(run);
-                while (start >= 0) {
-                    logAttr = run.psla + start;
+                while (wstart >= 0) {
+                    logAttr = run.psla + wstart;
                     //OS.MoveMemory(logAttr, run.psla + (start * SCRIPT_LOGATTR.sizeof), SCRIPT_LOGATTR.sizeof);
                     if (logAttr.fSoftBreak || logAttr.fWhiteSpace) break;
-                    start--;
+                    wstart--;
                 }
 
                 /*
@@ -362,7 +379,7 @@
                 *  after a letter with an accent. This cause a break line to be set in the middle of a word.
                 *  The fix is to detect the case and ignore fSoftBreak forcing the algorithm keep searching.
                 */
-                if (start is 0 && i !is lineStart && !run.tab) {
+                if (wstart is 0 && i !is lineStart && !run.tab) {
                     if (logAttr.fSoftBreak && !logAttr.fWhiteSpace) {
                         properties = device.scripts[run.analysis.eScript];
                         //OS.MoveMemory(properties, device.scripts[run.analysis.eScript], SCRIPT_PROPERTIES.sizeof);
@@ -371,44 +388,46 @@
                         //OS.MoveMemory(properties, device.scripts[pRun.analysis.eScript], SCRIPT_PROPERTIES.sizeof);
                         if (properties.langid is langID || langID is OS.LANG_NEUTRAL || properties.langid is OS.LANG_NEUTRAL) {
                             breakRun(pRun);
-                            logAttr = pRun.psla + (pRun.length - 1);
+                            logAttr = pRun.psla + (getUTF16length(pRun) - 1);
                             //OS.MoveMemory(logAttr, pRun.psla + ((pRun.length - 1) * SCRIPT_LOGATTR.sizeof), SCRIPT_LOGATTR.sizeof);
-                            if (!logAttr.fWhiteSpace) start = -1;
+                            if (!logAttr.fWhiteSpace) wstart = cast(UTF16index)-1;
                         }
                     }
                 }
-                if (start >= 0 || i is lineStart) break;
+                if (wstart >= 0 || i is lineStart) break;
                 run = allRuns[--i];
-                start = run.length - 1;
+                wstart = cast(UTF16index)(getUTF16length(run) - 1);
             }
-            if (start is 0 && i !is lineStart && !run.tab) {
+            if (wstart is 0 && i !is lineStart && !run.tab) {
                 run = allRuns[--i];
-            } else  if (start <= 0 && i is lineStart) {
+            } else  if (wstart <= 0 && i is lineStart) {
                 if (lineWidth is wrapWidth && firstIndice > 0) {
                     i = firstIndice - 1;
                     run = allRuns[i];
-                    start = run.length;
+                    wstart = cast(UTF16index)getUTF16length(run);
                 } else {
                     i = firstIndice;
                     run = allRuns[i];
-                    start = Math.max(1, firstStart);
+                    wstart = cast(UTF16index)Math.max(1, firstWstart);
                 }
             }
             breakRun(run);
-            while (start < run.length) {
-                logAttr = run.psla + start;
+            UTF16shift runWlength = getUTF16length(run);
+            while (wstart < runWlength) {
+                logAttr = run.psla + wstart;
                 //OS.MoveMemory(logAttr, run.psla + (start * SCRIPT_LOGATTR.sizeof), SCRIPT_LOGATTR.sizeof);
                 if (!logAttr.fWhiteSpace) break;
-                start++;
+                wstart++;
             }
-            if (0 < start && start < run.length) {
+            if (0 < wstart && wstart < runWlength) {
                 StyleItem newRun = new StyleItem();
-                newRun.start = run.start + start;
-                newRun.length = run.length - start;
+                UTF8shift UTF8startShift = getUTF8index(getUTF16index(run.UTF8start) + wstart) - run.UTF8start;
+                newRun.UTF8start = run.UTF8start + UTF8startShift;
+                newRun.UTF8length = run.UTF8length - UTF8startShift;
                 newRun.style = run.style;
                 newRun.analysis = cloneScriptAnalysis(run.analysis);
                 run.free();
-                run.length = start;
+                run.UTF8length = UTF8startShift;
                 OS.SelectObject(srcHdc, getItemFont(run));
                 run.analysis.fNoGlyphIndex = false;
                 shape (srcHdc, run);
@@ -434,7 +453,7 @@
     }
     lineWidth = 0;
     runs = new StyleItem[][](lineCount);
-    lineOffset = new int[lineCount + 1];
+    lineOffset = new UTF8index[lineCount + 1];
     lineY = new int[lineCount + 1];
     this.lineWidth = new int[lineCount];
     int lineRunCount = 0, line = 0;
@@ -489,7 +508,7 @@
             this.lineWidth[line] = lineWidth;
 
             StyleItem lastRun = runs[line][lineRunCount - 1];
-            int lastOffset = lastRun.start + lastRun.length;
+            UTF8index lastOffset = lastRun.UTF8start + lastRun.UTF8length;
             runs[line] = reorder(runs[line], i is allRuns.length - 1);
             lastRun = runs[line][lineRunCount - 1];
             if (run.softBreak && run !is lastRun) {
@@ -596,8 +615,8 @@
  *    <li>ERROR_NULL_ARGUMENT - if the gc is null</li>
  * </ul>
  */
-public void draw (GC gc, int x, int y, int selectionStart, int selectionEnd, Color selectionForeground, Color selectionBackground) {
-    draw(gc, x, y, selectionStart, selectionEnd, selectionForeground, selectionBackground, 0);
+public void draw (GC gc, int x, int y, int i_selectionStart, int i_selectionEnd, Color selectionForeground, Color selectionBackground) {
+    draw(gc, x, y, i_selectionStart, i_selectionEnd, selectionForeground, selectionBackground, 0);
 }
 
 /**
@@ -627,9 +646,11 @@
  *
  * @since 3.3
  */
-public void draw (GC gc, int x, int y, int selectionStart, int selectionEnd, Color selectionForeground, Color selectionBackground, int flags) {
+public void draw (GC gc, int x, int y, int i_selectionStart, int i_selectionEnd, Color selectionForeground, Color selectionBackground, int flags) {
     checkLayout();
     computeRuns(gc);
+    UTF8index selectionStart = text.takeIndexArg(i_selectionStart, "selectionStart@draw");
+    UTF8index selectionEnd = text.takeIndexArg(i_selectionEnd, "selectionEnd@draw");
     if (gc is null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
     if (gc.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
     if (selectionForeground !is null && selectionForeground.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
@@ -694,10 +715,10 @@
             OS.DeleteObject(clipRgn);
         }
     }
-    bool hasSelection = selectionStart <= selectionEnd && selectionStart !is -1 && selectionEnd !is -1;
+    bool hasSelection = selectionStart <= selectionEnd && selectionStart.internalValue !is -1 && selectionEnd.internalValue !is -1;
     if (hasSelection || (flags & SWT.LAST_LINE_SELECTION) !is 0) {
-        selectionStart = Math.min(Math.max(0, selectionStart), length - 1);
-        selectionEnd = Math.min(Math.max(0, selectionEnd), length - 1);
+        selectionStart = Math.min(Math.max(text.firstIndex(), selectionStart), text.beforeEndIndex());
+        selectionEnd = Math.min(Math.max(text.firstIndex(), selectionEnd), text.beforeEndIndex());
         if (selectionForeground is null) selectionForeground = device.getSystemColor(SWT.COLOR_LIST_SELECTION_TEXT);
         if (selectionBackground is null) selectionBackground = device.getSystemColor(SWT.COLOR_LIST_SELECTION);
         selectionStart = translateOffset(selectionStart);
@@ -740,9 +761,9 @@
             } else {
                 StyleItem run = lineRuns[lineRuns.length - 1];
                 if (run.lineBreak && !run.softBreak) {
-                    if (selectionStart <= run.start && run.start <= selectionEnd) extents = true;
+                    if (selectionStart <= run.UTF8start && run.UTF8start <= selectionEnd) extents = true;
                 } else {
-                    int endOffset = segmentsText.getAbsoluteCodePointOffset( run.start + run.length, -1 );
+                    UTF8index endOffset = segmentsText.offsetBefore(run.UTF8start + run.UTF8length);
                     if (selectionStart <= endOffset && endOffset < selectionEnd && (flags & SWT.FULL_SELECTION) !is 0) {
                         extents = true;
                     }
@@ -774,12 +795,12 @@
         int alignmentX = drawX;
         for (int i = 0; i < lineRuns.length; i++) {
             StyleItem run = lineRuns[i];
-            if (run.length is 0) continue;
+            if (run.UTF8length.internalValue is 0) continue;
             if (drawX > clip.x + clip.width) break;
             if (drawX + run.width >= clip.x) {
                 if (!run.lineBreak || run.softBreak) {
-                    int end = segmentsText.getAbsoluteCodePointOffset( run.start + run.length, -1 );
-                    bool fullSelection = hasSelection && selectionStart <= run.start && selectionEnd >= end;
+                    UTF8index end = segmentsText.offsetBefore(run.UTF8start + run.UTF8length);
+                    bool fullSelection = hasSelection && selectionStart <= run.UTF8start && selectionEnd >= end;
                     if (fullSelection) {
                         if (gdip) {
                             Gdip.Graphics_FillRectangle(gdipGraphics, cast(Gdip.Brush)selBrush, drawX, drawY, run.width, lineHeight);
@@ -805,11 +826,11 @@
                                 OS.DeleteObject(hBrush);
                             }
                         }
-                        bool partialSelection = hasSelection && !(selectionStart > end || run.start > selectionEnd);
+                        bool partialSelection = hasSelection && !(selectionStart > end || run.UTF8start > selectionEnd);
                         if (partialSelection) {
-                            int selStart = index8to16[ Math.max(selectionStart, run.start) ] - index8to16[run.start];
-                            int selEnd = index8to16[ Math.min(selectionEnd, end) ] - index8to16[ run.start ];
-                            int cChars = index8to16[run.start+run.length] - index8to16[run.start]; // make it wchar
+                            UTF16index selStart = getUTF16index(Math.max(selectionStart, run.UTF8start)) - getUTF16index(run.UTF8start);
+                            UTF16index selEnd = getUTF16index(Math.min(selectionEnd, end)) - getUTF16index(run.UTF8start);
+                            UTF16shift cChars = getUTF16length(run); // make it wchar
                             int gGlyphs = run.glyphCount;
                             int piX;
                             int* advances = run.justify !is null ? run.justify : run.advances;
@@ -842,19 +863,19 @@
         drawX = alignmentX;
         for (int i = 0; i < lineRuns.length; i++) {
             StyleItem run = lineRuns[i];
-            if (run.length is 0) continue;
+            if (run.UTF8length.internalValue is 0) continue;
             if (drawX > clip.x + clip.width) break;
             if (drawX + run.width >= clip.x) {
                 if (!run.tab && (!run.lineBreak || run.softBreak) && !(run.style !is null && run.style.metrics !is null)) {
-                    int end = run.start + run.length - 1;
-                    bool fullSelection = hasSelection && selectionStart <= run.start && selectionEnd >= end;
-                    bool partialSelection = hasSelection && !fullSelection && !(selectionStart > end || run.start > selectionEnd);
+                    UTF8index end = segmentsText.offsetBefore(run.UTF8start + run.UTF8length);
+                    bool fullSelection = hasSelection && selectionStart <= run.UTF8start && selectionEnd >= end;
+                    bool partialSelection = hasSelection && !fullSelection && !(selectionStart > end || run.UTF8start > selectionEnd);
                     OS.SelectObject(hdc, getItemFont(run));
                     int drawRunY = drawY + (baseline - run.ascent);
                     if (partialSelection) {
-                        int selStart = Math.max(index8to16[selectionStart], index8to16[run.start]) - index8to16[run.start];
-                        int selEnd = Math.min(index8to16[selectionEnd], index8to16[end]) - index8to16[run.start];
-                        int cChars = index8to16[run.start+run.length] - index8to16[run.start]; // make it wchar
+                        UTF16index selStart = Math.max(getUTF16index(selectionStart), getUTF16index(run.UTF8start)) - getUTF16index(run.UTF8start);
+                        UTF16index selEnd = Math.min(getUTF16index(selectionEnd), getUTF16index(end)) - getUTF16index(run.UTF8start);
+                        UTF16shift cChars = getUTF16length(run); // make it wchar
                         int gGlyphs = run.glyphCount;
                         int piX;
                         int* advances = run.justify !is null ? run.justify : run.advances;
@@ -1185,7 +1206,7 @@
     }
 }
 
-RECT* drawBorder(bool advance, void* graphics, int x, int y, int lineHeight, void* color, void* selectionColor, bool fullSelection, RECT* clipRect, RECT* rect, int alpha, StyleItem[] line, int index, int selectionStart, int selectionEnd) {
+RECT* drawBorder(bool advance, void* graphics, int x, int y, int lineHeight, void* color, void* selectionColor, bool fullSelection, RECT* clipRect, RECT* rect, int alpha, StyleItem[] line, int index, UTF8index selectionStart, UTF8index selectionEnd) {
     StyleItem run = line[index];
     TextStyle style = run.style;
     if (style is null) return null;
@@ -1196,14 +1217,14 @@
             OS.SetRect(clipRect, -1, rect.top, -1, rect.bottom);
         }
         bool isRTL = (orientation & SWT.RIGHT_TO_LEFT) !is 0;
-        if (run.start <= selectionStart && selectionStart <= run.start + run.length) {
+        if (run.UTF8start <= selectionStart && selectionStart <= run.UTF8start + run.UTF8length) {
             if (run.analysis.fRTL ^ isRTL) {
                 clipRect.right = rect.left;
             } else {
                 clipRect.left = rect.left;
             }
         }
-        if (run.start <= selectionEnd && selectionEnd <= run.start + run.length) {
+        if (run.UTF8start <= selectionEnd && selectionEnd <= run.UTF8start + run.UTF8length) {
             if (run.analysis.fRTL ^ isRTL) {
                 clipRect.left = rect.right;
             } else {
@@ -1433,14 +1454,15 @@
  *    <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
  * </ul>
  */
-public Rectangle getBounds (int start, int end) {
+public Rectangle getBounds (int i_start, int i_end) {
     checkLayout();
     computeRuns(null);
-    int length = text.length;
-    if (length is 0) return new Rectangle(0, 0, 0, 0);
+    UTF8index start = text.takeIndexArg(i_start, "start@getBounds");
+    UTF8index end = text.takeIndexArg(i_end, "end@getBounds");
+    if (text.length is 0) return new Rectangle(0, 0, 0, 0);
     if (start > end) return new Rectangle(0, 0, 0, 0);
-    start = Math.min(Math.max(0, start), length - 1);
-    end = Math.min(Math.max(0, end), length - 1);
+    start = Math.min(Math.max(text.firstIndex(), start), text.beforeEndIndex());
+    end = Math.min(Math.max(text.firstIndex(), end), text.beforeEndIndex());
     start = translateOffset(start);
     end = translateOffset(end);
     int left = 0x7fffffff, right = 0;
@@ -1448,21 +1470,22 @@
     bool isRTL = (orientation & SWT.RIGHT_TO_LEFT) !is 0;
     for (int i = 0; i < allRuns.length - 1; i++) {
         StyleItem run = allRuns[i];
-        int runEnd = run.start + run.length;
+        UTF8index runEnd = run.UTF8start + run.UTF8length;
         if (runEnd <= start) continue;
-        if (run.start > end) break;
+        if (run.UTF8start > end) break;
         int runLead = run.x;
         int runTrail = run.x + run.width;
-        if (run.start <= start && start < runEnd) {
+        if (run.UTF8start <= start && start < runEnd) {
             int cx = 0;
             if (run.style !is null && run.style.metrics !is null) {
                 GlyphMetrics metrics = run.style.metrics;
-                cx = metrics.width * (index8to16[start] - index8to16[run.start]);
+                cx = metrics.width * (getUTF16index(start) - getUTF16index(run.UTF8start));
             } else if (!run.tab) {
+                UTF16index iCP = getUTF16index(start) - getUTF16index(run.UTF8start);
+                UTF16shift cChars = getUTF16length(run);
                 int piX;
                 int* advances = run.justify !is null ? run.justify : run.advances;
-                int wlength = index8to16[ run.start+run.length] - index8to16[run.start];
-                OS.ScriptCPtoX(index8to16[start] - index8to16[run.start], false, wlength, run.glyphCount, run.clusters, run.visAttrs, advances, &run.analysis, &piX);
+                OS.ScriptCPtoX(iCP, false, cChars, run.glyphCount, run.clusters, run.visAttrs, advances, &run.analysis, &piX);
                 cx = isRTL ? run.width - piX : piX;
             }
             if (run.analysis.fRTL ^ isRTL) {
@@ -1471,16 +1494,17 @@
                 runLead = run.x + cx;
             }
         }
-        if (run.start <= end && end < runEnd) {
+        if (run.UTF8start <= end && end < runEnd) {
             int cx = run.width;
             if (run.style !is null && run.style.metrics !is null) {
                 GlyphMetrics metrics = run.style.metrics;
-                cx = metrics.width * (index8to16[end] - index8to16[run.start] + 1);
+                cx = metrics.width * (getUTF16index(end) - getUTF16index(run.UTF8start) + 1);
             } else if (!run.tab) {
+                UTF16index iCP = getUTF16index(end) - getUTF16index(run.UTF8start);
+                UTF16shift cChars = getUTF16length(run);
                 int piX;
                 int* advances = run.justify !is null ? run.justify : run.advances;
-                int wlength = index8to16[ run.start+run.length] - index8to16[run.start];
-                OS.ScriptCPtoX(index8to16[end] - index8to16[run.start], true, wlength, run.glyphCount, run.clusters, run.visAttrs, advances, &run.analysis, &piX);
+                OS.ScriptCPtoX(iCP, true, cChars, run.glyphCount, run.clusters, run.visAttrs, advances, &run.analysis, &piX);
                 cx = isRTL ? run.width - piX : piX;
             }
             if (run.analysis.fRTL ^ isRTL) {
@@ -1490,7 +1514,7 @@
             }
         }
         int lineIndex = 0;
-        while (lineIndex < runs.length && lineOffset[lineIndex + 1] <= run.start) {
+        while (lineIndex < runs.length && lineOffset[lineIndex + 1] <= run.UTF8start) {
             lineIndex++;
         }
         left = Math.min(left, runLead);
@@ -1592,14 +1616,15 @@
  * @exception SWTException <ul>
  *    <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
  */
-public int getLevel (int offset) {
+public int getLevel (int i_offset) {
     checkLayout();
     computeRuns(null);
+    UTF8index offset = text.takeIndexArg(i_offset, "offset@getLevel");
     int length = text.length;
-    if (!(0 <= offset && offset <= length)) SWT.error(SWT.ERROR_INVALID_RANGE);
+    if (!(0 <= offset.internalValue && offset.internalValue <= length)) SWT.error(SWT.ERROR_INVALID_RANGE);
     offset = translateOffset(offset);
     for (int i=1; i<allRuns.length; i++) {
-        if (allRuns[i].start > offset) {
+        if (allRuns[i].UTF8start > offset) {
             return allRuns[i - 1].analysis.s.uBidiLevel;
         }
     }
@@ -1691,11 +1716,12 @@
  *    <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
  * </ul>
  */
-public int getLineIndex (int offset) {
+public int getLineIndex (int i_offset) {
     checkLayout();
     computeRuns(null);
+    UTF8index offset = text.takeIndexArg(i_offset, "offset@getLineIndex");
     int length = text.length;
-    if (!(0 <= offset && offset <= length)) SWT.error(SWT.ERROR_INVALID_RANGE);
+    if (!(0 <= offset.internalValue && offset.internalValue <= length)) SWT.error(SWT.ERROR_INVALID_RANGE);
     offset = translateOffset(offset);
     for (int line=0; line<runs.length; line++) {
         if (lineOffset[line + 1] > offset) {
@@ -1789,12 +1815,13 @@
  * @see #getOffset(Point, int[])
  * @see #getOffset(int, int, int[])
  */
-public Point getLocation (int offset, bool trailing) {
+public Point getLocation (int i_offset, bool trailing) {
     checkLayout();
     computeRuns(null);
-    int length = text.length;
-    if (!(0 <= offset && offset <= length)) SWT.error(SWT.ERROR_INVALID_RANGE);
-    length = segmentsText.length;
+    UTF8index offset = text.takeIndexArg(i_offset, "offset@getLocation");
+    UTF8index length = text.endIndex();
+    if (!(0 <= offset.internalValue && offset <= length)) SWT.error(SWT.ERROR_INVALID_RANGE);
+    length = segmentsText.endIndex();
     offset = translateOffset(offset);
     int line;
     for (line=0; line<runs.length; line++) {
@@ -1809,20 +1836,20 @@
     while (high - low > 1) {
         int index = ((high + low) / 2);
         StyleItem run = allRuns[index];
-        if (run.start > offset) {
+        if (run.UTF8start > offset) {
             high = index;
-        } else if (run.start + run.length <= offset) {
+        } else if (run.UTF8start + run.UTF8length <= offset) {
             low = index;
         } else {
             int width;
             if (run.style !is null && run.style.metrics !is null) {
                 GlyphMetrics metrics = run.style.metrics;
-                width = metrics.width * (offset - run.start + (trailing ? 1 : 0));
+                width = metrics.width * (getUTF16index(offset) - getUTF16index(run.UTF8start) + trailing);
             } else if (run.tab) {
                 width = (trailing || (offset is length)) ? run.width : 0;
             } else {
-                int runOffset = index8to16[offset] - index8to16[run.start];
-                int cChars = index8to16[run.start+run.length] - index8to16[run.start]; // make it wchar
+                UTF16index runOffset = getUTF16index(offset) - getUTF16index(run.UTF8start);
+                UTF16shift cChars = getUTF16length(run); // make it wchar
                 int gGlyphs = run.glyphCount;
                 int piX;
                 int* advances = run.justify !is null ? run.justify : run.advances;
@@ -1854,20 +1881,21 @@
  *
  * @see #getPreviousOffset(int, int)
  */
-public int getNextOffset (int offset, int movement) {
+public int getNextOffset (int i_offset, int movement) {
     checkLayout();
-    return _getOffset (offset, movement, true);
+    return _getOffset (i_offset, movement, true);
 }
 
-int _getOffset(int offset, int movement, bool forward) {
+int _getOffset(int i_offset, int movement, bool forward) {
     computeRuns(null);
-    int length = text.length;
-    if (!(0 <= offset && offset <= length)) SWT.error(SWT.ERROR_INVALID_RANGE);
-    if (forward && offset is length) return length;
-    if (!forward && offset is 0) return 0;
+    UTF8index offset = text.takeIndexArg(i_offset, "offset@_getOffset");
+    UTF8index length = text.endIndex();
+    if (!(0 <= offset.internalValue && offset <= length)) SWT.error(SWT.ERROR_INVALID_RANGE);
+    if (forward && offset is length) return length.internalValue;
+    if (!forward && offset.internalValue is 0) return 0;
     int step = forward ? 1 : -1;
-    if ((movement & SWT.MOVEMENT_CHAR) !is 0) return offset + step;
-    length = segmentsText.length;
+    if ((movement & SWT.MOVEMENT_CHAR) !is 0) return (offset + text.toUTF8shift(offset, step)).internalValue;
+    length = segmentsText.endIndex();
     offset = translateOffset(offset);
     SCRIPT_LOGATTR* logAttr;
     SCRIPT_PROPERTIES* properties;
@@ -1875,15 +1903,15 @@
     offset = validadeOffset(offset, step);
     do {
         StyleItem run = allRuns[i];
-        if (run.start <= offset && offset < run.start + run.length) {
-            if (run.lineBreak && !run.softBreak) return untranslateOffset(run.start);
-            if (run.tab) return untranslateOffset(run.start);
+        if (run.UTF8start <= offset && offset < run.UTF8start + run.UTF8length) {
+            if (run.lineBreak && !run.softBreak) return untranslateOffset(run.UTF8start);
+            if (run.tab) return untranslateOffset(run.UTF8start);
             properties = device.scripts[run.analysis.eScript];
             bool isComplex = properties.fNeedsCaretInfo || properties.fNeedsWordBreaking;
             if (isComplex) breakRun(run);
-            while (run.start <= offset && offset < run.start + run.length) {
+            while (run.UTF8start <= offset && offset < run.UTF8start + run.UTF8length) {
                 if (isComplex) {
-                    logAttr = run.psla + (index8to16[offset] - index8to16[run.start]);
+                    logAttr = run.psla + (getUTF16index(offset) - getUTF16index(run.UTF8start));
                 }
                 switch (movement) {
                     case SWT.MOVEMENT_CLUSTER: {
@@ -1899,11 +1927,11 @@
                         if (properties.fNeedsWordBreaking) {
                             if (!logAttr.fInvalid && logAttr.fWordStop) return untranslateOffset(offset);
                         } else {
-                            if (offset > 0) {
-                                bool letterOrDigit = Compatibility.isLetterOrDigit(segmentsText.charAt(offset));
-                                bool previousLetterOrDigit = Compatibility.isLetterOrDigit(segmentsText.charAt(offset - 1));
+                            if (offset.internalValue > 0) {
+                                bool letterOrDigit = Compatibility.isLetterOrDigit(segmentsText.dcharAt(offset));
+                                bool previousLetterOrDigit = Compatibility.isLetterOrDigit(segmentsText.dcharBefore(offset));
                                 if (letterOrDigit !is previousLetterOrDigit || !letterOrDigit) {
-                                    if (!Compatibility.isWhitespace(segmentsText[offset..$].firstCodePoint())) {
+                                    if (!Compatibility.isWhitespace(segmentsText.dcharAt(offset))) {
                                         return untranslateOffset(offset);
                                     }
                                 }
@@ -1912,9 +1940,9 @@
                         break;
                     }
                     case SWT.MOVEMENT_WORD_END: {
-                        if (offset > 0) {
-                            bool isLetterOrDigit = Compatibility.isLetterOrDigit(segmentsText.charAt(offset));
-                            bool previousLetterOrDigit = Compatibility.isLetterOrDigit(segmentsText[offset - 1.. $].firstCodePoint());
+                        if (offset.internalValue > 0) {
+                            bool isLetterOrDigit = Compatibility.isLetterOrDigit(segmentsText.dcharAt(offset));
+                            bool previousLetterOrDigit = Compatibility.isLetterOrDigit(segmentsText.dcharBefore(offset));
                             if (!isLetterOrDigit && previousLetterOrDigit) {
                                 return untranslateOffset(offset);
                             }
@@ -1927,7 +1955,7 @@
             }
         }
         i += step;
-    } while (0 <= i && i < allRuns.length - 1 && 0 <= offset && offset < length);
+    } while (0 <= i && i < allRuns.length - 1 && 0 <= offset.internalValue && offset < length);
     return forward ? text.length : 0;
 }
 
@@ -2008,35 +2036,38 @@
         } else if (run.x + run.width <= x) {
             low = index;
         } else {
-            if (run.lineBreak && !run.softBreak) return untranslateOffset(run.start);
+            if (run.lineBreak && !run.softBreak) return untranslateOffset(run.UTF8start);
             int xRun = x - run.x;
             if (run.style !is null && run.style.metrics !is null) {
                 GlyphMetrics metrics = run.style.metrics;
                 if (metrics.width > 0) {
+                    UTF8index res = addUTF16shift(run.UTF8start, cast(UTF16shift)(xRun / metrics.width));
                     if (trailing !is null) {
-                        trailing[0] = (xRun % metrics.width < metrics.width / 2) ? 0 : 1;
+                        trailing[0] = (xRun % metrics.width < metrics.width / 2) ? 0 : segmentsText.UTF8strideAt(res).internalValue;
                     }
-                    return untranslateOffset(run.start + xRun / metrics.width);
+                    return untranslateOffset(res);
                 }
             }
             if (run.tab) {
-                if (trailing !is null) trailing[0] = x < (run.x + run.width / 2) ? 0 : 1;
-                return untranslateOffset(run.start);
+                UTF8index res = run.UTF8start;
+                if (trailing !is null) trailing[0] = x < (run.x + run.width / 2) ? 0 : segmentsText.UTF8strideAt(res).internalValue;
+                return untranslateOffset(res);
             }
-            int cChars = index8to16[run.start+run.length] - index8to16[run.start]; // make it wchar
+            UTF16shift cChars = getUTF16length(run); // make it wchar
             int cGlyphs = run.glyphCount;
-            int piCP;
-            int piTrailing;
+            UTF16shift piCP;
+            UTF16shift piTrailing;
             if ((orientation & SWT.RIGHT_TO_LEFT) !is 0) {
                 xRun = run.width - xRun;
             }
             int* advances = run.justify !is null ? run.justify : run.advances;
             OS.ScriptXtoCP(xRun, cChars, cGlyphs, run.clusters, run.visAttrs, advances, &run.analysis, &piCP, &piTrailing);
-            if (trailing !is null) trailing[0] = piTrailing;
-
-            // SWT: back from codepoints to utf8 index
-            int offsetIndex = segmentsText[ run.start .. $ ].codepointIndexToIndex( piCP );
-            return untranslateOffset(run.start + offsetIndex);
+            
+            // DWT: back from UTF-16 to UTF-8
+            UTF8index res = addUTF16shift(run.UTF8start, piCP);
+            if (trailing !is null)
+                trailing[0] = (addUTF16shift(res, piTrailing) - res).internalValue;
+            return untranslateOffset(res);
         }
     }
     if (trailing !is null) trailing[0] = 0;
@@ -2076,9 +2107,9 @@
  *
  * @see #getNextOffset(int, int)
  */
-public int getPreviousOffset (int offset, int movement) {
+public int getPreviousOffset (int i_offset, int movement) {
     checkLayout();
-    return _getOffset (offset, movement, false);
+    return _getOffset (i_offset, movement, false);
 }
 
 /**
@@ -2101,8 +2132,8 @@
     int count = 0;
     for (int i=0; i<stylesCount - 1; i++) {
         if (styles[i].style !is null) {
-            result[count++] = styles[i].start;
-            result[count++] = styles[i + 1].start - 1;
+            result[count++] = styles[i].UTF8start.internalValue;
+            result[count++] = getUTF8index(cast(UTF16index)(getUTF16index(styles[i + 1].UTF8start) - 1)).internalValue;
         }
     }
     if (count !is result.length) {
@@ -2124,28 +2155,30 @@
  */
 public int[] getSegments () {
     checkLayout();
-    return segments;
+    return cast(int[])segments;
 }
 
 void getSegmentsText( out String resUtf8, out String16 resUtf16 ) {
 
     void buildIndexTables() { // build the index translation tables.
+        index16to8.length = resUtf16.length + 1;
         index8to16.length = resUtf8.length + 1;
-        index16to8.length = resUtf16.length + 1;
+        index16to8[] = resUtf8.preFirstIndex();
+        index8to16[] = -1;
 
-        int idx8, idx16;
-        while( idx8 < resUtf8.length ){
-            int ate8, ate16;
-            dchar d8 = resUtf8[ idx8 .. $ ].firstCodePoint( ate8 );
-            dchar d16 = resUtf16[ idx16 .. $ ].firstCodePoint( ate16 );
-            assert( d8 is d16 );
-            index16to8[ idx16 .. idx16 +ate16 ] = idx8;
-            index8to16[ idx8  .. idx8  +ate8  ] = idx16;
-            idx8  += ate8;
-            idx16 += ate16;
+        UTF8index idx8;
+        UTF16index idx16;
+        for(;;) {
+            index16to8[ idx16 ] = idx8;
+            index8to16[ idx8.internalValue  ] = idx16;
+            if(idx8 == resUtf8.endIndex()) {
+                assert(idx16 == resUtf16.length);
+                break;
+            }
+            assert(resUtf8.dcharAt(idx8) == resUtf16.dcharAt(idx16));
+            idx8  += resUtf8.UTF8strideAt(idx8);
+            idx16 += resUtf16.UTF16strideAt(idx16);
         }
-        index16to8[ resUtf16.length ] = resUtf8.length;
-        index8to16[ resUtf8.length  ] = resUtf16.length;
     }
 
     if (segments is null) {
@@ -2170,7 +2203,7 @@
         return;
     }
     if (nSegments is 2) {
-        if (segments[0] is 0 && segments[1] is length_) {
+        if (segments[0].internalValue is 0 && segments[1].internalValue is length_) {
             resUtf8 = text;
             resUtf16 = wtext;
             buildIndexTables();
@@ -2179,29 +2212,28 @@
     }
     {
         auto oldChars = text;
-        // SWT: MARK is now 3 chars long
+        // DWT: MARK is now 3 chars long
         String separator = orientation is SWT.RIGHT_TO_LEFT ? STR_RTL_MARK : STR_LTR_MARK;
-        assert( separator.length is MARK_SIZE );
-        char[] newChars = new char[length_ + nSegments*MARK_SIZE];
+        char[] newChars = new char[length_ + nSegments*MARK_SIZE.internalValue];
 
         int charCount = 0, segmentCount = 0;
         while (charCount < length_) {
-            if (segmentCount < nSegments && charCount is segments[segmentCount]) {
-                int start = charCount + (segmentCount*MARK_SIZE);
-                newChars[ start .. start + MARK_SIZE ] = separator;
+            if (segmentCount < nSegments && charCount is segments[segmentCount].internalValue) {
+                int start = charCount + (segmentCount*MARK_SIZE.internalValue);
+                newChars[ start .. start + MARK_SIZE.internalValue ] = separator;
                 segmentCount++;
             } else {
-                newChars[charCount + (segmentCount*MARK_SIZE)] = oldChars[charCount];
+                newChars[charCount + (segmentCount*MARK_SIZE.internalValue)] = oldChars[charCount];
                 charCount++;
             }
         }
         if (segmentCount < nSegments) {
-            segments[segmentCount] = charCount;
-            int start = charCount + (segmentCount*MARK_SIZE);
-            newChars[ start .. start + MARK_SIZE ] = separator;
+            segments[segmentCount] = asUTF8index( charCount );
+            int start = charCount + (segmentCount*MARK_SIZE.internalValue);
+            newChars[ start .. start + MARK_SIZE.internalValue ] = separator;
             segmentCount++;
         }
-        resUtf8 = cast(String)newChars[ 0 .. Math.min(charCount + (segmentCount*MARK_SIZE), newChars.length)];
+        resUtf8 = cast(String)newChars[ 0 .. Math.min(charCount + (segmentCount*MARK_SIZE.internalValue), newChars.length)];
     }
     // now for the wide chars
     {
@@ -2222,7 +2254,7 @@
             }
         }
         if (segmentCount < nSegments) {
-            wsegments[segmentCount] = charCount;
+            wsegments[segmentCount] = cast(UTF16index) charCount;
             int start = charCount + (segmentCount*WMARK_SIZE);
             newWChars[ start .. start + WMARK_SIZE ] = wseparator;
             segmentCount++;
@@ -2259,12 +2291,13 @@
  *    <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
  * </ul>
  */
-public TextStyle getStyle (int offset) {
+public TextStyle getStyle (int i_offset) {
     checkLayout();
+    UTF8index offset = text.takeIndexArg(i_offset, "offset@getStyle");
     int length = text.length;
-    if (!(0 <= offset && offset < length)) SWT.error(SWT.ERROR_INVALID_RANGE);
+    if (!(0 <= offset.internalValue && offset.internalValue < length)) SWT.error(SWT.ERROR_INVALID_RANGE);
     for (int i=1; i<stylesCount; i++) {
-        if (styles[i].start > offset) {
+        if (styles[i].UTF8start > offset) {
             return styles[i - 1].style;
         }
     }
@@ -2363,7 +2396,7 @@
  *  Itemize the receiver text
  */
 StyleItem[] itemize () {
-    // SWT: itemize is the process of finding changes in direction
+    // DWT: itemize is the process of finding changes in direction
     getSegmentsText(segmentsText, segmentsWText );
     int length = segmentsText.length;
     SCRIPT_CONTROL scriptControl;
@@ -2379,11 +2412,11 @@
     }
 
     auto hHeap = OS.GetProcessHeap();
-    auto pItems = cast(SCRIPT_ITEM*)OS.HeapAlloc(hHeap, OS.HEAP_ZERO_MEMORY, MAX_ITEM * SCRIPT_ITEM.sizeof);
+    auto pItems = cast(SCRIPT_ITEM*)OS.HeapAlloc(hHeap, OS.HEAP_ZERO_MEMORY, MAX_ITEM * SCRIPT_ITEM.sizeof + 1);
     if (pItems is null) SWT.error(SWT.ERROR_NO_HANDLES);
     int pcItems;
-    String16 chars = segmentsWText;
-    OS.ScriptItemize(chars.ptr, chars.length, MAX_ITEM, &scriptControl, &scriptState, pItems, &pcItems);
+    String16 wchars = segmentsWText;
+    OS.ScriptItemize(wchars.ptr, wchars.length, MAX_ITEM, &scriptControl, &scriptState, pItems, &pcItems);
 //  if (hr is E_OUTOFMEMORY) //TODO handle it
     // SWT pcItems is not inclusive the trailing item
 
@@ -2401,13 +2434,14 @@
         System.arraycopy(styles, 0, newStyles, 0, stylesCount);
         styles = newStyles;
     }
-    int count = 0, start = 0, end = segmentsText.length, itemIndex = 0, styleIndex = 0;
+    int count = 0, itemIndex = 0, styleIndex = 0;
+    UTF8index start = segmentsText.firstIndex(), end = segmentsText.endIndex();
     StyleItem[] runs = new StyleItem[itemCount + stylesCount];
     SCRIPT_ITEM* scriptItem;
     bool linkBefore = false;
     while (start < end) {
         StyleItem item = new StyleItem();
-        item.start = start;
+        item.UTF8start = start;
         item.style = styles[styleIndex].style;
         runs[count++] = item;
         scriptItem = items + itemIndex;
@@ -2418,14 +2452,14 @@
         }
         //scriptItem.a = new SCRIPT_ANALYSIS();
         scriptItem = items + (itemIndex + 1);
-        int itemLimit = index16to8[scriptItem.iCharPos];
-        int styleLimit = translateOffset(styles[styleIndex + 1].start);
+        UTF8index itemLimit = getUTF8index(scriptItem.iCharPos);
+        UTF8index styleLimit = translateOffset(styles[styleIndex + 1].UTF8start);
         if (styleLimit <= itemLimit) {
             styleIndex++;
             start = styleLimit;
-            if (start < itemLimit && 0 < start && start < end) {
-                dchar pChar = segmentsText[ segmentsText.getAbsoluteCodePointOffset(start, -1) ..$].firstCodePoint();
-                dchar tChar = segmentsText[start     ..$].firstCodePoint();
+            if (start < itemLimit && 0 < start.internalValue && start < end) {
+                dchar pChar = segmentsText.dcharBefore(start);
+                dchar tChar = segmentsText.dcharAt(start);
                 if (Compatibility.isLetter(pChar) && Compatibility.isLetter(tChar)) {
                     item.analysis.fLinkAfter = true;
                     linkBefore = true;
@@ -2436,10 +2470,10 @@
             itemIndex++;
             start = itemLimit;
         }
-        item.length = start - item.start;
+        item.UTF8length = start - item.UTF8start;
     }
     StyleItem item = new StyleItem();
-    item.start = end;
+    item.UTF8start = end;
     scriptItem = items + itemCount;
     item.analysis = scriptItem.a;
     runs[count++] = item;
@@ -2674,41 +2708,35 @@
  *    <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
  * </ul>
  */
-public void setSegments(int[] segments) {
+public void setSegments(int[] i_segments) {
     checkLayout();
-    if (this.segments is null && segments is null) return;
-    if (this.segments !is null && segments !is null) {
-        if (this.segments.length is segments.length) {
+    if (this.segments is null && i_segments is null) return;
+    if (this.segments !is null && i_segments !is null)
+        if (this.segments.length is i_segments.length) {
             int i;
-            for (i = 0; i <segments.length; i++) {
-                if (this.segments[i] !is segments[i]) break;
+            for (i = 0; i <i_segments.length; i++) {
+                if (this.segments[i] !is text.takeIndexArg(i_segments[i], "segments@setSegments")) break;
             }
-            if (i is segments.length) return;
+            if (i is i_segments.length) return;
         }
-    }
     freeRuns();
-    this.segments  = segments.dup;
+    this.segments.length = i_segments.length;
+    foreach(i, ref s; this.segments)
+        s = text.takeIndexArg(i_segments[i], "segments@setSegments");
 
-    // SWT: create the wsegments ...
-    this.wsegments.length = segments.length;
-    uint index8, index16;
-    uint segIndex = 1;
-    while(index8 < text.length ){
-        int ate8;
-        int ate16;
-        dchar d8 = text[ index8 .. $ ].firstCodePoint( ate8 );
-        dchar d16 = wtext[ index16 .. $ ].firstCodePoint( ate16 );
-        assert( d8 is d16 );
-        assert( ate8 > 0 );
-        assert( ate16 > 0 );
-        index8 += ate8;
-        index16 += ate16;
-        if( segments[segIndex] is index8 ){
-            wsegments[segIndex] = index16;
+    // DWT: create the wsegments ...
+    this.wsegments.length = this.segments.length;
+    UTF8index idx8;
+    UTF16index idx16;
+    foreach(i, ref wsegment; this.wsegments) {
+        while( this.segments[i] != idx8 ) {
+            assert(text.dcharAt(idx8) == wtext.dcharAt(idx16));
+            idx8  += text.UTF8strideAt(idx8);
+            idx16 += wtext.UTF16strideAt(idx16);
+            assert(idx8 <= this.segments[i]);
         }
+        wsegment = idx16;
     }
-    assert( index16 is wtext.length );
-    assert( segIndex is segments.length );
 }
 
 /**
@@ -2745,18 +2773,21 @@
  *    <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
  * </ul>
  */
-public void setStyle (TextStyle style, int start, int end) {
+public void setStyle (TextStyle style, int i_start, int i_end) {
     checkLayout();
+    UTF8index start = text.takeIndexArg(i_start, "start@setStyle");
+    UTF8index end = text.takeIndexArg(i_end, "end@setStyle");
     int length = text.length;
     if (length is 0) return;
+    UTF8index endOffset = text.beforeEndIndex();
     if (start > end) return;
-    start = Math.min(Math.max(0, start), length - 1);
-    end = Math.min(Math.max(0, end), length - 1);
+    start = Math.min(Math.max(text.firstIndex(), start), endOffset);
+    end = Math.min(Math.max(text.firstIndex(), end), endOffset);
     int low = -1;
     int high = stylesCount;
     while (high - low > 1) {
         int index = (high + low) / 2;
-        if (styles[index + 1].start > start) {
+        if (styles[index + 1].UTF8start > start) {
             high = index;
         } else {
             low = index;
@@ -2764,7 +2795,7 @@
     }
     if (0 <= high && high < stylesCount) {
         StyleItem item = styles[high];
-        if (item.start is start && styles[high + 1].start - 1 is end) {
+        if (item.UTF8start is start && text.offsetBefore(styles[high + 1].UTF8start) is end) {
             if (style is null) {
                 if (item.style is null) return;
             } else {
@@ -2776,12 +2807,12 @@
     int modifyStart = high;
     int modifyEnd = modifyStart;
     while (modifyEnd < stylesCount) {
-        if (styles[modifyEnd + 1].start > end) break;
+        if (styles[modifyEnd + 1].UTF8start > end) break;
         modifyEnd++;
     }
     if (modifyStart is modifyEnd) {
-        int styleStart = styles[modifyStart].start;
-        int styleEnd = styles[modifyEnd + 1].start - 1;
+        UTF8index styleStart = styles[modifyStart].UTF8start;
+        UTF8index styleEnd = text.offsetBefore(styles[modifyEnd + 1].UTF8start);
         if (styleStart is start && styleEnd is end) {
             styles[modifyStart].style = style;
             return;
@@ -2796,19 +2827,19 @@
             }
             System.arraycopy(styles, modifyEnd + 1, styles, modifyEnd + 3, stylesCount - modifyEnd - 1);
             StyleItem item = new StyleItem();
-            item.start = start;
+            item.UTF8start = start;
             item.style = style;
             styles[modifyStart + 1] = item;
             item = new StyleItem();
-            item.start = end + 1;
+            item.UTF8start = text.offsetAfter(end);
             item.style = styles[modifyStart].style;
             styles[modifyStart + 2] = item;
             stylesCount = newLength;
             return;
         }
     }
-    if (start is styles[modifyStart].start) modifyStart--;
-    if (end is styles[modifyEnd + 1].start - 1) modifyEnd++;
+    if (start is styles[modifyStart].UTF8start) modifyStart--;
+    if (end is text.offsetBefore(styles[modifyEnd + 1].UTF8start)) modifyEnd++;
     int newLength = stylesCount + 1 - (modifyEnd - modifyStart - 1);
     if (newLength > styles.length) {
         int newSize = Math.min(newLength + 1024, Math.max(64, newLength * 2));
@@ -2818,10 +2849,10 @@
     }
     System.arraycopy(styles, modifyEnd, styles, modifyStart + 2, stylesCount - modifyEnd);
     StyleItem item = new StyleItem();
-    item.start = start;
+    item.UTF8start = start;
     item.style = style;
     styles[modifyStart + 1] = item;
-    styles[modifyStart + 2].start = end + 1;
+    styles[modifyStart + 2].UTF8start = text.offsetAfter(end);
     stylesCount = newLength;
 }
 
@@ -2876,7 +2907,7 @@
     styles = new StyleItem[2];
     styles[0] = new StyleItem();
     styles[1] = new StyleItem();
-    styles[1].start = text.length;
+    styles[1].UTF8start = text.endIndex();
     stylesCount = 2;
 }
 
@@ -2949,7 +2980,7 @@
  */
 void shape (HDC hdc, StyleItem run) {
     int[1] buffer;
-    auto wchars = segmentsWText[ index8to16[ run.start ] .. index8to16[ run.start + run.length ] ];
+    auto wchars = segmentsWText[ getUTF16index(run.UTF8start) .. getUTF16index(run.UTF8start + run.UTF8length) ];
     int maxGlyphs = (wchars.length * 3 / 2) + 16;
     auto hHeap = OS.GetProcessHeap();
     run.glyphs = cast(ushort*)OS.HeapAlloc(hHeap, OS.HEAP_ZERO_MEMORY, maxGlyphs * 2);
@@ -2963,7 +2994,7 @@
     short script = cast(short) run.analysis.eScript;
     SCRIPT_PROPERTIES sp = *device.scripts[script];
     bool shapeSucceed = shape(hdc, run, wchars, buffer,  maxGlyphs, &sp);
-int res;
+    int res;
     if (!shapeSucceed) {
         auto hFont = OS.GetCurrentObject(hdc, OS.OBJ_FONT);
         auto ssa = cast(SCRIPT_STRING_ANALYSIS*) OS.HeapAlloc(hHeap, OS.HEAP_ZERO_MEMORY, SCRIPT_STRING_ANALYSIS.sizeof);
@@ -3110,18 +3141,34 @@
     }
 }
 
-int validadeOffset(int offset, int step) {
-    offset = segmentsText.toAbsoluteCodePointStartOffset( offset );
-    offset += segmentsText.getRelativeCodePointOffset( offset, step );
-    if (segments !is null && segments.length > 2) {
-        for (int i = 0; i < segments.length; i++) {
-            if (translateOffset(segments[i]) - 1 is offset) {
-                offset += step;
-                break;
-            }
-        }
-    }
-    return offset;
+UTF8index getUTF8index(UTF16index i) 
+out(res) {
+    assert(res != segmentsText.preFirstIndex());
+}
+body {
+    return index16to8[i];
+}
+
+UTF16index getUTF16index(UTF8index i) 
+out(res) {
+    assert(res != -1);
+}
+body {
+    return index8to16[i.internalValue];
+}
+
+UTF8index addUTF16shift(UTF8index i, UTF16shift dw) {
+    return getUTF8index(cast(UTF16index)(getUTF16index(i) + dw));
+}
+
+UTF16shift getUTF16length(StyleItem run) {
+    return cast(UTF16shift)(getUTF16index(run.UTF8start + run.UTF8length) - getUTF16index(run.UTF8start));
+}
+
+UTF8index validadeOffset(UTF8index offset, UCSindex step) {
+    offset = asUTF8index( untranslateOffset(offset) );
+	offset += text.toUTF8shift(offset, step);
+    return translateOffset(offset);
 }
 
 /**
@@ -3135,33 +3182,33 @@
     return "TextLayout {}";
 }
 
-int translateOffset(int offset) {
+UTF8index translateOffset(UTF8index offset) {
     if (segments is null) return offset;
     int nSegments = segments.length;
     if (nSegments <= 1) return offset;
     int length = text.length;
     if (length is 0) return offset;
     if (nSegments is 2) {
-        if (segments[0] is 0 && segments[1] is length) return offset;
+        if (segments[0].internalValue is 0 && segments[1].internalValue is length) return offset;
     }
-    for (int i = 0; i < nSegments && offset - i >= segments[i]; i++) {
+    for (int i = 0; i < nSegments && offset.internalValue - i >= segments[i].internalValue; i++) {
         offset+=MARK_SIZE;
     }
     return offset;
 }
 
-int untranslateOffset(int offset) {
-    if (segments is null) return offset;
+int untranslateOffset(UTF8index offset) {
+    if (segments is null) return offset.internalValue;
     int nSegments = segments.length;
-    if (nSegments <= 1) return offset;
+    if (nSegments <= 1) return offset.internalValue;
     int length = text.length;
-    if (length is 0) return offset;
+    if (length is 0) return offset.internalValue;
     if (nSegments is 2) {
-        if (segments[0] is 0 && segments[1] is length) return offset;
+        if (segments[0].internalValue is 0 && segments[1].internalValue is length) return offset.internalValue;
     }
     for (int i = 0; i < nSegments && offset > segments[i]; i++) {
         offset-=MARK_SIZE;
     }
-    return offset;
+    return offset.internalValue;
 }
 }
--- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/graphics/TextStyle.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/graphics/TextStyle.d	Sat Jul 09 15:50:20 2011 +0300
@@ -225,14 +225,14 @@
     if (strikeout !is style.strikeout) return false;
     if (rise !is style.rise) return false;
     if (underlineColor !is null) {
-        if (!underlineColor.equals(style.underlineColor)) return false;
+        if (underlineColor != (style.underlineColor)) return false;
     } else if (style.underlineColor !is null) return false;
     if (strikeoutColor !is null) {
-        if (!strikeoutColor.equals(style.strikeoutColor)) return false;
+        if (strikeoutColor != (style.strikeoutColor)) return false;
     } else if (style.strikeoutColor !is null) return false;
     if (underlineStyle !is style.underlineStyle) return false;
     if (borderColor !is null) {
-        if (!borderColor.equals(style.borderColor)) return false;
+        if (borderColor != (style.borderColor)) return false;
     } else if (style.borderColor !is null) return false;
     return true;
 }
@@ -268,7 +268,7 @@
     if (style is null) return false;
     if (borderStyle !is style.borderStyle) return false;
     if (borderColor !is null) {
-        if (!borderColor.equals(style.borderColor)) return false;
+        if (borderColor != (style.borderColor)) return false;
     } else if (style.borderColor !is null) return false;
     return true;
 }
@@ -279,7 +279,7 @@
     if (underline !is style.underline) return false;
     if (underlineStyle !is style.underlineStyle) return false;
     if (underlineColor !is null) {
-        if (!underlineColor.equals(style.underlineColor)) return false;
+        if (underlineColor != (style.underlineColor)) return false;
     } else if (style.underlineColor !is null) return false;
     return true;
 }
@@ -289,7 +289,7 @@
     if (style is null) return false;
     if (strikeout !is style.strikeout) return false;
     if (strikeoutColor !is null) {
-        if (!strikeoutColor.equals(style.strikeoutColor)) return false;
+        if (strikeoutColor != (style.strikeoutColor)) return false;
     } else if (style.strikeoutColor !is null) return false;
     return true;
 }
--- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/Compatibility.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/Compatibility.d	Sat Jul 09 15:50:20 2011 +0300
@@ -31,7 +31,6 @@
 version(Tango){
 static import tango.text.Unicode;
 static import tango.sys.Process;
-static import tango.io.Path;
 } else { // Phobos
 }
 
@@ -121,15 +120,8 @@
  * @return true if the file exists
  */
 public static bool fileExists(String parent, String child) {
-    version(Tango){
-        return tango.io.Path.exists(
-                tango.io.Path.join(
-                    tango.io.Path.standard(parent),
-                    tango.io.Path.standard(child)));
-    } else { // Phobos
-        implMissing( __FILE__, __LINE__ );
-        return false;
-    }
+    scope f = new File(parent, child);
+    return f.exists();
 }
 
 /**
@@ -289,7 +281,7 @@
         auto proc = new tango.sys.Process.Process( prog );
         proc.execute;
     } else { // Phobos
-        implMissing( __FILE__, __LINE__ );
+        implMissingInPhobos();
     }
 }
 
@@ -310,7 +302,7 @@
         auto proc = new tango.sys.Process.Process( progArray );
         proc.execute;
     } else { // Phobos
-        implMissing( __FILE__, __LINE__ );
+        implMissingInPhobos();
     }
 }
 
@@ -426,20 +418,7 @@
  * @return true if the two instances of class String are equal
  */
 public static bool equalsIgnoreCase(String s1, String s2) {
-    version(Tango){
-        String s1b = new char[ s1.length ];
-        String s2b = new char[ s1.length ];
-        scope(exit){
-            delete s1b;
-            delete s2b;
-        }
-        String s1c = tango.text.Unicode.toFold( s1, s1b );
-        String s2c = tango.text.Unicode.toFold( s2, s2b );
-        return s1c == s2c;
-    } else { // Phobos
-        implMissing( __FILE__, __LINE__ );
-        return false;
-    }
+    return .equalsIgnoreCase(s1, s2);
 }
 
 }
--- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/Library.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/Library.d	Sat Jul 09 15:50:20 2011 +0300
@@ -117,7 +117,7 @@
                 }
                 os.close ();
                 is.close ();
-                if (!Platform.PLATFORM.equals ("win32")) { //$NON-NLS-1$
+                if (Platform.PLATFORM != ("win32")) { //$NON-NLS-1$
                     try {
                         Runtime.getRuntime ().exec (new String []{"chmod", "755", fileName}).waitFor(); //$NON-NLS-1$ //$NON-NLS-2$
                     } catch (Throwable e) {}
--- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/gdip/Gdip.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/gdip/Gdip.d	Sat Jul 09 15:50:20 2011 +0300
@@ -1004,7 +1004,7 @@
 
     **************************************************************************/
 
-    static Status Pen_SetDashPattern( Pen pen, float* dashArray, int count )
+    static Status Pen_SetDashPattern( Pen pen, in float* dashArray, int count )
     {
         return SetStatus(GdipSetPenDashArray(pen, dashArray, count));
     }
--- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/gdip/native.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/gdip/native.d	Sat Jul 09 15:50:20 2011 +0300
@@ -5,7 +5,7 @@
   Based on D version created by John Chapman for the Juno Project
     see: www.dsource.org/projects/juno
 
-  Changes and Additions for SWT:
+  Changes and Additions for DWT:
     John Reimer <terminal.node@gmail.com>
 
 ******************************************************************************/
@@ -29,8 +29,8 @@
 
 alias void  function(DebugEventLevel level, char* message) DebugEventProc;
 
-alias int   function(out uint token)    NotificationHookProc;
-alias void  function(uint token)        NotificationUnhookProc;
+alias int   function(out uint token) NotificationHookProc;
+alias void  function(in  uint token) NotificationUnhookProc;
 
 
 /******************************************************************************
@@ -210,8 +210,8 @@
 extern (Windows):
 
 version( STATIC_GDIPLUS ){
-Status GdiplusStartup( uint* token, GdiplusStartupInput* input, GdiplusStartupOutput* output);
-void   GdiplusShutdown(uint token);
+Status GdiplusStartup(uint* token, GdiplusStartupInput* input, GdiplusStartupOutput* output);
+void   GdiplusShutdown(in uint token);
 Status GdipCreateFromHDC(Handle hdc, out Handle graphics);
 Status GdipCreateFromHDC2(Handle hdc, Handle hDevice, out Handle graphics);
 Status GdipCreateFromHWND(Handle hwnd, out Handle graphics);
@@ -219,118 +219,118 @@
 Status GdipDeleteGraphics(Handle graphics);
 Status GdipGetDC(Handle graphics, out Handle hdc);
 Status GdipReleaseDC(Handle graphics, Handle hdc);
-Status GdipSetClipGraphics(Handle graphics, Handle srcgraphics, CombineMode combineMode);
-Status GdipSetClipRectI(Handle graphics, int x, int y, int width, int height, CombineMode combineMode);
-Status GdipSetClipRect(Handle graphics, float x, float y, float width, float height, CombineMode combineMode);
-Status GdipSetClipPath(Handle graphics, Handle path, CombineMode combineMode);
-Status GdipSetClipRegion(Handle graphics, Handle region, CombineMode combineMode);
-Status GdipSetClipHrgn(Handle graphics, HRGN hRgn, CombineMode combineMode);
+Status GdipSetClipGraphics(Handle graphics, in Handle srcgraphics, in CombineMode combineMode);
+Status GdipSetClipRectI(Handle graphics, in int x, in int y, in int width, in int height, in CombineMode combineMode);
+Status GdipSetClipRect(Handle graphics, in float x, in float y, in float width, in float height, in CombineMode combineMode);
+Status GdipSetClipPath(Handle graphics, in Handle path, in CombineMode combineMode);
+Status GdipSetClipRegion(Handle graphics, in Handle region, in CombineMode combineMode);
+Status GdipSetClipHrgn(Handle graphics, in HRGN hRgn, in CombineMode combineMode);
 
 Status GdipGetClip(Handle graphics, out Handle region);
 Status GdipResetClip(Handle graphics);
 Status GdipSaveGraphics(Handle graphics, out uint state);
-Status GdipRestoreGraphics(Handle graphics, int state);
-Status GdipFlush(Handle graphics, FlushIntention intention);
-Status GdipScaleWorldTransform(Handle graphics, float sx, float sy, MatrixOrder order);
-Status GdipRotateWorldTransform(Handle graphics, float angle, MatrixOrder order);
-Status GdipTranslateWorldTransform(Handle graphics, float dx, float dy, MatrixOrder order);
-Status GdipMultiplyWorldTransform(Handle graphics, Handle matrix, MatrixOrder order);
+Status GdipRestoreGraphics(Handle graphics, in int state);
+Status GdipFlush(Handle graphics, in FlushIntention intention);
+Status GdipScaleWorldTransform(Handle graphics, in float sx, in float sy, in MatrixOrder order);
+Status GdipRotateWorldTransform(Handle graphics, in float angle, in MatrixOrder order);
+Status GdipTranslateWorldTransform(Handle graphics, in float dx, in float dy, in MatrixOrder order);
+Status GdipMultiplyWorldTransform(Handle graphics, Handle matrix, in MatrixOrder order);
 Status GdipResetWorldTransform(Handle graphics);
-Status GdipBeginContainer(Handle graphics, ref GpRectF dstrect, ref GpRectF srcrect, GraphicsUnit unit, out int state);
-Status GdipBeginContainerI(Handle graphics, ref GpRect dstrect, ref GpRect srcrect, GraphicsUnit unit, out int state);
+Status GdipBeginContainer(Handle graphics, ref GpRectF dstrect, ref GpRectF srcrect, in GraphicsUnit unit, out int state);
+Status GdipBeginContainerI(Handle graphics, ref GpRect dstrect, ref GpRect srcrect, in GraphicsUnit unit, out int state);
 Status GdipBeginContainer2(Handle graphics, out int state);
-Status GdipEndContainer(Handle graphics, int state);
+Status GdipEndContainer(Handle graphics, in int state);
 Status GdipGetDpiX(Handle graphics, out float dpi);
 Status GdipGetDpiY(Handle graphics, out float dpi);
 Status GdipGetPageUnit(Handle graphics, out GraphicsUnit unit);
-Status GdipSetPageUnit(Handle graphics, GraphicsUnit unit);
+Status GdipSetPageUnit(Handle graphics, in GraphicsUnit unit);
 Status GdipGetPageScale(Handle graphics, out float scale);
-Status GdipSetPageScale(Handle graphics, float scale);
+Status GdipSetPageScale(Handle graphics, in float scale);
 Status GdipGetWorldTransform(Handle graphics, Handle matrix); // out not necessary?
-Status GdipSetWorldTransform(Handle graphics, Handle matrix);
+Status GdipSetWorldTransform(Handle graphics, in Handle matrix);
 Status GdipGetCompositingMode(Handle graphics, out CompositingMode compositingMode);
-Status GdipSetCompositingMode(Handle graphics, CompositingMode compositingMode);
+Status GdipSetCompositingMode(Handle graphics, in CompositingMode compositingMode);
 Status GdipGetCompositingQuality(Handle graphics, out CompositingQuality compositingQuality);
-Status GdipSetCompositingQuality(Handle graphics, CompositingQuality compositingQuality);
+Status GdipSetCompositingQuality(Handle graphics, in CompositingQuality compositingQuality);
 Status GdipGetInterpolationMode(Handle graphics, out InterpolationMode interpolationMode);
-Status GdipSetInterpolationMode(Handle graphics, InterpolationMode interpolationMode);
+Status GdipSetInterpolationMode(Handle graphics, in InterpolationMode interpolationMode);
 Status GdipGetSmoothingMode(Handle graphics, out SmoothingMode smoothingMode);
-Status GdipSetSmoothingMode(Handle graphics, SmoothingMode smoothingMode);
+Status GdipSetSmoothingMode(Handle graphics, in SmoothingMode smoothingMode);
 Status GdipGetPixelOffsetMode(Handle graphics, out PixelOffsetMode pixelOffsetMode);
-Status GdipSetPixelOffsetMode(Handle graphics, PixelOffsetMode pixelOffsetMode);
+Status GdipSetPixelOffsetMode(Handle graphics, in PixelOffsetMode pixelOffsetMode);
 Status GdipGetTextContrast(Handle graphics, out uint textContrast);
-Status GdipSetTextContrast(Handle graphics, uint textContrast);
-Status GdipGraphicsClear(Handle graphics, int color);
-Status GdipDrawLine(Handle graphics, Handle pen, float x1, float y1, float x2, float y2);
-Status GdipDrawLines(Handle graphics, Handle pen, GpPointF* points, int count);
-Status GdipDrawLineI(Handle graphics, Handle pen, int x1, int y1, int x2, int y2);
-Status GdipDrawLinesI(Handle graphics, Handle pen, GpPoint* points, int count);
-Status GdipDrawArc(Handle graphics, Handle pen, float x, float y, float width, float height, float startAngle, float sweepAngle);
-Status GdipDrawArcI(Handle graphics, Handle pen, int x, int y, int width, int height, float startAngle, float sweepAngle);
-Status GdipDrawBezier(Handle graphics, Handle pen, float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4);
-Status GdipDrawBeziers(Handle graphics, Handle pen, GpPointF* points, int count);
-Status GdipDrawBezierI(Handle graphics, Handle pen, int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4);
-Status GdipDrawBeziersI(Handle graphics, Handle pen, GpPoint* points, int count);
-Status GdipDrawRectangle(Handle graphics, Handle pen, float x, float y, float width, float height);
-Status GdipDrawRectangles(Handle graphics, Handle pen, GpRectF* rects, int count);
-Status GdipDrawRectangleI(Handle graphics, Handle pen, int x, int y, int width, int height);
-Status GdipDrawRectanglesI(Handle graphics, Handle pen, GpRect* rects, int count);
-Status GdipDrawEllipse(Handle graphics, Handle pen, float x, float y, float width, float height);
-Status GdipDrawEllipseI(Handle graphics, Handle pen, int x, int y, int width, int height);
-Status GdipDrawPie(Handle graphics, Handle pen, float x, float y, float width, float height, float startAngle, float sweepAngle);
-Status GdipDrawPieI(Handle graphics, Handle pen, int x, int y, int width, int height, float startAngle, float sweepAngle);
-Status GdipDrawPolygon(Handle graphics, Handle pen, GpPointF* points, int count);
-Status GdipDrawPolygonI(Handle graphics, Handle pen, GpPoint* points, int count);
-Status GdipDrawCurve(Handle graphics, Handle pen, GpPointF* points, int count);
-Status GdipDrawCurve2(Handle graphics, Handle pen, GpPointF* points, int count, float tension);
-Status GdipDrawCurve3(Handle graphics, Handle pen, GpPointF* points, int count, int offset, int numberOfSegments, float tension);
-Status GdipDrawCurveI(Handle graphics, Handle pen, GpPoint* points, int count);
-Status GdipDrawCurve2I(Handle graphics, Handle pen, GpPoint* points, int count, float tension);
-Status GdipDrawCurve3I(Handle graphics, Handle pen, GpPoint* points, int count, int offset, int numberOfSegments, float tension);
-Status GdipDrawClosedCurve(Handle graphics, Handle pen, GpPointF* points, int count);
-Status GdipDrawClosedCurve2(Handle graphics, Handle pen, GpPointF* points, int count, float tension);
-Status GdipDrawClosedCurveI(Handle graphics, Handle pen, GpPoint* points, int count);
-Status GdipDrawClosedCurve2I(Handle graphics, Handle pen, GpPoint* points, int count, float tension);
-Status GdipFillRectangleI(Handle graphics, Handle brush, int x, int y, int width, int height);
-Status GdipFillRectangle(Handle graphics, Handle brush, float x, float y, float width, float height);
-Status GdipFillRectanglesI(Handle graphics, Handle brush, GpRect* rects, int count);
-Status GdipFillRectangles(Handle graphics, Handle brush, GpRectF* rects, int count);
-Status GdipFillPolygon(Handle graphics, Handle brush, GpPointF* rects, int count, FillMode fillMode);
-Status GdipFillPolygonI(Handle graphics, Handle brush, GpPoint* rects, int count, FillMode fillMode);
-Status GdipFillEllipse(Handle graphics, Handle brush, float x, float y, float width, float height);
-Status GdipFillEllipseI(Handle graphics, Handle brush, int x, int y, int width, int height);
-Status GdipFillPie(Handle graphics, Handle brush, float x, float y, float width, float height, float startAngle, float sweepAngle);
-Status GdipFillPieI(Handle graphics, Handle brush, int x, int y, int width, int height, float startAngle, float sweepAngle);
+Status GdipSetTextContrast(Handle graphics, in uint textContrast);
+Status GdipGraphicsClear(Handle graphics, in int color);
+Status GdipDrawLine(Handle graphics, Handle pen, in float x1, in float y1, in float x2, in float y2);
+Status GdipDrawLines(Handle graphics, Handle pen, GpPointF* points, in int count);
+Status GdipDrawLineI(Handle graphics, Handle pen, in int x1, in int y1, in int x2, in int y2);
+Status GdipDrawLinesI(Handle graphics, Handle pen, GpPoint* points, in int count);
+Status GdipDrawArc(Handle graphics, Handle pen, in float x, in float y, in float width, in float height, in float startAngle, in float sweepAngle);
+Status GdipDrawArcI(Handle graphics, Handle pen, in int x, in int y, in int width, in int height, in float startAngle, in float sweepAngle);
+Status GdipDrawBezier(Handle graphics, Handle pen, in float x1, in float y1, in float x2, in float y2, in float x3, in float y3, in float x4, in float y4);
+Status GdipDrawBeziers(Handle graphics, Handle pen, GpPointF* points, in int count);
+Status GdipDrawBezierI(Handle graphics, Handle pen, in int x1, in int y1, in int x2, in int y2, in int x3, in int y3, in int x4, in int y4);
+Status GdipDrawBeziersI(Handle graphics, Handle pen, GpPoint* points, in int count);
+Status GdipDrawRectangle(Handle graphics, Handle pen, in float x, in float y, in float width, in float height);
+Status GdipDrawRectangles(Handle graphics, Handle pen, GpRectF* rects, in int count);
+Status GdipDrawRectangleI(Handle graphics, Handle pen, in int x, in int y, in int width, in int height);
+Status GdipDrawRectanglesI(Handle graphics, Handle pen, GpRect* rects, in int count);
+Status GdipDrawEllipse(Handle graphics, Handle pen, in float x, in float y, in float width, in float height);
+Status GdipDrawEllipseI(Handle graphics, Handle pen, in int x, in int y, in int width, in int height);
+Status GdipDrawPie(Handle graphics, Handle pen, in float x, in float y, in float width, in float height, in float startAngle, in float sweepAngle);
+Status GdipDrawPieI(Handle graphics, Handle pen, in int x, in int y, in int width, in int height, in float startAngle, in float sweepAngle);
+Status GdipDrawPolygon(Handle graphics, Handle pen, GpPointF* points, in int count);
+Status GdipDrawPolygonI(Handle graphics, Handle pen, GpPoint* points, in int count);
+Status GdipDrawCurve(Handle graphics, Handle pen, GpPointF* points, in int count);
+Status GdipDrawCurve2(Handle graphics, Handle pen, GpPointF* points, in int count, in float tension);
+Status GdipDrawCurve3(Handle graphics, Handle pen, GpPointF* points, in int count, in int offset, in int numberOfSegments, in float tension);
+Status GdipDrawCurveI(Handle graphics, Handle pen, GpPoint* points, in int count);
+Status GdipDrawCurve2I(Handle graphics, Handle pen, GpPoint* points, in int count, in float tension);
+Status GdipDrawCurve3I(Handle graphics, Handle pen, GpPoint* points, in int count, in int offset, in int numberOfSegments, in float tension);
+Status GdipDrawClosedCurve(Handle graphics, Handle pen, GpPointF* points, in int count);
+Status GdipDrawClosedCurve2(Handle graphics, Handle pen, GpPointF* points, in int count, in float tension);
+Status GdipDrawClosedCurveI(Handle graphics, Handle pen, GpPoint* points, in int count);
+Status GdipDrawClosedCurve2I(Handle graphics, Handle pen, GpPoint* points, in int count, in float tension);
+Status GdipFillRectangleI(Handle graphics, Handle brush, in int x, in int y, in int width, in int height);
+Status GdipFillRectangle(Handle graphics, Handle brush, in float x, in float y, in float width, in float height);
+Status GdipFillRectanglesI(Handle graphics, Handle brush, GpRect* rects, in int count);
+Status GdipFillRectangles(Handle graphics, Handle brush, GpRectF* rects, in int count);
+Status GdipFillPolygon(Handle graphics, Handle brush, GpPointF* rects, in int count, in FillMode fillMode);
+Status GdipFillPolygonI(Handle graphics, Handle brush, GpPoint* rects, in int count, in FillMode fillMode);
+Status GdipFillEllipse(Handle graphics, Handle brush, in float x, in float y, in float width, in float height);
+Status GdipFillEllipseI(Handle graphics, Handle brush, in int x, in int y, in int width, in int height);
+Status GdipFillPie(Handle graphics, Handle brush, in float x, in float y, in float width, in float height, in float startAngle, in float sweepAngle);
+Status GdipFillPieI(Handle graphics, Handle brush, in int x, in int y, in int width, in int height, in float startAngle, in float sweepAngle);
 Status GdipFillPath(Handle graphics, Handle brush, Handle path);
-Status GdipFillClosedCurve(Handle graphics, Handle brush, GpPointF* points, int count);
-Status GdipFillClosedCurveI(Handle graphics, Handle brush, GpPoint* points, int count);
-Status GdipFillClosedCurve2(Handle graphics, Handle brush, GpPointF* points, int count, FillMode fillMode, float tension);
-Status GdipFillClosedCurve2I(Handle graphics, Handle brush, GpPoint* points, int count, FillMode fillMode, float tension);
+Status GdipFillClosedCurve(Handle graphics, Handle brush, GpPointF* points, in int count);
+Status GdipFillClosedCurveI(Handle graphics, Handle brush, GpPoint* points, in int count);
+Status GdipFillClosedCurve2(Handle graphics, Handle brush, GpPointF* points, in int count, in FillMode fillMode, in float tension);
+Status GdipFillClosedCurve2I(Handle graphics, Handle brush, GpPoint* points, in int count, in FillMode fillMode, in float tension);
 Status GdipFillRegion(Handle graphics, Handle brush, Handle region);
-Status GdipDrawString(Handle graphics, LPCWSTR string, int length, Handle font, ref GpRectF layoutRect, Handle stringFormat, Handle brush);
-Status GdipMeasureString(Handle graphics, LPCWSTR string, int length, Handle font, ref GpRectF layoutRect, Handle stringFormat, ref GpRectF boundingBox, int* codepointsFitted, int* linesFitted);
+Status GdipDrawString(Handle graphics, LPCWSTR string, in int length, Handle font, ref GpRectF layoutRect, Handle stringFormat, Handle brush);
+Status GdipMeasureString(Handle graphics, LPCWSTR string, in int length, Handle font, ref GpRectF layoutRect, Handle stringFormat, ref GpRectF boundingBox, int* codepointsFitted, int* linesFitted);
 Status GdipGetStringFormatMeasurableCharacterRangeCount(Handle format, out int count);
 Status GdipCloneStringFormat(Handle format, out Handle newFormat);
 
-Status GdipMeasureCharacterRanges(Handle graphics, LPCWSTR string, int length, Handle font, ref GpRectF layoutRect, Handle stringFormat, int regionCount, Handle* regions);
-Status GdipDrawImage(Handle graphics, Handle image, float x, float y);
-Status GdipDrawImageI(Handle graphics, Handle image, int x, int y);
-Status GdipDrawImageRect(Handle graphics, Handle image, float x, float y, float width, float height);
-Status GdipDrawImageRectI(Handle graphics, Handle image, int x, int y, int width, int height);
-Status GdipDrawImagePointRect(Handle graphics, Handle image, float x, float y, float srcx, float srcy, float srcwidth, float srcheight, GraphicsUnit srcUnit);
-Status GdipDrawImagePointRectI(Handle graphics, Handle image, int x, int y, int srcx, int srcy, int srcwidth, int srcheight, GraphicsUnit srcUnit);
-Status GdipDrawImageRectRect(Handle graphics, Handle image, float dstx, float dsty, float dstwidth, float dstheight, float srcx, float srcy, float srcwidth, float srcheight, GraphicsUnit srcUnit, Handle imageAttributes, GpDrawImageAbort callback, void* callbakcData);
-Status GdipDrawImageRectRectI(Handle graphics, Handle image, int dstx, int dsty, int dstwidth, int dstheight, int srcx, int srcy, int srcwidth, int srcheight, GraphicsUnit srcUnit, Handle imageAttributes, GpDrawImageAbort callback, void* callbakcData);
-Status GdipDrawImagePoints(Handle graphics, Handle image, GpPointF* dstpoints, int count);
-Status GdipDrawImagePointsI(Handle graphics, Handle image, GpPoint* dstpoints, int count);
-Status GdipDrawImagePointsRect(Handle graphics, Handle image, GpPointF* dstpoints, int count, float srcx, float srcy, float srcwidth, float srcheight, GraphicsUnit srcUnit, Handle imageAttributes, GpDrawImageAbort callback, void* callbakcData);
-Status GdipDrawImagePointsRectI(Handle graphics, Handle image, GpPoint* dstpoints, int count, int srcx, int srcy, int srcwidth, int srcheight, GraphicsUnit srcUnit, Handle imageAttributes, GpDrawImageAbort callback, void* callbakcData);
-Status GdipIsVisiblePoint(Handle graphics, float x, float y, out int result);
-Status GdipIsVisiblePointI(Handle graphics, int x, int y, out int result);
-Status GdipIsVisibleRect(Handle graphics, float x, float y, float width, float height, out int result);
-Status GdipIsVisibleRectI(Handle graphics, int x, int y, int width, int height, out int result);
+Status GdipMeasureCharacterRanges(Handle graphics, LPCWSTR string, in int length, Handle font, ref GpRectF layoutRect, Handle stringFormat, in int regionCount, Handle* regions);
+Status GdipDrawImage(Handle graphics, Handle image, in float x, in float y);
+Status GdipDrawImageI(Handle graphics, Handle image, in int x, in int y);
+Status GdipDrawImageRect(Handle graphics, Handle image, in float x, in float y, in float width, in float height);
+Status GdipDrawImageRectI(Handle graphics, Handle image, in int x, in int y, in int width, in int height);
+Status GdipDrawImagePointRect(Handle graphics, Handle image, in float x, in float y, in float srcx, in float srcy, in float srcwidth, in float srcheight, in GraphicsUnit srcUnit);
+Status GdipDrawImagePointRectI(Handle graphics, Handle image, in int x, in int y, in int srcx, in int srcy, in int srcwidth, in int srcheight, in GraphicsUnit srcUnit);
+Status GdipDrawImageRectRect(Handle graphics, Handle image, in float dstx, in float dsty, in float dstwidth, in float dstheight, in float srcx, in float srcy, in float srcwidth, in float srcheight, in GraphicsUnit srcUnit, Handle imageAttributes, GpDrawImageAbort callback, void* callbakcData);
+Status GdipDrawImageRectRectI(Handle graphics, Handle image, in int dstx, in int dsty, in int dstwidth, in int dstheight, in int srcx, in int srcy, in int srcwidth, in int srcheight, in GraphicsUnit srcUnit, Handle imageAttributes, GpDrawImageAbort callback, void* callbakcData);
+Status GdipDrawImagePoints(Handle graphics, Handle image, GpPointF* dstpoints, in int count);
+Status GdipDrawImagePointsI(Handle graphics, Handle image, GpPoint* dstpoints, in int count);
+Status GdipDrawImagePointsRect(Handle graphics, Handle image, GpPointF* dstpoints, in int count, in float srcx, in float srcy, in float srcwidth, in float srcheight, in GraphicsUnit srcUnit, Handle imageAttributes, GpDrawImageAbort callback, void* callbakcData);
+Status GdipDrawImagePointsRectI(Handle graphics, Handle image, GpPoint* dstpoints, in int count, in int srcx, in int srcy, in int srcwidth, in int srcheight, in GraphicsUnit srcUnit, Handle imageAttributes, GpDrawImageAbort callback, void* callbakcData);
+Status GdipIsVisiblePoint(Handle graphics, in float x, in float y, out int result);
+Status GdipIsVisiblePointI(Handle graphics, in int x, in int y, out int result);
+Status GdipIsVisibleRect(Handle graphics, in float x, in float y, in float width, in float height, out int result);
+Status GdipIsVisibleRectI(Handle graphics, in int x, in int y, in int width, in int height, out int result);
 Status GdipGetTextRenderingHint(Handle graphics, out TextRenderingHint mode);
-Status GdipSetTextRenderingHint(Handle graphics, TextRenderingHint mode);
+Status GdipSetTextRenderingHint(Handle graphics, in TextRenderingHint mode);
 Status GdipGetClipBounds(Handle graphics, out GpRectF rect);
 Status GdipGetClipBoundsI(Handle graphics, out GpRect rect);
 Status GdipGetVisibleClipBounds(Handle graphics, out GpRectF rect);
@@ -338,122 +338,122 @@
 Status GdipIsClipEmpty(Handle graphics, out int result);
 Status GdipIsVisibleClipEmpty(Handle graphics, out int result);
 Status GdipGetRenderingOrigin(Handle graphics, out int x, out int y);
-Status GdipSetRenderingOrigin(Handle graphics, int x, int y);
+Status GdipSetRenderingOrigin(Handle graphics, in int x, in int y);
 Status GdipGetNearestColor(Handle graphics, ref int argb);
-Status GdipComment(Handle graphics, uint sizeData, ubyte* data);
-Status GdipTransformPoints(Handle graphics, CoordinateSpace destSpace, CoordinateSpace srcSpace, GpPointF* points, int count);
-Status GdipTransformPointsI(Handle graphics, CoordinateSpace destSpace, CoordinateSpace srcSpace, GpPoint* points, int count);
+Status GdipComment(Handle graphics, in uint sizeData, ubyte* data);
+Status GdipTransformPoints(Handle graphics, in CoordinateSpace destSpace, in CoordinateSpace srcSpace, GpPointF* points, in int count);
+Status GdipTransformPointsI(Handle graphics, in CoordinateSpace destSpace, in CoordinateSpace srcSpace, GpPoint* points, in int count);
 
 Status GdipCreateMatrix(out Handle matrix);
-Status GdipCreateMatrix2(float m11, float m12, float m21, float m22, float dx, float dy, out Handle matrix);
+Status GdipCreateMatrix2(in float m11, in float m12, in float m21, in float m22, in float dx, in float dy, out Handle matrix);
 Status GdipCreateMatrix3(ref GpRectF rect, GpPointF* dstplg, out Handle matrix);
 Status GdipCreateMatrix3I(ref GpRect rect, GpPoint* dstplg, out Handle matrix);
 Status GdipDeleteMatrix(Handle matrix);
 Status GdipCloneMatrix(Handle matrix, out Handle cloneMatrix);
 Status GdipGetMatrixElements(Handle matrix, float* matrixOut);
-Status GdipSetMatrixElements(Handle matrix, float m11, float m12, float m21, float m22, float xy, float dy);
+Status GdipSetMatrixElements(Handle matrix, in float m11, in float m12, in float m21, in float m22, in float xy, in float dy);
 Status GdipInvertMatrix(Handle matrix);
-Status GdipMultiplyMatrix(Handle matrix, Handle matrix2, MatrixOrder order);
-Status GdipScaleMatrix(Handle matrix, float scaleX, float scaleY, MatrixOrder order);
-Status GdipShearMatrix(Handle matrix, float shearX, float shearY, MatrixOrder order);
-Status GdipRotateMatrix(Handle matrix, float angle, MatrixOrder order);
-Status GdipTranslateMatrix(Handle matrix, float offsetX, float offsetY, MatrixOrder order);
+Status GdipMultiplyMatrix(Handle matrix, Handle matrix2, in MatrixOrder order);
+Status GdipScaleMatrix(Handle matrix, in float scaleX, in float scaleY, in MatrixOrder order);
+Status GdipShearMatrix(Handle matrix, in float shearX, in float shearY, in MatrixOrder order);
+Status GdipRotateMatrix(Handle matrix, in float angle, in MatrixOrder order);
+Status GdipTranslateMatrix(Handle matrix, in float offsetX, in float offsetY, in MatrixOrder order);
 Status GdipIsMatrixIdentity(Handle matrix, out int result);
 Status GdipIsMatrixInvertible(Handle matrix, out int result);
-Status GdipTransformMatrixPoints(Handle matrix, GpPointF *pts, int count);
+Status GdipTransformMatrixPoints(Handle matrix, GpPointF *pts, in int count);
 
 Status GdipGetBrushType(Handle brush, out BrushType type );
 Status GdipCloneBrush(Handle brush, out Handle cloneBrush);
 Status GdipDeleteBrush(Handle brush);
 
-Status GdipCreateSolidFill(int color, out Handle brush);
+Status GdipCreateSolidFill(in int color, out Handle brush);
 Status GdipGetSolidFillColor(Handle brush, out int color);
-Status GdipSetSolidFillColor(Handle brush, int color);
+Status GdipSetSolidFillColor(Handle brush, in int color);
 
-Status GdipCreateTexture(Handle image, WrapMode wrapMode, out Handle texture);
-Status GdipCreateTexture2(Handle image, WrapMode wrapMode, float x, float y, float width, float height, out Handle texture);
-Status GdipCreateTexture2I(Handle image, WrapMode wrapMode, int x, int y, int width, int height, out Handle texture);
+Status GdipCreateTexture(Handle image, in WrapMode wrapMode, out Handle texture);
+Status GdipCreateTexture2(Handle image, in WrapMode wrapMode, in float x, in float y, in float width, in float height, out Handle texture);
+Status GdipCreateTexture2I(Handle image, in WrapMode wrapMode, in int x, in int y, in int width, in int height, out Handle texture);
 Status GdipGetTextureImage(Handle brush, out Handle image);
 Status GdipGetTextureTransform(Handle brush, out Handle matrix);
-Status GdipSetTextureTransform(Handle brush, Handle matrix);
+Status GdipSetTextureTransform(Handle brush, in Handle matrix);
 Status GdipGetTextureWrapMode(Handle brush, out WrapMode wrapmode);
-Status GdipSetTextureWrapMode(Handle brush, WrapMode wrapmode);
+Status GdipSetTextureWrapMode(Handle brush, in WrapMode wrapmode);
 
-Status GdipCreateHatchBrush(HatchStyle hatchstyle, int forecol, int backcol, out Handle brush);
+Status GdipCreateHatchBrush(in HatchStyle hatchstyle, in int forecol, in int backcol, out Handle brush);
 Status GdipGetHatchStyle(Handle brush, out HatchStyle hatchstyle);
 Status GdipGetHatchForegroundColor(Handle brush, out int forecol);
 Status GdipGetHatchBackgroundColor(Handle brush, out int backcol);
 
-Status GdipCreateLineBrushI(ref GpPoint point1, ref GpPoint point2, int color1, int color2, WrapMode wrapMode, out Handle lineGradient);
-Status GdipCreateLineBrush(ref GpPointF point1, ref GpPointF point2, int color1, int color2, WrapMode wrapMode, out Handle lineGradient);
-Status GdipCreateLineBrushFromRectI(ref GpRect rect, int color1, int color2, LinearGradientMode mode, WrapMode wrapMode, out Handle lineGradient);
-Status GdipCreateLineBrushFromRect(ref GpRectF rect, int color1, int color2, LinearGradientMode mode, WrapMode wrapMode, out Handle lineGradient);
-Status GdipCreateLineBrushFromRectWithAngleI(ref GpRect rect, int color1, int color2, float angle, int isAngleScalable, WrapMode wrapMode, out Handle lineGradient);
-Status GdipCreateLineBrushFromRectWithAngle(ref GpRectF rect, int color1, int color2, float angle, int isAngleScalable, WrapMode wrapMode, out Handle lineGradient);
+Status GdipCreateLineBrushI(ref GpPoint point1, ref GpPoint point2, in int color1, in int color2, in WrapMode wrapMode, out Handle lineGradient);
+Status GdipCreateLineBrush(ref GpPointF point1, ref GpPointF point2, in int color1, in int color2, in WrapMode wrapMode, out Handle lineGradient);
+Status GdipCreateLineBrushFromRectI(ref GpRect rect, in int color1, in int color2, in LinearGradientMode mode, in WrapMode wrapMode, out Handle lineGradient);
+Status GdipCreateLineBrushFromRect(ref GpRectF rect, in int color1, in int color2, in LinearGradientMode mode, in WrapMode wrapMode, out Handle lineGradient);
+Status GdipCreateLineBrushFromRectWithAngleI(ref GpRect rect, in int color1, in int color2, in float angle, in int isAngleScalable, in WrapMode wrapMode, out Handle lineGradient);
+Status GdipCreateLineBrushFromRectWithAngle(ref GpRectF rect, in int color1, in int color2, in float angle, in int isAngleScalable, in WrapMode wrapMode, out Handle lineGradient);
 Status GdipGetLineBlendCount(Handle brush, out int count);
-Status GdipGetLineBlend(Handle brush, float* blend, float* positions, int count);
-Status GdipSetLineBlend(Handle brush, float* blend, float* positions, int count);
+Status GdipGetLineBlend(Handle brush, float* blend, float* positions, in int count);
+Status GdipSetLineBlend(Handle brush, in float* blend, in float* positions, in int count);
 Status GdipGetLinePresetBlendCount(Handle brush, out int count);
-Status GdipGetLinePresetBlend(Handle brush, uint* blend, float* positions, int count);
-Status GdipSetLinePresetBlend(Handle brush, uint* blend, float* positions, int count);
+Status GdipGetLinePresetBlend(Handle brush, uint* blend, float* positions, in int count);
+Status GdipSetLinePresetBlend(Handle brush, in uint* blend, in float* positions, in int count);
 Status GdipGetLineWrapMode(Handle brush, out WrapMode wrapmode);
-Status GdipSetLineWrapMode(Handle brush, WrapMode wrapmode);
+Status GdipSetLineWrapMode(Handle brush, in WrapMode wrapmode);
 Status GdipGetLineRect(Handle brush, out GpRectF rect);
 Status GdipGetLineColors(Handle brush, int* colors);
-Status GdipSetLineColors(Handle brush, int color1, int color2);
+Status GdipSetLineColors(Handle brush, in int color1, in int color2);
 Status GdipGetLineGammaCorrection(Handle brush, out int useGammaCorrection);
-Status GdipSetLineGammaCorrection(Handle brush, int useGammaCorrection);
-Status GdipSetLineSigmaBlend(Handle brush, float focus, float scale);
-Status GdipSetLineLinearBlend(Handle brush, float focus, float scale);
+Status GdipSetLineGammaCorrection(Handle brush, in int useGammaCorrection);
+Status GdipSetLineSigmaBlend(Handle brush, in float focus, in float scale);
+Status GdipSetLineLinearBlend(Handle brush, in float focus, in float scale);
 Status GdipGetLineTransform(Handle brush, out Handle matrix);
 Status GdipSetLineTransform(Handle brush, Handle matrix);
 Status GdipResetLineTransform(Handle brush);
-Status GdipMultiplyLineTransform(Handle brush, Handle matrix, MatrixOrder order);
-Status GdipTranslateLineTransform(Handle brush, float dx, float dy, MatrixOrder order);
-Status GdipScaleLineTransform(Handle brush, float sx, float sy, MatrixOrder order);
-Status GdipRotateLineTransform(Handle brush, float angle, MatrixOrder order);
+Status GdipMultiplyLineTransform(Handle brush, Handle matrix, in MatrixOrder order);
+Status GdipTranslateLineTransform(Handle brush, in float dx, in float dy, in MatrixOrder order);
+Status GdipScaleLineTransform(Handle brush, in float sx, in float sy, in MatrixOrder order);
+Status GdipRotateLineTransform(Handle brush, in float angle, in MatrixOrder order);
 
-Status GdipCreatePen1(int argb, float width, GraphicsUnit unit, out Handle pen);
-Status GdipCreatePen2(Handle brush, float width, GraphicsUnit unit, out Handle pen);
+Status GdipCreatePen1(in int argb, in float width, in GraphicsUnit unit, out Handle pen);
+Status GdipCreatePen2(Handle brush, in float width, in GraphicsUnit unit, out Handle pen);
 Status GdipDeletePen(Handle pen);
 Status GdipClonePen(Handle pen, out Handle clonepen);
-Status GdipSetPenLineCap197819(Handle pen, LineCap startCap, LineCap endCap, DashCap dashCap);
+Status GdipSetPenLineCap197819(Handle pen, in LineCap startCap, in LineCap endCap, in DashCap dashCap);
 Status GdipGetPenStartCap(Handle pen, out LineCap startCap);
-Status GdipSetPenStartCap(Handle pen, LineCap startCap);
+Status GdipSetPenStartCap(Handle pen, in LineCap startCap);
 Status GdipGetPenEndCap(Handle pen, out LineCap endCap);
-Status GdipSetPenEndCap(Handle pen, LineCap endCap);
+Status GdipSetPenEndCap(Handle pen, in LineCap endCap);
 Status GdipGetPenDashCap197819(Handle pen, out DashCap endCap);
-Status GdipSetPenDashCap197819(Handle pen, DashCap endCap);
+Status GdipSetPenDashCap197819(Handle pen, in DashCap endCap);
 Status GdipGetPenLineJoin(Handle pen, out LineJoin lineJoin);
-Status GdipSetPenLineJoin(Handle pen, LineJoin lineJoin);
+Status GdipSetPenLineJoin(Handle pen, in LineJoin lineJoin);
 Status GdipGetPenMiterLimit(Handle pen, out float miterLimit);
-Status GdipSetPenMiterLimit(Handle pen, float miterLimit);
+Status GdipSetPenMiterLimit(Handle pen, in float miterLimit);
 Status GdipGetPenMode(Handle pen, out PenAlignment penMode);
-Status GdipSetPenMode(Handle pen, PenAlignment penMode);
+Status GdipSetPenMode(Handle pen, in PenAlignment penMode);
 Status GdipGetPenTransform(Handle pen, out Handle matrix);
 Status GdipSetPenTransform(Handle pen, Handle matrix);
 Status GdipResetPenTransform(Handle pen);
-Status GdipMultiplyPenTransform(Handle pen, Handle matrix, MatrixOrder order);
-Status GdipTranslatePenTransform(Handle pen, float dx, float dy, MatrixOrder order);
-Status GdipScalePenTransform(Handle pen, float sx, float sy, MatrixOrder order);
-Status GdipRotatePenTransform(Handle pen, float angle, MatrixOrder order);
+Status GdipMultiplyPenTransform(Handle pen, Handle matrix, in MatrixOrder order);
+Status GdipTranslatePenTransform(Handle pen, in float dx, in float dy, in MatrixOrder order);
+Status GdipScalePenTransform(Handle pen, in float sx, in float sy, in MatrixOrder order);
+Status GdipRotatePenTransform(Handle pen, in float angle, in MatrixOrder order);
 Status GdipGetPenColor(Handle pen, out int argb);
-Status GdipSetPenColor(Handle pen, int argb);
+Status GdipSetPenColor(Handle pen, in int argb);
 Status GdipGetPenWidth(Handle pen, out float width);
-Status GdipSetPenWidth(Handle pen, float width);
+Status GdipSetPenWidth(Handle pen, in float width);
 Status GdipGetPenFillType(Handle pen, out PenType type);
 Status GdipGetPenBrushFill(Handle pen, out Handle brush);
 Status GdipSetPenBrushFill(Handle pen, Handle brush);
 Status GdipGetPenDashStyle(Handle pen, out DashStyle dashstyle);
-Status GdipSetPenDashStyle(Handle pen, DashStyle dashstyle);
+Status GdipSetPenDashStyle(Handle pen, in DashStyle dashstyle);
 Status GdipGetPenDashOffset(Handle pen, out float offset);
-Status GdipSetPenDashOffset(Handle pen, float offset);
+Status GdipSetPenDashOffset(Handle pen, in float offset);
 Status GdipGetPenDashCount(Handle pen, out int count);
-Status GdipGetPenDashArray(Handle pen, float* dash, int count);
-Status GdipSetPenDashArray(Handle pen, float* dash, int count);
+Status GdipGetPenDashArray(Handle pen, float* dash, in int count);
+Status GdipSetPenDashArray(Handle pen, in float* dash, in int count);
 Status GdipGetPenCompoundCount(Handle pen, out int count);
-Status GdipGetPenCompoundArray(Handle pen, float* dash, int count);
-Status GdipSetPenCompoundArray(Handle pen, float* dash, int count);
+Status GdipGetPenCompoundArray(Handle pen, float* dash, in int count);
+Status GdipSetPenCompoundArray(Handle pen, in float* dash, in int count);
 
 Status GdipCreateRegion(out Handle region);
 Status GdipCreateRegionRect(ref GpRectF rect, out Handle region);
@@ -463,22 +463,22 @@
 Status GdipDeleteRegion(Handle region);
 Status GdipSetInfinite(Handle region);
 Status GdipSetEmpty(Handle region);
-Status GdipCombineRegionRect(Handle region, ref GpRectF rect, CombineMode combineMode);
-Status GdipCombineRegionRectI(Handle region, ref GpRect rect, CombineMode combineMode);
-Status GdipCombineRegionPath(Handle region, Handle path, CombineMode combineMode);
-Status GdipCombineRegionRegion(Handle region, Handle region, CombineMode combineMode);
-Status GdipTranslateRegion(Handle region, float dx, float dy);
-Status GdipTranslateRegionI(Handle region, int dx, int dy);
+Status GdipCombineRegionRect(Handle region, ref GpRectF rect, in CombineMode combineMode);
+Status GdipCombineRegionRectI(Handle region, ref GpRect rect, in CombineMode combineMode);
+Status GdipCombineRegionPath(Handle region, Handle path, in CombineMode combineMode);
+Status GdipCombineRegionRegion(Handle region, Handle region, in CombineMode combineMode);
+Status GdipTranslateRegion(Handle region, in float dx, in float dy);
+Status GdipTranslateRegionI(Handle region, in int dx, in int dy);
 Status GdipTransformRegion(Handle region, Handle matrix);
 Status GdipGetRegionBounds(Handle region, Handle graphics, out GpRectF rect);
 Status GdipGetRegionHRgn(Handle region, Handle graphics, out Handle hRgn);
 Status GdipIsEmptyRegion(Handle region, Handle graphics, out int result);
 Status GdipIsInfiniteRegion(Handle region, Handle graphics, out int result);
 Status GdipIsEqualRegion(Handle region1, Handle region2, Handle graphics, out int result);
-Status GdipIsVisibleRegionPoint(Handle region, float x, float y, Handle graphics, out int result);
-Status GdipIsVisibleRegionRect(Handle region, float x, float y, float width, float height, Handle graphics, out int result);
-Status GdipIsVisibleRegionPointI(Handle region, int x, int y, Handle graphics, out int result);
-Status GdipIsVisibleRegionRectI(Handle region, int x, int y, int width, int height, Handle graphics, out int result);
+Status GdipIsVisibleRegionPoint(Handle region, in float x, in float y, Handle graphics, out int result);
+Status GdipIsVisibleRegionRect(Handle region, in float x, in float y, in float width, in float height, Handle graphics, out int result);
+Status GdipIsVisibleRegionPointI(Handle region, in int x, in int y, Handle graphics, out int result);
+Status GdipIsVisibleRegionRectI(Handle region, in int x, in int y, in int width, in int height, Handle graphics, out int result);
 Status GdipGetRegionScansCount(Handle region, out int count, Handle matrix);
 Status GdipGetRegionScans(Handle region, GpRectF* rects, out int count, Handle matrix);
 
@@ -490,7 +490,7 @@
 // Status GdipLoadImageFromStream(IStream stream, out Handle image);
 // Status GdipGetImageRawFormat(Handle image, out GUID format);
 Status GdipGetImageEncodersSize(out int numEncoders, out int size);
-// Status GdipGetImageEncoders(int numEncoders, int size, GpImageCodecInfo* encoders);
+// Status GdipGetImageEncoders(in int numEncoders, in int size, GpImageCodecInfo* encoders);
 // Status GdipSaveImageToFile(Handle image, LPCWSTR filename, ref GUID clsidEncoder, GpEncoderParameters* encoderParams);
 // Status GdipSaveImageToStream(Handle image, IStream stream, ref GUID clsidEncoder, GpEncoderParameters* encoderParams);
 // Status GdipSaveAdd(Handle image, GpEncoderParameters* encoderParams);
@@ -503,113 +503,113 @@
 Status GdipGetImageHorizontalResolution(Handle image, out float resolution);
 Status GdipGetImageVerticalResolution(Handle image, out float resolution);
 Status GdipGetPropertyCount(Handle image, out int numOfProperty);
-Status GdipGetPropertyIdList(Handle image, int numOfProperty, int* list);
+Status GdipGetPropertyIdList(Handle image, in int numOfProperty, int* list);
 Status GdipGetImagePixelFormat(Handle image, out PixelFormat format);
 Status GdipGetImageDimension(Handle image, out float width, out float height);
-Status GdipGetImageThumbnail(Handle image, int thumbWidth, int thumbHeight, out Handle thumbImage, GpGetThumbnailImageAbort callback, void* callbackData);
+Status GdipGetImageThumbnail(Handle image, in int thumbWidth, in int thumbHeight, out Handle thumbImage, GpGetThumbnailImageAbort callback, void* callbackData);
 // Status GdipImageGetFrameCount(Handle image, ref GUID dimensionID, out int count);
-// Status GdipImageSelectActiveFrame(Handle image, ref GUID dimensionID, int frameCount);
+// Status GdipImageSelectActiveFrame(Handle image, ref GUID dimensionID, in int frameCount);
 Status GdipImageGetFrameDimensionsCount(Handle image, out int count);
-// Status GdipImageGetFrameDimensionsList(Handle image, GUID* dimensionIDs, int count);
-Status GdipImageRotateFlip(Handle image, RotateFlipType rotateFlipType);
-Status GdipGetPropertyItemSize(Handle image, int propId, out uint propSize);
-Status GdipGetPropertyItem(Handle image, int propId, uint propSize, GpPropertyItem* buffer);
+// Status GdipImageGetFrameDimensionsList(Handle image, GUID* dimensionIDs, in int count);
+Status GdipImageRotateFlip(Handle image, in RotateFlipType rotateFlipType);
+Status GdipGetPropertyItemSize(Handle image, in int propId, out uint propSize);
+Status GdipGetPropertyItem(Handle image, in int propId, in uint propSize, GpPropertyItem* buffer);
 Status GdipSetPropertyItem(Handle image, ref GpPropertyItem buffer);
-Status GdipRemovePropertyItem(Handle image, int propId);
+Status GdipRemovePropertyItem(Handle image, in int propId);
 Status GdipGetPropertySize(Handle image, out uint totalBufferSize, ref int numProperties);
-Status GdipGetAllPropertyItems(Handle image, uint totalBufferSize, int numProperties, GpPropertyItem* allItems);
+Status GdipGetAllPropertyItems(Handle image, in uint totalBufferSize, in int numProperties, GpPropertyItem* allItems);
 Status GdipGetImageBounds(Handle image, out GpRectF srcRect, out GraphicsUnit srcUnit);
 // Status GdipGetEncoderParameterListSize(Handle image, ref GUID clsidEncoder, out uint size);
-// Status GdipGetEncoderParameterList(Handle image, ref GUID clsidEncoder, uint size, GpEncoderParameters* buffer);
+// Status GdipGetEncoderParameterList(Handle image, ref GUID clsidEncoder, in uint size, GpEncoderParameters* buffer);
 Status GdipGetImagePaletteSize(Handle image, out int size);
-Status GdipGetImagePalette(Handle image, GpColorPalette* palette, int size);
-Status GdipSetImagePalette(Handle image, GpColorPalette* palette);
+Status GdipGetImagePalette(Handle image, GpColorPalette* palette, in int size);
+Status GdipSetImagePalette(Handle image, in GpColorPalette* palette);
 
-Status GdipCreateBitmapFromScan0(int width, int height, int stride, PixelFormat format, ubyte* scan0, out Handle bitmap);
+Status GdipCreateBitmapFromScan0(in int width, in int height, in int stride, in PixelFormat format, ubyte* scan0, out Handle bitmap);
 Status GdipCreateBitmapFromHBITMAP(Handle hbitmap, Handle hpalette, out Handle bitmap);
 Status GdipCreateBitmapFromHICON(Handle hicon, out Handle bitmap);
 Status GdipCreateBitmapFromFileICM(LPCWSTR fileName, out Handle bitmap);
 Status GdipCreateBitmapFromFile(LPCWSTR fileName, out Handle bitmap);
 // Status GdipCreateBitmapFromStreamICM(IStream stream, out Handle bitmap);
 // Status GdipCreateBitmapFromStream(IStream stream, out Handle bitmap);
-Status GdipCreateBitmapFromGraphics(int width, int height, Handle graphics, out Handle bitmap);
-Status GdipCloneBitmapArea(float x, float y, float width, float height, PixelFormat format, Handle srcbitmap, out Handle dstbitmap);
-Status GdipCloneBitmapAreaI(int x, int y, int width, int height, PixelFormat format, Handle srcbitmap, out Handle dstbitmap);
-Status GdipBitmapGetPixel(Handle bitmap, int x, int y, out int color);
-Status GdipBitmapSetPixel(Handle bitmap, int x, int y, int color);
-Status GdipBitmapLockBits(Handle bitmap, GpRect* rect, ImageLockMode flags, PixelFormat format, GpBitmapData* lockedBitmapData);
+Status GdipCreateBitmapFromGraphics(in int width, in int height, Handle graphics, out Handle bitmap);
+Status GdipCloneBitmapArea(in float x, in float y, in float width, in float height, in PixelFormat format, Handle srcbitmap, out Handle dstbitmap);
+Status GdipCloneBitmapAreaI(in int x, in int y, in int width, in int height, in PixelFormat format, Handle srcbitmap, out Handle dstbitmap);
+Status GdipBitmapGetPixel(Handle bitmap, in int x, in int y, out int color);
+Status GdipBitmapSetPixel(Handle bitmap, in int x, in int y, in int color);
+Status GdipBitmapLockBits(Handle bitmap, GpRect* rect, in ImageLockMode flags, in PixelFormat format, GpBitmapData* lockedBitmapData);
 Status GdipBitmapUnlockBits(Handle bitmap, GpBitmapData* lockedBitmapData);
-Status GdipBitmapSetResolution(Handle bitmap, float xdpi, float ydpi);
+Status GdipBitmapSetResolution(Handle bitmap, in float xdpi, in float ydpi);
 Status GdipCreateHICONFromBitmap(Handle bitmap, out Handle hbmReturn);
-Status GdipCreateHBITMAPFromBitmap(Handle bitmap, out Handle hbmReturn, int background);
+Status GdipCreateHBITMAPFromBitmap(Handle bitmap, out Handle hbmReturn, in int background);
 
 Status GdipCreateImageAttributes(out Handle imageattr);
 Status GdipDisposeImageAttributes(Handle imageattr);
-Status GdipSetImageAttributesColorMatrix(Handle imageattr, ColorAdjustType type, int enableFlag, GpColorMatrix* colorMatrix, GpColorMatrix* grayMatrix, ColorMatrixFlag flags);
-Status GdipSetImageAttributesThreshold(Handle imageattr, ColorAdjustType type, int enableFlag, float threshold);
-Status GdipSetImageAttributesGamma(Handle imageattr, ColorAdjustType type, int enableFlag, float gamma);
-Status GdipSetImageAttributesNoOp(Handle imageattr, ColorAdjustType type, int enableFlag);
-Status GdipSetImageAttributesColorKeys(Handle imageattr, ColorAdjustType type, int enableFlag, int colorLow, int colorHigh);
-Status GdipSetImageAttributesOutputChannel(Handle imageattr, ColorAdjustType type, int enableFlag, ColorChannelFlag flags);
-Status GdipSetImageAttributesOutputChannelColorProfile(Handle imageattr, ColorAdjustType type, int enableFlag, LPCWSTR colorProfileFilename);
-Status GdipSetImageAttributesWrapMode(Handle imageattr, WrapMode wrap, int argb, int clamp);
+Status GdipSetImageAttributesColorMatrix(Handle imageattr, in ColorAdjustType type, in int enableFlag, in GpColorMatrix* colorMatrix, in GpColorMatrix* grayMatrix, in ColorMatrixFlag flags);
+Status GdipSetImageAttributesThreshold(Handle imageattr, in ColorAdjustType type, in int enableFlag, in float threshold);
+Status GdipSetImageAttributesGamma(Handle imageattr, in ColorAdjustType type, in int enableFlag, in float gamma);
+Status GdipSetImageAttributesNoOp(Handle imageattr, in ColorAdjustType type, in int enableFlag);
+Status GdipSetImageAttributesColorKeys(Handle imageattr, in ColorAdjustType type, in int enableFlag, in int colorLow, in int colorHigh);
+Status GdipSetImageAttributesOutputChannel(Handle imageattr, in ColorAdjustType type, in int enableFlag, in ColorChannelFlag flags);
+Status GdipSetImageAttributesOutputChannelColorProfile(Handle imageattr, in ColorAdjustType type, in int enableFlag, LPCWSTR colorProfileFilename);
+Status GdipSetImageAttributesWrapMode(Handle imageattr, in WrapMode wrap, in int argb, in int clamp);
 
 Status GdipNewInstalledFontCollection(out Handle fontCollection);
 Status GdipNewPrivateFontCollection(out Handle fontCollection);
 Status GdipDeletePrivateFontCollection(Handle fontCollection);
 Status GdipPrivateAddFontFile(Handle fontCollection, LPCWSTR filename);
-Status GdipPrivateAddMemoryFont(Handle fontCollection, void* memory, int length);
+Status GdipPrivateAddMemoryFont(Handle fontCollection, void* memory, in int length);
 Status GdipGetFontCollectionFamilyCount(Handle fontCollection, out int numFound);
-Status GdipGetFontCollectionFamilyList(Handle fontCollection, int numSought, Handle* gpfamilies, out int numFound);
+Status GdipGetFontCollectionFamilyList(Handle fontCollection, in int numSought, Handle* gpfamilies, out int numFound);
 
 Status GdipCreateFontFamilyFromName(LPCWSTR name, Handle fontCollection, out Handle FontFamily);
 Status GdipDeleteFontFamily(Handle FontFamily);
 Status GdipCloneFontFamily(Handle FontFamily, out Handle clonedFontFamily);
-Status GdipGetFamilyName(Handle family, LPCWSTR name, int language);
+Status GdipGetFamilyName(Handle family, LPCWSTR name, in int language);
 Status GdipGetGenericFontFamilyMonospace(out Handle nativeFamily);
 Status GdipGetGenericFontFamilySerif(out Handle nativeFamily);
 Status GdipGetGenericFontFamilySansSerif(out Handle nativeFamily);
-Status GdipGetEmHeight(Handle family, FontStyle style, out short EmHeight);
-Status GdipGetCellAscent(Handle family, FontStyle style, out short CellAscent);
-Status GdipGetCellDescent(Handle family, FontStyle style, out short CellDescent);
-Status GdipGetLineSpacing(Handle family, FontStyle style, out short LineSpacing);
-Status GdipIsStyleAvailable(Handle family, FontStyle style, out int IsStyleAvailable);
+Status GdipGetEmHeight(Handle family, in FontStyle style, out short EmHeight);
+Status GdipGetCellAscent(Handle family, in FontStyle style, out short CellAscent);
+Status GdipGetCellDescent(Handle family, in FontStyle style, out short CellDescent);
+Status GdipGetLineSpacing(Handle family, in FontStyle style, out short LineSpacing);
+Status GdipIsStyleAvailable(Handle family, in FontStyle style, out int IsStyleAvailable);
 
-Status GdipCreateFont(Handle fontFamily, float emSize, int style, int unit, out Handle font);
+Status GdipCreateFont(Handle fontFamily, in float emSize, in int style, in int unit, out Handle font);
 Status GdipCreateFontFromDC(Handle hdc, out Handle font);
 Status GdipDeleteFont(Handle font);
 Status GdipCloneFont(Handle font, out Handle cloneFont);
 Status GdipGetFontSize(Handle font, out float size);
 Status GdipGetFontHeight(Handle font, Handle graphics, out float height);
-Status GdipGetFontHeightGivenDPI(Handle font, float dpi, out float height);
+Status GdipGetFontHeightGivenDPI(Handle font, in float dpi, out float height);
 Status GdipGetFontStyle(Handle font, out FontStyle style);
 Status GdipGetFontUnit(Handle font, out GraphicsUnit unit);
 Status GdipGetFamily(Handle font, out Handle family);
-Status GdipCreateFontFromLogfontW( Handle hdc, ref LOGFONTW logfont, out Handle font);
-Status GdipCreateFontFromLogfontA( Handle hdc, ref LOGFONTA logfont, out Handle font );
+Status GdipCreateFontFromLogfontW(Handle hdc, ref LOGFONTW logfont, out Handle font);
+Status GdipCreateFontFromLogfontA(Handle hdc, ref LOGFONTA logfont, out Handle font);
 
 Status GdipGetLogFontW(Handle font, Handle graphics, out LOGFONTW logfontW);
 alias GdipGetLogFontW GdipGetLogFont;
 
-Status GdipCreateStringFormat(StringFormatFlags formatAttributes, int language, out Handle format);
+Status GdipCreateStringFormat(in StringFormatFlags formatAttributes, in int language, out Handle format);
 Status GdipDeleteStringFormat(Handle format);
 Status GdipGetStringFormatFlags(Handle format, out StringFormatFlags flags);
-Status GdipSetStringFormatFlags(Handle format, StringFormatFlags flags);
+Status GdipSetStringFormatFlags(Handle format, in StringFormatFlags flags);
 Status GdipGetStringFormatAlign(Handle format, out StringAlignment alignment);
-Status GdipSetStringFormatAlign(Handle format, StringAlignment alignment);
+Status GdipSetStringFormatAlign(Handle format, in StringAlignment alignment);
 Status GdipGetStringFormatLineAlign(Handle format, out StringAlignment alignment);
-Status GdipSetStringFormatLineAlign(Handle format, StringAlignment alignment);
+Status GdipSetStringFormatLineAlign(Handle format, in StringAlignment alignment);
 Status GdipGetStringFormatTrimming(Handle format, out StringTrimming trimming);
-Status GdipSetStringFormatTrimming(Handle format, StringTrimming trimming);
+Status GdipSetStringFormatTrimming(Handle format, in StringTrimming trimming);
 
-Status GdipCreatePath(FillMode brushMode, out Handle path);
+Status GdipCreatePath(in FillMode brushMode, out Handle path);
 Status GdipCreatePath2(GpPointF*, ubyte*, int, FillMode, out Handle);
 Status GdipCreatePath2I(GpPoint*, ubyte*, int, FillMode, out Handle);
 Status GdipDeletePath(Handle path);
 Status GdipClonePath(Handle path, out Handle clonepath);
 Status GdipResetPath(Handle path);
 Status GdipGetPathFillMode(Handle path, out FillMode fillmode);
-Status GdipSetPathFillMode(Handle path, FillMode fillmode);
+Status GdipSetPathFillMode(Handle path, in FillMode fillmode);
 Status GdipStartPathFigure(Handle path);
 Status GdipClosePathFigure(Handle path);
 Status GdipClosePathFigures(Handle path);
@@ -617,52 +617,52 @@
 Status GdipClearPathMarkers(Handle path);
 Status GdipReversePath(Handle path);
 Status GdipGetPathLastPoint(Handle path, out GpPointF lastPoint);
-Status GdipAddPathLine(Handle path, float x1, float y1, float x2, float y2);
-Status GdipAddPathLineI(Handle path, int x1, int y1, int x2, int y2);
-Status GdipAddPathLine2(Handle path, GpPointF* points, int count);
-Status GdipAddPathLine2I(Handle path, GpPoint* points, int count);
-Status GdipAddPathArc(Handle path, float x, float y, float width, float height, float startAngle, float sweepAngle);
-Status GdipAddPathArcI(Handle path, int x, int y, int width, int height, float startAngle, float sweepAngle);
-Status GdipAddPathBezier(Handle path, float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4);
-Status GdipAddPathBezierI(Handle path, int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4);
-Status GdipAddPathBeziers(Handle path, GpPointF* points, int count);
-Status GdipAddPathBeziersI(Handle path, GpPoint* points, int count);
-Status GdipAddPathCurve(Handle path, GpPointF* points, int count);
-Status GdipAddPathCurveI(Handle path, GpPoint* points, int count);
-Status GdipAddPathCurve2(Handle path, GpPointF* points, int count, float tension);
-Status GdipAddPathCurve2I(Handle path, GpPoint* points, int count, float tension);
-Status GdipAddPathCurve3(Handle path, GpPointF* points, int count, int offset, int numberOfSegments, float tension);
-Status GdipAddPathCurve3I(Handle path, GpPoint* points, int count, int offset, int numberOfSegments, float tension);
-Status GdipAddPathClosedCurve(Handle path, GpPointF* points, int count);
-Status GdipAddPathClosedCurveI(Handle path, GpPoint* points, int count);
-Status GdipAddPathClosedCurve2(Handle path, GpPointF* points, int count, float tension);
-Status GdipAddPathClosedCurve2I(Handle path, GpPoint* points, int count, float tension);
-Status GdipAddPathRectangle(Handle path, float x, float y, float width, float height);
-Status GdipAddPathRectangleI(Handle path, int x, int y, int width, int height);
-Status GdipAddPathRectangles(Handle path, GpRectF* rects, int count);
-Status GdipAddPathRectanglesI(Handle path, GpRect* rects, int count);
-Status GdipAddPathEllipse(Handle path, float x, float y, float width, float height);
-Status GdipAddPathEllipseI(Handle path, int x, int y, int width, int height);
-Status GdipAddPathPie(Handle path, float x, float y, float width, float height, float startAngle, float sweepAngle);
-Status GdipAddPathPieI(Handle path, int x, int y, int width, int height, float startAngle, float sweepAngle);
-Status GdipAddPathPolygon(Handle path, GpPointF* points, int count);
-Status GdipAddPathPolygonI(Handle path, GpPoint* points, int count);
-Status GdipAddPathPath(Handle path, Handle addingPath, int connect);
-Status GdipAddPathString(Handle path, LPCWSTR string, int length, Handle family, FontStyle style, float emSize, ref GpRectF layoutRect, Handle format);
-Status GdipAddPathStringI(Handle path, LPCWSTR string, int length, Handle family, FontStyle style, float emSize, ref GpRect layoutRect, Handle format);
+Status GdipAddPathLine(Handle path, in float x1, in float y1, in float x2, in float y2);
+Status GdipAddPathLineI(Handle path, in int x1, in int y1, in int x2, in int y2);
+Status GdipAddPathLine2(Handle path, GpPointF* points, in int count);
+Status GdipAddPathLine2I(Handle path, GpPoint* points, in int count);
+Status GdipAddPathArc(Handle path, in float x, in float y, in float width, in float height, in float startAngle, in float sweepAngle);
+Status GdipAddPathArcI(Handle path, in int x, in int y, in int width, in int height, in float startAngle, in float sweepAngle);
+Status GdipAddPathBezier(Handle path, in float x1, in float y1, in float x2, in float y2, in float x3, in float y3, in float x4, in float y4);
+Status GdipAddPathBezierI(Handle path, in int x1, in int y1, in int x2, in int y2, in int x3, in int y3, in int x4, in int y4);
+Status GdipAddPathBeziers(Handle path, GpPointF* points, in int count);
+Status GdipAddPathBeziersI(Handle path, GpPoint* points, in int count);
+Status GdipAddPathCurve(Handle path, GpPointF* points, in int count);
+Status GdipAddPathCurveI(Handle path, GpPoint* points, in int count);
+Status GdipAddPathCurve2(Handle path, GpPointF* points, in int count, in float tension);
+Status GdipAddPathCurve2I(Handle path, GpPoint* points, in int count, in float tension);
+Status GdipAddPathCurve3(Handle path, GpPointF* points, in int count, in int offset, in int numberOfSegments, in float tension);
+Status GdipAddPathCurve3I(Handle path, GpPoint* points, in int count, in int offset, in int numberOfSegments, in float tension);
+Status GdipAddPathClosedCurve(Handle path, GpPointF* points, in int count);
+Status GdipAddPathClosedCurveI(Handle path, GpPoint* points, in int count);
+Status GdipAddPathClosedCurve2(Handle path, GpPointF* points, in int count, in float tension);
+Status GdipAddPathClosedCurve2I(Handle path, GpPoint* points, in int count, in float tension);
+Status GdipAddPathRectangle(Handle path, in float x, in float y, in float width, in float height);
+Status GdipAddPathRectangleI(Handle path, in int x, in int y, in int width, in int height);
+Status GdipAddPathRectangles(Handle path, GpRectF* rects, in int count);
+Status GdipAddPathRectanglesI(Handle path, GpRect* rects, in int count);
+Status GdipAddPathEllipse(Handle path, in float x, in float y, in float width, in float height);
+Status GdipAddPathEllipseI(Handle path, in int x, in int y, in int width, in int height);
+Status GdipAddPathPie(Handle path, in float x, in float y, in float width, in float height, in float startAngle, in float sweepAngle);
+Status GdipAddPathPieI(Handle path, in int x, in int y, in int width, in int height, in float startAngle, in float sweepAngle);
+Status GdipAddPathPolygon(Handle path, GpPointF* points, in int count);
+Status GdipAddPathPolygonI(Handle path, GpPoint* points, in int count);
+Status GdipAddPathPath(Handle path, Handle addingPath, in int connect);
+Status GdipAddPathString(Handle path, LPCWSTR string, in int length, Handle family, in FontStyle style, in float emSize, ref GpRectF layoutRect, Handle format);
+Status GdipAddPathStringI(Handle path, LPCWSTR string, in int length, Handle family, in FontStyle style, in float emSize, ref GpRect layoutRect, Handle format);
 Status GdipTransformPath(Handle path, Handle matrix);
 Status GdipGetPathWorldBounds(Handle path, out GpRectF bounds, Handle matrix, Handle pen);
-Status GdipFlattenPath(Handle path, Handle matrix, float flatness);
-Status GdipWidenPath(Handle path, Handle pen, Handle matrix, float flatness);
-Status GdipWindingModeOutline(Handle path, Handle matrix, float flatness);
-Status GdipWarpPath(Handle path, Handle matrix, GpPointF* points, int count, float srcx, float srcy, float srcwidth, float srcwidth, WarpMode warpMode, float flatness);
+Status GdipFlattenPath(Handle path, Handle matrix, in float flatness);
+Status GdipWidenPath(Handle path, Handle pen, Handle matrix, in float flatness);
+Status GdipWindingModeOutline(Handle path, Handle matrix, in float flatness);
+Status GdipWarpPath(Handle path, Handle matrix, GpPointF* points, in int count, in float srcx, in float srcy, in float srcwidth, in float srcwidth, in WarpMode warpMode, in float flatness);
 Status GdipGetPointCount(Handle path, out int count);
-Status GdipGetPathTypes(Handle path, byte* types, int count);
-Status GdipGetPathPoints(Handle path, GpPointF* points, int count);
-Status GdipIsVisiblePathPoint(Handle path, float x, float y, Handle graphics, out int result);
-Status GdipIsVisiblePathPointI(Handle path, int x, int y, Handle graphics, out int result);
-Status GdipIsOutlineVisiblePathPoint(Handle path, float x, float y, Handle pen, Handle graphics, out int result);
-Status GdipIsOutlineVisiblePathPointI(Handle path, int x, int y, Handle pen, Handle graphics, out int result);
+Status GdipGetPathTypes(Handle path, byte* types, in int count);
+Status GdipGetPathPoints(Handle path, GpPointF* points, in int count);
+Status GdipIsVisiblePathPoint(Handle path, in float x, in float y, Handle graphics, out int result);
+Status GdipIsVisiblePathPointI(Handle path, in int x, in int y, Handle graphics, out int result);
+Status GdipIsOutlineVisiblePathPoint(Handle path, in float x, in float y, Handle pen, Handle graphics, out int result);
+Status GdipIsOutlineVisiblePathPointI(Handle path, in int x, in int y, Handle pen, Handle graphics, out int result);
 Status GdipDrawPath(Handle graphics, Handle pen, Handle path);
 
 
@@ -677,49 +677,49 @@
 Status GdipPathIterGetSubpathCount(Handle iterator, out int count);
 Status GdipPathIterHasCurve(Handle iterator, out int hasCurve);
 Status GdipPathIterRewind(Handle iterator);
-Status GdipPathIterEnumerate(Handle iterator, out int resultCount, GpPointF* points, ubyte* types, int count);
-Status GdipPathIterCopyData(Handle iterator, out int resultCount, GpPointF* points, ubyte* types, int startIndex, int endIndex);
+Status GdipPathIterEnumerate(Handle iterator, out int resultCount, GpPointF* points, ubyte* types, in int count);
+Status GdipPathIterCopyData(Handle iterator, out int resultCount, GpPointF* points, ubyte* types, in int startIndex, in int endIndex);
 
-Status GdipCreatePathGradient(GpPointF* points, int count, WrapMode wrapMode, out Handle polyGradient);
-Status GdipCreatePathGradientI(GpPoint* points, int count, WrapMode wrapMode, out Handle polyGradient);
+Status GdipCreatePathGradient(GpPointF* points, in int count, in WrapMode wrapMode, out Handle polyGradient);
+Status GdipCreatePathGradientI(GpPoint* points, in int count, in WrapMode wrapMode, out Handle polyGradient);
 Status GdipCreatePathGradientFromPath(Handle path, out Handle polyGradient);
 Status GdipGetPathGradientCenterColor(Handle brush, out int colors);
-Status GdipSetPathGradientCenterColor(Handle brush, int colors);
+Status GdipSetPathGradientCenterColor(Handle brush, in int colors);
 Status GdipGetPathGradientSurroundColorCount(Handle brush, out int count);
 Status GdipGetPathGradientSurroundColorsWithCount(Handle brush, int* color, ref int count);
-Status GdipSetPathGradientSurroundColorsWithCount(Handle brush, int* color, ref int count);
+Status GdipSetPathGradientSurroundColorsWithCount(Handle brush, in int* color, ref int count);
 Status GdipGetPathGradientCenterPoint(Handle brush, ref GpPointF point);
 Status GdipSetPathGradientCenterPoint(Handle brush, ref GpPointF point);
 Status GdipGetPathGradientRect(Handle brush, ref GpRectF rect);
 Status GdipGetPathGradientBlendCount(Handle brush, out int count);
-Status GdipGetPathGradientBlend(Handle brush, float* blend, float* positions, int count);
-Status GdipSetPathGradientBlend(Handle brush, float* blend, float* positions, int count);
+Status GdipGetPathGradientBlend(Handle brush, float* blend, float* positions, in int count);
+Status GdipSetPathGradientBlend(Handle brush, in float* blend, in float* positions, in int count);
 Status GdipGetPathGradientPresetBlendCount(Handle brush, out int count);
-Status GdipGetPathGradientPresetBlend(Handle brush, int* blend, float* positions, int count);
-Status GdipSetPathGradientPresetBlend(Handle brush, int* blend, float* positions, int count);
-Status GdipSetPathGradientSigmaBlend(Handle brush, float focus, float scale);
-Status GdipSetPathGradientLinearBlend(Handle brush, float focus, float scale);
+Status GdipGetPathGradientPresetBlend(Handle brush, int* blend, float* positions, in int count);
+Status GdipSetPathGradientPresetBlend(Handle brush, in int* blend, in float* positions, in int count);
+Status GdipSetPathGradientSigmaBlend(Handle brush, in float focus, in float scale);
+Status GdipSetPathGradientLinearBlend(Handle brush, in float focus, in float scale);
 Status GdipGetPathGradientTransform(Handle brush, out Handle matrix);
 Status GdipSetPathGradientTransform(Handle brush, Handle matrix);
 Status GdipResetPathGradientTransform(Handle brush);
-Status GdipMultiplyPathGradientTransform(Handle brush, Handle matrix, MatrixOrder order);
-Status GdipRotatePathGradientTransform(Handle brush, float angle, MatrixOrder order);
-Status GdipTranslatePathGradientTransform(Handle brush, float dx, float dy, MatrixOrder order);
-Status GdipScalePathGradientTransform(Handle brush, float sx, float sy, MatrixOrder order);
+Status GdipMultiplyPathGradientTransform(Handle brush, Handle matrix, in MatrixOrder order);
+Status GdipRotatePathGradientTransform(Handle brush, in float angle, in MatrixOrder order);
+Status GdipTranslatePathGradientTransform(Handle brush, in float dx, in float dy, in MatrixOrder order);
+Status GdipScalePathGradientTransform(Handle brush, in float sx, in float sy, in MatrixOrder order);
 Status GdipGetPathGradientFocusScales(Handle brush, out float xScale, out float yScale);
-Status GdipSetPathGradientFocusScales(Handle brush, float xScale, float yScale);
+Status GdipSetPathGradientFocusScales(Handle brush, in float xScale, in float yScale);
 Status GdipGetPathGradientWrapMode(Handle brush, out WrapMode wrapMode);
-Status GdipSetPathGradientWrapMode(Handle brush, WrapMode wrapMode);
+Status GdipSetPathGradientWrapMode(Handle brush, in WrapMode wrapMode);
 
 //added
 
-Status GdipResetTextureTransform( Handle brush );
-Status GdipScaleTextureTransform( Handle brush, float sx, float sy, MatrixOrder order );
-Status GdipTranslateTextureTransform( Handle brush, float dx, float dy, MatrixOrder order);
+Status GdipResetTextureTransform(Handle brush);
+Status GdipScaleTextureTransform(Handle brush, in float sx, in float sy, in MatrixOrder order);
+Status GdipTranslateTextureTransform(Handle brush, in float dx, in float dy, in MatrixOrder order);
 Status GdipStringFormatGetGenericDefault(out Handle format);
 Status GdipStringFormatGetGenericTypographic(out Handle format);
-Status GdipSetStringFormatHotkeyPrefix(Handle format, int hotkeyPrefix);
-Status GdipSetStringFormatTabStops( Handle format, float firstTabOffset, int count, float* tabStops);
+Status GdipSetStringFormatHotkeyPrefix(Handle format, in int hotkeyPrefix);
+Status GdipSetStringFormatTabStops(Handle format, in float firstTabOffset, in int count, in float* tabStops);
 
 void loadLib_Gdip(){
     // do nothing in this version
@@ -728,8 +728,8 @@
 }
 else{ // version(!STATIC_GDIPLUS)
 import java.nonstandard.SharedLib;
-Status function( uint* token, GdiplusStartupInput* input, GdiplusStartupOutput* output) GdiplusStartup;
-void   function(uint token) GdiplusShutdown;
+Status function(uint* token, GdiplusStartupInput* input, GdiplusStartupOutput* output) GdiplusStartup;
+void   function(in uint token) GdiplusShutdown;
 Status function(Handle hdc, out Handle graphics) GdipCreateFromHDC;
 Status function(Handle hdc, Handle hDevice, out Handle graphics) GdipCreateFromHDC2;
 Status function(Handle hwnd, out Handle graphics) GdipCreateFromHWND;
@@ -737,116 +737,116 @@
 Status function(Handle graphics) GdipDeleteGraphics;
 Status function(Handle graphics, out Handle hdc) GdipGetDC;
 Status function(Handle graphics, Handle hdc) GdipReleaseDC;
-Status function(Handle graphics, Handle srcgraphics, CombineMode combineMode) GdipSetClipGraphics;
-Status function(Handle graphics, int x, int y, int width, int height, CombineMode combineMode) GdipSetClipRectI;
-Status function(Handle graphics, float x, float y, float width, float height, CombineMode combineMode) GdipSetClipRect;
-Status function(Handle graphics, Handle path, CombineMode combineMode) GdipSetClipPath;
-Status function(Handle graphics, Handle region, CombineMode combineMode) GdipSetClipRegion;
-Status function(Handle graphics, HRGN hRgn, CombineMode combineMode) GdipSetClipHrgn;
+Status function(Handle graphics, Handle srcgraphics, in CombineMode combineMode) GdipSetClipGraphics;
+Status function(Handle graphics, in int x, in int y, in int width, in int height, in CombineMode combineMode) GdipSetClipRectI;
+Status function(Handle graphics, in float x, in float y, in float width, in float height, in CombineMode combineMode) GdipSetClipRect;
+Status function(Handle graphics, Handle path, in CombineMode combineMode) GdipSetClipPath;
+Status function(Handle graphics, Handle region, in CombineMode combineMode) GdipSetClipRegion;
+Status function(Handle graphics, HRGN hRgn, in CombineMode combineMode) GdipSetClipHrgn;
 Status function(Handle graphics, out Handle region) GdipGetClip;
 Status function(Handle graphics) GdipResetClip;
 Status function(Handle graphics, out uint state) GdipSaveGraphics;
-Status function(Handle graphics, int state) GdipRestoreGraphics;
-Status function(Handle graphics, FlushIntention intention) GdipFlush;
-Status function(Handle graphics, float sx, float sy, MatrixOrder order) GdipScaleWorldTransform;
-Status function(Handle graphics, float angle, MatrixOrder order) GdipRotateWorldTransform;
-Status function(Handle graphics, float dx, float dy, MatrixOrder order) GdipTranslateWorldTransform;
-Status function(Handle graphics, Handle matrix, MatrixOrder order) GdipMultiplyWorldTransform;
+Status function(Handle graphics, in int state) GdipRestoreGraphics;
+Status function(Handle graphics, in FlushIntention intention) GdipFlush;
+Status function(Handle graphics, in float sx, in float sy, in MatrixOrder order) GdipScaleWorldTransform;
+Status function(Handle graphics, in float angle, in MatrixOrder order) GdipRotateWorldTransform;
+Status function(Handle graphics, in float dx, in float dy, in MatrixOrder order) GdipTranslateWorldTransform;
+Status function(Handle graphics, Handle matrix, in MatrixOrder order) GdipMultiplyWorldTransform;
 Status function(Handle graphics) GdipResetWorldTransform;
-Status function(Handle graphics, ref GpRectF dstrect, ref GpRectF srcrect, GraphicsUnit unit, out int state) GdipBeginContainer;
-Status function(Handle graphics, ref GpRect dstrect, ref GpRect srcrect, GraphicsUnit unit, out int state) GdipBeginContainerI;
+Status function(Handle graphics, ref GpRectF dstrect, ref GpRectF srcrect, in GraphicsUnit unit, out int state) GdipBeginContainer;
+Status function(Handle graphics, ref GpRect dstrect, ref GpRect srcrect, in GraphicsUnit unit, out int state) GdipBeginContainerI;
 Status function(Handle graphics, out int state) GdipBeginContainer2;
-Status function(Handle graphics, int state) GdipEndContainer;
+Status function(Handle graphics, in int state) GdipEndContainer;
 Status function(Handle graphics, out float dpi) GdipGetDpiX;
 Status function(Handle graphics, out float dpi) GdipGetDpiY;
 Status function(Handle graphics, out GraphicsUnit unit) GdipGetPageUnit;
-Status function(Handle graphics, GraphicsUnit unit) GdipSetPageUnit;
+Status function(Handle graphics, in GraphicsUnit unit) GdipSetPageUnit;
 Status function(Handle graphics, out float scale) GdipGetPageScale;
-Status function(Handle graphics, float scale) GdipSetPageScale;
+Status function(Handle graphics, in float scale) GdipSetPageScale;
 Status function(Handle graphics, Handle matrix) GdipGetWorldTransform;
 Status function(Handle graphics, Handle matrix) GdipSetWorldTransform;
 Status function(Handle graphics, out CompositingMode compositingMode) GdipGetCompositingMode;
-Status function(Handle graphics, CompositingMode compositingMode) GdipSetCompositingMode;
+Status function(Handle graphics, in CompositingMode compositingMode) GdipSetCompositingMode;
 Status function(Handle graphics, out CompositingQuality compositingQuality) GdipGetCompositingQuality;
-Status function(Handle graphics, CompositingQuality compositingQuality) GdipSetCompositingQuality;
+Status function(Handle graphics, in CompositingQuality compositingQuality) GdipSetCompositingQuality;
 Status function(Handle graphics, out InterpolationMode interpolationMode) GdipGetInterpolationMode;
-Status function(Handle graphics, InterpolationMode interpolationMode) GdipSetInterpolationMode;
+Status function(Handle graphics, in InterpolationMode interpolationMode) GdipSetInterpolationMode;
 Status function(Handle graphics, out SmoothingMode smoothingMode) GdipGetSmoothingMode;
-Status function(Handle graphics, SmoothingMode smoothingMode) GdipSetSmoothingMode;
+Status function(Handle graphics, in SmoothingMode smoothingMode) GdipSetSmoothingMode;
 Status function(Handle graphics, out PixelOffsetMode pixelOffsetMode) GdipGetPixelOffsetMode;
-Status function(Handle graphics, PixelOffsetMode pixelOffsetMode) GdipSetPixelOffsetMode;
+Status function(Handle graphics, in PixelOffsetMode pixelOffsetMode) GdipSetPixelOffsetMode;
 Status function(Handle graphics, out uint textContrast) GdipGetTextContrast;
-Status function(Handle graphics, uint textContrast) GdipSetTextContrast;
-Status function(Handle graphics, int color) GdipGraphicsClear;
-Status function(Handle graphics, Handle pen, float x1, float y1, float x2, float y2) GdipDrawLine;
-Status function(Handle graphics, Handle pen, GpPointF* points, int count) GdipDrawLines;
-Status function(Handle graphics, Handle pen, int x1, int y1, int x2, int y2) GdipDrawLineI;
-Status function(Handle graphics, Handle pen, GpPoint* points, int count) GdipDrawLinesI;
-Status function(Handle graphics, Handle pen, float x, float y, float width, float height, float startAngle, float sweepAngle) GdipDrawArc;
-Status function(Handle graphics, Handle pen, int x, int y, int width, int height, float startAngle, float sweepAngle) GdipDrawArcI;
-Status function(Handle graphics, Handle pen, float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4) GdipDrawBezier;
-Status function(Handle graphics, Handle pen, GpPointF* points, int count) GdipDrawBeziers;
-Status function(Handle graphics, Handle pen, int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4) GdipDrawBezierI;
-Status function(Handle graphics, Handle pen, GpPoint* points, int count) GdipDrawBeziersI;
-Status function(Handle graphics, Handle pen, float x, float y, float width, float height) GdipDrawRectangle;
-Status function(Handle graphics, Handle pen, GpRectF* rects, int count) GdipDrawRectangles;
-Status function(Handle graphics, Handle pen, int x, int y, int width, int height) GdipDrawRectangleI;
-Status function(Handle graphics, Handle pen, GpRect* rects, int count) GdipDrawRectanglesI;
-Status function(Handle graphics, Handle pen, float x, float y, float width, float height) GdipDrawEllipse;
-Status function(Handle graphics, Handle pen, int x, int y, int width, int height) GdipDrawEllipseI;
-Status function(Handle graphics, Handle pen, float x, float y, float width, float height, float startAngle, float sweepAngle) GdipDrawPie;
-Status function(Handle graphics, Handle pen, int x, int y, int width, int height, float startAngle, float sweepAngle) GdipDrawPieI;
-Status function(Handle graphics, Handle pen, GpPointF* points, int count) GdipDrawPolygon;
-Status function(Handle graphics, Handle pen, GpPoint* points, int count) GdipDrawPolygonI;
-Status function(Handle graphics, Handle pen, GpPointF* points, int count) GdipDrawCurve;
-Status function(Handle graphics, Handle pen, GpPointF* points, int count, float tension) GdipDrawCurve2;
-Status function(Handle graphics, Handle pen, GpPointF* points, int count, int offset, int numberOfSegments, float tension) GdipDrawCurve3;
-Status function(Handle graphics, Handle pen, GpPoint* points, int count) GdipDrawCurveI;
-Status function(Handle graphics, Handle pen, GpPoint* points, int count, float tension) GdipDrawCurve2I;
-Status function(Handle graphics, Handle pen, GpPoint* points, int count, int offset, int numberOfSegments, float tension) GdipDrawCurve3I;
-Status function(Handle graphics, Handle pen, GpPointF* points, int count) GdipDrawClosedCurve;
-Status function(Handle graphics, Handle pen, GpPointF* points, int count, float tension) GdipDrawClosedCurve2;
-Status function(Handle graphics, Handle pen, GpPoint* points, int count) GdipDrawClosedCurveI;
-Status function(Handle graphics, Handle pen, GpPoint* points, int count, float tension) GdipDrawClosedCurve2I;
-Status function(Handle graphics, Handle brush, int x, int y, int width, int height) GdipFillRectangleI;
-Status function(Handle graphics, Handle brush, float x, float y, float width, float height) GdipFillRectangle;
-Status function(Handle graphics, Handle brush, GpRect* rects, int count) GdipFillRectanglesI;
-Status function(Handle graphics, Handle brush, GpRectF* rects, int count) GdipFillRectangles;
-Status function(Handle graphics, Handle brush, GpPointF* rects, int count, FillMode fillMode) GdipFillPolygon;
-Status function(Handle graphics, Handle brush, GpPoint* rects, int count, FillMode fillMode) GdipFillPolygonI;
-Status function(Handle graphics, Handle brush, float x, float y, float width, float height) GdipFillEllipse;
-Status function(Handle graphics, Handle brush, int x, int y, int width, int height) GdipFillEllipseI;
-Status function(Handle graphics, Handle brush, float x, float y, float width, float height, float startAngle, float sweepAngle) GdipFillPie;
-Status function(Handle graphics, Handle brush, int x, int y, int width, int height, float startAngle, float sweepAngle) GdipFillPieI;
+Status function(Handle graphics, in uint textContrast) GdipSetTextContrast;
+Status function(Handle graphics, in int color) GdipGraphicsClear;
+Status function(Handle graphics, Handle pen, in float x1, in float y1, in float x2, in float y2) GdipDrawLine;
+Status function(Handle graphics, Handle pen, GpPointF* points, in int count) GdipDrawLines;
+Status function(Handle graphics, Handle pen, in int x1, in int y1, in int x2, in int y2) GdipDrawLineI;
+Status function(Handle graphics, Handle pen, GpPoint* points, in int count) GdipDrawLinesI;
+Status function(Handle graphics, Handle pen, in float x, in float y, in float width, in float height, in float startAngle, in float sweepAngle) GdipDrawArc;
+Status function(Handle graphics, Handle pen, in int x, in int y, in int width, in int height, in float startAngle, in float sweepAngle) GdipDrawArcI;
+Status function(Handle graphics, Handle pen, in float x1, in float y1, in float x2, in float y2, in float x3, in float y3, in float x4, in float y4) GdipDrawBezier;
+Status function(Handle graphics, Handle pen, GpPointF* points, in int count) GdipDrawBeziers;
+Status function(Handle graphics, Handle pen, in int x1, in int y1, in int x2, in int y2, in int x3, in int y3, in int x4, in int y4) GdipDrawBezierI;
+Status function(Handle graphics, Handle pen, GpPoint* points, in int count) GdipDrawBeziersI;
+Status function(Handle graphics, Handle pen, in float x, in float y, in float width, in float height) GdipDrawRectangle;
+Status function(Handle graphics, Handle pen, GpRectF* rects, in int count) GdipDrawRectangles;
+Status function(Handle graphics, Handle pen, in int x, in int y, in int width, in int height) GdipDrawRectangleI;
+Status function(Handle graphics, Handle pen, GpRect* rects, in int count) GdipDrawRectanglesI;
+Status function(Handle graphics, Handle pen, in float x, in float y, in float width, in float height) GdipDrawEllipse;
+Status function(Handle graphics, Handle pen, in int x, in int y, in int width, in int height) GdipDrawEllipseI;
+Status function(Handle graphics, Handle pen, in float x, in float y, in float width, in float height, in float startAngle, in float sweepAngle) GdipDrawPie;
+Status function(Handle graphics, Handle pen, in int x, in int y, in int width, in int height, in float startAngle, in float sweepAngle) GdipDrawPieI;
+Status function(Handle graphics, Handle pen, GpPointF* points, in int count) GdipDrawPolygon;
+Status function(Handle graphics, Handle pen, GpPoint* points, in int count) GdipDrawPolygonI;
+Status function(Handle graphics, Handle pen, GpPointF* points, in int count) GdipDrawCurve;
+Status function(Handle graphics, Handle pen, GpPointF* points, in int count, in float tension) GdipDrawCurve2;
+Status function(Handle graphics, Handle pen, GpPointF* points, in int count, in int offset, in int numberOfSegments, in float tension) GdipDrawCurve3;
+Status function(Handle graphics, Handle pen, GpPoint* points, in int count) GdipDrawCurveI;
+Status function(Handle graphics, Handle pen, GpPoint* points, in int count, in float tension) GdipDrawCurve2I;
+Status function(Handle graphics, Handle pen, GpPoint* points, in int count, in int offset, in int numberOfSegments, in float tension) GdipDrawCurve3I;
+Status function(Handle graphics, Handle pen, GpPointF* points, in int count) GdipDrawClosedCurve;
+Status function(Handle graphics, Handle pen, GpPointF* points, in int count, in float tension) GdipDrawClosedCurve2;
+Status function(Handle graphics, Handle pen, GpPoint* points, in int count) GdipDrawClosedCurveI;
+Status function(Handle graphics, Handle pen, GpPoint* points, in int count, in float tension) GdipDrawClosedCurve2I;
+Status function(Handle graphics, Handle brush, in int x, in int y, in int width, in int height) GdipFillRectangleI;
+Status function(Handle graphics, Handle brush, in float x, in float y, in float width, in float height) GdipFillRectangle;
+Status function(Handle graphics, Handle brush, GpRect* rects, in int count) GdipFillRectanglesI;
+Status function(Handle graphics, Handle brush, GpRectF* rects, in int count) GdipFillRectangles;
+Status function(Handle graphics, Handle brush, GpPointF* rects, in int count, in FillMode fillMode) GdipFillPolygon;
+Status function(Handle graphics, Handle brush, GpPoint* rects, in int count, in FillMode fillMode) GdipFillPolygonI;
+Status function(Handle graphics, Handle brush, in float x, in float y, in float width, in float height) GdipFillEllipse;
+Status function(Handle graphics, Handle brush, in int x, in int y, in int width, in int height) GdipFillEllipseI;
+Status function(Handle graphics, Handle brush, in float x, in float y, in float width, in float height, in float startAngle, in float sweepAngle) GdipFillPie;
+Status function(Handle graphics, Handle brush, in int x, in int y, in int width, in int height, in float startAngle, in float sweepAngle) GdipFillPieI;
 Status function(Handle graphics, Handle brush, Handle path) GdipFillPath;
-Status function(Handle graphics, Handle brush, GpPointF* points, int count) GdipFillClosedCurve;
-Status function(Handle graphics, Handle brush, GpPoint* points, int count) GdipFillClosedCurveI;
-Status function(Handle graphics, Handle brush, GpPointF* points, int count, FillMode fillMode, float tension) GdipFillClosedCurve2;
-Status function(Handle graphics, Handle brush, GpPoint* points, int count, FillMode fillMode, float tension) GdipFillClosedCurve2I;
+Status function(Handle graphics, Handle brush, GpPointF* points, in int count) GdipFillClosedCurve;
+Status function(Handle graphics, Handle brush, GpPoint* points, in int count) GdipFillClosedCurveI;
+Status function(Handle graphics, Handle brush, GpPointF* points, in int count, in FillMode fillMode, in float tension) GdipFillClosedCurve2;
+Status function(Handle graphics, Handle brush, GpPoint* points, in int count, in FillMode fillMode, in float tension) GdipFillClosedCurve2I;
 Status function(Handle graphics, Handle brush, Handle region) GdipFillRegion;
-Status function(Handle graphics, LPCWSTR string, int length, Handle font, ref GpRectF layoutRect, Handle stringFormat, Handle brush) GdipDrawString;
-Status function(Handle graphics, LPCWSTR string, int length, Handle font, ref GpRectF layoutRect, Handle stringFormat, ref GpRectF boundingBox, int* codepointsFitted, int* linesFitted) GdipMeasureString;
+Status function(Handle graphics, LPCWSTR string, in int length, Handle font, ref GpRectF layoutRect, Handle stringFormat, Handle brush) GdipDrawString;
+Status function(Handle graphics, LPCWSTR string, in int length, Handle font, ref GpRectF layoutRect, Handle stringFormat, ref GpRectF boundingBox, int* codepointsFitted, int* linesFitted) GdipMeasureString;
 Status function(Handle format, out int count) GdipGetStringFormatMeasurableCharacterRangeCount;
 Status function(Handle format, out Handle newFormat) GdipCloneStringFormat;
-Status function(Handle graphics, LPCWSTR string, int length, Handle font, ref GpRectF layoutRect, Handle stringFormat, int regionCount, Handle* regions) GdipMeasureCharacterRanges;
-Status function(Handle graphics, Handle image, float x, float y) GdipDrawImage;
-Status function(Handle graphics, Handle image, int x, int y) GdipDrawImageI;
-Status function(Handle graphics, Handle image, float x, float y, float width, float height) GdipDrawImageRect;
-Status function(Handle graphics, Handle image, int x, int y, int width, int height) GdipDrawImageRectI;
-Status function(Handle graphics, Handle image, float x, float y, float srcx, float srcy, float srcwidth, float srcheight, GraphicsUnit srcUnit) GdipDrawImagePointRect;
-Status function(Handle graphics, Handle image, int x, int y, int srcx, int srcy, int srcwidth, int srcheight, GraphicsUnit srcUnit) GdipDrawImagePointRectI;
-Status function(Handle graphics, Handle image, float dstx, float dsty, float dstwidth, float dstheight, float srcx, float srcy, float srcwidth, float srcheight, GraphicsUnit srcUnit, Handle imageAttributes, GpDrawImageAbort callback, void* callbakcData) GdipDrawImageRectRect;
-Status function(Handle graphics, Handle image, int dstx, int dsty, int dstwidth, int dstheight, int srcx, int srcy, int srcwidth, int srcheight, GraphicsUnit srcUnit, Handle imageAttributes, GpDrawImageAbort callback, void* callbakcData) GdipDrawImageRectRectI;
-Status function(Handle graphics, Handle image, GpPointF* dstpoints, int count) GdipDrawImagePoints;
-Status function(Handle graphics, Handle image, GpPoint* dstpoints, int count) GdipDrawImagePointsI;
-Status function(Handle graphics, Handle image, GpPointF* dstpoints, int count, float srcx, float srcy, float srcwidth, float srcheight, GraphicsUnit srcUnit, Handle imageAttributes, GpDrawImageAbort callback, void* callbakcData) GdipDrawImagePointsRect;
-Status function(Handle graphics, Handle image, GpPoint* dstpoints, int count, int srcx, int srcy, int srcwidth, int srcheight, GraphicsUnit srcUnit, Handle imageAttributes, GpDrawImageAbort callback, void* callbakcData) GdipDrawImagePointsRectI;
-Status function(Handle graphics, float x, float y, out int result) GdipIsVisiblePoint;
-Status function(Handle graphics, int x, int y, out int result) GdipIsVisiblePointI;
-Status function(Handle graphics, float x, float y, float width, float height, out int result) GdipIsVisibleRect;
-Status function(Handle graphics, int x, int y, int width, int height, out int result) GdipIsVisibleRectI;
+Status function(Handle graphics, LPCWSTR string, in int length, Handle font, ref GpRectF layoutRect, Handle stringFormat, in int regionCount, Handle* regions) GdipMeasureCharacterRanges;
+Status function(Handle graphics, Handle image, in float x, in float y) GdipDrawImage;
+Status function(Handle graphics, Handle image, in int x, in int y) GdipDrawImageI;
+Status function(Handle graphics, Handle image, in float x, in float y, in float width, in float height) GdipDrawImageRect;
+Status function(Handle graphics, Handle image, in int x, in int y, in int width, in int height) GdipDrawImageRectI;
+Status function(Handle graphics, Handle image, in float x, in float y, in float srcx, in float srcy, in float srcwidth, in float srcheight, in GraphicsUnit srcUnit) GdipDrawImagePointRect;
+Status function(Handle graphics, Handle image, in int x, in int y, in int srcx, in int srcy, in int srcwidth, in int srcheight, in GraphicsUnit srcUnit) GdipDrawImagePointRectI;
+Status function(Handle graphics, Handle image, in float dstx, in float dsty, in float dstwidth, in float dstheight, in float srcx, in float srcy, in float srcwidth, in float srcheight, in GraphicsUnit srcUnit, Handle imageAttributes, GpDrawImageAbort callback, void* callbakcData) GdipDrawImageRectRect;
+Status function(Handle graphics, Handle image, in int dstx, in int dsty, in int dstwidth, in int dstheight, in int srcx, in int srcy, in int srcwidth, in int srcheight, in GraphicsUnit srcUnit, Handle imageAttributes, GpDrawImageAbort callback, void* callbakcData) GdipDrawImageRectRectI;
+Status function(Handle graphics, Handle image, GpPointF* dstpoints, in int count) GdipDrawImagePoints;
+Status function(Handle graphics, Handle image, GpPoint* dstpoints, in int count) GdipDrawImagePointsI;
+Status function(Handle graphics, Handle image, GpPointF* dstpoints, in int count, in float srcx, in float srcy, in float srcwidth, in float srcheight, in GraphicsUnit srcUnit, Handle imageAttributes, GpDrawImageAbort callback, void* callbakcData) GdipDrawImagePointsRect;
+Status function(Handle graphics, Handle image, GpPoint* dstpoints, in int count, in int srcx, in int srcy, in int srcwidth, in int srcheight, in GraphicsUnit srcUnit, Handle imageAttributes, GpDrawImageAbort callback, void* callbakcData) GdipDrawImagePointsRectI;
+Status function(Handle graphics, in float x, in float y, out int result) GdipIsVisiblePoint;
+Status function(Handle graphics, in int x, in int y, out int result) GdipIsVisiblePointI;
+Status function(Handle graphics, in float x, in float y, in float width, in float height, out int result) GdipIsVisibleRect;
+Status function(Handle graphics, in int x, in int y, in int width, in int height, out int result) GdipIsVisibleRectI;
 Status function(Handle graphics, out TextRenderingHint mode) GdipGetTextRenderingHint;
-Status function(Handle graphics, TextRenderingHint mode) GdipSetTextRenderingHint;
+Status function(Handle graphics, in TextRenderingHint mode) GdipSetTextRenderingHint;
 Status function(Handle graphics, out GpRectF rect) GdipGetClipBounds;
 Status function(Handle graphics, out GpRect rect) GdipGetClipBoundsI;
 Status function(Handle graphics, out GpRectF rect) GdipGetVisibleClipBounds;
@@ -854,115 +854,115 @@
 Status function(Handle graphics, out int result) GdipIsClipEmpty;
 Status function(Handle graphics, out int result) GdipIsVisibleClipEmpty;
 Status function(Handle graphics, out int x, out int y) GdipGetRenderingOrigin;
-Status function(Handle graphics, int x, int y) GdipSetRenderingOrigin;
+Status function(Handle graphics, in int x, in int y) GdipSetRenderingOrigin;
 Status function(Handle graphics, ref int argb) GdipGetNearestColor;
-Status function(Handle graphics, uint sizeData, ubyte* data) GdipComment;
-Status function(Handle graphics, CoordinateSpace destSpace, CoordinateSpace srcSpace, GpPointF* points, int count) GdipTransformPoints;
-Status function(Handle graphics, CoordinateSpace destSpace, CoordinateSpace srcSpace, GpPoint* points, int count) GdipTransformPointsI;
+Status function(Handle graphics, in uint sizeData, ubyte* data) GdipComment;
+Status function(Handle graphics, in CoordinateSpace destSpace, in CoordinateSpace srcSpace, GpPointF* points, in int count) GdipTransformPoints;
+Status function(Handle graphics, in CoordinateSpace destSpace, in CoordinateSpace srcSpace, GpPoint* points, in int count) GdipTransformPointsI;
 Status function(out Handle matrix) GdipCreateMatrix;
-Status function(float m11, float m12, float m21, float m22, float dx, float dy, out Handle matrix) GdipCreateMatrix2;
+Status function(in float m11, in float m12, in float m21, in float m22, in float dx, in float dy, out Handle matrix) GdipCreateMatrix2;
 Status function(ref GpRectF rect, GpPointF* dstplg, out Handle matrix) GdipCreateMatrix3;
 Status function(ref GpRect rect, GpPoint* dstplg, out Handle matrix) GdipCreateMatrix3I;
 Status function(Handle matrix) GdipDeleteMatrix;
 Status function(Handle matrix, out Handle cloneMatrix) GdipCloneMatrix;
 Status function(Handle matrix, float* matrixOut) GdipGetMatrixElements;
-Status function(Handle matrix, float m11, float m12, float m21, float m22, float xy, float dy) GdipSetMatrixElements;
+Status function(Handle matrix, in float m11, in float m12, in float m21, in float m22, in float xy, in float dy) GdipSetMatrixElements;
 Status function(Handle matrix) GdipInvertMatrix;
-Status function(Handle matrix, Handle matrix2, MatrixOrder order) GdipMultiplyMatrix;
-Status function(Handle matrix, float scaleX, float scaleY, MatrixOrder order) GdipScaleMatrix;
-Status function(Handle matrix, float shearX, float shearY, MatrixOrder order) GdipShearMatrix;
-Status function(Handle matrix, float angle, MatrixOrder order) GdipRotateMatrix;
-Status function(Handle matrix, float offsetX, float offsetY, MatrixOrder order) GdipTranslateMatrix;
+Status function(Handle matrix, Handle matrix2, in MatrixOrder order) GdipMultiplyMatrix;
+Status function(Handle matrix, in float scaleX, in float scaleY, in MatrixOrder order) GdipScaleMatrix;
+Status function(Handle matrix, in float shearX, in float shearY, in MatrixOrder order) GdipShearMatrix;
+Status function(Handle matrix, in float angle, in MatrixOrder order) GdipRotateMatrix;
+Status function(Handle matrix, in float offsetX, in float offsetY, in MatrixOrder order) GdipTranslateMatrix;
 Status function(Handle matrix, out int result) GdipIsMatrixIdentity;
 Status function(Handle matrix, out int result) GdipIsMatrixInvertible;
-Status function(Handle matrix, GpPointF *pts, int count) GdipTransformMatrixPoints;
+Status function(Handle matrix, GpPointF *pts, in int count) GdipTransformMatrixPoints;
 Status function(Handle brush, out BrushType type ) GdipGetBrushType;
 Status function(Handle brush, out Handle cloneBrush) GdipCloneBrush;
 Status function(Handle brush) GdipDeleteBrush;
-Status function(int color, out Handle brush) GdipCreateSolidFill;
+Status function(in int color, out Handle brush) GdipCreateSolidFill;
 Status function(Handle brush, out int color) GdipGetSolidFillColor;
-Status function(Handle brush, int color) GdipSetSolidFillColor;
-Status function(Handle image, WrapMode wrapMode, out Handle texture) GdipCreateTexture;
-Status function(Handle image, WrapMode wrapMode, float x, float y, float width, float height, out Handle texture) GdipCreateTexture2;
-Status function(Handle image, WrapMode wrapMode, int x, int y, int width, int height, out Handle texture) GdipCreateTexture2I;
+Status function(Handle brush, in int color) GdipSetSolidFillColor;
+Status function(Handle image, in WrapMode wrapMode, out Handle texture) GdipCreateTexture;
+Status function(Handle image, in WrapMode wrapMode, in float x, in float y, in float width, in float height, out Handle texture) GdipCreateTexture2;
+Status function(Handle image, in WrapMode wrapMode, in int x, in int y, in int width, in int height, out Handle texture) GdipCreateTexture2I;
 Status function(Handle brush, out Handle image) GdipGetTextureImage;
 Status function(Handle brush, out Handle matrix) GdipGetTextureTransform;
 Status function(Handle brush, Handle matrix) GdipSetTextureTransform;
 Status function(Handle brush, out WrapMode wrapmode) GdipGetTextureWrapMode;
-Status function(Handle brush, WrapMode wrapmode) GdipSetTextureWrapMode;
-Status function(HatchStyle hatchstyle, int forecol, int backcol, out Handle brush) GdipCreateHatchBrush;
+Status function(Handle brush, in WrapMode wrapmode) GdipSetTextureWrapMode;
+Status function(in HatchStyle hatchstyle, in int forecol, in int backcol, out Handle brush) GdipCreateHatchBrush;
 Status function(Handle brush, out HatchStyle hatchstyle) GdipGetHatchStyle;
 Status function(Handle brush, out int forecol) GdipGetHatchForegroundColor;
 Status function(Handle brush, out int backcol) GdipGetHatchBackgroundColor;
-Status function(ref GpPoint point1, ref GpPoint point2, int color1, int color2, WrapMode wrapMode, out Handle lineGradient) GdipCreateLineBrushI;
-Status function(ref GpPointF point1, ref GpPointF point2, int color1, int color2, WrapMode wrapMode, out Handle lineGradient) GdipCreateLineBrush;
-Status function(ref GpRect rect, int color1, int color2, LinearGradientMode mode, WrapMode wrapMode, out Handle lineGradient) GdipCreateLineBrushFromRectI;
-Status function(ref GpRectF rect, int color1, int color2, LinearGradientMode mode, WrapMode wrapMode, out Handle lineGradient) GdipCreateLineBrushFromRect;
-Status function(ref GpRect rect, int color1, int color2, float angle, int isAngleScalable, WrapMode wrapMode, out Handle lineGradient) GdipCreateLineBrushFromRectWithAngleI;
-Status function(ref GpRectF rect, int color1, int color2, float angle, int isAngleScalable, WrapMode wrapMode, out Handle lineGradient) GdipCreateLineBrushFromRectWithAngle;
+Status function(ref GpPoint point1, ref GpPoint point2, in int color1, in int color2, in WrapMode wrapMode, out Handle lineGradient) GdipCreateLineBrushI;
+Status function(ref GpPointF point1, ref GpPointF point2, in int color1, in int color2, in WrapMode wrapMode, out Handle lineGradient) GdipCreateLineBrush;
+Status function(ref GpRect rect, in int color1, in int color2, in LinearGradientMode mode, in WrapMode wrapMode, out Handle lineGradient) GdipCreateLineBrushFromRectI;
+Status function(ref GpRectF rect, in int color1, in int color2, in LinearGradientMode mode, in WrapMode wrapMode, out Handle lineGradient) GdipCreateLineBrushFromRect;
+Status function(ref GpRect rect, in int color1, in int color2, in float angle, in int isAngleScalable, in WrapMode wrapMode, out Handle lineGradient) GdipCreateLineBrushFromRectWithAngleI;
+Status function(ref GpRectF rect, in int color1, in int color2, in float angle, in int isAngleScalable, in WrapMode wrapMode, out Handle lineGradient) GdipCreateLineBrushFromRectWithAngle;
 Status function(Handle brush, out int count) GdipGetLineBlendCount;
-Status function(Handle brush, float* blend, float* positions, int count) GdipGetLineBlend;
-Status function(Handle brush, float* blend, float* positions, int count) GdipSetLineBlend;
+Status function(Handle brush, float* blend, float* positions, in int count) GdipGetLineBlend;
+Status function(Handle brush, in float* blend, in float* positions, in int count) GdipSetLineBlend;
 Status function(Handle brush, out int count) GdipGetLinePresetBlendCount;
-Status function(Handle brush, uint* blend, float* positions, int count) GdipGetLinePresetBlend;
-Status function(Handle brush, uint* blend, float* positions, int count) GdipSetLinePresetBlend;
+Status function(Handle brush, uint* blend, float* positions, in int count) GdipGetLinePresetBlend;
+Status function(Handle brush, in uint* blend, in float* positions, in int count) GdipSetLinePresetBlend;
 Status function(Handle brush, out WrapMode wrapmode) GdipGetLineWrapMode;
-Status function(Handle brush, WrapMode wrapmode) GdipSetLineWrapMode;
+Status function(Handle brush, in WrapMode wrapmode) GdipSetLineWrapMode;
 Status function(Handle brush, out GpRectF rect) GdipGetLineRect;
 Status function(Handle brush, int* colors) GdipGetLineColors;
-Status function(Handle brush, int color1, int color2) GdipSetLineColors;
+Status function(Handle brush, in int color1, in int color2) GdipSetLineColors;
 Status function(Handle brush, out int useGammaCorrection) GdipGetLineGammaCorrection;
-Status function(Handle brush, int useGammaCorrection) GdipSetLineGammaCorrection;
-Status function(Handle brush, float focus, float scale) GdipSetLineSigmaBlend;
-Status function(Handle brush, float focus, float scale) GdipSetLineLinearBlend;
+Status function(Handle brush, in int useGammaCorrection) GdipSetLineGammaCorrection;
+Status function(Handle brush, in float focus, in float scale) GdipSetLineSigmaBlend;
+Status function(Handle brush, in float focus, in float scale) GdipSetLineLinearBlend;
 Status function(Handle brush, out Handle matrix) GdipGetLineTransform;
 Status function(Handle brush, Handle matrix) GdipSetLineTransform;
 Status function(Handle brush) GdipResetLineTransform;
-Status function(Handle brush, Handle matrix, MatrixOrder order) GdipMultiplyLineTransform;
-Status function(Handle brush, float dx, float dy, MatrixOrder order) GdipTranslateLineTransform;
-Status function(Handle brush, float sx, float sy, MatrixOrder order) GdipScaleLineTransform;
-Status function(Handle brush, float angle, MatrixOrder order) GdipRotateLineTransform;
-Status function(int argb, float width, GraphicsUnit unit, out Handle pen) GdipCreatePen1;
-Status function(Handle brush, float width, GraphicsUnit unit, out Handle pen) GdipCreatePen2;
+Status function(Handle brush, Handle matrix, in MatrixOrder order) GdipMultiplyLineTransform;
+Status function(Handle brush, in float dx, in float dy, in MatrixOrder order) GdipTranslateLineTransform;
+Status function(Handle brush, in float sx, in float sy, in MatrixOrder order) GdipScaleLineTransform;
+Status function(Handle brush, in float angle, in MatrixOrder order) GdipRotateLineTransform;
+Status function(in int argb, in float width, in GraphicsUnit unit, out Handle pen) GdipCreatePen1;
+Status function(Handle brush, in float width, in GraphicsUnit unit, out Handle pen) GdipCreatePen2;
 Status function(Handle pen) GdipDeletePen;
 Status function(Handle pen, out Handle clonepen) GdipClonePen;
-Status function(Handle pen, LineCap startCap, LineCap endCap, DashCap dashCap) GdipSetPenLineCap197819;
+Status function(Handle pen, in LineCap startCap, in LineCap endCap, in DashCap dashCap) GdipSetPenLineCap197819;
 Status function(Handle pen, out LineCap startCap) GdipGetPenStartCap;
-Status function(Handle pen, LineCap startCap) GdipSetPenStartCap;
+Status function(Handle pen, in LineCap startCap) GdipSetPenStartCap;
 Status function(Handle pen, out LineCap endCap) GdipGetPenEndCap;
-Status function(Handle pen, LineCap endCap) GdipSetPenEndCap;
+Status function(Handle pen, in LineCap endCap) GdipSetPenEndCap;
 Status function(Handle pen, out DashCap endCap) GdipGetPenDashCap197819;
-Status function(Handle pen, DashCap endCap) GdipSetPenDashCap197819;
+Status function(Handle pen, in DashCap endCap) GdipSetPenDashCap197819;
 Status function(Handle pen, out LineJoin lineJoin) GdipGetPenLineJoin;
-Status function(Handle pen, LineJoin lineJoin) GdipSetPenLineJoin;
+Status function(Handle pen, in LineJoin lineJoin) GdipSetPenLineJoin;
 Status function(Handle pen, out float miterLimit) GdipGetPenMiterLimit;
-Status function(Handle pen, float miterLimit) GdipSetPenMiterLimit;
+Status function(Handle pen, in float miterLimit) GdipSetPenMiterLimit;
 Status function(Handle pen, out PenAlignment penMode) GdipGetPenMode;
-Status function(Handle pen, PenAlignment penMode) GdipSetPenMode;
+Status function(Handle pen, in PenAlignment penMode) GdipSetPenMode;
 Status function(Handle pen, out Handle matrix) GdipGetPenTransform;
 Status function(Handle pen, Handle matrix) GdipSetPenTransform;
 Status function(Handle pen) GdipResetPenTransform;
-Status function(Handle pen, Handle matrix, MatrixOrder order) GdipMultiplyPenTransform;
-Status function(Handle pen, float dx, float dy, MatrixOrder order) GdipTranslatePenTransform;
-Status function(Handle pen, float sx, float sy, MatrixOrder order) GdipScalePenTransform;
-Status function(Handle pen, float angle, MatrixOrder order) GdipRotatePenTransform;
+Status function(Handle pen, Handle matrix, in MatrixOrder order) GdipMultiplyPenTransform;
+Status function(Handle pen, in float dx, in float dy, in MatrixOrder order) GdipTranslatePenTransform;
+Status function(Handle pen, in float sx, in float sy, in MatrixOrder order) GdipScalePenTransform;
+Status function(Handle pen, in float angle, in MatrixOrder order) GdipRotatePenTransform;
 Status function(Handle pen, out int argb) GdipGetPenColor;
-Status function(Handle pen, int argb) GdipSetPenColor;
+Status function(Handle pen, in int argb) GdipSetPenColor;
 Status function(Handle pen, out float width) GdipGetPenWidth;
-Status function(Handle pen, float width) GdipSetPenWidth;
+Status function(Handle pen, in float width) GdipSetPenWidth;
 Status function(Handle pen, out PenType type) GdipGetPenFillType;
 Status function(Handle pen, out Handle brush) GdipGetPenBrushFill;
 Status function(Handle pen, Handle brush) GdipSetPenBrushFill;
 Status function(Handle pen, out DashStyle dashstyle) GdipGetPenDashStyle;
-Status function(Handle pen, DashStyle dashstyle) GdipSetPenDashStyle;
+Status function(Handle pen, in DashStyle dashstyle) GdipSetPenDashStyle;
 Status function(Handle pen, out float offset) GdipGetPenDashOffset;
-Status function(Handle pen, float offset) GdipSetPenDashOffset;
+Status function(Handle pen, in float offset) GdipSetPenDashOffset;
 Status function(Handle pen, out int count) GdipGetPenDashCount;
-Status function(Handle pen, float* dash, int count) GdipGetPenDashArray;
-Status function(Handle pen, float* dash, int count) GdipSetPenDashArray;
+Status function(Handle pen, float* dash, in int count) GdipGetPenDashArray;
+Status function(Handle pen, in float* dash, in int count) GdipSetPenDashArray;
 Status function(Handle pen, out int count) GdipGetPenCompoundCount;
-Status function(Handle pen, float* dash, int count) GdipGetPenCompoundArray;
-Status function(Handle pen, float* dash, int count) GdipSetPenCompoundArray;
+Status function(Handle pen, float* dash, in int count) GdipGetPenCompoundArray;
+Status function(Handle pen, in float* dash, in int count) GdipSetPenCompoundArray;
 Status function(out Handle region) GdipCreateRegion;
 Status function(ref GpRectF rect, out Handle region) GdipCreateRegionRect;
 Status function(ref GpRect rect, out Handle region) GdipCreateRegionRectI;
@@ -971,22 +971,22 @@
 Status function(Handle region) GdipDeleteRegion;
 Status function(Handle region) GdipSetInfinite;
 Status function(Handle region) GdipSetEmpty;
-Status function(Handle region, ref GpRectF rect, CombineMode combineMode) GdipCombineRegionRect;
-Status function(Handle region, ref GpRect rect, CombineMode combineMode) GdipCombineRegionRectI;
-Status function(Handle region, Handle path, CombineMode combineMode) GdipCombineRegionPath;
-Status function(Handle region, Handle region, CombineMode combineMode) GdipCombineRegionRegion;
-Status function(Handle region, float dx, float dy) GdipTranslateRegion;
-Status function(Handle region, int dx, int dy) GdipTranslateRegionI;
+Status function(Handle region, ref GpRectF rect, in CombineMode combineMode) GdipCombineRegionRect;
+Status function(Handle region, ref GpRect rect, in CombineMode combineMode) GdipCombineRegionRectI;
+Status function(Handle region, Handle path, in CombineMode combineMode) GdipCombineRegionPath;
+Status function(Handle region, Handle region, in CombineMode combineMode) GdipCombineRegionRegion;
+Status function(Handle region, in float dx, in float dy) GdipTranslateRegion;
+Status function(Handle region, in int dx, in int dy) GdipTranslateRegionI;
 Status function(Handle region, Handle matrix) GdipTransformRegion;
 Status function(Handle region, Handle graphics, out GpRectF rect) GdipGetRegionBounds;
 Status function(Handle region, Handle graphics, out Handle hRgn) GdipGetRegionHRgn;
 Status function(Handle region, Handle graphics, out int result) GdipIsEmptyRegion;
 Status function(Handle region, Handle graphics, out int result) GdipIsInfiniteRegion;
 Status function(Handle region1, Handle region2, Handle graphics, out int result) GdipIsEqualRegion;
-Status function(Handle region, float x, float y, Handle graphics, out int result) GdipIsVisibleRegionPoint;
-Status function(Handle region, float x, float y, float width, float height, Handle graphics, out int result) GdipIsVisibleRegionRect;
-Status function(Handle region, int x, int y, Handle graphics, out int result) GdipIsVisibleRegionPointI;
-Status function(Handle region, int x, int y, int width, int height, Handle graphics, out int result) GdipIsVisibleRegionRectI;
+Status function(Handle region, in float x, in float y, Handle graphics, out int result) GdipIsVisibleRegionPoint;
+Status function(Handle region, in float x, in float y, in float width, in float height, Handle graphics, out int result) GdipIsVisibleRegionRect;
+Status function(Handle region, in int x, in int y, Handle graphics, out int result) GdipIsVisibleRegionPointI;
+Status function(Handle region, in int x, in int y, in int width, in int height, Handle graphics, out int result) GdipIsVisibleRegionRectI;
 Status function(Handle region, out int count, Handle matrix) GdipGetRegionScansCount;
 Status function(Handle region, GpRectF* rects, out int count, Handle matrix) GdipGetRegionScans;
 Status function(Handle image) GdipDisposeImage;
@@ -1002,97 +1002,97 @@
 Status function(Handle image, out float resolution) GdipGetImageHorizontalResolution;
 Status function(Handle image, out float resolution) GdipGetImageVerticalResolution;
 Status function(Handle image, out int numOfProperty) GdipGetPropertyCount;
-Status function(Handle image, int numOfProperty, int* list) GdipGetPropertyIdList;
+Status function(Handle image, in int numOfProperty, int* list) GdipGetPropertyIdList;
 Status function(Handle image, out PixelFormat format) GdipGetImagePixelFormat;
 Status function(Handle image, out float width, out float height) GdipGetImageDimension;
-Status function(Handle image, int thumbWidth, int thumbHeight, out Handle thumbImage, GpGetThumbnailImageAbort callback, void* callbackData) GdipGetImageThumbnail;
+Status function(Handle image, in int thumbWidth, in int thumbHeight, out Handle thumbImage, GpGetThumbnailImageAbort callback, void* callbackData) GdipGetImageThumbnail;
 Status function(Handle image, out int count) GdipImageGetFrameDimensionsCount;
-Status function(Handle image, RotateFlipType rotateFlipType) GdipImageRotateFlip;
-Status function(Handle image, int propId, out uint propSize) GdipGetPropertyItemSize;
-Status function(Handle image, int propId, uint propSize, GpPropertyItem* buffer) GdipGetPropertyItem;
+Status function(Handle image, in RotateFlipType rotateFlipType) GdipImageRotateFlip;
+Status function(Handle image, in int propId, out uint propSize) GdipGetPropertyItemSize;
+Status function(Handle image, in int propId, in uint propSize, GpPropertyItem* buffer) GdipGetPropertyItem;
 Status function(Handle image, ref GpPropertyItem buffer) GdipSetPropertyItem;
-Status function(Handle image, int propId) GdipRemovePropertyItem;
+Status function(Handle image, in int propId) GdipRemovePropertyItem;
 Status function(Handle image, out uint totalBufferSize, ref int numProperties) GdipGetPropertySize;
-Status function(Handle image, uint totalBufferSize, int numProperties, GpPropertyItem* allItems) GdipGetAllPropertyItems;
+Status function(Handle image, in uint totalBufferSize, in int numProperties, GpPropertyItem* allItems) GdipGetAllPropertyItems;
 Status function(Handle image, out GpRectF srcRect, out GraphicsUnit srcUnit) GdipGetImageBounds;
 Status function(Handle image, out int size) GdipGetImagePaletteSize;
-Status function(Handle image, GpColorPalette* palette, int size) GdipGetImagePalette;
-Status function(Handle image, GpColorPalette* palette) GdipSetImagePalette;
-Status function(int width, int height, int stride, PixelFormat format, ubyte* scan0, out Handle bitmap) GdipCreateBitmapFromScan0;
+Status function(Handle image, GpColorPalette* palette, in int size) GdipGetImagePalette;
+Status function(Handle image, in GpColorPalette* palette) GdipSetImagePalette;
+Status function(in int width, in int height, in int stride, in PixelFormat format, ubyte* scan0, out Handle bitmap) GdipCreateBitmapFromScan0;
 Status function(Handle hbitmap, Handle hpalette, out Handle bitmap) GdipCreateBitmapFromHBITMAP;
 Status function(Handle hicon, out Handle bitmap) GdipCreateBitmapFromHICON;
 Status function(LPCWSTR fileName, out Handle bitmap) GdipCreateBitmapFromFileICM;
 Status function(LPCWSTR fileName, out Handle bitmap) GdipCreateBitmapFromFile;
-Status function(int width, int height, Handle graphics, out Handle bitmap) GdipCreateBitmapFromGraphics;
-Status function(float x, float y, float width, float height, PixelFormat format, Handle srcbitmap, out Handle dstbitmap) GdipCloneBitmapArea;
-Status function(int x, int y, int width, int height, PixelFormat format, Handle srcbitmap, out Handle dstbitmap) GdipCloneBitmapAreaI;
-Status function(Handle bitmap, int x, int y, out int color) GdipBitmapGetPixel;
-Status function(Handle bitmap, int x, int y, int color) GdipBitmapSetPixel;
-Status function(Handle bitmap, GpRect* rect, ImageLockMode flags, PixelFormat format, GpBitmapData* lockedBitmapData) GdipBitmapLockBits;
+Status function(in int width, in int height, Handle graphics, out Handle bitmap) GdipCreateBitmapFromGraphics;
+Status function(in float x, in float y, in float width, in float height, in PixelFormat format, Handle srcbitmap, out Handle dstbitmap) GdipCloneBitmapArea;
+Status function(in int x, in int y, in int width, in int height, in PixelFormat format, Handle srcbitmap, out Handle dstbitmap) GdipCloneBitmapAreaI;
+Status function(Handle bitmap, in int x, in int y, out int color) GdipBitmapGetPixel;
+Status function(Handle bitmap, in int x, in int y, in int color) GdipBitmapSetPixel;
+Status function(Handle bitmap, GpRect* rect, in ImageLockMode flags, in PixelFormat format, GpBitmapData* lockedBitmapData) GdipBitmapLockBits;
 Status function(Handle bitmap, GpBitmapData* lockedBitmapData) GdipBitmapUnlockBits;
-Status function(Handle bitmap, float xdpi, float ydpi) GdipBitmapSetResolution;
+Status function(Handle bitmap, in float xdpi, in float ydpi) GdipBitmapSetResolution;
 Status function(Handle bitmap, out Handle hbmReturn) GdipCreateHICONFromBitmap;
-Status function(Handle bitmap, out Handle hbmReturn, int background) GdipCreateHBITMAPFromBitmap;
+Status function(Handle bitmap, out Handle hbmReturn, in int background) GdipCreateHBITMAPFromBitmap;
 Status function(out Handle imageattr) GdipCreateImageAttributes;
 Status function(Handle imageattr) GdipDisposeImageAttributes;
-Status function(Handle imageattr, ColorAdjustType type, int enableFlag, GpColorMatrix* colorMatrix, GpColorMatrix* grayMatrix, ColorMatrixFlag flags) GdipSetImageAttributesColorMatrix;
-Status function(Handle imageattr, ColorAdjustType type, int enableFlag, float threshold) GdipSetImageAttributesThreshold;
-Status function(Handle imageattr, ColorAdjustType type, int enableFlag, float gamma) GdipSetImageAttributesGamma;
-Status function(Handle imageattr, ColorAdjustType type, int enableFlag) GdipSetImageAttributesNoOp;
-Status function(Handle imageattr, ColorAdjustType type, int enableFlag, int colorLow, int colorHigh) GdipSetImageAttributesColorKeys;
-Status function(Handle imageattr, ColorAdjustType type, int enableFlag, ColorChannelFlag flags) GdipSetImageAttributesOutputChannel;
-Status function(Handle imageattr, ColorAdjustType type, int enableFlag, LPCWSTR colorProfileFilename) GdipSetImageAttributesOutputChannelColorProfile;
-Status function(Handle imageattr, WrapMode wrap, int argb, int clamp) GdipSetImageAttributesWrapMode;
+Status function(Handle imageattr, in ColorAdjustType type, in int enableFlag, in GpColorMatrix* colorMatrix, in GpColorMatrix* grayMatrix, in ColorMatrixFlag flags) GdipSetImageAttributesColorMatrix;
+Status function(Handle imageattr, in ColorAdjustType type, in int enableFlag, in float threshold) GdipSetImageAttributesThreshold;
+Status function(Handle imageattr, in ColorAdjustType type, in int enableFlag, in float gamma) GdipSetImageAttributesGamma;
+Status function(Handle imageattr, in ColorAdjustType type, in int enableFlag) GdipSetImageAttributesNoOp;
+Status function(Handle imageattr, in ColorAdjustType type, in int enableFlag, in int colorLow, in int colorHigh) GdipSetImageAttributesColorKeys;
+Status function(Handle imageattr, in ColorAdjustType type, in int enableFlag, in ColorChannelFlag flags) GdipSetImageAttributesOutputChannel;
+Status function(Handle imageattr, in ColorAdjustType type, in int enableFlag, LPCWSTR colorProfileFilename) GdipSetImageAttributesOutputChannelColorProfile;
+Status function(Handle imageattr, in WrapMode wrap, in int argb, in int clamp) GdipSetImageAttributesWrapMode;
 Status function(out Handle fontCollection) GdipNewInstalledFontCollection;
 Status function(out Handle fontCollection) GdipNewPrivateFontCollection;
 Status function(Handle fontCollection) GdipDeletePrivateFontCollection;
 Status function(Handle fontCollection, LPCWSTR filename) GdipPrivateAddFontFile;
-Status function(Handle fontCollection, void* memory, int length) GdipPrivateAddMemoryFont;
+Status function(Handle fontCollection, void* memory, in int length) GdipPrivateAddMemoryFont;
 Status function(Handle fontCollection, out int numFound) GdipGetFontCollectionFamilyCount;
-Status function(Handle fontCollection, int numSought, Handle* gpfamilies, out int numFound) GdipGetFontCollectionFamilyList;
+Status function(Handle fontCollection, in int numSought, Handle* gpfamilies, out int numFound) GdipGetFontCollectionFamilyList;
 Status function(LPCWSTR name, Handle fontCollection, out Handle FontFamily) GdipCreateFontFamilyFromName;
 Status function(Handle FontFamily) GdipDeleteFontFamily;
 Status function(Handle FontFamily, out Handle clonedFontFamily) GdipCloneFontFamily;
-Status function(Handle family, LPCWSTR name, int language) GdipGetFamilyName;
+Status function(Handle family, LPCWSTR name, in int language) GdipGetFamilyName;
 Status function(out Handle nativeFamily) GdipGetGenericFontFamilyMonospace;
 Status function(out Handle nativeFamily) GdipGetGenericFontFamilySerif;
 Status function(out Handle nativeFamily) GdipGetGenericFontFamilySansSerif;
-Status function(Handle family, FontStyle style, out short EmHeight) GdipGetEmHeight;
-Status function(Handle family, FontStyle style, out short CellAscent) GdipGetCellAscent;
-Status function(Handle family, FontStyle style, out short CellDescent) GdipGetCellDescent;
-Status function(Handle family, FontStyle style, out short LineSpacing) GdipGetLineSpacing;
-Status function(Handle family, FontStyle style, out int IsStyleAvailable) GdipIsStyleAvailable;
-Status function(Handle fontFamily, float emSize, int style, int unit, out Handle font) GdipCreateFont;
+Status function(Handle family, in FontStyle style, out short EmHeight) GdipGetEmHeight;
+Status function(Handle family, in FontStyle style, out short CellAscent) GdipGetCellAscent;
+Status function(Handle family, in FontStyle style, out short CellDescent) GdipGetCellDescent;
+Status function(Handle family, in FontStyle style, out short LineSpacing) GdipGetLineSpacing;
+Status function(Handle family, in FontStyle style, out int IsStyleAvailable) GdipIsStyleAvailable;
+Status function(Handle fontFamily, in float emSize, in int style, in int unit, out Handle font) GdipCreateFont;
 Status function(Handle hdc, out Handle font) GdipCreateFontFromDC;
 Status function(Handle font) GdipDeleteFont;
 Status function(Handle font, out Handle cloneFont) GdipCloneFont;
 Status function(Handle font, out float size) GdipGetFontSize;
 Status function(Handle font, Handle graphics, out float height) GdipGetFontHeight;
-Status function(Handle font, float dpi, out float height) GdipGetFontHeightGivenDPI;
+Status function(Handle font, in float dpi, out float height) GdipGetFontHeightGivenDPI;
 Status function(Handle font, out FontStyle style) GdipGetFontStyle;
 Status function(Handle font, out GraphicsUnit unit) GdipGetFontUnit;
 Status function(Handle font, out Handle family) GdipGetFamily;
-Status function( Handle hdc, ref LOGFONTW logfont, out Handle font) GdipCreateFontFromLogfontW;
-Status function( Handle hdc, ref LOGFONTA logfont, out Handle font ) GdipCreateFontFromLogfontA;
+Status function(Handle hdc, ref LOGFONTW logfont, out Handle font) GdipCreateFontFromLogfontW;
+Status function(Handle hdc, ref LOGFONTA logfont, out Handle font ) GdipCreateFontFromLogfontA;
 Status function(Handle font, Handle graphics, out LOGFONTW logfontW) GdipGetLogFontW;
-Status function(StringFormatFlags formatAttributes, int language, out Handle format) GdipCreateStringFormat;
+Status function(in StringFormatFlags formatAttributes, in int language, out Handle format) GdipCreateStringFormat;
 Status function(Handle format) GdipDeleteStringFormat;
 Status function(Handle format, out StringFormatFlags flags) GdipGetStringFormatFlags;
-Status function(Handle format, StringFormatFlags flags) GdipSetStringFormatFlags;
+Status function(Handle format, in StringFormatFlags flags) GdipSetStringFormatFlags;
 Status function(Handle format, out StringAlignment alignment) GdipGetStringFormatAlign;
-Status function(Handle format, StringAlignment alignment) GdipSetStringFormatAlign;
+Status function(Handle format, in StringAlignment alignment) GdipSetStringFormatAlign;
 Status function(Handle format, out StringAlignment alignment) GdipGetStringFormatLineAlign;
-Status function(Handle format, StringAlignment alignment) GdipSetStringFormatLineAlign;
+Status function(Handle format, in StringAlignment alignment) GdipSetStringFormatLineAlign;
 Status function(Handle format, out StringTrimming trimming) GdipGetStringFormatTrimming;
-Status function(Handle format, StringTrimming trimming) GdipSetStringFormatTrimming;
-Status function(FillMode brushMode, out Handle path) GdipCreatePath;
+Status function(Handle format, in StringTrimming trimming) GdipSetStringFormatTrimming;
+Status function(in FillMode brushMode, out Handle path) GdipCreatePath;
 Status function(GpPointF*, ubyte*, int, FillMode, out Handle) GdipCreatePath2;
 Status function(GpPoint*, ubyte*, int, FillMode, out Handle) GdipCreatePath2I;
 Status function(Handle path) GdipDeletePath;
 Status function(Handle path, out Handle clonepath) GdipClonePath;
 Status function(Handle path) GdipResetPath;
 Status function(Handle path, out FillMode fillmode) GdipGetPathFillMode;
-Status function(Handle path, FillMode fillmode) GdipSetPathFillMode;
+Status function(Handle path, in FillMode fillmode) GdipSetPathFillMode;
 Status function(Handle path) GdipStartPathFigure;
 Status function(Handle path) GdipClosePathFigure;
 Status function(Handle path) GdipClosePathFigures;
@@ -1100,52 +1100,52 @@
 Status function(Handle path) GdipClearPathMarkers;
 Status function(Handle path) GdipReversePath;
 Status function(Handle path, out GpPointF lastPoint) GdipGetPathLastPoint;
-Status function(Handle path, float x1, float y1, float x2, float y2) GdipAddPathLine;
-Status function(Handle path, int x1, int y1, int x2, int y2) GdipAddPathLineI;
-Status function(Handle path, GpPointF* points, int count) GdipAddPathLine2;
-Status function(Handle path, GpPoint* points, int count) GdipAddPathLine2I;
-Status function(Handle path, float x, float y, float width, float height, float startAngle, float sweepAngle) GdipAddPathArc;
-Status function(Handle path, int x, int y, int width, int height, float startAngle, float sweepAngle) GdipAddPathArcI;
-Status function(Handle path, float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4) GdipAddPathBezier;
-Status function(Handle path, int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4) GdipAddPathBezierI;
-Status function(Handle path, GpPointF* points, int count) GdipAddPathBeziers;
-Status function(Handle path, GpPoint* points, int count) GdipAddPathBeziersI;
-Status function(Handle path, GpPointF* points, int count) GdipAddPathCurve;
-Status function(Handle path, GpPoint* points, int count) GdipAddPathCurveI;
-Status function(Handle path, GpPointF* points, int count, float tension) GdipAddPathCurve2;
-Status function(Handle path, GpPoint* points, int count, float tension) GdipAddPathCurve2I;
-Status function(Handle path, GpPointF* points, int count, int offset, int numberOfSegments, float tension) GdipAddPathCurve3;
-Status function(Handle path, GpPoint* points, int count, int offset, int numberOfSegments, float tension) GdipAddPathCurve3I;
-Status function(Handle path, GpPointF* points, int count) GdipAddPathClosedCurve;
-Status function(Handle path, GpPoint* points, int count) GdipAddPathClosedCurveI;
-Status function(Handle path, GpPointF* points, int count, float tension) GdipAddPathClosedCurve2;
-Status function(Handle path, GpPoint* points, int count, float tension) GdipAddPathClosedCurve2I;
-Status function(Handle path, float x, float y, float width, float height) GdipAddPathRectangle;
-Status function(Handle path, int x, int y, int width, int height) GdipAddPathRectangleI;
-Status function(Handle path, GpRectF* rects, int count) GdipAddPathRectangles;
-Status function(Handle path, GpRect* rects, int count) GdipAddPathRectanglesI;
-Status function(Handle path, float x, float y, float width, float height) GdipAddPathEllipse;
-Status function(Handle path, int x, int y, int width, int height) GdipAddPathEllipseI;
-Status function(Handle path, float x, float y, float width, float height, float startAngle, float sweepAngle) GdipAddPathPie;
-Status function(Handle path, int x, int y, int width, int height, float startAngle, float sweepAngle) GdipAddPathPieI;
-Status function(Handle path, GpPointF* points, int count) GdipAddPathPolygon;
-Status function(Handle path, GpPoint* points, int count) GdipAddPathPolygonI;
-Status function(Handle path, Handle addingPath, int connect) GdipAddPathPath;
-Status function(Handle path, LPCWSTR string, int length, Handle family, FontStyle style, float emSize, ref GpRectF layoutRect, Handle format) GdipAddPathString;
-Status function(Handle path, LPCWSTR string, int length, Handle family, FontStyle style, float emSize, ref GpRect layoutRect, Handle format) GdipAddPathStringI;
+Status function(Handle path, in float x1, in float y1, in float x2, in float y2) GdipAddPathLine;
+Status function(Handle path, in int x1, in int y1, in int x2, in int y2) GdipAddPathLineI;
+Status function(Handle path, GpPointF* points, in int count) GdipAddPathLine2;
+Status function(Handle path, GpPoint* points, in int count) GdipAddPathLine2I;
+Status function(Handle path, in float x, in float y, in float width, in float height, in float startAngle, in float sweepAngle) GdipAddPathArc;
+Status function(Handle path, in int x, in int y, in int width, in int height, in float startAngle, in float sweepAngle) GdipAddPathArcI;
+Status function(Handle path, in float x1, in float y1, in float x2, in float y2, in float x3, in float y3, in float x4, in float y4) GdipAddPathBezier;
+Status function(Handle path, in int x1, in int y1, in int x2, in int y2, in int x3, in int y3, in int x4, in int y4) GdipAddPathBezierI;
+Status function(Handle path, GpPointF* points, in int count) GdipAddPathBeziers;
+Status function(Handle path, GpPoint* points, in int count) GdipAddPathBeziersI;
+Status function(Handle path, GpPointF* points, in int count) GdipAddPathCurve;
+Status function(Handle path, GpPoint* points, in int count) GdipAddPathCurveI;
+Status function(Handle path, GpPointF* points, in int count, in float tension) GdipAddPathCurve2;
+Status function(Handle path, GpPoint* points, in int count, in float tension) GdipAddPathCurve2I;
+Status function(Handle path, GpPointF* points, in int count, in int offset, in int numberOfSegments, in float tension) GdipAddPathCurve3;
+Status function(Handle path, GpPoint* points, in int count, in int offset, in int numberOfSegments, in float tension) GdipAddPathCurve3I;
+Status function(Handle path, GpPointF* points, in int count) GdipAddPathClosedCurve;
+Status function(Handle path, GpPoint* points, in int count) GdipAddPathClosedCurveI;
+Status function(Handle path, GpPointF* points, in int count, in float tension) GdipAddPathClosedCurve2;
+Status function(Handle path, GpPoint* points, in int count, in float tension) GdipAddPathClosedCurve2I;
+Status function(Handle path, in float x, in float y, in float width, in float height) GdipAddPathRectangle;
+Status function(Handle path, in int x, in int y, in int width, in int height) GdipAddPathRectangleI;
+Status function(Handle path, GpRectF* rects, in int count) GdipAddPathRectangles;
+Status function(Handle path, GpRect* rects, in int count) GdipAddPathRectanglesI;
+Status function(Handle path, in float x, in float y, in float width, in float height) GdipAddPathEllipse;
+Status function(Handle path, in int x, in int y, in int width, in int height) GdipAddPathEllipseI;
+Status function(Handle path, in float x, in float y, in float width, in float height, in float startAngle, in float sweepAngle) GdipAddPathPie;
+Status function(Handle path, in int x, in int y, in int width, in int height, in float startAngle, in float sweepAngle) GdipAddPathPieI;
+Status function(Handle path, GpPointF* points, in int count) GdipAddPathPolygon;
+Status function(Handle path, GpPoint* points, in int count) GdipAddPathPolygonI;
+Status function(Handle path, Handle addingPath, in int connect) GdipAddPathPath;
+Status function(Handle path, LPCWSTR string, in int length, Handle family, in FontStyle style, in float emSize, ref GpRectF layoutRect, Handle format) GdipAddPathString;
+Status function(Handle path, LPCWSTR string, in int length, Handle family, in FontStyle style, in float emSize, ref GpRect layoutRect, Handle format) GdipAddPathStringI;
 Status function(Handle path, Handle matrix) GdipTransformPath;
 Status function(Handle path, out GpRectF bounds, Handle matrix, Handle pen) GdipGetPathWorldBounds;
-Status function(Handle path, Handle matrix, float flatness) GdipFlattenPath;
-Status function(Handle path, Handle pen, Handle matrix, float flatness) GdipWidenPath;
-Status function(Handle path, Handle matrix, float flatness) GdipWindingModeOutline;
-Status function(Handle path, Handle matrix, GpPointF* points, int count, float srcx, float srcy, float srcwidth, float srcwidth, WarpMode warpMode, float flatness) GdipWarpPath;
+Status function(Handle path, Handle matrix, in float flatness) GdipFlattenPath;
+Status function(Handle path, Handle pen, Handle matrix, in float flatness) GdipWidenPath;
+Status function(Handle path, Handle matrix, in float flatness) GdipWindingModeOutline;
+Status function(Handle path, Handle matrix, GpPointF* points, in int count, in float srcx, in float srcy, in float srcwidth, in float srcwidth, in WarpMode warpMode, in float flatness) GdipWarpPath;
 Status function(Handle path, out int count) GdipGetPointCount;
-Status function(Handle path, byte* types, int count) GdipGetPathTypes;
-Status function(Handle path, GpPointF* points, int count) GdipGetPathPoints;
-Status function(Handle path, float x, float y, Handle graphics, out int result) GdipIsVisiblePathPoint;
-Status function(Handle path, int x, int y, Handle graphics, out int result) GdipIsVisiblePathPointI;
-Status function(Handle path, float x, float y, Handle pen, Handle graphics, out int result) GdipIsOutlineVisiblePathPoint;
-Status function(Handle path, int x, int y, Handle pen, Handle graphics, out int result) GdipIsOutlineVisiblePathPointI;
+Status function(Handle path, byte* types, in int count) GdipGetPathTypes;
+Status function(Handle path, GpPointF* points, in int count) GdipGetPathPoints;
+Status function(Handle path, in float x, in float y, Handle graphics, out int result) GdipIsVisiblePathPoint;
+Status function(Handle path, in int x, in int y, Handle graphics, out int result) GdipIsVisiblePathPointI;
+Status function(Handle path, in float x, in float y, Handle pen, Handle graphics, out int result) GdipIsOutlineVisiblePathPoint;
+Status function(Handle path, in int x, in int y, Handle pen, Handle graphics, out int result) GdipIsOutlineVisiblePathPointI;
 Status function(Handle graphics, Handle pen, Handle path) GdipDrawPath;
 Status function(out Handle iterator, Handle path) GdipCreatePathIter;
 Status function(Handle iterator) GdipDeletePathIter;
@@ -1158,45 +1158,45 @@
 Status function(Handle iterator, out int count) GdipPathIterGetSubpathCount;
 Status function(Handle iterator, out int hasCurve) GdipPathIterHasCurve;
 Status function(Handle iterator) GdipPathIterRewind;
-Status function(Handle iterator, out int resultCount, GpPointF* points, ubyte* types, int count) GdipPathIterEnumerate;
-Status function(Handle iterator, out int resultCount, GpPointF* points, ubyte* types, int startIndex, int endIndex) GdipPathIterCopyData;
-Status function(GpPointF* points, int count, WrapMode wrapMode, out Handle polyGradient) GdipCreatePathGradient;
-Status function(GpPoint* points, int count, WrapMode wrapMode, out Handle polyGradient) GdipCreatePathGradientI;
+Status function(Handle iterator, out int resultCount, GpPointF* points, ubyte* types, in int count) GdipPathIterEnumerate;
+Status function(Handle iterator, out int resultCount, GpPointF* points, ubyte* types, in int startIndex, in int endIndex) GdipPathIterCopyData;
+Status function(GpPointF* points, in int count, in WrapMode wrapMode, out Handle polyGradient) GdipCreatePathGradient;
+Status function(GpPoint* points, in int count, in WrapMode wrapMode, out Handle polyGradient) GdipCreatePathGradientI;
 Status function(Handle path, out Handle polyGradient) GdipCreatePathGradientFromPath;
 Status function(Handle brush, out int colors) GdipGetPathGradientCenterColor;
-Status function(Handle brush, int colors) GdipSetPathGradientCenterColor;
+Status function(Handle brush, in int colors) GdipSetPathGradientCenterColor;
 Status function(Handle brush, out int count) GdipGetPathGradientSurroundColorCount;
 Status function(Handle brush, int* color, ref int count) GdipGetPathGradientSurroundColorsWithCount;
-Status function(Handle brush, int* color, ref int count) GdipSetPathGradientSurroundColorsWithCount;
+Status function(Handle brush, in int* color, ref int count) GdipSetPathGradientSurroundColorsWithCount;
 Status function(Handle brush, ref GpPointF point) GdipGetPathGradientCenterPoint;
 Status function(Handle brush, ref GpPointF point) GdipSetPathGradientCenterPoint;
 Status function(Handle brush, ref GpRectF rect) GdipGetPathGradientRect;
 Status function(Handle brush, out int count) GdipGetPathGradientBlendCount;
-Status function(Handle brush, float* blend, float* positions, int count) GdipGetPathGradientBlend;
-Status function(Handle brush, float* blend, float* positions, int count) GdipSetPathGradientBlend;
+Status function(Handle brush, float* blend, float* positions, in int count) GdipGetPathGradientBlend;
+Status function(Handle brush, in float* blend, in float* positions, in int count) GdipSetPathGradientBlend;
 Status function(Handle brush, out int count) GdipGetPathGradientPresetBlendCount;
-Status function(Handle brush, int* blend, float* positions, int count) GdipGetPathGradientPresetBlend;
-Status function(Handle brush, int* blend, float* positions, int count) GdipSetPathGradientPresetBlend;
-Status function(Handle brush, float focus, float scale) GdipSetPathGradientSigmaBlend;
-Status function(Handle brush, float focus, float scale) GdipSetPathGradientLinearBlend;
+Status function(Handle brush, int* blend, float* positions, in int count) GdipGetPathGradientPresetBlend;
+Status function(Handle brush, in int* blend, in float* positions, in int count) GdipSetPathGradientPresetBlend;
+Status function(Handle brush, in float focus, in float scale) GdipSetPathGradientSigmaBlend;
+Status function(Handle brush, in float focus, in float scale) GdipSetPathGradientLinearBlend;
 Status function(Handle brush, out Handle matrix) GdipGetPathGradientTransform;
 Status function(Handle brush, Handle matrix) GdipSetPathGradientTransform;
 Status function(Handle brush) GdipResetPathGradientTransform;
-Status function(Handle brush, Handle matrix, MatrixOrder order) GdipMultiplyPathGradientTransform;
-Status function(Handle brush, float angle, MatrixOrder order) GdipRotatePathGradientTransform;
-Status function(Handle brush, float dx, float dy, MatrixOrder order) GdipTranslatePathGradientTransform;
-Status function(Handle brush, float sx, float sy, MatrixOrder order) GdipScalePathGradientTransform;
+Status function(Handle brush, Handle matrix, in MatrixOrder order) GdipMultiplyPathGradientTransform;
+Status function(Handle brush, in float angle, in MatrixOrder order) GdipRotatePathGradientTransform;
+Status function(Handle brush, in float dx, in float dy, in MatrixOrder order) GdipTranslatePathGradientTransform;
+Status function(Handle brush, in float sx, in float sy, in MatrixOrder order) GdipScalePathGradientTransform;
 Status function(Handle brush, out float xScale, out float yScale) GdipGetPathGradientFocusScales;
-Status function(Handle brush, float xScale, float yScale) GdipSetPathGradientFocusScales;
+Status function(Handle brush, in float xScale, in float yScale) GdipSetPathGradientFocusScales;
 Status function(Handle brush, out WrapMode wrapMode) GdipGetPathGradientWrapMode;
-Status function(Handle brush, WrapMode wrapMode) GdipSetPathGradientWrapMode;
-Status function( Handle brush ) GdipResetTextureTransform;
-Status function( Handle brush, float sx, float sy, MatrixOrder order ) GdipScaleTextureTransform;
-Status function( Handle brush, float dx, float dy, MatrixOrder order) GdipTranslateTextureTransform;
+Status function(Handle brush, in WrapMode wrapMode) GdipSetPathGradientWrapMode;
+Status function(Handle brush ) GdipResetTextureTransform;
+Status function(Handle brush, in float sx, in float sy, in MatrixOrder order ) GdipScaleTextureTransform;
+Status function(Handle brush, in float dx, in float dy, in MatrixOrder order) GdipTranslateTextureTransform;
 Status function(out Handle format) GdipStringFormatGetGenericDefault;
 Status function(out Handle format) GdipStringFormatGetGenericTypographic;
-Status function(Handle format, int hotkeyPrefix) GdipSetStringFormatHotkeyPrefix;
-Status function( Handle format, float firstTabOffset, int count, float* tabStops) GdipSetStringFormatTabStops;
+Status function(Handle format, in int hotkeyPrefix) GdipSetStringFormatHotkeyPrefix;
+Status function(Handle format, in float firstTabOffset, in int count, in float* tabStops) GdipSetStringFormatTabStops;
 
 Symbol[] symbols;
 static this(){
--- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/image/FileFormat.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/image/FileFormat.d	Sat Jul 09 15:50:20 2011 +0300
@@ -36,6 +36,7 @@
     import tango.core.Tuple;
 } else { // Phobos
     import std.typetuple;
+    alias TypeTuple Tuple;
 }
 
 /**
@@ -47,12 +48,7 @@
     static const String FORMAT_PACKAGE = "org.eclipse.swt.internal.image"; //$NON-NLS-1$
     static const String FORMAT_SUFFIX = "FileFormat"; //$NON-NLS-1$
     static const String[] FORMATS = [ "WinBMP"[], "WinBMP", "GIF", "WinICO", "JPEG", "PNG", "TIFF", "OS2BMP" ]; //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$//$NON-NLS-5$ //$NON-NLS-6$//$NON-NLS-7$//$NON-NLS-8$
-    version(Tango){
-        alias Tuple!( WinBMPFileFormat, WinBMPFileFormat, GIFFileFormat, WinICOFileFormat, JPEGFileFormat, PNGFileFormat, TIFFFileFormat, OS2BMPFileFormat ) TFormats;
-    } else { // Phobos
-        alias TypeTuple!( WinBMPFileFormat, WinBMPFileFormat, GIFFileFormat, WinICOFileFormat, JPEGFileFormat, PNGFileFormat, TIFFFileFormat, OS2BMPFileFormat ) TFormats;
-    }
-
+    alias Tuple!( WinBMPFileFormat, WinBMPFileFormat, GIFFileFormat, WinICOFileFormat, JPEGFileFormat, PNGFileFormat, TIFFFileFormat, OS2BMPFileFormat ) TFormats;
     LEDataInputStream inputStream;
     LEDataOutputStream outputStream;
     ImageLoader loader;
--- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/image/GIFFileFormat.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/image/GIFFileFormat.d	Sat Jul 09 15:50:20 2011 +0300
@@ -493,7 +493,7 @@
 
         try {
             /* Step 3: Write the GIF89a Header and Logical Screen Descriptor. */
-            outputStream.write(cast(byte[])GIF89a);
+            outputStream.write(GIF89a);
             int bitField = globalTable*128 + (depth-1)*16 + depth-1;
             outputStream.writeShort(cast(short)logicalScreenWidth);
             outputStream.writeShort(cast(short)logicalScreenHeight);
@@ -516,7 +516,7 @@
                 outputStream.write(GIF_EXTENSION_BLOCK_ID);
                 outputStream.write(GIF_APPLICATION_EXTENSION_BLOCK_ID);
                 outputStream.write(NETSCAPE2_0.length);
-                outputStream.write(cast(byte[])NETSCAPE2_0);
+                outputStream.write(NETSCAPE2_0);
                 outputStream.write(3); // Three bytes follow
                 outputStream.write(1); // Extension type
                 outputStream.writeShort(cast(short) repeatCount);
--- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/image/LEDataOutputStream.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/image/LEDataOutputStream.d	Sat Jul 09 15:50:20 2011 +0300
@@ -28,7 +28,7 @@
  * Write the specified number of bytes of the given byte array,
  * starting at the specified offset, to the output stream.
  */
-public override void write(byte b[], int off, int len) {
+public override void write(in byte b[], int off, int len) {
     ostr.write(b, off, len);
 }
 /**
--- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/image/PngChunk.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/image/PngChunk.d	Sat Jul 09 15:50:20 2011 +0300
@@ -44,11 +44,11 @@
     // Non-critical chunks.
     static const int CHUNK_tRNS = 5;
 
-    static /*const*/ byte[] TYPE_IHDR = cast(byte[])"IHDR";//{(byte) 'I', (byte) 'H', (byte) 'D', (byte) 'R'};
-    static /*const*/ byte[] TYPE_PLTE = cast(byte[])"PLTE";//{(byte) 'P', (byte) 'L', (byte) 'T', (byte) 'E'};
-    static /*const*/ byte[] TYPE_IDAT = cast(byte[])"IDAT";//{(byte) 'I', (byte) 'D', (byte) 'A', (byte) 'T'};
-    static /*const*/ byte[] TYPE_IEND = cast(byte[])"IEND";//{(byte) 'I', (byte) 'E', (byte) 'N', (byte) 'D'};
-    static /*const*/ byte[] TYPE_tRNS = cast(byte[])"tRNS";//{(byte) 't', (byte) 'R', (byte) 'N', (byte) 'S'};
+    static const byte[] TYPE_IHDR = cast(byte[])"IHDR";//{(byte) 'I', (byte) 'H', (byte) 'D', (byte) 'R'};
+    static const byte[] TYPE_PLTE = cast(byte[])"PLTE";//{(byte) 'P', (byte) 'L', (byte) 'T', (byte) 'E'};
+    static const byte[] TYPE_IDAT = cast(byte[])"IDAT";//{(byte) 'I', (byte) 'D', (byte) 'A', (byte) 'T'};
+    static const byte[] TYPE_IEND = cast(byte[])"IEND";//{(byte) 'I', (byte) 'E', (byte) 'N', (byte) 'D'};
+    static const byte[] TYPE_tRNS = cast(byte[])"tRNS";//{(byte) 't', (byte) 'R', (byte) 'N', (byte) 'S'};
 
     private static int[] _CRC_TABLE = null;
     static int[] CRC_TABLE() {
@@ -190,7 +190,7 @@
  * The fourth byte is upper case if the chunk is unsafe to copy.
  * Public chunk types are defined by the PNG Development Group.
  */
-void setType(byte[] value) {
+void setType(in byte[] value) {
     if (value.length !is TYPE_FIELD_LENGTH) {
         SWT.error (SWT.ERROR_INVALID_ARGUMENT);
     }
@@ -218,7 +218,7 @@
  * 2. It will set the CRC field to the computed CRC
  *    value of the data array given.
  */
-void setData(byte[] data) {
+void setData(in byte[] data) {
     setLength(data.length);
     System.arraycopy(data, 0, reference, DATA_OFFSET, data.length);
     setCRC(computeCRC());
@@ -276,7 +276,7 @@
     return ~crc;
 }
 
-bool typeMatchesArray(byte[] array) {
+bool typeMatchesArray(in byte[] array) {
     for (int i = 0; i < TYPE_FIELD_LENGTH; i++) {
         if (reference[TYPE_OFFSET + i] !is array[i]){
             return false;
--- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/image/PngDeflater.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/image/PngDeflater.d	Sat Jul 09 15:50:20 2011 +0300
@@ -13,6 +13,7 @@
 module org.eclipse.swt.internal.image.PngDeflater;
 
 import java.io.ByteArrayOutputStream;
+import java.lang.all;
 
 public class PngDeflater {
 
@@ -22,7 +23,7 @@
     static const int MAX_MATCHES = 32;
     static const int HASH = 8209;
 
-    byte[] istr;
+    TryConst!(byte)[] istr;
     int inLength;
 
     ByteArrayOutputStream bytes;
@@ -120,8 +121,8 @@
 
 }
 
-static /*const*/ Code lengthCodes[];
-static /*const*/ Code distanceCodes[];
+static TryConst!(Code[]) lengthCodes;
+static TryConst!(Code[]) distanceCodes;
 
 static this() {
     lengthCodes = [
@@ -219,7 +220,7 @@
 
 }
 
-int hash(byte[] bytes) {
+int hash(in byte[] bytes) {
 
     int hash = ((bytes[0] & 0xff) << 24 | (bytes[1] & 0xff) << 16 | (bytes[2] & 0xff) << 8) % HASH;
     if (hash < 0) {
@@ -268,7 +269,7 @@
 
 }
 
-Code findCode(int value, Code[] codes) {
+TryConst!(Code) findCode(int value, in Code[] codes) {
 
     int i, j, k;
 
@@ -291,7 +292,6 @@
 
 void outputMatch(int length, int distance) {
 
-    Code d, l;
     int thisLength;
 
     while (length > 0) {
@@ -313,7 +313,7 @@
         length = length - thisLength;
 
         // find length code
-        l = findCode(thisLength, lengthCodes);
+        auto l = findCode(thisLength, lengthCodes);
 
         // transmit the length code
         // 256 through 279 are 7 bits long starting at 0000000
@@ -331,7 +331,7 @@
         }
 
         // find distance code
-        d = findCode(distance, distanceCodes);
+        auto d = findCode(distance, distanceCodes);
 
         // transmit the distance code
         // 5 bits long starting at 00000
@@ -593,7 +593,7 @@
 
 }
 
-public byte[] deflate(byte[] input) {
+public byte[] deflate(in byte[] input) {
 
     istr = input;
     inLength = input.length;
--- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/image/PngEncoder.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/image/PngEncoder.d	Sat Jul 09 15:50:20 2011 +0300
@@ -78,7 +78,7 @@
 
     byte byte1 = cast(byte) ((theShort >> 8) & 0xff);
     byte byte2 = cast(byte) (theShort & 0xff);
-    byte[] temp = [byte1, byte2];
+    byte[2] temp = [byte1, byte2];
     baos.write(temp, 0, 2);
 
 }
@@ -89,12 +89,12 @@
     byte byte2 = cast(byte) ((theInt >> 16) & 0xff);
     byte byte3 = cast(byte) ((theInt >> 8) & 0xff);
     byte byte4 = cast(byte) (theInt & 0xff);
-    byte[] temp = [byte1, byte2, byte3, byte4];
+    byte[4] temp = [byte1, byte2, byte3, byte4];
     baos.write(temp, 0, 4);
 
 }
 
-void writeChunk(byte[] tag, byte[] buffer) {
+void writeChunk(in byte[] tag, in byte[] buffer) {
 
     int bufferLength = (buffer !is null) ? buffer.length : 0;
 
--- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/image/PngHuffmanTable.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/image/PngHuffmanTable.d	Sat Jul 09 15:50:20 2011 +0300
@@ -27,7 +27,7 @@
     generateTable(lengths);
 }
 
-private void initialize(int[] lengths) {
+private void initialize(in int[] lengths) {
     codeValues = new int[lengths.length];
     for (int i = 0; i < codeValues.length; i++) {
         codeValues[i] = i;
--- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/image/PngHuffmanTables.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/image/PngHuffmanTables.d	Sat Jul 09 15:50:20 2011 +0300
@@ -24,7 +24,7 @@
     static PngHuffmanTable FixedDistanceTable;
 
     static const int LiteralTableSize = 288;
-    static const int[] FixedLiteralLengths = [
+    static int[] FixedLiteralLengths = [
         8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
         8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
         8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
@@ -40,7 +40,7 @@
     ];
 
     static const int DistanceTableSize = 32;
-    static const int[] FixedDistanceLengths = [
+    static int[] FixedDistanceLengths = [
         5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
         5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
     ];
--- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/image/PngInputStream.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/image/PngInputStream.d	Sat Jul 09 15:50:20 2011 +0300
@@ -13,7 +13,6 @@
 module org.eclipse.swt.internal.image.PngInputStream;
 
 import java.io.InputStream;
-import java.lang.System;
 import org.eclipse.swt.internal.image.PngIdatChunk;
 import org.eclipse.swt.internal.image.PngChunkReader;
 import org.eclipse.swt.internal.image.PngChunk;
--- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/image/TIFFModifiedHuffmanCodec.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/image/TIFFModifiedHuffmanCodec.d	Sat Jul 09 15:50:20 2011 +0300
@@ -13,6 +13,7 @@
 module org.eclipse.swt.internal.image.TIFFModifiedHuffmanCodec;
 
 import org.eclipse.swt.SWT;
+import java.lang.all;
 
 /*
 * Decoder for
@@ -144,7 +145,7 @@
 int decodeRunLength() {
     int runLength = 0;
     int partialRun = 0;
-    short[][][] huffmanCode = isWhite ? WHITE_CODE : BLACK_CODE;
+    TryConst!(short[][][]) huffmanCode = isWhite ? WHITE_CODE : BLACK_CODE;
     while (true) {
         bool found = false;
         nbrBits = isWhite ? WHITE_MIN_BITS : BLACK_MIN_BITS;
--- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/ole/win32/COM.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/ole/win32/COM.d	Sat Jul 09 15:50:20 2011 +0300
@@ -35,7 +35,7 @@
    static if (g.length == 38)
      const GUID IIDFromStringT = IIDFromStringT!(g[1..$-1]);
    else static if (g.length == 36)
-     const GUID IIDFromStringT = {
+     const GUID IIDFromStringT = GUID (
         mixin("0x" ~ g[0..8]),
         mixin("0x" ~ g[9..13]),
         mixin("0x" ~ g[14..18]),
@@ -47,7 +47,7 @@
             mixin("0x" ~ g[28..30]),
             mixin("0x" ~ g[30..32]),
             mixin("0x" ~ g[32..34]),
-            mixin("0x" ~ g[34..36]) ] };
+            mixin("0x" ~ g[34..36]) ] );
    else
      static assert(false, "Incorrect format for GUID. "~g);
 }
--- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/ole/win32/COMTYPES.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/ole/win32/COMTYPES.d	Sat Jul 09 15:50:20 2011 +0300
@@ -9,6 +9,7 @@
 
 private import org.eclipse.swt.internal.win32.WINTYPES;
 private import org.eclipse.swt.internal.ole.win32.extras;
+import java.lang.util;
 //private import std.c.windows.windows;
 //private import std.c.windows.com;
 
@@ -17,11 +18,7 @@
 
 alias WCHAR OLECHAR;
 alias OLECHAR *LPOLESTR;
-version(D_Version2){
-    mixin("alias const(OLECHAR) *LPCOLESTR;");
-} else { // D1
-    alias OLECHAR *LPCOLESTR;
-}
+alias TryConst!(OLECHAR) *LPCOLESTR;
 
 alias IID* LPIID;
 alias HRESULT STDAPI;
--- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/ole/win32/extras.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/ole/win32/extras.d	Sat Jul 09 15:50:20 2011 +0300
@@ -9,6 +9,7 @@
 //public import std.c.windows.windows;
 import org.eclipse.swt.internal.win32.WINTYPES;
 import org.eclipse.swt.internal.ole.win32.COMTYPES;
+import java.lang.util;
 
 enum
 {
@@ -158,11 +159,7 @@
     extern IID IID_IEnumOLEVERB;
 }
 
-version(D_Version2){
-    mixin("alias const(IID) *REFCIID;");
-} else { // D1
-    alias IID *REFCIID;
-}
+alias TryConst!(IID) *REFCIID;
 extern (Windows) export {
     DWORD   CoBuildVersion();
 
@@ -207,11 +204,7 @@
 //typedef GUID CLSID;
 //alias CLSID * LPCLSID;
 alias GUID *REFGUID;
-version(D_Version2){
-    mixin("alias const(GUID) *REFCGUID;");
-} else { // D1
-    alias GUID *REFCGUID;
-}
+alias TryConst!(GUID) *REFCGUID;
 
 //alias IID *REFIID;
 
--- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/win32/OS.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/win32/OS.d	Sat Jul 09 15:50:20 2011 +0300
@@ -21,15 +21,17 @@
 import java.nonstandard.SharedLib;
 
 version(Tango){
-static import tango.sys.Common;
+    static import tango.sys.Common;
 
-static import tango.stdc.stdlib;
-static import tango.stdc.string;
-import tango.sys.win32.CodePage : CodePage;
-private import tango.stdc.stringz;
-
-
+    static import tango.stdc.stdlib;
+    static import tango.stdc.string; //for strlen
+    import tango.sys.win32.CodePage : CodePage;
+    private import tango.stdc.stringz;
 } else { // Phobos
+    static import core.stdc.string; //for strlen
+    static import std.windows.charset; //for toMBSz
+    static import std.c.windows.windows; //for GetLastError
+    static import std.windows.syserror; //for sysErrorString
 }
 
 alias org.eclipse.swt.internal.win32.WINAPI DWTWINAPI;
@@ -387,7 +389,8 @@
                 char[2000] buf;
                 getDwtLogger.error( __FILE__, __LINE__, "{}: {}", msg, CodePage.from( winMsg, buf ) );
             } else { // Phobos
-                implMissing( __FILE__, __LINE__ );
+                auto err = std.c.windows.windows.GetLastError();
+                getDwtLogger.error( __FILE__, __LINE__, "{}: {}", msg, std.windows.syserror.sysErrorString(err) );
             }
         }
         TCHAR[] buffer = new TCHAR[ MAX_PATH ];
@@ -3578,8 +3581,7 @@
     version(Tango){
         return tango.stdc.string.strlen( cast(char*)ptr );
     } else { // Phobos
-        implMissing( __FILE__, __LINE__ );
-        return 0;
+        return core.stdc.string.strlen( cast(char*)ptr );
     }
 }
 
@@ -3593,7 +3595,7 @@
 //-----------------------------------------------------------------------------
 // convert UTF-8 to MBCS
 alias StrToMBCS StrToMBCSs;
-public CHAR[] StrToMBCS(CString sc, uint codepage = 0) {
+public CHAR[] StrToMBCS(in char[] sc, uint codepage = 0) {
     CHAR[] ret = cast(CHAR[]) sc;
     try{
         foreach (char c; sc){
@@ -3616,8 +3618,7 @@
 }
 
 // convert UTF-8 to MBCSz
-public char* StrToMBCSz(CString sc) {
-    char* ret = null;
+public TryConst!(char)* StrToMBCSz(in char[] sc) {
     version(Tango){
         try{
             if( CodePage.isAscii( sc )){
@@ -3628,19 +3629,18 @@
             return toStringz( tango.sys.win32.CodePage.CodePage.into( sc, dst ));
         }catch(Exception e){
             // do nothing
-            ret = "";
+            return "".ptr;
         }
 
     } else { // Phobos
-        implMissing( __FILE__, __LINE__ );
+        return std.windows.charset.toMBSz(sc);
     }
-    return ret;
 }
 
-public String16 StrToWCHARs(uint codepage , CString sc, bool terminated = false ) {
+public String16 StrToWCHARs(uint codepage , in char[] sc, bool terminated = false ) {
     return StrToWCHARs( sc, terminated );
 }
-public String16 StrToWCHARs(CString sc, bool terminated = false ) {
+public String16 StrToWCHARs(in char[] sc, bool terminated = false ) {
     String16 ret;
     try{
         ret = toWCharArray(sc);
@@ -3654,19 +3654,19 @@
     return ret;
 }
 
-public LPCWSTR StrToWCHARz( uint codepage, CString sc, uint* length = null ) {
+public LPCWSTR StrToWCHARz( uint codepage, in char[] sc, uint* length = null ) {
     return StrToWCHARz( sc, length );
 }
 
-public LPCWSTR StrToWCHARz(CString sc, uint* length = null ) {
+public LPCWSTR StrToWCHARz(in char[] sc, uint* length = null ) {
     return StrToWCHARs(sc, true ).ptr;
 }
 
-public CString MBCSsToStr(CHAR[] string, uint codepage = 0){
+public String MBCSsToStr(in CHAR[] string, uint codepage = 0){
     return MBCSzToStr( string.ptr, string.length, codepage);
 }
 
-public CString MBCSzToStr(PCHAR pString, int _length = -1, uint codepage = 0) {
+public String MBCSzToStr(in PCHAR pString, int _length = -1, uint codepage = 0) {
     // null terminated string pointer
     if(_length == -1){
         _length = 0;
@@ -3678,19 +3678,19 @@
         return null;
 
     String16 wcs = _mbcszToWs(pString, _length, codepage);
-    String result;
-    try{
-        result = String_valueOf(wcs);
-    }catch(Exception e){
+    
+    try {
+        return String_valueOf(wcs);
+    } catch {
+        return null;
     }
-    return result;
 }
 
-public String WCHARsToStr(CString16 string){
+public String WCHARsToStr(in WCHAR[] string){
     return WCHARzToStr(string.ptr, string.length);
 }
 
-public String WCHARzToStr(LPCWSTR pString, int _length = -1)
+public String WCHARzToStr(in LPCWSTR pString, int _length = -1)
 {
     if( pString is null ){
         return null;
@@ -3706,13 +3706,11 @@
     // convert wchar* to UTF-8
     auto wcs = pString[0.._length];
 
-    String result;
-    try{
-        result = String_valueOf(wcs);
-    }catch(Exception e){
-        // do nothing
+    try {
+        return String_valueOf(wcs);
+    } catch {
+        return null;
     }
-    return result;
 }
 
 /**
@@ -3726,7 +3724,7 @@
 {
 // BSTR is aliased to wchar*
 // Note : Free the "bstr" memory if freeTheString is true, default false
-static char[] BSTRToStr(/*BSTR*/ inout wchar* bstr, bool freeTheString = false){
+static char[] BSTRToStr(/*BSTR*/ ref wchar* bstr, bool freeTheString = false){
     if(bstr is null) return null;
     int size = (SysStringByteLen(bstr) + 1)/wchar.sizeof;
     char[] result = WCHARzToStr(bstr, size);
@@ -3740,7 +3738,7 @@
 } // end of OLE_COM
 
 
-public static String16 _mbcszToWs(PCHAR pMBCS, int len, uint codepage = 0)
+public static String16 _mbcszToWs(in PCHAR pMBCS, int len, uint codepage = 0)
 {
     wchar[] wbuf;
     // Convert MBCS to unicode
@@ -3759,26 +3757,6 @@
     return _length;
 }
 
-/**
- * There is a bug in Phobos std.string.toupper() to lower() with
- std.string.toupper() and std.string.tolower() give a wrong result when deal with a mixture of upper/lower English and Chinese characters. e.g.
-char[] a = "AbCd中文eFgH";
-char[] b = std.string.toupper(a);
-char[] c = std.string.tolower(a);
-The length of a is 11, but the length of b,c is 18 now.
- *
- */
-public String tolower(char[] string) {
-    LPCTSTR ps = StrToTCHARz(string);
-    LPCTSTR ps2 = OS.CharLower(cast(LPTSTR)ps);
-    return TCHARzToStr(ps2);
-}
-public String toupper(char[] string) {
-    LPCTSTR ps = StrToTCHARz(string);
-    LPCTSTR ps2 = OS.CharUpper(cast(LPTSTR)ps);
-    return TCHARzToStr(ps2);
-}
-
 version(ANSI){
     alias StrToMBCS         StrToTCHARs;
     alias StrToMBCSz        StrToTCHARz;
--- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/win32/WINAPI.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/win32/WINAPI.d	Sat Jul 09 15:50:20 2011 +0300
@@ -7,6 +7,7 @@
 module org.eclipse.swt.internal.win32.WINAPI;
 
 public import org.eclipse.swt.internal.win32.WINTYPES;
+import java.nonstandard.SafeUtf;
 
 version(Tango){
     import tango.sys.win32.Types;
@@ -5153,14 +5154,14 @@
 // USP methods (Unicode Complex Script processor)
 HRESULT ScriptBreak(
   LPCWSTR pwcChars,
-  int cChars,
+  int cChars, //length of pwcChars
   SCRIPT_ANALYSIS *psa,
   SCRIPT_LOGATTR *psla
 );
 HRESULT ScriptCPtoX(
-  int iCP,
+  UTF16index iCP,//Logical character position in the run.
   BOOL fTrailing,
-  int cChars,
+  UTF16shift cChars,//Number of characters in the run.
   int cGlyphs,
   WORD *pwLogClust,
   SCRIPT_VISATTR *psva,
@@ -5183,7 +5184,7 @@
 );
 HRESULT ScriptGetLogicalWidths(
   SCRIPT_ANALYSIS *psa,
-  int cChars,
+  UTF16shift cChars,//Count of the logical code points in the run.
   int cGlyphs,
   int *piGlyphWidth,
   WORD *pwLogClust,
@@ -5198,14 +5199,14 @@
   HDC hdc,
   SCRIPT_CACHE* psc,
   LPCWSTR pwcInChars,
-  int cChars,
+  int cChars, //length of pwcChars
   DWORD dwFlags,
   WORD* pwOutGlyphs
 );
 HRESULT ScriptStringAnalyse(
   HDC hdc,
-  LPCVOID pString,
-  int cString,
+  LPCVOID pString,//It can be a Unicode string or use the character set from a Windows ANSI code page, as specified by the iCharset parameter.
+  int cString,//Length of the string to analyze.
   int cGlyphs,
   int iCharset,
   DWORD dwFlags,
@@ -5223,8 +5224,8 @@
   int iY, 
   UINT uOptions, 
   RECT* prc, 
-  int iMinSel, 
-  int iMaxSel, 
+  UTF16index iMinSel, //starting pos for substringing output string
+  UTF16index iMaxSel, //ending pos for substringing output string
   BOOL fDisabled 
 );
 HRESULT ScriptStringFree(
@@ -5233,7 +5234,7 @@
 
 HRESULT ScriptItemize(
   LPCWSTR pwcInChars,
-  int cInChars,
+  int cInChars, //length of pwcChars
   int cMaxItems,
   SCRIPT_CONTROL *psControl,
   SCRIPT_STATE *psState,
@@ -5261,7 +5262,7 @@
   HDC hdc,              // in
   SCRIPT_CACHE *psc,    // in/out
   LPCWSTR pwcChars,      //
-  int cChars,
+  int cChars,//length of pwcChars; Number of characters in the Unicode run.
   int cMaxGlyphs,
   SCRIPT_ANALYSIS *psa,
   WORD *pwOutGlyphs,
@@ -5287,14 +5288,14 @@
 );
 HRESULT ScriptXtoCP(
   int iX,
-  int cChars,
+  UTF16shift cChars,//Count of logical code points in the run.
   int cGlyphs,
   WORD *pwLogClust,         //
   SCRIPT_VISATTR *psva,     //
   int *piAdvance,           //
   SCRIPT_ANALYSIS *psa,     //
-  int *piCP,
-  int *piTrailing
+  UTF16shift *piCP,
+  UTF16shift *piTrailing
 );
 UINT SendInput(
     UINT nInputs,
--- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/win32/WINTYPES.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/win32/WINTYPES.d	Sat Jul 09 15:50:20 2011 +0300
@@ -3,6 +3,7 @@
  */
 
 module org.eclipse.swt.internal.win32.WINTYPES;
+import java.nonstandard.SafeUtf;
 
 version(Tango){
     public import tango.sys.win32.Types;
@@ -38,13 +39,8 @@
     alias WINBOOL BOOL;
     alias uint CALTYPE;
     alias uint CALID;
-    version(D_Version2){
-        mixin("alias const(char) CCHAR;");
-        mixin("alias const(wchar) CWCHAR;");
-    } else { // D1
-        alias char CCHAR;
-        alias wchar CWCHAR;
-    }
+    alias TryConst!(char) CCHAR;
+    alias TryConst!(wchar) CWCHAR;
     alias char* PCHAR;
     alias uint COLORREF;
     alias uint TCOLORREF;
@@ -124,21 +120,12 @@
     alias WINBOOL* LPBOOL;
     alias ubyte* LPBYTE;
     alias COLORREF* LPCOLORREF;
-    version(D_Version2){
-        mixin( "alias const(char)* LPCCH;");
-        mixin( "alias const(char)* LPCH;");
-        mixin( "alias const(char)* LPCSTR;");
-        mixin( "alias const(TCHAR)* LPCTSTR;");
-        mixin( "alias const(wchar)* LPCWCH;");
-        mixin( "alias const(wchar)* LPCWSTR;");
-    } else {
-        alias PCHAR LPCCH;
-        alias PCHAR LPCH;
-        alias PCHAR LPCSTR;
-        alias TCHAR* LPCTSTR;
-        alias wchar* LPCWCH;
-        alias wchar* LPCWSTR;
-    }
+    alias TryConst!(char)* LPCCH;
+    alias TryConst!(char)* LPCH;
+    alias TryConst!(char)* LPCSTR;
+    alias TryConst!(TCHAR)* LPCTSTR;
+    alias TryConst!(wchar)* LPCWCH;
+    alias TryConst!(wchar)* LPCWSTR;
     alias DWORD* LPDWORD;
     alias HANDLE* LPHANDLE;
     alias int* LPINT;
@@ -148,11 +135,7 @@
     alias TCHAR* LPTSTR;
     alias int LRESULT;
     alias POINTER LPVOID;
-    version(D_Version2){
-        mixin( "alias const(void)* LPCVOID;");
-    } else {
-        alias POINTER LPCVOID;
-    }
+    alias TryConst!(void)* LPCVOID;
     alias wchar* LPWCH;
     alias wchar* LPWORD;
     alias wchar* LPWSTR;
@@ -15474,7 +15457,7 @@
 }
 
 struct SCRIPT_ITEM {
-    int iCharPos;
+    UTF16index iCharPos;
     SCRIPT_ANALYSIS a;
 }
 
--- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/IME.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/IME.d	Sat Jul 09 15:50:20 2011 +0300
@@ -24,6 +24,7 @@
 import org.eclipse.swt.widgets.Display;
 
 import java.lang.all;
+import java.nonstandard.UnsafeUtf;
 
 /**
  * Instances of this class represent input method editors.
@@ -406,8 +407,9 @@
                     display.lastKey = 0;
                     display.lastVirtual = display.lastNull = display.lastDead = false;
                     length_ = chars.length;
-                    for (int i = 0; i < length_; i+=chars.getRelativeCodePointOffset(i,1)) {
-                        dchar c = chars[ i .. $ ].firstCodePoint();
+                    int di;
+                    for (int i = 0; i < length_; i += di) {
+                        dchar c = chars.dcharAt(i, di);
                         display.lastAscii = c;
                         event = new Event ();
                         event.character = cast(wchar) c;
--- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/Text.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/Text.d	Sat Jul 09 15:50:20 2011 +0300
@@ -1126,6 +1126,7 @@
     * which can reference a potentially large character
     * array.
     */
+    //FIXME: no UTF-8 support
     return getText ().substring (start, end + 1);
 }
 
@@ -1435,7 +1436,7 @@
 
     /* Verify the character */
     String oldText = "";
-    int start, end;
+    int start, end; //Windows' indices: UTF-16 or Windows 8-bit character set
     OS.SendMessage (handle, OS.EM_GETSEL, &start, &end);
     switch (key) {
         case 0x08:  /* Bs */
@@ -1992,6 +1993,7 @@
         event.start = mbcsToWcsPos (start);
         event.end = mbcsToWcsPos (end);
     }
+    //FIXME: start and end should be converted from UTF-16 to UTF-8
     /*
     * It is possible (but unlikely), that application
     * code could have disposed the widget in the verify
--- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/Widget.d	Sun Apr 17 17:58:36 2011 +0200
+++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/Widget.d	Sat Jul 09 15:50:20 2011 +0300
@@ -504,13 +504,12 @@
 }
 
 char [] fixMnemonic (String string, bool spaces) {
-    char[] buffer = (string ~ '\0').dup;
+    char[] buffer = cast(char[])string ~ '\0';
     int i = 0, j = 0;
     while (i < buffer.length) {
         if (buffer [i] is '&') {
             if (i + 1 < buffer.length && buffer [i + 1] is '&') {
-                if (spaces) buffer [j] = ' ';
-                j++;
+                buffer [j++] = spaces ? ' ' : buffer [i];
                 i++;
             }
             i++;
@@ -518,8 +517,8 @@
             buffer [j++] = buffer [i++];
         }
     }
-    while (j < buffer.length) buffer [j++] = 0;
-    return buffer;
+    if (j < buffer.length) buffer [j++] = 0;
+    return buffer[0 .. j];
 }
 
 /**
--- a/rakefile	Sun Apr 17 17:58:36 2011 +0200
+++ b/rakefile	Sat Jul 09 15:50:20 2011 +0300
@@ -55,7 +55,7 @@
     LIBNAMES_BASIC  = [ "advapi32", "comctl32", "comdlg32", "gdi32", "kernel32",
                         "shell32", "ole32", "oleaut32", "olepro32", "oleacc",
                         "user32", "usp10", "msimg32", "opengl32", "shlwapi",
-                        "zlib", "dwt-base" ]
+                        "dwt-base" ]
 
 else
     SONAMES_BASIC   = [ "gtk-x11-2.0", "gdk-x11-2.0", "atk-1.0", "gdk_pixbuf-2.0",
@@ -248,6 +248,8 @@
 
     if isWindows
         rsp.puts "-L/NOM"
+        rsp.puts "-L/SUBSYSTEM:CONSOLE:4.0"
+        rsp.puts win_path(File.expand_path("win-res\\resource.res"))
         libnames.each do | libname |
             rsp.puts "-L+#{libname}#{LIBEXT}"
         end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/win-res/enable-theme.xml	Sat Jul 09 15:50:20 2011 +0300
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
+  <assemblyIdentity
+      version="1.0.0.0"
+      processorArchitecture="X86"
+      name="-"
+      type="win32"
+      />
+  <description></description>
+  <dependency>
+    <dependentAssembly>
+      <assemblyIdentity
+          type="win32"
+          name="Microsoft.Windows.Common-Controls"
+          version="6.0.0.0"
+          processorArchitecture="*"
+          publicKeyToken="6595b64144ccf1df"
+          language="*"
+          />
+    </dependentAssembly>
+  </dependency>
+</assembly>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/win-res/resource.rc	Sat Jul 09 15:50:20 2011 +0300
@@ -0,0 +1,3 @@
+#define RT_MANIFEST 24
+1 RT_MANIFEST "enable-theme.xml"
+100 ICON "swt-logo.ico"
\ No newline at end of file
Binary file win-res/resource.res has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/win-res/resource.res.build.cmd	Sat Jul 09 15:50:20 2011 +0300
@@ -0,0 +1,5 @@
+@"C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\rc" /foresource.res resource.rc
+@if errorlevel 1 (
+	echo Building failed!
+	pause
+)
Binary file win-res/swt-logo.ico has changed