Skip to content

Commit

Permalink
Merge branch 'master' of github.com:D-Programming-Language/phobos
Browse files Browse the repository at this point in the history
  • Loading branch information
WalterBright committed Feb 17, 2012
2 parents 1bbdb1b + ec31c04 commit 931f89f
Show file tree
Hide file tree
Showing 16 changed files with 155 additions and 116 deletions.
16 changes: 16 additions & 0 deletions changelog.dd
Expand Up @@ -3,8 +3,10 @@ $(VERSION 058, ddd mm, 2012, =================================================,
$(WHATSNEW
$(LI Added std.csv for reading CSV files.)
$(LI Added std.net.curl as D-ified wrapper over etc.c.curl and libcurl.)
$(LI Added templates PackageName, ModuleName and FullyQualifiedName into std.traits.)
$(LI The overload of std.concurrency.receiveTimeout which takes a long has
been deprecated. Please use the overload which takes a core.time.Duration.)
$(LI Moved std.datetime.abs to core.time.)
$(LI The overload of std.conv.to which used a member function named to on the
type being converted has been deprecated. Please define opCast on the type
instead, and std.conv.to will use that.)
Expand All @@ -31,8 +33,22 @@ $(VERSION 058, ddd mm, 2012, =================================================,
)

$(LIBBUGSFIXED
$(LI $(BUGZILLA 4295): IID_IUnknown symbol undefined in phobos.lib)
$(LI $(BUGZILLA 5614): version(Win32) vs version(Windows) in Phobos)
$(LI $(BUGZILLA 5718): Can't demangle symbol defined inside unittest block)
$(LI $(BUGZILLA 6255): Add support for different base conversions in std.conv)
$(LI $(BUGZILLA 6472): RedBlackTree.removeKey)
$(LI $(BUGZILLA 6642): SysTime should not be hasUnsharedAliasing)
$(LI $(BUGZILLA 6874): heap corruption caused by std.array.insertInPlaceImpl or gc.gcx)
$(LI $(BUGZILLA 6944): stdio.File.byLine can't handle an empty file)
$(LI $(BUGZILLA 7092): std.concurrency.receive does not accept free functions)
$(LI $(BUGZILLA 7141): std.regex - escaped characters can form operators in character classes)
$(LI $(BUGZILLA 7230): Crash during printing anonymous union with writeln family functions.)
$(LI $(BUGZILLA 7241): std.format can't read into array of dchar)
$(LI $(BUGZILLA 7302): std.conv.parse with radix doesn't work on ranges)
$(LI $(BUGZILLA 7397): [Regression] std.path.buildPath can't be used with string[])
$(LI $(BUGZILLA 7480): Unhelpful formatting specifier mismatch exception message for pointers)
$(LI $(BUGZILLA 7484): std.algorithm.copy overlapping array copy)
)
)

Expand Down
52 changes: 38 additions & 14 deletions std/algorithm.d
Expand Up @@ -5360,28 +5360,46 @@ assert(b[0 .. $ - c.length] == [ 1, 5, 9, 1 ]);
Range2 copy(Range1, Range2)(Range1 source, Range2 target)
if (isInputRange!Range1 && isOutputRange!(Range2, ElementType!Range1))
{
static if(isArray!Range1 && isArray!Range2 &&
is(Unqual!(typeof(source[0])) == Unqual!(typeof(target[0]))))
{
// Array specialization. This uses optimized memory copying routines
// under the hood and is about 10-20x faster than the generic
// implementation.
enforce(target.length >= source.length,
"Cannot copy a source array into a smaller target array.");
target[0..source.length] = source;

return target[source.length..$];
}
else

static Range2 genericImpl(Range1 source, Range2 target)
{
// Generic implementation.
for (; !source.empty; source.popFront())
{
put(target, source.front);
}

return target;
}

static if(isArray!Range1 && isArray!Range2 &&
is(Unqual!(typeof(source[0])) == Unqual!(typeof(target[0]))))
{
immutable overlaps =
(source.ptr >= target.ptr &&
source.ptr < target.ptr + target.length) ||
(target.ptr >= source.ptr &&
target.ptr < source.ptr + source.length);

if(overlaps)
{
return genericImpl(source, target);
}
else
{
// Array specialization. This uses optimized memory copying
// routines under the hood and is about 10-20x faster than the
// generic implementation.
enforce(target.length >= source.length,
"Cannot copy a source array into a smaller target array.");
target[0..source.length] = source;

return target[source.length..$];
}
}
else
{
return genericImpl(source, target);
}

}

Expand All @@ -5403,6 +5421,12 @@ unittest
auto e = copy(filter!("a > 1")(a), b);
assert(b[0] == 5 && e.length == 1);
}

{
int[] a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
copy(a[5..10], a[4..9]);
assert(a[4..9] == [6, 7, 8, 9, 10]);
}
}

// swapRanges
Expand Down
2 changes: 1 addition & 1 deletion std/concurrency.d
Expand Up @@ -631,7 +631,7 @@ receiveOnlyRet!(T) receiveOnly(T...)()


/**
* $(RED Deprecated. It will be removed in July 2012. Please use the version
* $(RED Deprecated. It will be removed in August 2012. Please use the version
* which takes a $(CXREF time, Duration) instead.)
*/
deprecated bool receiveTimeout(T...)( long ms, T ops )
Expand Down
2 changes: 1 addition & 1 deletion std/conv.d
Expand Up @@ -368,7 +368,7 @@ unittest
}

/**
$(RED Deprecated. It will be removed in July 2012. Please define $(D opCast)
$(RED Deprecated. It will be removed in August 2012. Please define $(D opCast)
for user-defined types instead of a $(D to) function.
$(LREF to) will now use $(D opCast).)
Expand Down
32 changes: 16 additions & 16 deletions std/ctype.d
@@ -1,7 +1,7 @@
// Written in the D programming language.

/**
* $(RED Deprecated. It will be removed in July 2012. Please use
* $(RED Deprecated. It will be removed in August 2012. Please use
* $(LINK2 std_ascii.html, std.ascii) instead.)
*
* Simple ASCII character classification functions.
Expand All @@ -22,61 +22,61 @@ module std.ctype;
import std.ascii;

pragma(msg, "Notice: As of Phobos 2.058, std.ctype has been " ~
"deprecated. It will be removed in July 2012. " ~
"deprecated. It will be removed in August 2012. " ~
"Please use std.ascii instead.");

deprecated:

/**
* $(RED Deprecated. It will be removed in July 2012. Please use
* $(RED Deprecated. It will be removed in August 2012. Please use
* $(D std.ascii.isAlphaNum) instead.)
*
* Returns !=0 if c is a letter in the range (0..9, a..z, A..Z).
*/
pure int isalnum(dchar c) { return (c <= 0x7F) ? _ctype[c] & (_ALP|_DIG) : 0; }

/**
* $(RED Deprecated. It will be removed in July 2012. Please use
* $(RED Deprecated. It will be removed in August 2012. Please use
* $(D std.ascii.isAlpha) instead.)
*
* Returns !=0 if c is an ascii upper or lower case letter.
*/
pure int isalpha(dchar c) { return (c <= 0x7F) ? _ctype[c] & (_ALP) : 0; }

/**
* $(RED Deprecated. It will be removed in July 2012. Please use
* $(RED Deprecated. It will be removed in August 2012. Please use
* $(D std.ctype.ascii.isControl) instead.)
*
* Returns !=0 if c is a control character.
*/
pure int iscntrl(dchar c) { return (c <= 0x7F) ? _ctype[c] & (_CTL) : 0; }

/**
* $(RED Deprecated. It will be removed in July 2012. Please use
* $(RED Deprecated. It will be removed in August 2012. Please use
* $(D std.ascii.isDigit) instead.)
*
* Returns !=0 if c is a digit.
*/
pure int isdigit(dchar c) { return (c <= 0x7F) ? _ctype[c] & (_DIG) : 0; }

/**
* $(RED Deprecated. It will be removed in July 2012. Please use
* $(RED Deprecated. It will be removed in August 2012. Please use
* $(D std.ascii.isLower) instead.)
*
* Returns !=0 if c is lower case ascii letter.
*/
pure int islower(dchar c) { return (c <= 0x7F) ? _ctype[c] & (_LC) : 0; }

/**
* $(RED Deprecated. It will be removed in July 2012. Please use
* $(RED Deprecated. It will be removed in August 2012. Please use
* $(D std.ascii.isPunctuation) instead.)
*
* Returns !=0 if c is a punctuation character.
*/
pure int ispunct(dchar c) { return (c <= 0x7F) ? _ctype[c] & (_PNC) : 0; }

/**
* $(RED Deprecated. It will be removed in July 2012. Please use
* $(RED Deprecated. It will be removed in August 2012. Please use
* $(D std.ascii.isWhite) instead.)
*
* Returns !=0 if c is a space, tab, vertical tab, form feed,
Expand All @@ -85,39 +85,39 @@ pure int ispunct(dchar c) { return (c <= 0x7F) ? _ctype[c] & (_PNC) : 0; }
pure int isspace(dchar c) { return (c <= 0x7F) ? _ctype[c] & (_SPC) : 0; }

/**
* $(RED Deprecated. It will be removed in July 2012. Please use
* $(RED Deprecated. It will be removed in August 2012. Please use
* $(D std.ascii.isUpper) instead.)
*
* Returns !=0 if c is an upper case ascii character.
*/
pure int isupper(dchar c) { return (c <= 0x7F) ? _ctype[c] & (_UC) : 0; }

/**
* $(RED Deprecated. It will be removed in July 2012. Please use
* $(RED Deprecated. It will be removed in August 2012. Please use
* $(D std.ascii.isHexDigit) instead.)
*
* Returns !=0 if c is a hex digit (0..9, a..f, A..F).
*/
pure int isxdigit(dchar c) { return (c <= 0x7F) ? _ctype[c] & (_HEX) : 0; }

/**
* $(RED Deprecated. It will be removed in July 2012. Please use
* $(RED Deprecated. It will be removed in August 2012. Please use
* $(D std.ascii.isGraphical) instead.)
*
* Returns !=0 if c is a printing character except for the space character.
*/
pure int isgraph(dchar c) { return (c <= 0x7F) ? _ctype[c] & (_ALP|_DIG|_PNC) : 0; }

/**
* $(RED Deprecated. It will be removed in July 2012. Please use
* $(RED Deprecated. It will be removed in August 2012. Please use
* $(D std.ascii.isPrintable) instead.)
*
* Returns !=0 if c is a printing character including the space character.
*/
pure int isprint(dchar c) { return (c <= 0x7F) ? _ctype[c] & (_ALP|_DIG|_PNC|_BLK) : 0; }

/**
* $(RED Deprecated. It will be removed in July 2012. Please use
* $(RED Deprecated. It will be removed in August 2012. Please use
* $(D std.ascii.isASCII) instead.)
*
* Returns !=0 if c is in the ascii character set, i.e. in the range 0..0x7F.
Expand All @@ -126,7 +126,7 @@ pure int isascii(dchar c) { return c <= 0x7F; }


/**
* $(RED Deprecated. It will be removed in July 2012. Please use
* $(RED Deprecated. It will be removed in August 2012. Please use
* $(D std.ascii.toLower) instead.)
*
* If c is an upper case ascii character,
Expand All @@ -139,7 +139,7 @@ pure dchar tolower(dchar c)


/**
* $(RED Deprecated. It will be removed in July 2012. Please use
* $(RED Deprecated. It will be removed in August 2012. Please use
* $(D std.ascii.toUpper) instead.)
*
* If c is a lower case ascii character,
Expand Down
4 changes: 2 additions & 2 deletions std/date.d
@@ -1,7 +1,7 @@
// Written in the D programming language.

/**
* $(RED Deprecated. It will be removed in February 2012.
* $(RED Deprecated. It will be removed in March 2012.
* Please use std.datetime instead.)
*
* Dates are represented in several formats. The date implementation
Expand Down Expand Up @@ -30,7 +30,7 @@ import std.conv, std.datebase, std.dateparse, std.exception, std.stdio;
import std.c.stdlib;

pragma(msg, "Notice: As of Phobos 2.055, std.date and std.dateparse have been " ~
"deprecated. They will be removed in February 2012. " ~
"deprecated. They will be removed in March 2012. " ~
"Please use std.datetime instead.");

deprecated:
Expand Down
2 changes: 1 addition & 1 deletion std/dateparse.d
@@ -1,7 +1,7 @@
// Written in the D programming language.

/**
* $(RED Deprecated. It will be removed in February 2012.
* $(RED Deprecated. It will be removed in March 2012.
* Please use std.datetime instead.)
*
* dateparse module.
Expand Down
10 changes: 5 additions & 5 deletions std/datetime.d
Expand Up @@ -7408,7 +7408,7 @@ assert(SysTime(DateTime(2000, 6, 4, 12, 22, 9)).daysInMonth == 30);
}

/++
$(RED Deprecated. It will be removed in July 2012.
$(RED Deprecated. It will be removed in August 2012.
Please use daysInMonth instead.)
+/
deprecated @property ubyte endOfMonthDay() const nothrow
Expand Down Expand Up @@ -12440,7 +12440,7 @@ assert(Date(2000, 6, 4).daysInMonth == 30);
}

/++
$(RED Deprecated. It will be removed in July 2012.
$(RED Deprecated. It will be removed in August 2012.
Please use daysInMonth instead.)
+/
deprecated @property ubyte endOfMonthDay() const pure nothrow
Expand Down Expand Up @@ -17371,7 +17371,7 @@ assert(DateTime(Date(2000, 6, 4), TimeOfDay(12, 22, 9)).daysInMonth == 30);
}

/++
$(RED Deprecated. It will be removed in July 2012.
$(RED Deprecated. It will be removed in August 2012.
Please use daysInMonth instead.)
+/
deprecated @property ubyte endOfMonthDay() const pure nothrow
Expand Down Expand Up @@ -31152,7 +31152,7 @@ version(testStdDateTime) unittest
//==============================================================================

/++
$(RED Deprecated. It will be removed in February 2012. This is only here to
$(RED Deprecated. It will be removed in March 2012. This is only here to
help transition code which uses std.date to using std.datetime.)

Returns a $(D d_time) for the given $(D SysTime).
Expand All @@ -31179,7 +31179,7 @@ version(testStdDateTime) unittest


/++
$(RED Deprecated. It will be removed in February 2012. This is only here to
$(RED Deprecated. It will be removed in March 2012. This is only here to
help transition code which uses std.date to using std.datetime.)

Returns a $(D SysTime) for the given $(D d_time).
Expand Down
2 changes: 1 addition & 1 deletion std/exception.d
Expand Up @@ -495,7 +495,7 @@ template enforceEx(E)
}

/++
$(RED Scheduled for deprecation in February 2012. Please use the version of
$(RED Scheduled for deprecation in March 2012. Please use the version of
$(D enforceEx) which takes an exception that constructs with
$(D new E(msg, file, line)).)
Expand Down

0 comments on commit 931f89f

Please sign in to comment.