diff --git a/posix.mak b/posix.mak index 108f4e813..8c9a8d3d0 100644 --- a/posix.mak +++ b/posix.mak @@ -179,7 +179,7 @@ STD_MODULES = $(addprefix std/, algorithm array ascii base64 bigint \ bitmanip compiler complex concurrency container conv \ cstream csv datetime demangle encoding exception \ file format functional getopt json math mathspecial \ - metastrings mmfile numeric outbuffer parallelism path \ + mmfile numeric outbuffer parallelism path \ process random range regex signals socket socketstream \ stdint stdio stdiobase stream string syserror system traits \ typecons typetuple uni uri utf uuid variant xml zip zlib) diff --git a/std/metastrings.d b/std/metastrings.d deleted file mode 100644 index 855cd6016..000000000 --- a/std/metastrings.d +++ /dev/null @@ -1,189 +0,0 @@ -// Written in the D programming language. - -/* - * Explicitly undocumented. It will be removed in October 2014. - * - * Please use $(XREF string, format), $(XREF conv, to), or - * $(XREF conv, parse) instead of these templates (which one would depend on - * which template is being replaced.) They now work in CTFE, and these - * templates are very inefficient.) - */ -module std.metastrings; - -/* - * Explicitly undocumented. It will be removed in October 2014. - * - * Please use $(XREF string, format) instead. It now works in CTFE, - * and this template is very inefficient.) - */ - -deprecated("std.string.format now works in CTFE. Please use it instead.") -template Format(A...) -{ - static if (A.length == 0) - enum Format = ""; - else static if (is(typeof(A[0]) : const(char)[])) - enum Format = FormatString!(A[0], A[1..$]); - else - enum Format = toStringNow!(A[0]) ~ Format!(A[1..$]); -} - -deprecated("std.string.format now works in CTFE. Please use it instead.") -template FormatString(const(char)[] F, A...) -{ - static if (F.length == 0) - enum FormatString = Format!(A); - else static if (F.length == 1) - enum FormatString = F[0] ~ Format!(A); - else static if (F[0..2] == "%s") - enum FormatString - = toStringNow!(A[0]) ~ FormatString!(F[2..$],A[1..$]); - else static if (F[0..2] == "%%") - enum FormatString = "%" ~ FormatString!(F[2..$],A); - else - { - static assert(F[0] != '%', "unrecognized format %" ~ F[1]); - enum FormatString = F[0] ~ FormatString!(F[1..$],A); - } -} - -unittest -{ - auto s = Format!("hel%slo", "world", -138, 'c', true); - assert(s == "helworldlo-138ctrue", "[" ~ s ~ "]"); -} - -/* - * Explicitly undocumented. It will be removed in October 2014. - * - * Please use $(XREF conv, format) instead. It now works in CTFE, - * and this template is very inefficient.) - */ - -deprecated("std.conv.to now works in CTFE. Please use it instead.") -template toStringNow(ulong v) -{ - static if (v < 10) - enum toStringNow = "" ~ cast(char)(v + '0'); - else - enum toStringNow = toStringNow!(v / 10) ~ toStringNow!(v % 10); -} - -unittest -{ - static assert(toStringNow!(1uL << 62) == "4611686018427387904"); -} - -deprecated("std.conv.to!string now works in CTFE. Please use it instead.") -template toStringNow(long v) -{ - static if (v < 0) - enum toStringNow = "-" ~ toStringNow!(cast(ulong) -v); - else - enum toStringNow = toStringNow!(cast(ulong) v); -} - -unittest -{ - static assert(toStringNow!(0x100000000) == "4294967296"); - static assert(toStringNow!(-138L) == "-138"); -} - -deprecated("std.conv.to!string now works in CTFE. Please use it instead.") -template toStringNow(uint U) -{ - enum toStringNow = toStringNow!(cast(ulong)U); -} - -deprecated("std.conv.to!string now works in CTFE. Please use it instead.") -template toStringNow(int I) -{ - enum toStringNow = toStringNow!(cast(long)I); -} - -deprecated("std.conv.to!string now works in CTFE. Please use it instead.") -template toStringNow(bool B) -{ - enum toStringNow = B ? "true" : "false"; -} - -deprecated("std.conv.to!string now works in CTFE. Please use it instead.") -template toStringNow(string S) -{ - enum toStringNow = S; -} - -deprecated("std.conv.to!string now works in CTFE. Please use it instead.") -template toStringNow(char C) -{ - enum toStringNow = "" ~ C; -} - - -/* - * Explicitly undocumented. It will be removed in October 2014. - * - * Please use $(XREF conv, parse) instead. It now works in CTFE, - * and this template is very inefficient.) - */ - -deprecated("to!string(std.conv.parse!uint(value)) now works in CTFE. Please use it instead.") -template parseUinteger(const(char)[] s) -{ - static if (s.length == 0) - { - enum value = ""; - enum rest = ""; - } - else static if (s[0] >= '0' && s[0] <= '9') - { - enum value = s[0] ~ parseUinteger!(s[1..$]).value; - enum rest = parseUinteger!(s[1..$]).rest; - } - else - { - enum value = ""; - enum rest = s; - } -} - -/* - * Explicitly undocumented. It will be removed in October 2014. - * - * Please use $(XREF conv, parse) instead. It now works in CTFE, - * and this template is very inefficient.) - */ - -deprecated("to!string(std.conv.parse!int(value)) now works in CTFE. Please use it instead.") -template parseInteger(const(char)[] s) -{ - static if (s.length == 0) - { - enum value = ""; - enum rest = ""; - } - else static if (s[0] >= '0' && s[0] <= '9') - { - enum value = s[0] ~ parseUinteger!(s[1..$]).value; - enum rest = parseUinteger!(s[1..$]).rest; - } - else static if (s.length >= 2 && - s[0] == '-' && s[1] >= '0' && s[1] <= '9') - { - enum value = s[0..2] ~ parseUinteger!(s[2..$]).value; - enum rest = parseUinteger!(s[2..$]).rest; - } - else - { - enum value = ""; - enum rest = s; - } -} - -unittest -{ - assert(parseUinteger!("1234abc").value == "1234"); - assert(parseUinteger!("1234abc").rest == "abc"); - assert(parseInteger!("-1234abc").value == "-1234"); - assert(parseInteger!("-1234abc").rest == "abc"); -} diff --git a/unittest.d b/unittest.d index 21deea05e..4437ab4dd 100644 --- a/unittest.d +++ b/unittest.d @@ -26,7 +26,6 @@ public import std.format; public import std.getopt; public import std.math; public import std.mathspecial; -public import std.metastrings; public import std.mmfile; public import std.outbuffer; public import std.parallelism; diff --git a/win32.mak b/win32.mak index d31cd89b4..412f91236 100644 --- a/win32.mak +++ b/win32.mak @@ -113,7 +113,7 @@ SRC_STD_2_HEAVY= std\range.d SRC_STD_2a_HEAVY= std\array.d std\functional.d std\path.d std\outbuffer.d std\utf.d SRC_STD_3= std\csv.d std\math.d std\complex.d std\numeric.d std\bigint.d \ - std\metastrings.d std\bitmanip.d std\typecons.d \ + std\bitmanip.d std\typecons.d \ std\uni.d std\base64.d std\ascii.d \ std\demangle.d std\uri.d std\mmfile.d std\getopt.d @@ -163,7 +163,7 @@ SRC_STD= std\zlib.d std\zip.d std\stdint.d std\container.d std\conv.d std\utf.d std\stdio.d std\uni.d std\uuid.d \ std\cstream.d std\demangle.d \ std\signals.d std\typetuple.d std\traits.d \ - std\metastrings.d std\getopt.d \ + std\getopt.d \ std\variant.d std\numeric.d std\bitmanip.d std\complex.d std\mathspecial.d \ std\functional.d std\algorithm.d std\array.d std\typecons.d \ std\json.d std\xml.d std\encoding.d std\bigint.d std\concurrency.d \ @@ -308,7 +308,6 @@ DOCS= $(DOC)\object.html \ $(DOC)\std_json.html \ $(DOC)\std_math.html \ $(DOC)\std_mathspecial.html \ - $(DOC)\std_metastrings.html \ $(DOC)\std_mmfile.html \ $(DOC)\std_numeric.html \ $(DOC)\std_outbuffer.html \ @@ -410,7 +409,6 @@ cov : $(SRC_TO_COMPILE) $(LIB) $(DMD) -cov=95 -unittest -main -run std\complex.d $(DMD) -cov=70 -unittest -main -run std\numeric.d $(DMD) -cov=94 -unittest -main -run std\bigint.d - $(DMD) -cov=100 -unittest -main -run std\metastrings.d $(DMD) -cov=95 -unittest -main -run std\bitmanip.d $(DMD) -cov=82 -unittest -main -run std\typecons.d $(DMD) -cov=44 -unittest -main -run std\uni.d @@ -602,9 +600,6 @@ $(DOC)\std_math.html : $(STDDOC) std\math.d $(DOC)\std_mathspecial.html : $(STDDOC) std\mathspecial.d $(DMD) -c -o- $(DDOCFLAGS) -Df$(DOC)\std_mathspecial.html $(STDDOC) std\mathspecial.d -$(DOC)\std_metastrings.html : $(STDDOC) std\metastrings.d - $(DMD) -c -o- $(DDOCFLAGS) -Df$(DOC)\std_metastrings.html $(STDDOC) std\metastrings.d - $(DOC)\std_mmfile.html : $(STDDOC) std\mmfile.d $(DMD) -c -o- $(DDOCFLAGS) -Df$(DOC)\std_mmfile.html $(STDDOC) std\mmfile.d diff --git a/win64.mak b/win64.mak index c33b14ab6..3ac93f3cf 100644 --- a/win64.mak +++ b/win64.mak @@ -114,7 +114,7 @@ SRC_STD_2a_HEAVY= std\array.d std\functional.d std\path.d std\outbuffer.d std\ut SRC_STD_math=std\math.d SRC_STD_3= std\csv.d std\complex.d std\numeric.d std\bigint.d -SRC_STD_3c= std\datetime.d std\metastrings.d std\bitmanip.d std\typecons.d +SRC_STD_3c= std\datetime.d std\bitmanip.d std\typecons.d SRC_STD_3a= std\uni.d std\base64.d std\ascii.d \ std\demangle.d std\uri.d std\mmfile.d std\getopt.d @@ -182,7 +182,7 @@ SRC_STD= std\zlib.d std\zip.d std\stdint.d std\container.d std\conv.d std\utf.d std\stdio.d std\uni.d std\uuid.d \ std\cstream.d std\demangle.d \ std\signals.d std\typetuple.d std\traits.d \ - std\metastrings.d std\getopt.d \ + std\getopt.d \ std\variant.d std\numeric.d std\bitmanip.d std\complex.d std\mathspecial.d \ std\functional.d std\algorithm.d std\array.d std\typecons.d \ std\json.d std\xml.d std\encoding.d std\bigint.d std\concurrency.d \ @@ -327,7 +327,6 @@ DOCS= $(DOC)\object.html \ $(DOC)\std_json.html \ $(DOC)\std_math.html \ $(DOC)\std_mathspecial.html \ - $(DOC)\std_metastrings.html \ $(DOC)\std_mmfile.html \ $(DOC)\std_numeric.html \ $(DOC)\std_outbuffer.html \ @@ -581,9 +580,6 @@ $(DOC)\std_math.html : $(STDDOC) std\math.d $(DOC)\std_mathspecial.html : $(STDDOC) std\mathspecial.d $(DMD) -c -o- $(DDOCFLAGS) -Df$(DOC)\std_mathspecial.html $(STDDOC) std\mathspecial.d -$(DOC)\std_metastrings.html : $(STDDOC) std\metastrings.d - $(DMD) -c -o- $(DDOCFLAGS) -Df$(DOC)\std_metastrings.html $(STDDOC) std\metastrings.d - $(DOC)\std_mmfile.html : $(STDDOC) std\mmfile.d $(DMD) -c -o- $(DDOCFLAGS) -Df$(DOC)\std_mmfile.html $(STDDOC) std\mmfile.d