diff --git a/std/array.d b/std/array.d index 15a680ef3..1013e46b5 100644 --- a/std/array.d +++ b/std/array.d @@ -25,14 +25,10 @@ $(D opApply) function $(D r). Note that narrow strings are handled as a special case in an overload. Example: - -$(D_RUN_CODE -$(ARGS ---- auto a = array([1, 2, 3, 4, 5][]); assert(a == [ 1, 2, 3, 4, 5 ]); ---- -), $(ARGS), $(ARGS), $(ARGS import std.array;)) */ ForeachType!Range[] array(Range)(Range r) if (isIterable!Range && !isNarrowString!Range) @@ -230,16 +226,12 @@ Returns a newly allocated associative array out of elements of the input range, which must be a range of tuples (Key, Value). Example: - -$(D_RUN_CODE -$(ARGS ---- auto a = assocArray(zip([0, 1, 2], ["a", "b", "c"])); assert(a == [0:"a", 1:"b", 2:"c"]); auto b = assocArray([ tuple("foo", "bar"), tuple("baz", "quux") ]); assert(b == ["foo":"bar", "baz":"quux"]); ---- -), $(ARGS), $(ARGS), $(ARGS import std.array;)) */ auto assocArray(Range)(Range r) @@ -312,8 +304,6 @@ array. In this case sizes may be specified for any number of dimensions from 1 to the number in $(D T). Examples: -$(D_RUN_CODE -$(ARGS --- double[] arr = uninitializedArray!(double[])(100); assert(arr.length == 100); @@ -322,7 +312,6 @@ double[][] matrix = uninitializedArray!(double[][])(42, 31); assert(matrix.length == 42); assert(matrix[0].length == 31); --- -), $(ARGS), $(ARGS), $(ARGS import std.array;)) */ auto uninitializedArray(T, I...)(I sizes) if(allSatisfy!(isIntegral, I)) @@ -415,14 +404,11 @@ the first argument using the dot notation, $(D array.empty) is equivalent to $(D empty(array)). Example: -$(D_RUN_CODE -$(ARGS ---- auto a = [ 1, 2, 3 ]; assert(!a.empty); assert(a[3 .. $].empty); ---- -), $(ARGS), $(ARGS), $(ARGS import std.array;)) */ @property bool empty(T)(in T[] a) @safe pure nothrow @@ -445,14 +431,11 @@ equivalent to $(D save(array)). The function does not duplicate the content of the array, it simply returns its argument. Example: -$(D_RUN_CODE -$(ARGS ---- auto a = [ 1, 2, 3 ]; auto b = a.save; assert(b is a); ---- -), $(ARGS), $(ARGS), $(ARGS import std.array;)) */ @property T[] save(T)(T[] a) @safe pure nothrow @@ -469,14 +452,11 @@ $(D popFront) automaticaly advances to the next $(GLOSSARY code point). Example: -$(D_RUN_CODE -$(ARGS ---- int[] a = [ 1, 2, 3 ]; a.popFront(); assert(a == [ 2, 3 ]); ---- -), $(ARGS), $(ARGS), $(ARGS import std.array;)) */ void popFront(T)(ref T[] a) @@ -573,14 +553,11 @@ popFront) automaticaly eliminates the last $(GLOSSARY code point). Example: -$(D_RUN_CODE -$(ARGS ---- int[] a = [ 1, 2, 3 ]; a.popBack(); assert(a == [ 1, 2 ]); ---- -), $(ARGS), $(ARGS), $(ARGS import std.array;)) */ void popBack(T)(ref T[] a) @@ -645,13 +622,10 @@ dchar). Example: -$(D_RUN_CODE -$(ARGS ---- int[] a = [ 1, 2, 3 ]; assert(a.front == 1); ---- -), $(ARGS), $(ARGS), $(ARGS import std.array;)) */ @property ref T front(T)(T[] a) if (!isNarrowString!(T[]) && !is(T[] == void[])) @@ -690,13 +664,10 @@ back) automaticaly returns the last $(GLOSSARY code point) as a $(D dchar). Example: -$(D_RUN_CODE -$(ARGS ---- int[] a = [ 1, 2, 3 ]; assert(a.back == 3); ---- -), $(ARGS), $(ARGS), $(ARGS import std.array;)) */ @property ref T back(T)(T[] a) if (!isNarrowString!(T[])) { @@ -735,8 +706,6 @@ values referred by them. If $(D r1) and $(D r2) have an overlapping slice, returns that slice. Otherwise, returns the null slice. Example: -$(D_RUN_CODE -$(ARGS ---- int[] a = [ 10, 11, 12, 13, 14 ]; int[] b = a[1 .. 3]; @@ -745,7 +714,6 @@ b = b.dup; // overlap disappears even though the content is the same assert(overlap(a, b).empty); ---- -), $(ARGS), $(ARGS), $(ARGS import std.array;)) */ inout(T)[] overlap(T)(inout(T)[] r1, inout(T)[] r2) @trusted pure nothrow { @@ -816,15 +784,12 @@ it's commented out. must be an input range or a single item) inserted at position $(D pos). Examples: -$(D_RUN_CODE -$(ARGS --------------------- -int[] a = [ 1, 2, 3, 4 ]; -auto b = a.insert(2, [ 1, 2 ]); -assert(a == [ 1, 2, 3, 4 ]); -assert(b == [ 1, 2, 1, 2, 3, 4 ]); --------------------- -), $(ARGS), $(ARGS), $(ARGS import std.array;)) + -------------------- + int[] a = [ 1, 2, 3, 4 ]; + auto b = a.insert(2, [ 1, 2 ]); + assert(a == [ 1, 2, 3, 4 ]); + assert(b == [ 1, 2, 1, 2, 3, 4 ]); + -------------------- +/ T[] insert(T, Range)(T[] array, size_t pos, Range stuff) if(isInputRange!Range && @@ -936,17 +901,14 @@ private void copyBackwards(T)(T[] src, T[] dest) Inserts $(D stuff) (which must be an input range or any number of implicitly convertible items) in $(D array) at position $(D pos). -Example: -$(D_RUN_CODE -$(ARGS ---- -int[] a = [ 1, 2, 3, 4 ]; -a.insertInPlace(2, [ 1, 2 ]); -assert(a == [ 1, 2, 1, 2, 3, 4 ]); -a.insertInPlace(3, 10u, 11); -assert(a == [ 1, 2, 1, 10, 11, 2, 3, 4]); ---- -), $(ARGS), $(ARGS), $(ARGS import std.array;)) + Example: + --- + int[] a = [ 1, 2, 3, 4 ]; + a.insertInPlace(2, [ 1, 2 ]); + assert(a == [ 1, 2, 1, 2, 3, 4 ]); + a.insertInPlace(3, 10u, 11); + assert(a == [ 1, 2, 1, 10, 11, 2, 3, 4]); + --- +/ void insertInPlace(T, U...)(ref T[] array, size_t pos, U stuff) if(!isSomeString!(T[]) @@ -1416,13 +1378,10 @@ unittest Splits a string by whitespace. Example: -$(D_RUN_CODE -$(ARGS ---- auto a = " a bcd ef gh "; assert(equal(splitter(a), ["", "a", "bcd", "ef", "gh"][])); ---- -), $(ARGS), $(ARGS), $(ARGS import std.array, std.algorithm: equal;)) */ auto splitter(C)(C[] s) if(isSomeString!(C[])) @@ -1515,17 +1474,14 @@ unittest Concatenates all of the ranges in $(D ror) together into one array using $(D sep) as the separator if present. -Examples: -$(D_RUN_CODE -$(ARGS --------------------- -assert(join(["hello", "silly", "world"], " ") == "hello silly world"); -assert(join(["hello", "silly", "world"]) == "hellosillyworld"); + Examples: + -------------------- + assert(join(["hello", "silly", "world"], " ") == "hello silly world"); + assert(join(["hello", "silly", "world"]) == "hellosillyworld"); -assert(join([[1, 2, 3], [4, 5]], [72, 73]) == [1, 2, 3, 72, 73, 4, 5]); -assert(join([[1, 2, 3], [4, 5]]) == [1, 2, 3, 4, 5]); --------------------- -), $(ARGS), $(ARGS), $(ARGS import std.array;)) + assert(join([[1, 2, 3], [4, 5]], [72, 73]) == [1, 2, 3, 72, 73, 4, 5]); + assert(join([[1, 2, 3], [4, 5]]) == [1, 2, 3, 4, 5]); + -------------------- +/ ElementEncodingType!(ElementType!RoR)[] join(RoR, R)(RoR ror, R sep) if(isInputRange!RoR && @@ -1817,16 +1773,13 @@ until then, it's commented out. (inclusive) to $(D to) (exclusive) with the range $(D stuff). Returns a new array without changing the contents of $(D subject). -Examples: -$(D_RUN_CODE -$(ARGS --------------------- -auto a = [ 1, 2, 3, 4 ]; -auto b = a.replace(1, 3, [ 9, 9, 9 ]); -assert(a == [ 1, 2, 3, 4 ]); -assert(b == [ 1, 9, 9, 9, 4 ]); --------------------- -), $(ARGS), $(ARGS), $(ARGS import std.array;)) + Examples: + -------------------- + auto a = [ 1, 2, 3, 4 ]; + auto b = a.replace(1, 3, [ 9, 9, 9 ]); + assert(a == [ 1, 2, 3, 4 ]); + assert(b == [ 1, 9, 9, 9, 4 ]); + -------------------- +/ T[] replace(T, Range)(T[] subject, size_t from, size_t to, Range stuff) if(isInputRange!Range && @@ -1916,15 +1869,12 @@ unittest (inclusive) to $(D to) (exclusive) with the range $(D stuff). Expands or shrinks the array as needed. -Example: -$(D_RUN_CODE -$(ARGS ---- -int[] a = [ 1, 2, 3, 4 ]; -a.replaceInPlace(1, 3, [ 9, 9, 9 ]); -assert(a == [ 1, 9, 9, 9, 4 ]); ---- -), $(ARGS), $(ARGS), $(ARGS import std.array;)) + Example: + --- + int[] a = [ 1, 2, 3, 4 ]; + a.replaceInPlace(1, 3, [ 9, 9, 9 ]); + assert(a == [ 1, 9, 9, 9, 4 ]); + --- +/ void replaceInPlace(T, Range)(ref T[] array, size_t from, size_t to, Range stuff) if(isDynamicArray!Range && @@ -2146,8 +2096,6 @@ recommended over $(D a ~= data) when appending many elements because it is more efficient. Example: -$(D_RUN_CODE -$(ARGS ---- auto app = appender!string(); string b = "abcdefg"; @@ -2160,7 +2108,6 @@ app2.put(3); app2.put([ 4, 5, 6 ]); assert(app2.data == [ 1, 2, 3, 4, 5, 6 ]); ---- -), $(ARGS), $(ARGS), $(ARGS import std.array;)) */ struct Appender(A : T[], T) { diff --git a/std/base64.d b/std/base64.d index e16ae1f09..8b05047d5 100644 --- a/std/base64.d +++ b/std/base64.d @@ -6,40 +6,35 @@ * Implemented according to $(WEB tools.ietf.org/html/rfc4648, * RFC 4648 - The Base16, Base32, and Base64 Data Encodings). * -* Example: - * $(D_RUN_CODE - * $(ARGS + * Example: * ----- - *ubyte[] data = [0x14, 0xfb, 0x9c, 0x03, 0xd9, 0x7e]; + * ubyte[] data = [0x14, 0xfb, 0x9c, 0x03, 0xd9, 0x7e]; * - *const(char)[] encoded = Base64.encode(data); - *assert(encoded == "FPucA9l+"); + * const(char)[] encoded = Base64.encode(data); + * assert(encoded == "FPucA9l+"); * - *ubyte[] decoded = Base64.decode("FPucA9l+"); - *assert(decoded == [0x14, 0xfb, 0x9c, 0x03, 0xd9, 0x7e]); + * ubyte[] decoded = Base64.decode("FPucA9l+"); + * assert(decoded == [0x14, 0xfb, 0x9c, 0x03, 0xd9, 0x7e]); * ----- - * ), $(ARGS), $(ARGS), $(ARGS import std.base64;)) + * * Support Range interface using Encoder / Decoder. * * Example: - * $(D_RUN_CODE - * $(ARGS * ----- * // Create MIME Base64 with CRLF, per line 76. - *File f = File("./text.txt", "r"); - *scope(exit) f.close(); + * File f = File("./text.txt", "r"); + * scope(exit) f.close(); * - *Appender!string mime64 = appender!string; + * Appender!string mime64 = appender!string; * - *foreach (encoded; Base64.encoder(f.byChunk(57))) - *{ - * mime64.put(encoded); - * mime64.put("\r\n"); - *} + * foreach (encoded; Base64.encoder(f.byChunk(57))) + * { + * mime64.put(encoded); + * mime64.put("\r\n"); + * } * - *writeln(mime64.data); + * writeln(mime64.data); * ----- - *), $(ARGS), $(ARGS), $(ARGS import std.base64, std.array, std.stdio: File, writeln;)) * * Copyright: Masahiro Nakagawa 2010-. * License: $(WEB boost.org/LICENSE_1_0.txt, Boost License 1.0). @@ -672,36 +667,30 @@ template Base64Impl(char Map62th, char Map63th, char Padding = '=') * Default $(D Encoder) encodes chunk data. * * Example: - *$(D_RUN_CODE - *$(ARGS * ----- - *File f = File("text.txt", "r"); - *scope(exit) f.close(); + * File f = File("text.txt", "r"); + * scope(exit) f.close(); * - *uint line = 0; - *foreach (encoded; Base64.encoder(f.byLine())) - *{ - * writeln(++line, ". ", encoded); - *} + * uint line = 0; + * foreach (encoded; Base64.encoder(f.byLine())) + * { + * writeln(++line, ". ", encoded); + * } * ----- - *), $(ARGS), $(ARGS), $(ARGS import std.base64, std.stdio: File, writeln;)) * * In addition, You can use $(D Encoder) that returns encoded single character. * This $(D Encoder) performs Range-based and lazy encoding. * * Example: - *$(D_RUN_CODE - *$(ARGS * ----- - *ubyte[] data = cast(ubyte[]) "0123456789"; + * ubyte[] data = cast(ubyte[]) "0123456789"; * * // The ElementType of data is not aggregation type - *foreach (encoded; Base64.encoder(data)) - *{ - * writeln(encoded); - *} + * foreach (encoded; Base64.encoder(data)) + * { + * writeln(encoded); + * } * ----- - *), $(ARGS), $(ARGS), $(ARGS import std.base64, std.stdio: writeln;)) * * Params: * range = an $(D InputRange) to iterate. @@ -1357,31 +1346,24 @@ template Base64Impl(char Map62th, char Map63th, char Padding = '=') * Default $(D Decoder) decodes chunk data. * * Example: - *$(D_RUN_CODE - *$(ARGS * ----- - *foreach (decoded; Base64.decoder(stdin.byLine())) - *{ - * writeln(decoded); - *} + * foreach (decoded; Base64.decoder(stdin.byLine())) + * { + * writeln(decoded); + * } * ----- - *), $(ARGS FPucA9l+), $(ARGS), $(ARGS import std.base64, std.stdio;)) * * In addition, You can use $(D Decoder) that returns decoded single character. * This $(D Decoder) performs Range-based and lazy decoding. * * Example: - *$(D_RUN_CODE - *$(ARGS * ----- - *auto encoded = Base64.encoder(cast(ubyte[])"0123456789"); - *foreach (n; map!q{a - '0'}(Base64.decoder(encoded))) - *{ - * writeln(n); - *} + * auto encoded = Base64.encoder(cast(ubyte[])"0123456789"); + * foreach (n; map!q{a - '0'}(Base64.decoder(encoded))) + * { + * writeln(n); + * } * ----- - *), $(ARGS), $(ARGS), $(ARGS import std.base64, std.stdio: writeln; - *import std.algorithm: map;)) * * NOTE: * If you use $(D ByChunk), chunk-size should be the multiple of 4. diff --git a/std/concurrency.d b/std/concurrency.d index 03207e641..6559d0730 100644 --- a/std/concurrency.d +++ b/std/concurrency.d @@ -13,8 +13,6 @@ * additional features specific to in-process messaging. * * Synposis: - *$(D_RUN_CODE - *$(ARGS * --- * import std.stdio; * import std.concurrency; @@ -45,7 +43,6 @@ * writeln("Successfully printed number."); * } * --- - *), $(ARGS), $(ARGS), $(ARGS)) * * Copyright: Copyright Sean Kelly 2009 - 2010. * License: Boost License 1.0. @@ -429,8 +426,6 @@ private template isSpawnable(F, T...) * threads. * * Example: - *$(D_RUN_CODE - *$(ARGS * --- * import std.stdio, std.concurrency; * @@ -455,7 +450,6 @@ private template isSpawnable(F, T...) * auto tid2 = spawn(&f2, str.dup); * } * --- - *), $(ARGS), $(ARGS), $(ARGS)) */ Tid spawn(F, T...)( F fn, T args ) if ( isSpawnable!(F, T) ) @@ -623,8 +617,6 @@ private void _send(T...)( MsgType type, Tid tid, T vals ) * sent. * * Example: - *$(D_RUN_CODE - *$(ARGS * --- * import std.stdio; * import std.variant; @@ -645,7 +637,6 @@ private void _send(T...)( MsgType type, Tid tid, T vals ) * send(tid, 42); * } * --- - *), $(ARGS), $(ARGS), $(ARGS)) */ void receive(T...)( T ops ) { @@ -706,11 +697,9 @@ private template receiveOnlyRet(T...) * the message will be packed into a $(XREF typecons, Tuple). * * Example: - *$(D_RUN_CODE - *$(ARGS * --- * import std.concurrency; - + * * void spawnedFunc() * { * auto msg = receiveOnly!(int, string)(); @@ -724,7 +713,6 @@ private template receiveOnlyRet(T...) * send(tid, 42, "42"); * } * --- - *), $(ARGS), $(ARGS), $(ARGS)) */ receiveOnlyRet!(T) receiveOnly(T...)() {