Commit graph

72 commits

Author SHA1 Message Date
jmdavis
256976dddd Removed "scheduled for deprecation" pragmas.
The pragmas have not been as effective as we might have liked, since
they only work with templates and can't tell you where in your code you
need to make changes, and they seemed to have been more annoying to
programmers than helpful, so we're going to discontinue them. We'll
leave them in for stuff that's actually been deprecated until deprecated
has been improved enough to take a message, but we'll leave "scheduled
for deprecation" messages to the documentation and changelog.
2011-10-23 23:11:17 -07:00
jmdavis
f0af275440 Unscheduled toUTF16z for deprecation.
It's pretty clear from discussions on the newsgroup that we want to keep
toUTF16z, so it shouldn't be scheduled for deprecation anymore. That
change is part of https://github.com/D-Programming-Language/phobos/pull/279 ,
but for whatever reason that pull request hasn't been reviewed yet, let
alone merged in, and this change shouldn't need review, _and_ it should
be in before the next release, so I'm just making it and checking it in.
It's simply removing the "scheduled for deprecation" note in the
documentation and its associated pragma.
2011-10-22 15:24:39 -07:00
jmdavis
5a3739f92d Made std.utf use enforce and enforceEx where applicable. 2011-09-26 22:40:22 -07:00
jmdavis
ea2da771d0 Applied some of the suggestions from the review comments. 2011-09-26 22:18:18 -07:00
jmdavis
b9b8337ccd Renamed UtfException to UTFException to match other uses of UTF.
I created an alias for UtfException and scheduled it for deprecation
(with a fairly short time to deprecation given that it's a simple
renaming).
2011-09-26 22:18:18 -07:00
jmdavis
37ed7a8c25 Fixed UtfException's sequence so that it's uint[4] again. 2011-09-26 22:18:18 -07:00
jmdavis
2ecabfce51 Cleaned up std.utf.
The main purpose of these changes was to make as much as possible in
std.utf pure (other than toUTFx, which I'll be replacing with toUTF in a
future pull request), but I also ended up doing a fair bit of
documentation cleanup. Almost everything in std.utf is pure now though,
which should help considerably in making it possible to make
string functions pure.
2011-09-26 22:18:18 -07:00
jmdavis
41b9078cbf Fix Windows unit tests. 2011-08-15 20:42:10 -07:00
jmdavis
7eee94d2a8 Fix Windows build. 2011-08-15 03:24:29 -07:00
jmdavis
d41b8d939e Scheduled toUTF16z for deprecation. 2011-08-14 19:24:33 -07:00
jmdavis
25cf1cb1fa Attempt at improving warning on toUTFz.
I also put @system on the two overloads of toUTFZ which do pointer
arithmetic. They're obviously @system anyway, but tagging them with it
makes it clearer.
2011-07-12 22:34:58 -07:00
jmdavis
5e79789e01 Merge branch 'master' into utfz 2011-07-10 03:38:54 -07:00
jmdavis
1192616696 Changed toUTFz to use ElementEncodingType instead of typeof(str[0]). 2011-07-10 03:37:55 -07:00
jmdavis
6c6a493def Updates to toUTFz per Andrei's suggestions. 2011-07-03 22:57:19 -07:00
jmdavis
f7d8ca569a Improvement to warning in documentation. 2011-06-29 20:32:16 -07:00
jmdavis
3309c9751a Improved toUTFz so that it does less copying.
toUTFz no longer guarantees that the string will remain zero-terminated.
If the string can be zero-terminated but isn't immutable and doesn't
need to be copied to have the requested character pointer type, then it
no longer copies. This means that it's possible to have a string which
is zero-terminated and then stops being zero-terminated if you alter the
character one passed its end, but that's not likely to be an issue in
most cases, and a note in the documentation points it out so that
programmers can know about it and deal with it appropriately.
2011-06-29 20:10:13 -07:00
jmdavis
595bcb86ba Implemented toUTFz.
I haven't made std.conv.to use it yet, and I haven't touched toUTF16z or
toStringz at all, but here's an implementation for toUTFz. After this is
in, we can make std.conv.to use it when converting to character
pointers, and we should probably make it so that we have toStringz,
toWstringz, and toDstringz which use it and return immutable character
pointers and get rid of toUTF16z.
2011-06-26 02:37:50 -07:00
jmdavis
7de549c1fa Merged master into branch with changes to std.string.
Conflicts:
	changelog.dd
	std/array.d
2011-06-22 21:38:17 -07:00
jmdavis
308df18f16 Added an example to std.utf.codeLength. 2011-06-21 19:36:01 -07:00
jmdavis
1684abf962 Revert "Fixed codeLength fatal misprint."
This reverts commit 1fc3a08fcb.
2011-06-21 19:22:33 -07:00
Denis
1fc3a08fcb Fixed codeLength fatal misprint. 2011-06-21 10:35:45 -07:00
jmdavis
0e1afe82cb Improved std.string.indexOf and std.string.lastIndexOf.
indexOf and lastIndexOf should not work properly with unicode for all
string types (unlike before). As part of that, I also ended up fixing a
bug in std.array.back for strings (wstrings in particular were broken).
I also improved various, related unit tests.
2011-06-12 16:59:50 -07:00
blackwhale
903738f786 another attempt at stride/strideBack 2011-05-27 18:50:14 +04:00
blackwhale
a4cf6d203b strideBack. make all strides work with mutable strings. style. 2011-05-27 17:21:18 +04:00
Walter Bright
046e1b36db add source links 2011-02-06 15:46:50 -08:00
Don Clugston
84477a5d3e Move Boost copyright declaration from ddoc to normal comment. Fixes ugly ddoc output. 2010-11-24 19:34:47 +00:00
Masahiro Nakagawa
3dbdfbfdf6 Workaround for dmd 2.050. 2010-11-24 13:51:26 +00:00
Masahiro Nakagawa
9ac23bf4d8 issue 5247: std.utf.stride() should not return 0xFF 2010-11-23 11:42:57 +00:00
Masahiro Nakagawa
44f8ab9581 Clean up std.utf. Remove UtfError and toUTF* shortcut functions. Add attributes. count function supports dchar 2010-11-23 10:28:07 +00:00
Andrei Alexandrescu
460c844b4f Fix for bugzilla 2718 2010-09-26 21:19:14 +00:00
Andrei Alexandrescu
1e4fd1db4e Bugzilla 755 2010-09-14 03:31:16 +00:00
Andrei Alexandrescu
432e3fdfc8 Replaced std.contracts with std.exception throughout 2010-07-04 22:09:03 +00:00
Shin Fujishiro
b5a054159c Fixed bugzilla 978: std.utf's toUTF* functions accept some invalid and reject some valid UTF.
* Fixed decode() to accept U+FFFE and U+FFFF.
* Changed some assert contracts (which check input for validity) to if-throw.
* Fixed static array argument to be passed by ref (regression).
2010-06-23 03:03:56 +00:00
Lars T. Kyllingstad
5e624d18c2 2275 - std.utf.toUTF16z() should return const(wchar)* 2010-06-14 13:40:18 +00:00
Andrei Alexandrescu
c3e79d1616 Eliminated decodeFront() and decodeBack() - they aren't needed since strings are bidirectional ranges. 2010-06-08 17:37:58 +00:00
Walter Bright
53a3eec534 invariant => immutable 2010-05-05 22:19:49 +00:00
Andrei Alexandrescu
2a9a6e336c string, wstring are now bidirectional (not random) ranges
std.algorithm: defined move with one argument; levenshtein distance generalized to with all forward ranges; take now has swapped arguments
std.array: empty for arrays is now a @property; front and back for a string and wstring automatically decodes the first/last character; popFront, popBack for string and wstring obey the UTF stride
std.conv: changed the default array formatting from "[a, b, c]" to "a b c"
std.range: swapped order of arguments in take
std.stdio: added readln template
std.variant: now works with statically-sized arrays and const data
std.traits: added isNarrowString
2010-02-22 15:52:31 +00:00
Walter Bright
d340dab9f3 inout to ref 2009-12-19 07:46:41 +00:00
Don Clugston
0ecae3a354 Change [length] to [$] throughout Phobos. 2009-11-03 07:55:49 +00:00
Andrei Alexandrescu
904f56e34a Added count function and changed the encode function to take fixed-size array by reference. 2009-10-27 03:28:06 +00:00
Walter Bright
478c52201b update for value static arrays 2009-10-24 02:38:26 +00:00
Andrei Alexandrescu
93cca46ecc fixed decodeFront and decodeBack 2009-10-03 21:47:54 +00:00
Walter Bright
dbf4772242 wrong return type in std.utf 2009-09-30 02:25:14 +00:00
Sean Kelly
747f3cf1e4 Changed Phobos to use the Boost license. Currently, all public domain modules and all licensed modules by Walter, Andrei, Bartosz, and Don have been changed to use this license (excepting std.c, for the moment). Ideally, all Phobos modules will eventually be distributed under this license, which means obtaining permission from a few more authors, deleting, or rewriting some modules.
Removed std.openrj.
2009-09-16 18:19:51 +00:00
Andrei Alexandrescu
bbbce419ab improved error messages. 2009-07-04 07:10:14 +00:00
Andrei Alexandrescu
7b69dabc20 Added encode() with fixed-size arrays. 2009-04-29 22:05:05 +00:00
Andrei Alexandrescu
ff252e5b2f * toUTF16z accepts in char[] 2009-04-06 18:33:41 +00:00
Andrei Alexandrescu
1ae5300f52 * std.algorithm: Changed the map() function so that it deduces the return type
* std.contracts: Added file and line information to enforce. Added errnoEnforce that reads and formats a message according to errno. Added corresponding ErrnoException class.

* std.encoding: For now commented out std.encoding.to. 

* std.file: Fixed bug 2065

* std.format: Fixed bug in raw write for arrays

* std.getopt: Added new option stopOnFirstNonOption. Also automatically expand dubious option groups with embedded in them (useful for shebang scripts)

* std.math: improved integral powers

* std.md5: Improved signature of sum so it takes multiple arrays. Added getDigestString.

* std.path: changed signatures of test functions from bool to int. Implemented rel2abs for Windows. Improved join so that it accepts multiple paths. Got rid of some gotos with the help of scope statements.

* std.process: added getenv and setenv. Improved system() so it returns the exit code correctly on Linux.

* std.random: added the dice function - a handy (possibly biased) dice.

* std.file: added support for opening large files (not yet tested)

* std.utf: added the codeLength function. Got rid of some gotos.
2008-05-06 05:08:52 +00:00
Walter Bright
b2a37b2833 updates for new const regime 2007-12-21 00:01:31 +00:00
Brad Roberts
a9bc53273c merge r387:397 from candidate to trunk
-- new module std.contracts
  -- migrate callers to it where appropriate
2007-10-14 23:04:19 +00:00