Mercurial > projects > dwt2
diff org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet130a.d @ 112:9f4c18c268b2
Update to compile and execute with dmd 2.052.
author | kntroh |
---|---|
date | Wed, 16 Mar 2011 21:53:53 +0900 |
parents | 8ae65ae167f5 |
children | 536e43f63c81 |
line wrap: on
line diff
--- a/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet130a.d Sat Nov 13 14:15:51 2010 +0100 +++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet130a.d Wed Mar 16 21:53:53 2011 +0900 @@ -33,10 +33,15 @@ import java.lang.all; -//import tango.core.Thread; -import tango.io.Stdout; -import tango.util.Convert; -import tango.util.log.Trace; +version(Tango){ + //import tango.core.Thread; + import tango.io.Stdout; + import tango.util.Convert; + import tango.util.log.Trace; +} else { // Phobos + import std.conv; + import std.stdio; +} void main(String[] args){ @@ -66,7 +71,11 @@ display.syncExec( dgRunnable( &printStart, text, id )); for (int i = 0; i < 6; i++) { if (display.isDisposed()) return; - Trace.formatln("do task that takes a long time in a separate thread {} {}/6", id, i); + 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); } /* @@ -101,14 +110,22 @@ } display.dispose(); } - private void printStart(Text text, int id ) { + private static void printStart(Text text, int id ) { if (text.isDisposed()) return; - Trace.formatln( "Start long running task {}", id ); - text.append("\nStart long running task "~to!(char[])(id)); + 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 void printEnd(Text text, int id ) { + private static void printEnd(Text text, int id ) { if (text.isDisposed()) return; - Trace.formatln( "Completed long running task {}", id ); - text.append("\nCompleted long running task "~to!(char[])(id)); + 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)); } }