From dd3a0c20a2029e87e2136a9af4d5cfa27738f53f Mon Sep 17 00:00:00 2001 From: jmdavis Date: Tue, 14 Jun 2011 04:00:03 -0700 Subject: [PATCH] Created std.ascii to replace std.ctype. All of the new, properly camelcased functions in std.ctype have been moved to std.ascii, and std.ctype has been scheduled for deprecation. --- posix.mak | 6 +- std/algorithm.d | 2 +- std/array.d | 2 +- std/ascii.d | 388 ++++++++++++++++++++++++++++++++++++++++++++++ std/conv.d | 4 +- std/ctype.d | 379 ++++---------------------------------------- std/datetime.d | 2 +- std/demangle.d | 2 +- std/format.d | 8 +- std/getopt.d | 2 +- std/json.d | 2 +- std/md5.d | 6 +- std/net/isemail.d | 5 +- std/regex.d | 8 +- std/regexp.d | 14 +- std/stream.d | 2 +- std/string.d | 60 +++---- std/uni.d | 18 +-- std/uri.d | 2 +- std/xml.d | 2 +- win32.mak | 11 +- 21 files changed, 505 insertions(+), 420 deletions(-) create mode 100644 std/ascii.d diff --git a/posix.mak b/posix.mak index 9f6d97b0a..63f20abc4 100644 --- a/posix.mak +++ b/posix.mak @@ -154,9 +154,9 @@ endif MAIN = $(ROOT)/emptymain.d # Stuff in std/ -STD_MODULES = $(addprefix std/, algorithm array base64 bigint bitmanip \ - compiler complex concurrency container contracts conv cpuid \ - cstream ctype date datetime datebase dateparse demangle \ +STD_MODULES = $(addprefix std/, algorithm array ascii base64 bigint \ + bitmanip compiler complex concurrency container contracts conv \ + cpuid cstream ctype date datetime datebase dateparse demangle \ encoding exception file format functional getopt gregorian \ json loader math mathspecial md5 metastrings mmfile numeric \ outbuffer parallelism path perf process random range regex \ diff --git a/std/algorithm.d b/std/algorithm.d index 15f3f4f52..54c729317 100644 --- a/std/algorithm.d +++ b/std/algorithm.d @@ -314,7 +314,7 @@ module std.algorithm; //debug = std_algorithm; import std.c.string; -import std.array, std.container, std.conv, std.ctype, std.exception, +import std.array, std.ascii, std.container, std.conv, std.exception, std.functional, std.math, std.metastrings, std.range, std.string, std.traits, std.typecons, std.typetuple, std.stdio, std.uni; diff --git a/std/array.d b/std/array.d index 4717454d7..827ab086a 100644 --- a/std/array.d +++ b/std/array.d @@ -13,7 +13,7 @@ Source: $(PHOBOSSRC std/_array.d) module std.array; import core.memory, core.bitop; -import std.algorithm, std.conv, std.ctype, std.encoding, std.exception, +import std.algorithm, std.ascii, std.conv, std.exception, std.range, std.string, std.traits, std.typecons, std.uni, std.utf; import std.c.string : memcpy; version(unittest) import core.exception, std.stdio, std.typetuple; diff --git a/std/ascii.d b/std/ascii.d new file mode 100644 index 000000000..fa12aa687 --- /dev/null +++ b/std/ascii.d @@ -0,0 +1,388 @@ +// Written in the D programming language. + +/++ + Simple ASCII character classification functions. + For Unicode classification, see $(LINK2 std_uni.html, std.uni). + References: + $(LINK2 http://www.digitalmars.com/d/ascii-table.html, ASCII Table), + $(LINK2 http://en.wikipedia.org/wiki/Ascii, Wikipedia) + Macros: + WIKI=Phobos/StdASCII + + Copyright: Copyright 2000 - + License: $(WEB www.boost.org/LICENSE_1_0.txt, Boost License 1.0). + Authors: $(WEB digitalmars.com, Walter Bright) and Jonathan M Davis + Source: $(PHOBOSSRC std/_ascii.d) + +/ +module std.ascii; + +version(unittest) import std.range; + + +immutable hexDigits = "0123456789ABCDEF"; /// 0..9A..F +immutable fullHexDigits = "0123456789ABCDEFabcdef"; /// 0..9A..Fa..f +immutable digits = "0123456789"; /// 0..9 +immutable octDigits = "01234567"; /// 0..7 +immutable lowercase = "abcdefghijklmnopqrstuvwxyz"; /// a..z +immutable letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" ~ + "abcdefghijklmnopqrstuvwxyz"; /// A..Za..z +immutable uppercase = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; /// A..Z +immutable whitespace = " \t\v\r\n\f"; /// ASCII whitespace + + +version(Windows) +{ + /// Newline sequence for this system. + immutable newline = "\r\n"; +} +else version(Posix) +{ + /// Newline sequence for this system. + immutable newline = "\n"; +} +else + static assert(0, "Unsupported OS"); + + +/++ + Returns whether $(D c) is a letter or a number (0..9, a..z, A..Z). + +/ +bool isAlphaNum(dchar c) @safe pure nothrow +{ + return c <= 0x7F ? cast(bool)(_ctype[c] & (_ALP|_DIG)) : false; +} + +unittest +{ + foreach(c; chain(digits, octDigits, fullHexDigits, letters, lowercase, uppercase)) + assert(isAlphaNum(c)); + + foreach(c; whitespace) + assert(!isAlphaNum(c)); +} + + +/++ + Returns whether $(D c) is an ASCII letter (A..Z, a..z). + +/ +bool isAlpha(dchar c) @safe pure nothrow +{ + return c <= 0x7F ? cast(bool)(_ctype[c] & _ALP) : false; +} + +unittest +{ + foreach(c; chain(letters, lowercase, uppercase)) + assert(isAlpha(c)); + + foreach(c; chain(digits, octDigits, whitespace)) + assert(!isAlpha(c)); +} + + +/++ + Returns whether $(D c) is a lowercase ASCII letter (a..z). + +/ +bool isLower(dchar c) @safe pure nothrow +{ + return c <= 0x7F ? cast(bool)(_ctype[c] & _LC) : false; +} + +unittest +{ + foreach(c; lowercase) + assert(isLower(c)); + + foreach(c; chain(digits, uppercase, whitespace)) + assert(!isLower(c)); +} + + +/++ + Returns whether $(D c) is an uppercase ASCII letter (A..Z). + +/ +bool isUpper(dchar c) @safe pure nothrow +{ + return c <= 0x7F ? cast(bool)(_ctype[c] & _UC) : false; +} + +unittest +{ + foreach(c; uppercase) + assert(isUpper(c)); + + foreach(c; chain(digits, lowercase, whitespace)) + assert(!isUpper(c)); +} + + +/++ + Returns whether $(D c) is a digit (0..9). + +/ +bool isDigit(dchar c) @safe pure nothrow +{ + return c <= 0x7F ? cast(bool)(_ctype[c] & _DIG) : false; +} + +unittest +{ + foreach(c; digits) + assert(isDigit(c)); + + foreach(c; chain(letters, whitespace)) + assert(!isDigit(c)); +} + + +/++ + Returns whether $(D c) is a digit in base 8 (0..7). + +/ +bool isOctDigit(dchar c) @safe pure nothrow +{ + //I'd edit _ctype to have a flag for octal except that something calling + //the int versions of the other functions might actually rely on the exact + //integer value returned for some reason, and so messing with _ctype + //and its flags could break that. _ctype can be edited appropriately after + //the int versions have been removed. + return c >= '0' && c <= '7'; +} + +unittest +{ + foreach(c; octDigits) + assert(isOctDigit(c)); + + foreach(c; chain(letters, ['8', '9'], whitespace)) + assert(!isOctDigit(c)); +} + + +/++ + Returns whether $(D c) is a digit in base 16 (0..9, A..F, a..f). + +/ +bool isHexDigit(dchar c) @safe pure nothrow +{ + return c <= 0x7F ? cast(bool)(_ctype[c] & _HEX) : false; +} + +unittest +{ + foreach(c; fullHexDigits) + assert(isHexDigit(c)); + + foreach(c; chain(lowercase[6 .. $], uppercase[6 .. $], whitespace)) + assert(!isHexDigit(c)); +} + + +/++ + Whether or not $(D c) is a whitespace character. That includes the space, + tab, vertical tab, form feed, carriage return, and linefeed characters. + +/ +bool isWhite(dchar c) @safe pure nothrow +{ + return c <= 0x7F ? cast(bool)(_ctype[c] & _SPC) : false; +} + +unittest +{ + foreach(c; whitespace) + assert(isWhite(c)); + + foreach(c; chain(digits, letters)) + assert(!isWhite(c)); +} + + +/++ + Returns whether $(D c) is a control character. + +/ +bool isControl(dchar c) @safe pure nothrow +{ + return c <= 0x7F ? cast(bool)(_ctype[c] & _CTL) : false; +} + +unittest +{ + foreach(dchar c; iota(0, 32)) + assert(isControl(c)); + assert(isControl(127)); + + foreach(c; chain(digits, letters, [' '])) + assert(!isControl(c)); +} + + +/++ + Whether or not $(D c) is a punctuation character. That includes all ASCII + characters which are not control characters, letters, digits, or whitespace. + +/ +bool isPunct(dchar c) @safe pure nothrow +{ + return c <= 0x7F ? cast(bool)(_ctype[c] & _PNC) : false; +} + +unittest +{ + foreach(dchar c; iota(0, 128)) + { + if(isControl(c) || isAlphaNum(c) || c == ' ') + assert(!isPunct(c)); + else + assert(isPunct(c)); + } +} + + +/++ + Whether or not $(D c) is a printable character other than the space + character. + +/ +bool isGraph(dchar c) @safe pure nothrow +{ + return c <= 0x7F ? cast(bool)(_ctype[c] & (_ALP|_DIG|_PNC)) : false; +} + +unittest +{ + foreach(dchar c; iota(0, 128)) + { + if(isControl(c) || c == ' ') + assert(!isGraph(c)); + else + assert(isGraph(c)); + } +} + +/++ + Whether or not $(D c) is a printable character - including the space + character. + +/ +bool isPrint(dchar c) @safe pure nothrow +{ + return c <= 0x7F ? cast(bool)(_ctype[c] & (_ALP|_DIG|_PNC|_BLK)) : false; +} + +unittest +{ + foreach(dchar c; iota(0, 128)) + { + if(isControl(c)) + assert(!isPrint(c)); + else + assert(isPrint(c)); + } +} + + +/++ + Whether or not $(D c) is in the ASCII character set - i.e. in the range + 0..0x7F. + +/ +bool isASCII(dchar c) @safe pure nothrow +{ + return c <= 0x7F; +} + +unittest +{ + foreach(dchar c; iota(0, 128)) + assert(isASCII(c)); + + assert(!isASCII(128)); +} + + +/++ + If $(D c) is an uppercase ASCII character, then its corresponding lowercase + letter is returned. Otherwise, $(D c) is returned. + +/ +dchar toLower(dchar c) @safe pure nothrow +out(result) +{ + assert(!isUpper(result)); +} +body +{ + return isUpper(c) ? c + cast(dchar)('a' - 'A') : c; +} + +unittest +{ + foreach(i, c; uppercase) + assert(toLower(c) == lowercase[i]); + + foreach(dchar c; iota(0, 128)) + { + if(c < 'A' || c > 'Z') + assert(toLower(c) == c); + } +} + + +/++ + If $(D c) is a lowercase ASCII character, then its corresponding uppercase + letter is returned. Otherwise, $(D c) is returned. + +/ +dchar toUpper(dchar c) @safe pure nothrow +out(result) +{ + assert(!isLower(result)); +} +body +{ + return isLower(c) ? c - cast(dchar)('a' - 'A') : c; +} + +unittest +{ + foreach(i, c; lowercase) + assert(toUpper(c) == uppercase[i]); + + foreach(dchar c; iota(0, 128)) + { + if(c < 'a' || c > 'z') + assert(toUpper(c) == c); + } +} + + +//============================================================================== +// Private Section. +//============================================================================== +private: + +enum +{ + _SPC = 8, + _CTL = 0x20, + _BLK = 0x40, + _HEX = 0x80, + _UC = 1, + _LC = 2, + _PNC = 0x10, + _DIG = 4, + _ALP = _UC|_LC, +} + +immutable ubyte _ctype[128] = +[ + _CTL,_CTL,_CTL,_CTL,_CTL,_CTL,_CTL,_CTL, + _CTL,_CTL|_SPC,_CTL|_SPC,_CTL|_SPC,_CTL|_SPC,_CTL|_SPC,_CTL,_CTL, + _CTL,_CTL,_CTL,_CTL,_CTL,_CTL,_CTL,_CTL, + _CTL,_CTL,_CTL,_CTL,_CTL,_CTL,_CTL,_CTL, + _SPC|_BLK,_PNC,_PNC,_PNC,_PNC,_PNC,_PNC,_PNC, + _PNC,_PNC,_PNC,_PNC,_PNC,_PNC,_PNC,_PNC, + _DIG|_HEX,_DIG|_HEX,_DIG|_HEX,_DIG|_HEX,_DIG|_HEX, + _DIG|_HEX,_DIG|_HEX,_DIG|_HEX,_DIG|_HEX,_DIG|_HEX, + _PNC,_PNC,_PNC,_PNC,_PNC,_PNC, + _PNC,_UC|_HEX,_UC|_HEX,_UC|_HEX,_UC|_HEX,_UC|_HEX,_UC|_HEX,_UC, + _UC,_UC,_UC,_UC,_UC,_UC,_UC,_UC, + _UC,_UC,_UC,_UC,_UC,_UC,_UC,_UC, + _UC,_UC,_UC,_PNC,_PNC,_PNC,_PNC,_PNC, + _PNC,_LC|_HEX,_LC|_HEX,_LC|_HEX,_LC|_HEX,_LC|_HEX,_LC|_HEX,_LC, + _LC,_LC,_LC,_LC,_LC,_LC,_LC,_LC, + _LC,_LC,_LC,_LC,_LC,_LC,_LC,_LC, + _LC,_LC,_LC,_PNC,_PNC,_PNC,_PNC,_CTL +]; + diff --git a/std/conv.d b/std/conv.d index 61842442d..8ab122022 100644 --- a/std/conv.d +++ b/std/conv.d @@ -19,7 +19,7 @@ module std.conv; import core.stdc.math : ldexpl; import core.memory, core.stdc.errno, core.stdc.string, core.stdc.stdlib; -import std.algorithm, std.array, std.ctype, std.exception, std.math, std.range, +import std.algorithm, std.array, std.ascii, std.exception, std.math, std.range, std.stdio, std.string, std.traits, std.typecons, std.typetuple, std.uni, std.utf; import std.metastrings; @@ -2452,7 +2452,7 @@ unittest // { // //writefln("toFloat('%s')", s); // auto sz = toStringZ(to!(const char[])(s)); -// if (std.ctype.isspace(*sz)) +// if (std.ascii.isspace(*sz)) // goto Lerr; // // issue 1589 diff --git a/std/ctype.d b/std/ctype.d index e8969d8ff..0822a4a13 100644 --- a/std/ctype.d +++ b/std/ctype.d @@ -1,6 +1,9 @@ // Written in the D programming language. /** + * $(RED Scheduled for deprecation in December 2011. Please use + * $(LINK2 std_ascii.html, std.ascii) instead.) + * * Simple ASCII character classification functions. * For Unicode classification, see $(LINK2 std_uni.html, std.uni). * References: @@ -16,78 +19,60 @@ */ module std.ctype; -version(unittest) import std.range; - - -immutable hexDigits = "0123456789ABCDEF"; /// 0..9A..F -immutable fullHexDigits = "0123456789ABCDEFabcdef"; /// 0..9A..Fa..f -immutable digits = "0123456789"; /// 0..9 -immutable octDigits = "01234567"; /// 0..7 -immutable lowercase = "abcdefghijklmnopqrstuvwxyz"; /// a..z -immutable letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" ~ - "abcdefghijklmnopqrstuvwxyz"; /// A..Za..z -immutable uppercase = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; /// A..Z -immutable whitespace = " \t\v\r\n\f"; /// ASCII whitespace - - -version(Windows) -{ - /// Newline sequence for this system. - immutable newline = "\r\n"; -} -else version(Posix) -{ - /// Newline sequence for this system. - immutable newline = "\n"; -} -else - static assert(0, "Unsupported OS"); +import std.ascii; /** - * $(RED Scheduled for deprecation in December 2011. Please use $(D isAlphaNum) instead.) + * $(RED Scheduled for deprecation in December 2011. 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 Scheduled for deprecation in December 2011. Please use $(D isAlpha) instead.) + * $(RED Scheduled for deprecation in December 2011. 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 Scheduled for deprecation in December 2011. Please use $(D isControl) instead.) + * $(RED Scheduled for deprecation in December 2011. 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 Scheduled for deprecation in December 2011. Please use $(D isDigit) instead.) + * $(RED Scheduled for deprecation in December 2011. 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 Scheduled for deprecation in December 2011. Please use $(D isLower) instead.) + * $(RED Scheduled for deprecation in December 2011. 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 Scheduled for deprecation in December 2011. Please use $(D isPunct) instead.) + * $(RED Scheduled for deprecation in December 2011. Please use + * $(D std.ascii.isPunct) instead.) * * Returns !=0 if c is a punctuation character. */ pure int ispunct(dchar c) { return (c <= 0x7F) ? _ctype[c] & (_PNC) : 0; } /** - * $(RED Scheduled for deprecation in December 2011. Please use $(D isWhite) instead.) + * $(RED Scheduled for deprecation in December 2011. Please use + * $(D std.ascii.isWhite) instead.) * * Returns !=0 if c is a space, tab, vertical tab, form feed, * carriage return, or linefeed. @@ -95,35 +80,40 @@ 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 Scheduled for deprecation in December 2011. Please use $(D isUpper) instead.) + * $(RED Scheduled for deprecation in December 2011. 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 Scheduled for deprecation in December 2011. Please use $(D isHexDigit) instead.) + * $(RED Scheduled for deprecation in December 2011. 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 Scheduled for deprecation in December 2011. Please use $(D isGraph) instead.) + * $(RED Scheduled for deprecation in December 2011. Please use + * $(D std.ascii.isGraph) 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 Scheduled for deprecation in December 2011. Please use $(D isPrint) instead.) + * $(RED Scheduled for deprecation in December 2011. Please use + * $(D std.ascii.isPrint) 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 Scheduled for deprecation in December 2011. Please use $(D isASCII) instead.) + * $(RED Scheduled for deprecation in December 2011. Please use + * $(D std.ascii.isASCII) instead.) * * Returns !=0 if c is in the ascii character set, i.e. in the range 0..0x7F. */ @@ -131,329 +121,28 @@ pure int isascii(dchar c) { return c <= 0x7F; } /** - * $(RED Scheduled for deprecation in December 2011. Please use $(D toLower) instead.) + * $(RED Scheduled for deprecation in December 2011. Please use + * $(D std.ascii.toLower) instead.) * * If c is an upper case ascii character, * return the lower case equivalent, otherwise return c. */ pure dchar tolower(dchar c) { - return toLower(c); + return std.ascii.toLower(c); } /** - * $(RED Scheduled for deprecation in December 2011. Please use $(D toUpper) instead.) + * $(RED Scheduled for deprecation in December 2011. Please use + * $(D std.ascii.toUpper) instead.) * * If c is a lower case ascii character, * return the upper case equivalent, otherwise return c. */ pure dchar toupper(dchar c) { - return toUpper(c); -} - - -/++ - Returns whether $(D c) is a letter or a number (0..9, a..z, A..Z). - +/ -bool isAlphaNum(dchar c) @safe pure nothrow -{ - return c <= 0x7F ? cast(bool)(_ctype[c] & (_ALP|_DIG)) : false; -} - -unittest -{ - foreach(c; chain(digits, octDigits, fullHexDigits, letters, lowercase, uppercase)) - assert(isAlphaNum(c)); - - foreach(c; whitespace) - assert(!isAlphaNum(c)); -} - - -/++ - Returns whether $(D c) is an ASCII letter (A..Z, a..z). - +/ -bool isAlpha(dchar c) @safe pure nothrow -{ - return c <= 0x7F ? cast(bool)(_ctype[c] & _ALP) : false; -} - -unittest -{ - foreach(c; chain(letters, lowercase, uppercase)) - assert(isAlpha(c)); - - foreach(c; chain(digits, octDigits, whitespace)) - assert(!isAlpha(c)); -} - - -/++ - Returns whether $(D c) is a lowercase ASCII letter (a..z). - +/ -bool isLower(dchar c) @safe pure nothrow -{ - return c <= 0x7F ? cast(bool)(_ctype[c] & _LC) : false; -} - -unittest -{ - foreach(c; lowercase) - assert(isLower(c)); - - foreach(c; chain(digits, uppercase, whitespace)) - assert(!isLower(c)); -} - - -/++ - Returns whether $(D c) is an uppercase ASCII letter (A..Z). - +/ -bool isUpper(dchar c) @safe pure nothrow -{ - return c <= 0x7F ? cast(bool)(_ctype[c] & _UC) : false; -} - -unittest -{ - foreach(c; uppercase) - assert(isUpper(c)); - - foreach(c; chain(digits, lowercase, whitespace)) - assert(!isUpper(c)); -} - - -/++ - Returns whether $(D c) is a digit (0..9). - +/ -bool isDigit(dchar c) @safe pure nothrow -{ - return c <= 0x7F ? cast(bool)(_ctype[c] & _DIG) : false; -} - -unittest -{ - foreach(c; digits) - assert(isDigit(c)); - - foreach(c; chain(letters, whitespace)) - assert(!isDigit(c)); -} - - -/++ - Returns whether $(D c) is a digit in base 8 (0..7). - +/ -bool isOctDigit(dchar c) @safe pure nothrow -{ - //I'd edit _ctype to have a flag for octal except that something calling - //the int versions of the other functions might actually rely on the exact - //integer value returned for some reason, and so messing with _ctype - //and its flags could break that. _ctype can be edited appropriately after - //the int versions have been removed. - return c >= '0' && c <= '7'; -} - -unittest -{ - foreach(c; octDigits) - assert(isOctDigit(c)); - - foreach(c; chain(letters, ['8', '9'], whitespace)) - assert(!isOctDigit(c)); -} - - -/++ - Returns whether $(D c) is a digit in base 16 (0..9, A..F, a..f). - +/ -bool isHexDigit(dchar c) @safe pure nothrow -{ - return c <= 0x7F ? cast(bool)(_ctype[c] & _HEX) : false; -} - -unittest -{ - foreach(c; fullHexDigits) - assert(isHexDigit(c)); - - foreach(c; chain(lowercase[6 .. $], uppercase[6 .. $], whitespace)) - assert(!isHexDigit(c)); -} - - -/++ - Whether or not $(D c) is a whitespace character. That includes the space, - tab, vertical tab, form feed, carriage return, and linefeed characters. - +/ -bool isWhite(dchar c) @safe pure nothrow -{ - return c <= 0x7F ? cast(bool)(_ctype[c] & _SPC) : false; -} - -unittest -{ - foreach(c; whitespace) - assert(isWhite(c)); - - foreach(c; chain(digits, letters)) - assert(!isWhite(c)); -} - - -/++ - Returns whether $(D c) is a control character. - +/ -bool isControl(dchar c) @safe pure nothrow -{ - return c <= 0x7F ? cast(bool)(_ctype[c] & _CTL) : false; -} - -unittest -{ - foreach(dchar c; iota(0, 32)) - assert(isControl(c)); - assert(isControl(127)); - - foreach(c; chain(digits, letters, [' '])) - assert(!isControl(c)); -} - - -/++ - Whether or not $(D c) is a punctuation character. That includes all ASCII - characters which are not control characters, letters, digits, or whitespace. - +/ -bool isPunct(dchar c) @safe pure nothrow -{ - return c <= 0x7F ? cast(bool)(_ctype[c] & _PNC) : false; -} - -unittest -{ - foreach(dchar c; iota(0, 128)) - { - if(isControl(c) || isAlphaNum(c) || c == ' ') - assert(!isPunct(c)); - else - assert(isPunct(c)); - } -} - - -/++ - Whether or not $(D c) is a printable character other than the space - character. - +/ -bool isGraph(dchar c) @safe pure nothrow -{ - return c <= 0x7F ? cast(bool)(_ctype[c] & (_ALP|_DIG|_PNC)) : false; -} - -unittest -{ - foreach(dchar c; iota(0, 128)) - { - if(isControl(c) || c == ' ') - assert(!isGraph(c)); - else - assert(isGraph(c)); - } -} - -/++ - Whether or not $(D c) is a printable character - including the space - character. - +/ -bool isPrint(dchar c) @safe pure nothrow -{ - return c <= 0x7F ? cast(bool)(_ctype[c] & (_ALP|_DIG|_PNC|_BLK)) : false; -} - -unittest -{ - foreach(dchar c; iota(0, 128)) - { - if(isControl(c)) - assert(!isPrint(c)); - else - assert(isPrint(c)); - } -} - - -/++ - Whether or not $(D c) is in the ASCII character set - i.e. in the range - 0..0x7F. - +/ -bool isASCII(dchar c) @safe pure nothrow -{ - return c <= 0x7F; -} - -unittest -{ - foreach(dchar c; iota(0, 128)) - assert(isASCII(c)); - - assert(!isASCII(128)); -} - - -/++ - If $(D c) is an uppercase ASCII character, then its corresponding lowercase - letter is returned. Otherwise, $(D c) is returned. - +/ -dchar toLower(dchar c) @safe pure nothrow -out(result) -{ - assert(!isUpper(result)); -} -body -{ - return isUpper(c) ? c + cast(dchar)('a' - 'A') : c; -} - -unittest -{ - foreach(i, c; uppercase) - assert(toLower(c) == lowercase[i]); - - foreach(dchar c; iota(0, 128)) - { - if(c < 'A' || c > 'Z') - assert(toLower(c) == c); - } -} - - -/++ - If $(D c) is a lowercase ASCII character, then its corresponding uppercase - letter is returned. Otherwise, $(D c) is returned. - +/ -dchar toUpper(dchar c) @safe pure nothrow -out(result) -{ - assert(!isLower(result)); -} -body -{ - return isLower(c) ? c - cast(dchar)('a' - 'A') : c; -} - -unittest -{ - foreach(i, c; lowercase) - assert(toUpper(c) == uppercase[i]); - - foreach(dchar c; iota(0, 128)) - { - if(c < 'a' || c > 'z') - assert(toUpper(c) == c); - } + return std.ascii.toUpper(c); } diff --git a/std/datetime.d b/std/datetime.d index cf68fb1e4..5a0da6f94 100644 --- a/std/datetime.d +++ b/std/datetime.d @@ -106,8 +106,8 @@ import core.stdc.time; import std.array; import std.algorithm; +import std.ascii; import std.conv; -import std.ctype; import std.exception; import std.file; import std.functional; diff --git a/std/demangle.d b/std/demangle.d index 81e562e95..86c81b994 100644 --- a/std/demangle.d +++ b/std/demangle.d @@ -40,7 +40,7 @@ private class MangleException : Exception * pretty-printing any found D mangled names. ------------------- import std.stdio; -import std.ctype; +import std.ascii; import std.demangle; int main() diff --git a/std/format.d b/std/format.d index 4a8913ac0..aed967fda 100644 --- a/std/format.d +++ b/std/format.d @@ -21,8 +21,8 @@ module std.format; //debug=format; // uncomment to turn on debugging printf's import core.stdc.stdio, core.stdc.stdlib, core.stdc.string, core.vararg; -import std.algorithm, std.array, std.bitmanip, std.conv, - std.ctype, std.exception, std.functional, std.math, std.range, +import std.algorithm, std.array, std.ascii, std.bitmanip, std.conv, + std.exception, std.functional, std.math, std.range, std.string, std.system, std.traits, std.typecons, std.typetuple, std.utf; version(unittest) { @@ -828,8 +828,8 @@ struct FormatSpec(Char) { if (trailing.ptr[0] == ' ') { - while (!r.empty && std.ctype.isWhite(r.front)) r.popFront(); - //r = std.algorithm.find!(not!(std.ctype.isWhite))(r); + while (!r.empty && std.ascii.isWhite(r.front)) r.popFront(); + //r = std.algorithm.find!(not!(std.ascii.isWhite))(r); } else { diff --git a/std/getopt.d b/std/getopt.d index 7caf26dad..0fd0e5a06 100644 --- a/std/getopt.d +++ b/std/getopt.d @@ -33,7 +33,7 @@ Distributed under the Boost Software License, Version 1.0. module std.getopt; private import std.array, std.string, std.conv, std.traits, std.bitmanip, - std.algorithm, std.ctype, std.exception; + std.algorithm, std.ascii, std.exception; version (unittest) { diff --git a/std/json.d b/std/json.d index 4e0b16d06..c43f97287 100644 --- a/std/json.d +++ b/std/json.d @@ -17,9 +17,9 @@ Distributed under the Boost Software License, Version 1.0. */ module std.json; +import std.ascii; import std.conv; import std.range; -import std.ctype; import std.utf; private { diff --git a/std/md5.d b/std/md5.d index b9a8843aa..f1f9402ba 100644 --- a/std/md5.d +++ b/std/md5.d @@ -88,7 +88,7 @@ module std.md5; //debug=md5; // uncomment to turn on debugging printf's -import std.ctype; +import std.ascii; import std.string; import std.exception; import std.c.stdio : printf; @@ -128,8 +128,8 @@ string digestToString(in ubyte[16] digest) foreach (ubyte u; digest) { - result[i] = std.ctype.hexDigits[u >> 4]; - result[i + 1] = std.ctype.hexDigits[u & 15]; + result[i] = std.ascii.hexDigits[u >> 4]; + result[i + 1] = std.ascii.hexDigits[u & 15]; i += 2; } return assumeUnique(result); diff --git a/std/net/isemail.d b/std/net/isemail.d index 980fbe961..9eead7088 100644 --- a/std/net/isemail.d +++ b/std/net/isemail.d @@ -26,6 +26,7 @@ module std.net.isemail; import std.algorithm : ElementType, equal, uniq, filter, contains = canFind; import std.array; +import std.ascii; import std.conv; import std.exception : enforce; import std.regex; @@ -2047,10 +2048,10 @@ sizediff_t lastIndexOf(Char1, Char2)(in Char1[] s, const(Char2)[] sub, return std.string.lastIndexOf(s, c, cs); if (c <= 0x7F) { - c = std.ctype.toLower(c); + c = std.ascii.toLower(c); for (ptrdiff_t i = s.length - sub.length; i >= 0; i--) { - if (std.ctype.toLower(s[i]) == c) + if (std.ascii.toLower(s[i]) == c) { if (icmp(s[i + 1 .. i + sub.length], sub[1 .. sub.length]) == 0) return i; diff --git a/std/regex.d b/std/regex.d index 2ddb7388d..7da1c2b90 100644 --- a/std/regex.d +++ b/std/regex.d @@ -104,7 +104,7 @@ import core.stdc.stdlib; import core.stdc.string; import std.stdio; import std.string; -import std.ctype; +import std.ascii; import std.outbuffer; import std.bitmanip; import std.utf; @@ -833,7 +833,7 @@ Returns the number of parenthesized captures if (isAlpha(c)) { op = REichar; - c = cast(char)std.ctype.toUpper(c); + c = cast(char)std.ascii.toUpper(c); } } if (op == REchar && c <= 0xFF) @@ -2114,7 +2114,7 @@ Returns $(D hit) (converted to $(D string) if necessary). if (c1 != c2) { if (isLower(cast(E) c2)) - c2 = std.ctype.toUpper(cast(E) c2); + c2 = std.ascii.toUpper(cast(E) c2); else goto Lnomatch; if (c1 != c2) @@ -2145,7 +2145,7 @@ Returns $(D hit) (converted to $(D string) if necessary). if (c1 != c2) { if (isLower(cast(E) c2)) - c2 = std.ctype.toUpper(cast(E) c2); + c2 = std.ascii.toUpper(cast(E) c2); else goto Lnomatch; if (c1 != c2) diff --git a/std/regexp.d b/std/regexp.d index 07b2bf2cb..cf1325e98 100644 --- a/std/regexp.d +++ b/std/regexp.d @@ -134,7 +134,7 @@ private import std.array; import std.stdio; import std.string; - import std.ctype; + import std.ascii; import std.outbuffer; import std.bitmanip; import std.utf; @@ -1653,7 +1653,7 @@ public bool test(string s) if (c1 != c2) { if (isLower(cast(rchar)c2)) - c2 = std.ctype.toUpper(cast(rchar)c2); + c2 = std.ascii.toUpper(cast(rchar)c2); else goto Lnomatch; if (c1 != c2) @@ -1682,7 +1682,7 @@ public bool test(string s) if (c1 != c2) { if (isLower(cast(rchar)c2)) - c2 = std.ctype.toUpper(cast(rchar)c2); + c2 = std.ascii.toUpper(cast(rchar)c2); else goto Lnomatch; if (c1 != c2) @@ -2416,7 +2416,7 @@ public bool test(string s) if (isAlpha(c)) { op = REichar; - c = cast(char)std.ctype.toUpper(c); + c = cast(char)std.ascii.toUpper(c); } } if (op == REchar && c <= 0xFF) @@ -2956,7 +2956,7 @@ private: c = prog[i + 1]; if (c <= 0x7F) { r.setbit2(c); - r.setbit2(std.ctype.toLower(cast(rchar)c)); + r.setbit2(std.ascii.toLower(cast(rchar)c)); } return 1; @@ -2982,8 +2982,8 @@ private: c = *cast(rchar *)&prog[i + 1 + size_t.sizeof]; debug(regexp) printf("\tREistring %d, '%c'\n", len, c); if (c <= 0x7F) - { r.setbit2(std.ctype.toUpper(cast(rchar)c)); - r.setbit2(std.ctype.toLower(cast(rchar)c)); + { r.setbit2(std.ascii.toUpper(cast(rchar)c)); + r.setbit2(std.ascii.toLower(cast(rchar)c)); } return 1; diff --git a/std/stream.d b/std/stream.d index 2dfd0ebae..2dc23194c 100644 --- a/std/stream.d +++ b/std/stream.d @@ -73,7 +73,7 @@ enum SeekPos { private { import std.conv; - import std.ctype; + import std.ascii; import std.format; import std.system; // for Endian enumeration import std.utf; diff --git a/std/string.d b/std/string.d index 630d983d6..57d5b092b 100644 --- a/std/string.d +++ b/std/string.d @@ -60,7 +60,7 @@ module std.string; import core.exception : onRangeError; import core.vararg, core.stdc.stdio, core.stdc.stdlib, core.stdc.string, - std.conv, std.ctype, std.exception, std.format, std.functional, + std.ascii, std.conv, std.exception, std.format, std.functional, std.metastrings, std.range, std.regex, std.stdio, std.traits, std.typetuple, std.uni, std.utf; @@ -104,7 +104,7 @@ class StringException : Exception /++ $(RED Scheduled for deprecation in December 2011. - Please use $(XREF ctype, hexDigits) instead.) + Please use $(XREF ascii, hexDigits) instead.) 0..9A..F +/ @@ -112,15 +112,15 @@ immutable char[16] hexdigits = "0123456789ABCDEF"; /++ $(RED Scheduled for deprecation in December 2011. - Please use $(XREF ctype, digits) instead.) + Please use $(XREF ascii, digits) instead.) 0..9 +/ -alias std.ctype.digits digits; +alias std.ascii.digits digits; /++ $(RED Scheduled for deprecation in December 2011. - Please use $(XREF ctype, octDigits) instead.) + Please use $(XREF ascii, octDigits) instead.) 0..7 +/ @@ -128,7 +128,7 @@ immutable char[8] octdigits = "01234567"; /++ $(RED Scheduled for deprecation in December 2011. - Please use $(XREF ctype, lowercase) instead.) + Please use $(XREF ascii, lowercase) instead.) a..z +/ @@ -136,7 +136,7 @@ immutable char[26] lowercase = "abcdefghijklmnopqrstuvwxyz"; /++ $(RED Scheduled for deprecation in December 2011. - Please use $(XREF ctype, letters) instead.) + Please use $(XREF ascii, letters) instead.) A..Za..z +/ @@ -145,7 +145,7 @@ immutable char[52] letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" /++ $(RED Scheduled for deprecation in December 2011. - Please use $(XREF ctype, uppercase) instead.) + Please use $(XREF ascii, uppercase) instead.) A..Z +/ @@ -153,11 +153,11 @@ immutable char[26] uppercase = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; /++ $(RED Scheduled for deprecation in December 2011. - Please use $(XREF ctype, whitespace) instead.) + Please use $(XREF ascii, whitespace) instead.) ASCII whitespace. +/ -alias std.ctype.whitespace whitespace; +alias std.ascii.whitespace whitespace; /++ $(RED Scheduled for deprecation in December 2011. @@ -177,15 +177,15 @@ enum dchar PS = '\u2029'; /++ $(RED Scheduled for deprecation in December 2011. - Please use $(XREF ctype, newline) instead.) + Please use $(XREF ascii, newline) instead.) Newline sequence for this system. +/ -alias std.ctype.newline newline; +alias std.ascii.newline newline; /********************************** * $(RED Scheduled for deprecation in December 2011. - * Please use $(XREF ctype, isWhite) or $(XREF uni, isUniWhite) instead.) + * Please use $(XREF ascii, isWhite) or $(XREF uni, isUniWhite) instead.) * * Returns true if c is ASCII whitespace or unicode LS or PS. */ @@ -194,7 +194,7 @@ else bool iswhite(C)(C c) if(is(Unqual!C : dchar)) { pragma(msg, softDeprec!("2.054", "December 2011", "iswhite", - "std.ctype.isWhite or std.uni.isUniWhite")); + "std.ascii.isWhite or std.uni.isUniWhite")); return c <= 0x7F ? indexOf(whitespace, c) != -1 @@ -472,7 +472,7 @@ sizediff_t indexOf(Char)(in Char[] s, { static if (Char.sizeof == 1) { - if (std.ctype.isASCII(c)) + if (std.ascii.isASCII(c)) { // Plain old ASCII auto p = cast(char*)memchr(s.ptr, c, s.length); if (p) @@ -491,13 +491,13 @@ sizediff_t indexOf(Char)(in Char[] s, } else { - if (std.ctype.isASCII(c)) + if (std.ascii.isASCII(c)) { // Plain old ASCII - auto c1 = cast(char) std.ctype.toLower(c); + auto c1 = cast(char) std.ascii.toLower(c); foreach (sizediff_t i, c2; s) { - auto c3 = std.ctype.toLower(c2); + auto c3 = std.ascii.toLower(c2); if (c1 == c3) return i; } @@ -656,13 +656,13 @@ sizediff_t lastIndexOf(Char)(const(Char)[] s, } else { - if(std.ctype.isASCII(c)) + if(std.ascii.isASCII(c)) { - immutable c1 = std.ctype.toLower(c); + immutable c1 = std.ascii.toLower(c); for(auto i = s.length; i-- != 0;) { - immutable c2 = std.ctype.toLower(s[i]); + immutable c2 = std.ascii.toLower(s[i]); if(c1 == c2) return cast(sizediff_t)i; } @@ -969,11 +969,11 @@ void toLowerInPlace(C)(ref C[] s) for (size_t i = 0; i < s.length; ) { immutable c = s[i]; - if (std.ctype.isUpper(c)) + if (std.ascii.isUpper(c)) { s[i++] = cast(C) (c + (cast(C)'a' - 'A')); } - else if (!std.ctype.isASCII(c)) + else if (!std.ascii.isASCII(c)) { // wide character size_t j = i; @@ -1149,7 +1149,7 @@ void toUpperInPlace(C)(ref C[] s) { s[i++] = cast(C) (c - (cast(C)'a' - 'A')); } - else if (!std.ctype.isASCII(c)) + else if (!std.ascii.isASCII(c)) { // wide character size_t j = i; @@ -2124,9 +2124,9 @@ in assert(from.length == to.length); assert(from.length <= 128); foreach (char c; from) - assert(std.ctype.isASCII(c)); + assert(std.ascii.isASCII(c)); foreach (char c; to) - assert(std.ctype.isASCII(c)); + assert(std.ascii.isASCII(c)); } body { @@ -2223,7 +2223,7 @@ char[] bug2479sformat(char[] s, TypeInfo[] arguments, va_list argptr) void putc(dchar c) { - if(std.ctype.isASCII(c)) + if(std.ascii.isASCII(c)) { if (i >= s.length) onRangeError("std.string.sformat", 0); @@ -2280,7 +2280,7 @@ char[] sformat(char[] s, ...) void putc(dchar c) { - if(std.ctype.isASCII(c)) + if(std.ascii.isASCII(c)) { if (i >= s.length) onRangeError("std.string.sformat", 0); @@ -2648,7 +2648,7 @@ unittest S succ(S)(S s) if (isSomeString!S) { - if (s.length && std.ctype.isAlphaNum(s[$ - 1])) + if (s.length && std.ascii.isAlphaNum(s[$ - 1])) { auto r = s.dup; size_t i = r.length - 1; @@ -2681,7 +2681,7 @@ S succ(S)(S s) if (isSomeString!S) break; default: - if (std.ctype.isAlphaNum(c)) + if (std.ascii.isAlphaNum(c)) r[i]++; return cast(S) r; } diff --git a/std/uni.d b/std/uni.d index 3f82823c9..f4808a7d3 100644 --- a/std/uni.d +++ b/std/uni.d @@ -2,7 +2,7 @@ /** * Simple Unicode character classification functions. - * For ASCII classification, see $(LINK2 std_ctype.html, std.ctype). + * For ASCII classification, see $(LINK2 std_ascii.html, std.ascii). * Macros: * WIKI=Phobos/StdUni * References: @@ -19,7 +19,7 @@ */ module std.uni; -static import std.ctype; +static import std.ascii; enum dchar lineSep = '\u2028'; /// UTF line separator enum dchar paraSep = '\u2029'; /// UTF paragraph separator @@ -29,7 +29,7 @@ enum dchar paraSep = '\u2029'; /// UTF paragraph separator +/ bool isUniWhite(dchar c) @safe pure nothrow { - return std.ctype.isWhite(c) || + return std.ascii.isWhite(c) || c == lineSep || c == paraSep || c == '\u0085' || c == '\u00A0' || c == '\u1680' || c == '\u180E' || (c >= '\u2000' && c <= '\u200A') || @@ -41,8 +41,8 @@ bool isUniWhite(dchar c) @safe pure nothrow +/ bool isUniLower(dchar c) @safe pure nothrow { - if(std.ctype.isASCII(c)) - return std.ctype.isLower(c); + if(std.ascii.isASCII(c)) + return std.ascii.isLower(c); return isUniAlpha(c) && c == toUniLower(c); } @@ -52,8 +52,8 @@ bool isUniLower(dchar c) @safe pure nothrow +/ bool isUniUpper(dchar c) @safe pure nothrow { - if(std.ctype.isASCII(c)) - return std.ctype.isUpper(c); + if(std.ascii.isASCII(c)) + return std.ascii.isUpper(c); return isUniAlpha(c) && c == toUniUpper(c); } @@ -64,7 +64,7 @@ bool isUniUpper(dchar c) @safe pure nothrow +/ dchar toUniLower(dchar c) @safe pure nothrow { - if(std.ctype.isUpper(c)) + if(std.ascii.isUpper(c)) c += 32; else if(c >= 0x00C0) { @@ -123,7 +123,7 @@ dchar toUniLower(dchar c) @safe pure nothrow +/ dchar toUniUpper(dchar c) @safe pure nothrow { - if(std.ctype.isLower(c)) + if(std.ascii.isLower(c)) c -= 32; else if(c >= 0x00E0) { diff --git a/std/uri.d b/std/uri.d index 94f26729e..772a7992f 100644 --- a/std/uri.d +++ b/std/uri.d @@ -30,7 +30,7 @@ module std.uri; /* ====================== URI Functions ================ */ -private import std.ctype; +private import std.ascii; private import std.c.stdlib; private import std.utf; private import std.stdio; diff --git a/std/xml.d b/std/xml.d index 8001c50d7..cc6204d6d 100644 --- a/std/xml.d +++ b/std/xml.d @@ -124,7 +124,7 @@ Distributed under the Boost Software License, Version 1.0. module std.xml; import std.array; -import std.ctype; +import std.ascii; import std.string; import std.encoding; diff --git a/win32.mak b/win32.mak index 3904aecdf..fc75b0250 100644 --- a/win32.mak +++ b/win32.mak @@ -111,7 +111,7 @@ SRCS_12 = std\array.d std\functional.d std\range.d \ SRCS_2 = std\math.d std\complex.d std\numeric.d std\bigint.d \ std\dateparse.d std\date.d std\datetime.d \ std\metastrings.d std\bitmanip.d std\typecons.d \ - std\uni.d std\base64.d std\md5.d std\ctype.d \ + std\uni.d std\base64.d std\md5.d std\ctype.d std\ascii.d \ std\demangle.d std\uri.d std\mmfile.d std\getopt.d \ std\signals.d std\typetuple.d std\traits.d std\bind.d \ std\encoding.d std\xml.d \ @@ -177,6 +177,7 @@ DOCS= $(DOC)\object.html \ $(DOC)\core_sync_semaphore.html \ $(DOC)\std_algorithm.html \ $(DOC)\std_array.html \ + $(DOC)\std_ascii.html \ $(DOC)\std_base64.html \ $(DOC)\std_bigint.html \ $(DOC)\std_bind.html \ @@ -271,7 +272,7 @@ SRC_STD= std\zlib.d std\zip.d std\stdint.d std\container.d std\conv.d std\utf.d std\json.d std\xml.d std\encoding.d std\bigint.d std\concurrency.d \ std\range.d std\stdiobase.d std\parallelism.d \ std\regex.d std\datebase.d \ - std\__fileinit.d std\gregorian.d std\exception.d + std\__fileinit.d std\gregorian.d std\exception.d std\ascii.d SRC_STD_NET= std\net\isemail.d @@ -382,6 +383,9 @@ algorithm.obj : std\algorithm.d array.obj : std\array.d $(DMD) -c $(DFLAGS) std\array.d +ascii.obj : std\ascii.d + $(DMD) -c $(DFLAGS) std\ascii.d + base64.obj : std\base64.d $(DMD) -c $(DFLAGS) -inline std\base64.d @@ -681,6 +685,9 @@ $(DOC)\std_algorithm.html : $(STDDOC) std\algorithm.d $(DOC)\std_array.html : $(STDDOC) std\array.d $(DMD) -c -o- $(DFLAGS) -Df$(DOC)\std_array.html $(STDDOC) std\array.d +$(DOC)\std_ascii.html : $(STDDOC) std\ascii.d + $(DMD) -c -o- $(DFLAGS) -Df$(DOC)\std_ascii.html $(STDDOC) std\ascii.d + $(DOC)\std_base64.html : $(STDDOC) std\base64.d $(DMD) -c -o- $(DFLAGS) -Df$(DOC)\std_base64.html $(STDDOC) std\base64.d