changeset 104:ab745d8b10e5

Updated to dmd 2.052
author David Bryant <bagnose@gmail.com>
date Sun, 20 Feb 2011 22:24:36 +1030
parents ad672ab258c5
children 7abaf5c3959f
files doodle/core/backtrace.d doodle/core/logging.d doodle/core/undo.d doodle/dia/icanvas.d doodle/tk/events.d nobuild/dot-hgrc nobuild/gtkd-patches.diff
diffstat 7 files changed, 119 insertions(+), 55 deletions(-) [+]
line wrap: on
line diff
--- a/doodle/core/backtrace.d	Wed Oct 06 13:03:38 2010 +1030
+++ b/doodle/core/backtrace.d	Sun Feb 20 22:24:36 2011 +1030
@@ -72,7 +72,15 @@
 
         override string toString() const { return null; }   // Why does toString require overriding?
 
-        override int opApply(scope int delegate(ref char[]) dg) {
+        override int opApply( scope int delegate(ref char[]) dg) {
+            return opApply( (ref size_t, ref char[] buf)
+                           {
+                           return dg( buf );
+                           } );
+        }
+
+
+        override int opApply(scope int delegate(ref size_t, ref char[]) dg) {
             // NOTE: The first 5 frames with the current implementation are
             //       inside core.runtime and the object code, so eliminate
             //       these for readability.
@@ -80,17 +88,18 @@
             int ret = 0;
 
             for(int i = FIRSTFRAME; i < numframes; ++i) {
+                size_t pos = i - FIRSTFRAME;
                 char[] text = framelist[i][0 .. strlen(framelist[i])];
 
-                int a = text.lastIndexOf('(');
-                int b = text.lastIndexOf('+');
+                auto a = text.lastIndexOf('(');
+                auto b = text.lastIndexOf('+');
 
                 if (a != -1 && b != -1) {
                     ++a;
                     text = format("%s%s%s", text[0..a], demangle(text[a..b].idup), text[b..$]).dup;
                 }
 
-                ret = dg(text);
+                ret = dg(pos, text);
                 if (ret)
                     break;
             }
--- a/doodle/core/logging.d	Wed Oct 06 13:03:38 2010 +1030
+++ b/doodle/core/logging.d	Sun Feb 20 22:24:36 2011 +1030
@@ -52,8 +52,14 @@
 }
 
 private {
-    mixin(defineEnum!("Severity",
-                      "TRACE", "INFO", "MESSAGE", "WARNING", "ERROR", "FATAL"));
+    enum Severity {
+        TRACE,
+        INFO,
+        MESSAGE,
+        WARNING,
+        ERROR,
+        FATAL
+    };
 
     string severityString(in Severity s) {
         switch (s) {
@@ -105,7 +111,7 @@
     string bgColorString(in Color c)     { return std.string.format("\033[%dm", 40 + c); }
 
     private string right(in string str, in int n) {
-        int pos = str.length < n ? 0 : str.length - n;
+        auto pos = str.length < n ? 0 : str.length - n;
         return str[pos..$];
     }
 }
--- a/doodle/core/undo.d	Wed Oct 06 13:03:38 2010 +1030
+++ b/doodle/core/undo.d	Sun Feb 20 22:24:36 2011 +1030
@@ -1,7 +1,7 @@
 module doodle.core.undo;
 
 import std.array;
-import std.date;
+import std.datetime;
 
 // An abstract framework for undo/redo.
 // Assume the application works on one document at a time,
@@ -31,22 +31,22 @@
 abstract class Edit {
     private {
         string _description;
-        d_time _timeStamp;
+        SysTime _timeStamp;
     }
 
     this(in string description) {
         _description = description;
-        _timeStamp = getUTCtime;
+        _timeStamp = Clock.currTime;
     }
 
-    this(in string description, d_time timeStamp) {
+    this(in string description, SysTime timeStamp) {
         assert(description);
         _description = description;
         _timeStamp = timeStamp;
     }
 
     string description() const { return _description; }
-    d_time timeStamp() const { return _timeStamp; }
+    const(SysTime) timeStamp() const { return _timeStamp; }
 
     final bool merge(Edit subsequent) {
         if (mergeImpl(subsequent)) {
--- a/doodle/dia/icanvas.d	Wed Oct 06 13:03:38 2010 +1030
+++ b/doodle/dia/icanvas.d	Sun Feb 20 22:24:36 2011 +1030
@@ -11,8 +11,12 @@
     import std.typecons;
 }
 
-mixin(defineEnum!("Cursor",
-                  "DEFAULT", "HAND", "CROSSHAIR", "PENCIL"));
+enum Cursor {
+    DEFAULT,
+    HAND,
+    CROSSHAIR,
+    PENCIL
+}
 
 interface IViewport2 {
     void damageModel(in Rectangle area);
--- a/doodle/tk/events.d	Wed Oct 06 13:03:38 2010 +1030
+++ b/doodle/tk/events.d	Sun Feb 20 22:24:36 2011 +1030
@@ -7,25 +7,54 @@
 }
 
 private {
-    import std.typecons;
+    import std.conv;
+}
+
+enum ButtonAction {
+    SINGLE_PRESS,
+    DOUBLE_PRESS,
+    TRIPLE_PRESS,
+    RELEASE
+}
+
+enum ButtonName {
+    LEFT,
+    MIDDLE,
+    RIGHT,
+    FOUR,
+    FIVE
 }
 
-mixin(defineEnum!("ButtonAction",
-                  "SINGLE_PRESS", "DOUBLE_PRESS", "TRIPLE_PRESS", "RELEASE"));
-
-mixin(defineEnum!("ButtonName",
-                  "LEFT", "MIDDLE", "RIGHT", "FOUR", "FIVE"));
+enum ScrollDirection {
+    UP,
+    DOWN,
+    LEFT,
+    RIGHT
+}
 
-mixin(defineEnum!("ScrollDirection",
-                  "UP", "DOWN", "LEFT", "RIGHT"));
+enum Modifier {
+    SHIFT,
+    CAPS_LOCK,
+    CONTROL,
+    ALT,
+    NUM_LOCK,
+    META,
+    SCROLL_LOCK,
+    LEFT_BUTTON,
+    MIDDLE_BUTTON,
+    RIGHT_BUTTON,
+    UNUSED_BUTTON_1,
+    UNUSED_BUTTON_2
+}
 
-mixin(defineEnum!("Modifier",
-                  "SHIFT", "CAPS_LOCK", "CONTROL", "ALT", "NUM_LOCK", "META",
-                  "SCROLL_LOCK", "LEFT_BUTTON", "MIDDLE_BUTTON", "RIGHT_BUTTON",
-                  "UNUSED_BUTTON_1", "UNUSED_BUTTON_2"));
-
-mixin(defineEnum!("CrossingMode",           // FIXME what to do about GRAB2/UNGRAB2
-                  "NORMAL", "GRAB", "UNGRAB", "GRAB2", "UNGRAB2", "STATE_CHANGED"));
+enum CrossingMode {           // FIXME what to do about GRAB2/UNGRAB2
+    NORMAL,
+    GRAB,
+    UNGRAB,
+    GRAB2,
+    UNGRAB2,
+    STATE_CHANGED
+}
 
 struct Mask {
     this(in Modifier[] modifiers) {
@@ -44,7 +73,7 @@
             for (int i = 0; i < _bits.sizeof * 8; ++i) {
                 if (_bits & (1 << i)) {
                     if (s.length != 0) s ~= "|";
-                    s ~= enumToString(cast(Modifier)i);
+                    s ~= to!string(cast(Modifier)i);
                 }
             }
 
@@ -122,7 +151,7 @@
     CrossingMode crossingMode() const { return _crossingMode; }
 
     override string toString() const {
-        return std.string.format("Crossing event: %s, %s, %s, %s", enumToString(_crossingMode), screenPoint, modelPoint, mask);
+        return std.string.format("Crossing event: %s, %s, %s, %s", to!string(_crossingMode), screenPoint, modelPoint, mask);
     }
 
     private {
@@ -143,7 +172,7 @@
 
     override string toString() const {
         return std.string.format("Button event: %s, %s, %s, %s, %s",
-                                 enumToString(_buttonAction), enumToString(_buttonName),
+                                 to!string(_buttonAction), to!string(_buttonName),
                                  _screenPoint, _modelPoint, _mask);
     }
 
@@ -180,7 +209,7 @@
 
     override string toString() const {
         return std.string.format("Scroll event: %s, %s, %s, %s",
-                                 enumToString(_scrollDirection), _screenPoint, _modelPoint, _mask);
+                                 to!string(_scrollDirection), _screenPoint, _modelPoint, _mask);
     }
 
     ScrollDirection scrollDirection() const { return _scrollDirection; }
--- a/nobuild/dot-hgrc	Wed Oct 06 13:03:38 2010 +1030
+++ b/nobuild/dot-hgrc	Sun Feb 20 22:24:36 2011 +1030
@@ -9,6 +9,9 @@
 # revlogng needs flags = inline
 flags = inline
 
+[diff]
+ignorews = True
+
 # --- User interface --- #
 [ui]
 # show changed files and be a bit more verbose if True
--- a/nobuild/gtkd-patches.diff	Wed Oct 06 13:03:38 2010 +1030
+++ b/nobuild/gtkd-patches.diff	Sun Feb 20 22:24:36 2011 +1030
@@ -1,3 +1,25 @@
+Index: GNUmakefile
+===================================================================
+--- GNUmakefile	(revision 797)
++++ GNUmakefile	(working copy)
+@@ -1,6 +1,7 @@
+ #makeAll.sh
+ SHELL=/bin/sh
+-prefix=/usr/local
++#prefix=/usr/local
++prefix=/home/daveb/source/d/dmd
+ 
+ OS=$(shell uname || uname -s)
+ ARCH=$(shell arch || uname -m)
+@@ -19,7 +20,7 @@
+ endif
+ 
+ ifeq ("$(DC)","dmd")
+-    DCFLAGS=-O
++    DCFLAGS=-O -w -wi
+     output=-of$@
+ else ifeq ("$(DC)","ldc")
+     DCFLAGS=-O
 Index: src/gdkpixbuf/PixbufAnimation.d
 ===================================================================
 --- src/gdkpixbuf/PixbufAnimation.d	(revision 797)
@@ -251,6 +273,19 @@
  	{
  		// void gtk_object_unref (GtkObject *object);
  		gtk_object_unref(gtkObject);
+Index: src/gtk/TextBuffer.d
+===================================================================
+--- src/gtk/TextBuffer.d	(revision 797)
++++ src/gtk/TextBuffer.d	(working copy)
+@@ -119,7 +119,7 @@
+ version(Tango) {
+ 	private import tango.core.Vararg;
+ } else {
+-	private import std.stdarg;
++	private import core.vararg;
+ }
+ 
+ 
 Index: src/gtk/RecentChooserMenu.d
 ===================================================================
 --- src/gtk/RecentChooserMenu.d	(revision 797)
@@ -429,28 +464,6 @@
  	}
 +        +/
  }
-Index: GNUmakefile
-===================================================================
---- GNUmakefile	(revision 797)
-+++ GNUmakefile	(working copy)
-@@ -1,6 +1,7 @@
- #makeAll.sh
- SHELL=/bin/sh
--prefix=/usr/local
-+#prefix=/usr/local
-+prefix=/home/daveb/source/d/dmd
- 
- OS=$(shell uname || uname -s)
- ARCH=$(shell arch || uname -m)
-@@ -19,7 +20,7 @@
- endif
- 
- ifeq ("$(DC)","dmd")
--    DCFLAGS=-O
-+    DCFLAGS=-O -wi
-     output=-of$@
- else ifeq ("$(DC)","ldc")
-     DCFLAGS=-O
 Index: demos/dsss.conf
 ===================================================================
 --- demos/dsss.conf	(revision 797)