diff --git a/etc/gamma.d b/etc/gamma.d new file mode 100644 index 000000000..93c5823d6 --- /dev/null +++ b/etc/gamma.d @@ -0,0 +1,477 @@ +/* + * Cephes code Copyright 1994 by Stephen L. Moshier + * Converted to D by Don Clugston. + */ + +/** +Macros: + GAMMA = Γ + INTEGRAL = ∫ +*/ +module etc.gamma; + +import std.math; +private import std.stdio; +import etc.realtest; + +//------------------------------------------------------------------ +const real SQRT2PI = 2.50662827463100050242E0L; // sqrt(2pi) +const real MAXGAMMA = 1755.455L; // exp(tgamma(x)) == inf if x>MAXGAMMA + +// Polynomial approximations for gamma and loggamma. + +static real GammaNumeratorCoeffs[] = [ + 0x1p+0, // 1 + 0x1.acf42d903366539ep-1, // 0.83780043015731267283 + 0x1.73a991c8475f1aeap-2, // 0.36295154366402391688 + 0x1.c7e918751d6b2a92p-4, // 0.1113062816019361559 + 0x1.86d162cca32cfe86p-6, // 0.023853632434611082525 + 0x1.0c378e2e6eaf7cd8p-8, // 0.0040926668283940355009 + 0x1.dc5c66b7d05feb54p-12, // 0.00045429319606080091555 + 0x1.616457b47e448694p-15 // 4.2127604874716220134e-05 +]; + +static real GammaDenominatorCoeffs[] = [ + 0x1p+0, // 1 + 0x1.a8f9faae5d8fc8b0p-2, // 0.41501609505884554346 + -0x1.cb7895a6756eebdep-3, // -0.22435109056703291645 + -0x1.7b9bab006d30652ap-5, // -0.046338876712445342138 + 0x1.c671af78f312082ep-6, // 0.027737065658400729792 + -0x1.a11ebbfaf96252dcp-11, // -0.00079559336824947383209 + -0x1.447b4d2230a77ddap-10, // -0.0012377992466531522311 + 0x1.ec1d45bb85e06696p-13, // 0.00023465840591606352443 + -0x1.d4ce24d05bd0a8e6p-17 // -1.3971485174761704409e-05 +]; + +static real GammaSmallCoeffs[] = [ + 0x1p+0, // 1 + 0x1.2788cfc6fb618f52p-1, // 0.57721566490153286082 + -0x1.4fcf4026afa2f7ecp-1, // -0.65587807152025406846 + -0x1.5815e8fa24d7e306p-5, // -0.042002635034033440541 + 0x1.5512320aea2ad71ap-3, // 0.16653861137208052067 + -0x1.59af0fb9d82e2160p-5, // -0.042197733607059154702 + -0x1.3b4b61d3bfdf244ap-7, // -0.0096220233604062716456 + 0x1.d9358e9d9d69fd34p-8, // 0.0072205994780369096722 + -0x1.38fc4bcbada775d6p-10 // -0.0011939450513815100956 +]; + +static real GammaSmallNegCoeffs[] = [ + -0x1p+0, // -1 + 0x1.2788cfc6fb618f54p-1, // 0.57721566490153286086 + 0x1.4fcf4026afa2bc4cp-1, // 0.65587807152025365473 + -0x1.5815e8fa2468fec8p-5, // -0.042002635034021129105 + -0x1.5512320baedaf4b6p-3, // -0.16653861139444135193 + -0x1.59af0fa283baf07ep-5, // -0.042197733437311917216 + 0x1.3b4a70de31e05942p-7, // 0.0096219111550359767339 + 0x1.d9398be3bad13136p-8, // 0.0072208372618931703258 + 0x1.291b73ee05bcbba2p-10 // 0.001133374167243894382 +]; + +static real logGammaStirlingCoeffs[] = [ + 0x1.5555555555553f98p-4, // 0.083333333333333314473 + -0x1.6c16c16c07509b10p-9, // -0.0027777777777503496034 + 0x1.a01a012461cbf1e4p-11, // 0.00079365077958550707556 + -0x1.3813089d3f9d1640p-11, // -0.00059523458517656885149 + 0x1.b911a92555a277b8p-11, // 0.00084127232973224980805 + -0x1.ed0a7b4206087b22p-10, // -0.0018808019381193769072 + 0x1.402523859811b308p-8 // 0.0048850261424322707812 +]; + +static real logGammaNumerator[] = [ + -0x1.0edd25913aaa40a2p+23, // -8875666.7836507038022 + -0x1.31c6ce2e58842d1ep+24, // -20039374.181038151756 + -0x1.f015814039477c3p+23, // -16255680.62543700591 + -0x1.74ffe40c4b184b34p+22, // -6111225.0120052143001 + -0x1.0d9c6d08f9eab55p+20, // -1104326.8146914642612 + -0x1.54c6b71935f1fc88p+16, // -87238.715228435114593 + -0x1.0e761b42932b2aaep+11 // -2163.6908276438128575 +]; + +static real logGammaDenominator[] = [ + -0x1.4055572d75d08c56p+24, // -20993367.177578958762 + -0x1.deeb6013998e4d76p+24, // -31386464.076561826621 + -0x1.106f7cded5dcc79ep+24, // -17854332.870450781569 + -0x1.25e17184848c66d2p+22, // -4814940.3794118821866 + -0x1.301303b99a614a0ap+19, // -622744.11640662195015 + -0x1.09e76ab41ae965p+15, // -34035.708405343046707 + -0x1.00f95ced9e5f54eep+9, // -513.94814844353701437 + 0x1p+0 // 1 +]; + +/* **************************************************** + * Helper function: Gamma function computed by Stirling's formula. + * + * Stirling's formula for the gamma function is: + * + * $(GAMMA)(x) = sqrt(2 π) xx-0.5 exp(-x) (1 + 1/x P(1/x)) + * + */ +private real gammaStirling(real x) +{ + static real SmallStirlingCoeffs[] = [ + 0x1.55555555555543aap-4, // 0.083333333333333318004 + 0x1.c71c71c720dd8792p-9, // 0.0034722222222300753277 + -0x1.5f7268f0b5907438p-9, // -0.0026813271618763044182 + -0x1.e13cd410e0477de6p-13, // -0.00022947197478731854057 + 0x1.9b0f31643442616ep-11, // 0.00078403348427447530038 + 0x1.2527623a3472ae08p-14, // 6.9893322606231931717e-05 + -0x1.37f6bc8ef8b374dep-11, // -0.00059502375540563301557 + -0x1.8c968886052b872ap-16, // -2.3638488095017590616e-05 + 0x1.76baa9c6d3eeddbcp-11 // 0.0007147391378143610789 + ]; + + static real LargeStirlingCoeffs[] = [ + 1.0L, + 8.33333333333333333333E-2L, + 3.47222222222222222222E-3L, + -2.68132716049382716049E-3L, + -2.29472093621399176955E-4L, + 7.84039221720066627474E-4L, + 6.97281375836585777429E-5L + ]; + + real w = 1.0L / x; + real y = exp(x); + if (x > 1024.0L) + { + // For large x, use rational coefficients from the analytical expansion. + w = poly(w, LargeStirlingCoeffs); + // Avoid overflow in pow() + real v = pow( x, 0.5L * x - 0.25L ); + y = v * (v / y); + } + else + { + w = 1.0L + w * poly(w, SmallStirlingCoeffs); + y = pow( x, x - 0.5L ) / y; + } + y = SQRT2PI * y * w; + return y; +} + +/***************************************************** + * The Gamma function, $(GAMMA)(x) + * + * Generalizes the factorial function to real and complex numbers. + * Like x!, $(GAMMA)(x+1) = x*$(GAMMA)(x). + * + * Mathematically, if z.re > 0 then + * $(GAMMA)(z) =$(INTEGRAL)0&infintz-1e-tdt + * + * This function is equivalent to tgamma() in the C programming language. + * + * + * + *
Special Values
x $(GAMMA)(x) invalid? + *
NAN NAN yes + *
±0.0 ±∞ yes + *
integer > 0 (x-1)! no + *
integer < 0 NAN yes + *
+∞ +∞ no + *
-∞ NAN yes + *
+ * + * References: + * cephes, http://en.wikipedia.org/wiki/Gamma_function + * + */ +real tgamma(real x) +{ + /* Author: Don Clugston. Based on code from the CEPHES library. + * + * Arguments |x| <= 13 are reduced by recurrence and the function + * approximated by a rational function of degree 7/8 in the + * interval (2,3). Large arguments are handled by Stirling's + * formula. Large negative arguments are made positive using + * a reflection formula. + */ + + real q, z; + + if (isnan(x)) + return x; + if (x == -x.infinity) + return real.nan; + if ( fabs(x) > MAXGAMMA ) + return real.infinity; + if (x == 0) + return 1.0 / x; // +- infinity depending on sign of x, create an exception. + + q = fabs(x); + + if ( q > 13.0L ) + { + // Large arguments are handled by Stirling's + // formula. Large negative arguments are made positive using + // the reflection formula. + + if ( x < 0.0L ) + { + int sgngam = 1; // sign of gamma. + real p = floor(q); + if ( p == q ) + return real.nan; // poles for all integers <0. + int intpart = cast(int)(p); + if ( (intpart & 1) == 0 ) + sgngam = -1; + z = q - p; + if ( z > 0.5L ) + { + p += 1.0L; + z = q - p; + } + z = q * sin( PI * z ); + z = fabs(z) * gammaStirling(q); + if ( z <= PI / real.max ) + return sgngam * real.infinity; + return sgngam * PI / z; + } + else + return gammaStirling(x); + } + + // Arguments |x| <= 13 are reduced by recurrence and the function + // approximated by a rational function of degree 7/8 in the + // interval (2,3). + + z = 1.0L; + while ( x >= 3.0L ) + { + x -= 1.0L; + z *= x; + } + + while ( x < -0.03125L ) + { + z /= x; + x += 1.0L; + } + + if ( x <= 0.03125L ) + { + if ( x == 0.0L ) + return real.nan; + else if ( x < 0.0L ) + { + x = -x; + return z / (x * poly( x, GammaSmallNegCoeffs )); + } + else + { + return z / (x * poly( x, GammaSmallCoeffs )); + } + } + + while ( x < 2.0L ) + { + z /= x; + x += 1.0L; + } + if ( x == 2.0L ) + return z; + + x -= 2.0L; + return z * poly( x, GammaNumeratorCoeffs ) / poly( x, GammaDenominatorCoeffs ); +} + +unittest +{ + // gamma(n) = factorial(n-1) if n is an integer. + double fact = 1.0L; + for (int i = 1; fact < real.max; ++i) + { + // Require exact equality for small factorials + if (i < 14) + assert(tgamma(i * 1.0L)==fact); + assert(feqrel(tgamma(i * 1.0L), fact) > real.mant_dig - 15); + //writefln(i, " %a ---> %a %a ", i*1.0L, tgamma(i * 1.0L), fact, feqrel(tgamma(i*1.0L), fact)); + fact *= (i * 1.0L); + } + assert(tgamma(0.0) == real.infinity); + assert(tgamma(-0.0) == -real.infinity); + assert(isnan(tgamma(-1.0))); + assert(isnan(tgamma(real.nan))); + assert(tgamma(real.infinity) == real.infinity); + assert(isnan(tgamma(-real.infinity))); + assert(tgamma(real.min * real.epsilon) == real.infinity); + + assert(feqrel(tgamma(0.5), sqrt(PI)) > real.mant_dig - 3); +} + +/***************************************************** + * Natural logarithm of gamma function. + * + * Returns the base e (2.718...) logarithm of the absolute + * value of the gamma function of the argument. + * + * For reals, lgamma is equivalent to log(fabs(tgamma(x)). + * + * + * + *
Special Values
x log$(GAMMA)(x) invalid? + *
NaN NaN yes + *
integer <= 0 +∞ yes + *
1, 2 +0.0 no + *
±∞ +∞ no + *
+ * + */ +real lgamma(real x) +{ + /* Author: Don Clugston. Based on code from the CEPHES library. + * + * For arguments greater than 33, the logarithm of the gamma + * function is approximated by the logarithmic version of + * Stirling's formula using a polynomial approximation of + * degree 4. Arguments between -33 and +33 are reduced by + * recurrence to the interval [2,3] of a rational approximation. + * The cosecant reflection formula is employed for arguments + * less than -33. + */ + real q, w, z, f, nx; + + if (isnan(x)) + return x; + if (fabs(x) == x.infinity) + return x.infinity; + + if ( x < -34.0L ) + { + q = -x; + w = lgamma(q); + real p = floor(q); + if ( p == q ) + return real.infinity; + int intpart = cast(int)(p); + real sgngam = 1; + if ( (intpart & 1) == 0 ) + sgngam = -1; + z = q - p; + if ( z > 0.5L ) + { + p += 1.0L; + z = p - q; + } + z = q * sin( PI * z ); + if ( z == 0.0L ) + return sgngam * real.infinity; + /* z = LOGPI - logl( z ) - w; */ + z = log( PI / z ) - w; + return z; + } + + if ( x < 13.0L ) + { + z = 1.0L; + nx = floor( x + 0.5L ); + f = x - nx; + while ( x >= 3.0L ) + { + nx -= 1.0L; + x = nx + f; + z *= x; + } + while ( x < 2.0L ) + { + if( fabs(x) <= 0.03125 ) + { + if ( x == 0.0L ) + return real.infinity; + if ( x < 0.0L ) + { + x = -x; + q = z / (x * poly( x, GammaSmallNegCoeffs)); + } + else + q = z / (x * poly( x, GammaSmallCoeffs)); + return log( fabs(q) ); + } + z /= nx + f; + nx += 1.0L; + x = nx + f; + } + z = fabs(z); + if ( x == 2.0L ) + return log(z); + x = (nx - 2.0L) + f; + real p = x * poly( x, logGammaNumerator ) / poly( x, logGammaDenominator); + return ( log(z) + p ); + } + + //const real MAXLGM = 1.04848146839019521116e+4928L; + //if ( x > MAXLGM ) return sgngaml * real.infinity; + + /* log( sqrt( 2*pi ) ) */ + const real LOGSQRT2PI = 0.91893853320467274178L; + + q = ( x - 0.5L ) * log(x) - x + LOGSQRT2PI; + if (x > 1.0e10L) return q; + real p = 1.0L/(x*x); + q += poly( p, logGammaStirlingCoeffs ) / x; + return q ; +} + +unittest +{ + assert(isnan(lgamma(real.nan))); + assert(lgamma(real.infinity) == real.infinity); + assert(lgamma(-1.0) == real.infinity); + assert(lgamma(0.0) == real.infinity); + assert(std.math.isPosZero(lgamma(1.0L))); + assert(std.math.isPosZero(lgamma(2.0L))); + + // x, correct loggamma(x), correct d/dx loggamma(x). + static real[] testpoints = + [ + 8.0L, 8.525146484375L + 1.48766904143001655310E-5, 2.01564147795560999654E0L, + 8.99993896484375e-1L, 6.6375732421875e-2L + 5.11505711292524166220E-6L, -7.54938684259372234258E-1, + 7.31597900390625e-1L, 2.2369384765625e-1 + 5.21506341809849792422E-6L, -1.13355566660398608343E0L, + 2.31639862060546875e-1L, 1.3686676025390625L + 1.12609441752996145670E-5L, -4.56670961813812679012E0, + 1.73162841796875L, -8.88214111328125e-2L + 3.36207740803753034508E-6L, 2.33339034686200586920E-1L, + 1.23162841796875L, -9.3902587890625e-2L + 1.28765089229009648104E-5L, -2.49677345775751390414E-1L, + 7.3786976294838206464e19L, 3.301798506038663053312e21L - 1.656137564136932662487046269677E5L, + 4.57477139169563904215E1L, + 1.08420217248550443401E-19L, 4.36682586669921875e1L + 1.37082843669932230418E-5L, + -9.22337203685477580858E18L, +// 1.0L, 0.0L, -5.77215664901532860607E-1L, +// 2.0L, 0.0L, 4.22784335098467139393E-1L, + -0.5L, 1.2655029296875L + 9.19379714539648894580E-6L, 3.64899739785765205590E-2L, + -1.5L, 8.6004638671875e-1L + 6.28657731014510932682E-7L, 7.03156640645243187226E-1L, + -2.5L, -5.6243896484375E-2L + 1.79986700949327405470E-7, 1.10315664064524318723E0L, + -3.5L, -1.30902099609375L + 1.43111007079536392848E-5L, 1.38887092635952890151E0L + ]; + + // TODO: test derivatives as well. + + for (int i=0; i real.mant_dig-5); + } + + static real logabsgamma(real x) + { + // For poles, tgamma(x) returns nan, but lgamma() returns infinity. + if (x < 0 && x == floor(x)) + return real.infinity; + return log(fabs(tgamma(x))); + } + + static real exploggamma(real x) + { + return exp(lgamma(x)); + } + + static real absgamma(real x) + { + if (x < 0 && x == floor(x)) + return real.infinity; + return fabs(tgamma(x)); + } + + // Check that loggamma(x) = log(gamma(x)) provided x is not -1, -2, -3, ... + assert(consistencyTwoFuncs(&lgamma, &logabsgamma, -1000, 1700) > real.mant_dig-7); + assert(consistencyTwoFuncs(&exploggamma, &absgamma, -2000, real.infinity) > real.mant_dig-16); +} + + diff --git a/internal/adi.d b/internal/adi.d index 7baa6a47d..e8ba513a9 100644 --- a/internal/adi.d +++ b/internal/adi.d @@ -173,13 +173,13 @@ extern (C) long _adReverseWchar(wchar[] a) break; if (stridelo == stridehi) - { int tmp; + { int stmp; assert(stridelo == 2); - assert(tmp.sizeof == 2 * (*lo).sizeof); - tmp = *cast(int*)lo; + assert(stmp.sizeof == 2 * (*lo).sizeof); + stmp = *cast(int*)lo; *cast(int*)lo = *cast(int*)hi; - *cast(int*)hi = tmp; + *cast(int*)hi = stmp; lo += stridelo; hi--; continue; @@ -546,7 +546,7 @@ extern (C) int _adEqBit(Array a1, Array a2) ubyte mask; n = a1.length & 7; - mask = (1 << n) - 1; + mask = cast(ubyte)((1 << n) - 1); //printf("i = %d, n = %d, mask = %x, %x, %x\n", i, n, mask, p1[i], p2[i]); return (mask == 0) || (p1[i] & mask) == (p2[i] & mask); } @@ -785,7 +785,7 @@ extern (C) int _adCmpBit(Array a1, Array a2) break; // not equal } for (uint j = i * 8; j < len; j++) - { ubyte mask = 1 << j; + { ubyte mask = cast(ubyte)(1 << j); int c; c = cast(int)(p1[i] & mask) - cast(int)(p2[i] & mask); diff --git a/internal/cast.d b/internal/cast.d index 9d98800f3..8dfb4d824 100644 --- a/internal/cast.d +++ b/internal/cast.d @@ -148,5 +148,4 @@ void *_d_interface_vtbl(ClassInfo ic, Object o) } } assert(0); - return null; } diff --git a/internal/qsort.d b/internal/qsort.d index c68e70fdd..91d105bc7 100644 --- a/internal/qsort.d +++ b/internal/qsort.d @@ -129,6 +129,7 @@ extern (C) long _adSort(Array a, TypeInfo ti) else // else stack empty, all done return *cast(long*)(&a); } + assert(0); } diff --git a/internal/trace.d b/internal/trace.d index d1224c4ff..64c6c4204 100644 --- a/internal/trace.d +++ b/internal/trace.d @@ -749,9 +749,9 @@ static void trace_merge() p++; count = strtoul(p,&p,10); - t = strtoull(p,&p,10); + t = cast(long)strtoull(p,&p,10); s.totaltime += t; - t = strtoull(p,&p,10); + t = cast(long)strtoull(p,&p,10); s.functime += t; } break; diff --git a/linux.mak b/linux.mak index 414e39c36..b20759270 100644 --- a/linux.mak +++ b/linux.mak @@ -12,8 +12,8 @@ CFLAGS=-O #CFLAGS=-g -DFLAGS=-O -release -#DFLAGS=-unittest +DFLAGS=-O -release -w +#DFLAGS=-unittest -w CC=gcc #DMD=/dmd/bin/dmd @@ -140,7 +140,7 @@ SRC_STD_C_WIN= std/c/windows/windows.d std/c/windows/com.d \ SRC_STD_C_LINUX= std/c/linux/linux.d std/c/linux/linuxextern.d \ std/c/linux/socket.d -SRC_ETC= etc/gamma.d etc/realtest.d +SRC_ETC= etc/gamma.d SRC_ETC_C= etc/c/zlib.d diff --git a/std.ddoc b/std.ddoc index b98147cd8..238856543 100644 --- a/std.ddoc +++ b/std.ddoc @@ -170,12 +170,11 @@ YELLOW = $0 BLACK = $0 WHITE = $0 -RPAREN = ) -LPAREN = ( - D_COMMENT = $0 D_STRING = $0 D_KEYWORD = $0 D_PSYMBOL = $0 D_PARAM = $0 - +RPAREN = ) +LPAREN = ( +FOO=$0 diff --git a/std/asserterror.d b/std/asserterror.d index 77ca59076..f2bc3f27e 100644 --- a/std/asserterror.d +++ b/std/asserterror.d @@ -6,8 +6,6 @@ import std.c.stdlib; class AssertError : Error { - private: - uint linnum; char[] filename; diff --git a/std/base64.d b/std/base64.d index 7988390d9..584395846 100644 --- a/std/base64.d +++ b/std/base64.d @@ -133,6 +133,9 @@ body case 0: break; + + default: + assert(0); } return buf[0 .. (bp - &buf[0])]; @@ -211,6 +214,7 @@ body if(ch == '/') return 'Z' - 'A' + 1 + 'z' - 'a' + 1 + '9' - '0' + 1 + 1; badc(ch); + assert(0); } diff --git a/std/bitarray.d b/std/bitarray.d index aee589ea9..d37930d72 100644 --- a/std/bitarray.d +++ b/std/bitarray.d @@ -157,6 +157,7 @@ struct BitArray { case 0: assert(b == true); break; case 1: assert(b == false); break; case 2: assert(b == true); break; + default: assert(0); } i++; } @@ -167,6 +168,7 @@ struct BitArray { case 0: assert(b == true); break; case 1: assert(b == false); break; case 2: assert(b == true); break; + default: assert(0); } } } @@ -301,7 +303,7 @@ struct BitArray ubyte mask; n = this.length & 7; - mask = (1 << n) - 1; + mask = cast(ubyte)((1 << n) - 1); //printf("i = %d, n = %d, mask = %x, %x, %x\n", i, n, mask, p1[i], p2[i]); return (mask == 0) || (p1[i] & mask) == (p2[i] & mask); } @@ -349,7 +351,7 @@ struct BitArray break; // not equal } for (uint j = i * 8; j < len; j++) - { ubyte mask = 1 << j; + { ubyte mask = cast(ubyte)(1 << j); int c; c = cast(int)(p1[i] & mask) - cast(int)(p2[i] & mask); diff --git a/std/boxer.d b/std/boxer.d index 636008be1..cef57af58 100644 --- a/std/boxer.d +++ b/std/boxer.d @@ -189,6 +189,7 @@ struct Box default: return TypeClass.Other; } } + assert(0); } /** Return whether this value could be unboxed as the given type without throwing. */ diff --git a/std/c/linux/socket.d b/std/c/linux/socket.d index bf734c7e1..b5aaa8519 100644 --- a/std/c/linux/socket.d +++ b/std/c/linux/socket.d @@ -173,7 +173,7 @@ else version(LittleEndian) uint16_t htons(uint16_t x) { - return (x >> 8) | (x << 8); + return cast(uint16_t)((x >> 8) | (x << 8)); } diff --git a/std/c/windows/windows.d b/std/c/windows/windows.d index bdebb514a..f0b72ac44 100644 --- a/std/c/windows/windows.d +++ b/std/c/windows/windows.d @@ -968,8 +968,8 @@ enum // int MAKELANGID(int p, int s) { return ((cast(WORD)s) << 10) | cast(WORD)p; } -WORD PRIMARYLANGID(int lgid) { return cast(WORD)lgid & 0x3ff; } -WORD SUBLANGID(int lgid) { return cast(WORD)lgid >> 10; } +WORD PRIMARYLANGID(int lgid) { return cast(WORD)(lgid & 0x3ff); } +WORD SUBLANGID(int lgid) { return cast(WORD)(lgid >> 10); } struct FLOATING_SAVE_AREA { diff --git a/std/c/windows/winsock.d b/std/c/windows/winsock.d index aced43a4c..87ee5175e 100644 --- a/std/c/windows/winsock.d +++ b/std/c/windows/winsock.d @@ -321,7 +321,7 @@ else version(LittleEndian) uint16_t htons(uint16_t x) { - return (x >> 8) | (x << 8); + return cast(uint16_t)((x >> 8) | (x << 8)); } diff --git a/std/conv.d b/std/conv.d index 3d99a6379..795c8794a 100644 --- a/std/conv.d +++ b/std/conv.d @@ -329,7 +329,7 @@ long toLong(char[] s) char c = s[i]; if (c >= '0' && c <= '9') { - ulong v1 = v; + ulong v1 = cast(ulong)v; v = v * 10 + (c - '0'); if (cast(ulong)v < v1) goto Loverflow; @@ -893,6 +893,7 @@ float toFloat(in char[] s) Lerr: conv_error(s ~ " not representable as a float"); + assert(0); } unittest @@ -956,6 +957,7 @@ double toDouble(in char[] s) Lerr: conv_error(s ~ " not representable as a double"); + assert(0); } unittest @@ -1021,6 +1023,7 @@ real toReal(in char[] s) Lerr: conv_error(s ~ " not representable as a real"); + assert(0); } unittest diff --git a/std/cstream.d b/std/cstream.d index 1043b6b82..33e05ed4f 100644 --- a/std/cstream.d +++ b/std/cstream.d @@ -193,7 +193,7 @@ class CFile : Stream { file.position = 0; lines = new char[][5]; foreach(ulong n, char[] line; file) { - lines[n-1] = line.dup; + lines[cast(size_t)(n-1)] = line.dup; } assert( lines[0] == "Testing stream.d:"); assert( lines[1] == "Another line"); diff --git a/std/date.d b/std/date.d index 53833fe61..837cb56a4 100644 --- a/std/date.d +++ b/std/date.d @@ -198,7 +198,7 @@ d_time toInteger(d_time n) int Day(d_time t) { - return floor(t, msPerDay); + return cast(int)floor(t, msPerDay); } int LeapYear(int y) @@ -810,6 +810,9 @@ version (Win32) case TIME_ZONE_ID_UNKNOWN: // Daylight savings time not used in this time zone break; + + default: + assert(0); } return t; } @@ -869,7 +872,7 @@ version (linux) dt -= LocalTZA; int year = YearFromTime(dt); - int leap = LeapYear(dt); + int leap = LeapYear(cast(int)dt); //writefln("year = %s, leap = %s, month = %s", year, leap, MonthFromTime(dt)); d_time start = TimeFromYear(year); // Jan 1 diff --git a/std/dateparse.d b/std/dateparse.d index 95cc8ab77..7443b86fd 100644 --- a/std/dateparse.d +++ b/std/dateparse.d @@ -528,6 +528,7 @@ private: } dp = nextToken(); } + assert(0); } int parseCalendarDate(int n1) diff --git a/std/demangle.d b/std/demangle.d index 801488c84..81f8682de 100644 --- a/std/demangle.d +++ b/std/demangle.d @@ -87,9 +87,11 @@ char[] demangle(char[] name) { if (!isxdigit(c)) error(); - return (c >= 'a') ? c - 'a' + 10 : - (c >= 'A') ? c - 'A' + 10 : - c - '0'; + return cast(ubyte) + ( (c >= 'a') ? c - 'a' + 10 : + (c >= 'A') ? c - 'A' + 10 : + c - '0' + ); } size_t parseNumber() @@ -265,6 +267,7 @@ char[] demangle(char[] name) case 'U': p = "extern (C) "; break; // C function case 'W': p = "extern (Windows) "; break; // Windows function case 'V': p = "extern (Pascal) "; break; // Pascal function + default: assert(0); } p ~= parseType() ~ " " ~ identifier ~ "(" ~ args ~ ")"; return p; @@ -298,6 +301,7 @@ char[] demangle(char[] name) p = name[i .. length]; goto L1; } + assert(0); } char[] parseTemplateInstanceName() @@ -330,8 +334,11 @@ char[] demangle(char[] name) for (i = 0; i < 10; i++) { ubyte b; - b = (ascii2hex(name[ni + i * 2]) << 4) + - ascii2hex(name[ni + i * 2 + 1]); + b = cast(ubyte) + ( + (ascii2hex(name[ni + i * 2]) << 4) + + ascii2hex(name[ni + i * 2 + 1]) + ); p[i] = b; } result ~= format(r); diff --git a/std/file.d b/std/file.d index 97eeb0fe6..16d94355a 100644 --- a/std/file.d +++ b/std/file.d @@ -531,9 +531,9 @@ struct DirEntry * * void main(char[][] args) * { - * char[][] dirs = std.file.listdir(args[1]); + * auto dirs = std.file.listdir(args[1]); * - * foreach (char[] d; dirs) + * foreach (d; dirs) * writefln(d); * } * ---- @@ -572,9 +572,9 @@ char[][] listdir(char[] pathname) * * void main(char[][] args) * { - * char[][] d_source_files = std.file.listdir(args[1], "*.d"); + * auto d_source_files = std.file.listdir(args[1], "*.d"); * - * foreach (char[] d; d_source_files) + * foreach (d; d_source_files) * writefln(d); * } * ---- @@ -587,9 +587,9 @@ char[][] listdir(char[] pathname) * * void main(char[][] args) * { - * char[][] d_source_files = std.file.listdir(args[1], RegExp(r"\.(d|obj)$")); + * auto d_source_files = std.file.listdir(args[1], RegExp(r"\.(d|obj)$")); * - * foreach (char[] d; d_source_files) + * foreach (d; d_source_files) * writefln(d); * } * ---- @@ -650,7 +650,7 @@ char[][] listdir(char[] pathname, RegExp r) * * void main(char[][] args) * { - * char[] pathname = args[1]; + * auto pathname = args[1]; * char[][] result; * * bool listing(char[] filename) @@ -661,7 +661,7 @@ char[][] listdir(char[] pathname, RegExp r) * * listdir(pathname, &listing); * - * foreach (char[] name; result) + * foreach (name; result) * writefln("%s", name); * } * ---- @@ -1222,9 +1222,10 @@ struct DirEntry return; } _size = statbuf.st_size; - _creationTime = statbuf.st_ctime * std.date.TicksPerSecond; - _lastAccessTime = statbuf.st_atime * std.date.TicksPerSecond; - _lastWriteTime = statbuf.st_mtime * std.date.TicksPerSecond; + _creationTime = cast(d_time)statbuf.st_ctime * std.date.TicksPerSecond; + _lastAccessTime = cast(d_time)statbuf.st_atime * std.date.TicksPerSecond; + _lastWriteTime = cast(d_time)statbuf.st_mtime * std.date.TicksPerSecond; + didstat = 1; } } @@ -1328,6 +1329,7 @@ void listdir(char[] pathname, bool delegate(DirEntry* de) callback) } } + /*************************************************** * Copy a file. * Bugs: @@ -1348,3 +1350,17 @@ void copy(char[] from, char[] to) } +unittest +{ + listdir (".", delegate bool (DirEntry * de) + { + auto s = std.string.format("%s : c %s, w %s, a %s", de.name, + toUTCString (de.creationTime), + toUTCString (de.lastWriteTime), + toUTCString (de.lastAccessTime)); + return true; + } + ); +} + + diff --git a/std/format.d b/std/format.d index 74acdb895..7b16a3470 100644 --- a/std/format.d +++ b/std/format.d @@ -686,7 +686,7 @@ void doFormat(void delegate(dchar) putc, TypeInfo[] arguments, va_list argptr) case Mangle.Tlong: signed = 1; - vnumber = va_arg!(long)(argptr); + vnumber = cast(ulong)va_arg!(long)(argptr); goto Lnumber; case Mangle.Tulong: @@ -873,6 +873,10 @@ void doFormat(void delegate(dchar) putc, TypeInfo[] arguments, va_list argptr) } if (precision == 0 || !(flags & FLprecision)) { vchar = '0' + vnumber; + if (vnumber < 10) + vchar = '0' + vnumber; + else + vchar = (uc ? 'A' - 10 : 'a' - 10) + vnumber; goto L2; } } @@ -1343,5 +1347,14 @@ unittest assert(r == "80000000"); r = std.string.format("%x", ++i); assert(r == "80000001"); + + r = std.string.format("%x", 10); + assert(r == "a"); + r = std.string.format("%X", 10); + assert(r == "A"); + r = std.string.format("%x", 15); + assert(r == "f"); + r = std.string.format("%X", 15); + assert(r == "F"); } diff --git a/std/math.d b/std/math.d index 08d4faa45..f22348b75 100644 --- a/std/math.d +++ b/std/math.d @@ -539,7 +539,7 @@ creal sqrt(creal z) if (z == 0) { - c = 0; + c = 0 + 0i; } else { real z_re = z.re; @@ -659,7 +659,7 @@ real frexp(real value, out int exp) else { exp = ex - 0x3FFE; - vu[4] = (0x8000 & vu[4]) | 0x3FFE; + vu[4] = cast(ushort)((0x8000 & vu[4]) | 0x3FFE); } } else if (!*vl) @@ -677,7 +677,7 @@ real frexp(real value, out int exp) *vl <<= 1; } while (*vl > 0); exp = i; - vu[4] = (0x8000 & vu[4]) | 0x3FFE; + vu[4] = cast(ushort)((0x8000 & vu[4]) | 0x3FFE); } return value; } diff --git a/std/math2.d b/std/math2.d index de8336c6f..5b29cb25d 100644 --- a/std/math2.d +++ b/std/math2.d @@ -259,9 +259,9 @@ unittest int sum(int[] n) { long result = 0; - for (uint i = 0; i < n.length; i++) - result += n[i]; - return result; + for (size_t i = 0; i < n.length; i++) + result += n[i]; + return cast(int)result; } unittest diff --git a/std/mmfile.d b/std/mmfile.d index d9b463370..ec11f44d7 100644 --- a/std/mmfile.d +++ b/std/mmfile.d @@ -103,49 +103,52 @@ class MmFile if (dwVersion & 0x80000000 && (dwVersion & 0xFF) == 3) { - throw new FileException(filename, - "Win32s does not implement mm files"); + throw new FileException(filename, + "Win32s does not implement mm files"); } switch (mode) { - case Mode.Read: - dwDesiredAccess2 = GENERIC_READ; - dwShareMode = FILE_SHARE_READ; - dwCreationDisposition = OPEN_EXISTING; - flProtect = PAGE_READONLY; - dwDesiredAccess = FILE_MAP_READ; - break; - - case Mode.ReadWriteNew: - assert(size != 0); - dwDesiredAccess2 = GENERIC_READ | GENERIC_WRITE; - dwShareMode = FILE_SHARE_READ | FILE_SHARE_WRITE; - dwCreationDisposition = CREATE_ALWAYS; - flProtect = PAGE_READWRITE; - dwDesiredAccess = FILE_MAP_WRITE; - break; - - case Mode.ReadWrite: - dwDesiredAccess2 = GENERIC_READ | GENERIC_WRITE; - dwShareMode = FILE_SHARE_READ | FILE_SHARE_WRITE; - dwCreationDisposition = OPEN_ALWAYS; - flProtect = PAGE_READWRITE; - dwDesiredAccess = FILE_MAP_WRITE; - break; - - case Mode.ReadCopyOnWrite: - if (dwVersion & 0x80000000) - { - throw new FileException(filename, - "Win9x does not implement copy on write"); - } - dwDesiredAccess2 = GENERIC_READ | GENERIC_WRITE; - dwShareMode = FILE_SHARE_READ | FILE_SHARE_WRITE; - dwCreationDisposition = OPEN_EXISTING; - flProtect = PAGE_WRITECOPY; - dwDesiredAccess = FILE_MAP_COPY; - break; + case Mode.Read: + dwDesiredAccess2 = GENERIC_READ; + dwShareMode = FILE_SHARE_READ; + dwCreationDisposition = OPEN_EXISTING; + flProtect = PAGE_READONLY; + dwDesiredAccess = FILE_MAP_READ; + break; + + case Mode.ReadWriteNew: + assert(size != 0); + dwDesiredAccess2 = GENERIC_READ | GENERIC_WRITE; + dwShareMode = FILE_SHARE_READ | FILE_SHARE_WRITE; + dwCreationDisposition = CREATE_ALWAYS; + flProtect = PAGE_READWRITE; + dwDesiredAccess = FILE_MAP_WRITE; + break; + + case Mode.ReadWrite: + dwDesiredAccess2 = GENERIC_READ | GENERIC_WRITE; + dwShareMode = FILE_SHARE_READ | FILE_SHARE_WRITE; + dwCreationDisposition = OPEN_ALWAYS; + flProtect = PAGE_READWRITE; + dwDesiredAccess = FILE_MAP_WRITE; + break; + + case Mode.ReadCopyOnWrite: + if (dwVersion & 0x80000000) + { + throw new FileException(filename, + "Win9x does not implement copy on write"); + } + dwDesiredAccess2 = GENERIC_READ | GENERIC_WRITE; + dwShareMode = FILE_SHARE_READ | FILE_SHARE_WRITE; + dwCreationDisposition = OPEN_EXISTING; + flProtect = PAGE_WRITECOPY; + dwDesiredAccess = FILE_MAP_COPY; + break; + + default: + assert(0); } if (useWfuncs) @@ -242,6 +245,9 @@ class MmFile oflag = O_RDWR; fmode = 0; break; + + default: + assert(0); } if (filename.length) @@ -265,7 +271,7 @@ class MmFile if (prot & PROT_WRITE && size > statbuf.st_size) { // Need to make the file size bytes big - std.c.linux.linux.lseek(fd, size - 1, SEEK_SET); + std.c.linux.linux.lseek(fd, cast(int)(size - 1), SEEK_SET); char c = 0; std.c.linux.linux.write(fd, &c, 1); } @@ -447,7 +453,7 @@ class MmFile p = MapViewOfFileEx(hFileMap, dwDesiredAccess, hi, cast(uint)start, len, address); if (!p) errNo(); } else { - p = mmap(address, len, prot, flags, fd, start); + p = mmap(address, len, prot, flags, fd, cast(int)start); if (p == MAP_FAILED) errNo(); } data = p[0 .. len]; diff --git a/std/random.d b/std/random.d index 3d88124d2..a830de360 100644 --- a/std/random.d +++ b/std/random.d @@ -108,7 +108,7 @@ static this() } else { - s = (cast(long)tv.tv_sec << 32) + tv.tv_usec; + s = cast(ulong)((cast(long)tv.tv_sec << 32) + tv.tv_usec); } } rand_seed(cast(uint) s, cast(uint)(s >> 32)); diff --git a/std/regexp.d b/std/regexp.d index 18826c27c..1d95d7df8 100644 --- a/std/regexp.d +++ b/std/regexp.d @@ -39,24 +39,61 @@ of the following characters: - + $(TR $(TH Attribute) $(TH Action)) - - -
Attribute - Action +
Attribute Characters
$(B g) - global; repeat over the whole input string + $(TD $(B g)) + $(TD global; repeat over the whole input string)
$(B i) - case insensitive + $(TD $(B i)) + $(TD case insensitive)
$(B m) - treat as multiple lines separated by newlines + $(TD $(B m)) + $(TD treat as multiple lines separated by newlines)
+ * + * The $(I format)[] string has the formatting characters: + * + * + + $(TR $(TH Format) $(TH Replaced With)) + $(TR + $(TD $(B $$)) $(TD $) + ) + $(TR + $(TD $(B $&)) $(TD The matched substring.) + ) + $(TR + $(TD $(B $`)) $(TD The portion of string that precedes the matched substring.) + ) + $(TR + $(TD $(B $')) $(TD The portion of string that follows the matched substring.) + ) + $(TR + $(TD $(B $(DOLLAR))$(I n)) $(TD The $(I n)th capture, where $(I n) + is a single digit 1-9 + and $$(I n) is not followed by a decimal digit.) + ) + $(TR + $(TD $(B $(DOLLAR))$(I nn)) $(TD The $(I nn)th capture, where $(I nn) + is a two-digit decimal + number 01-99. + If $(I nn)th capture is undefined or more than the number + of parenthesized subexpressions, use the empty + string instead.) + ) +
Formatting Characters
+ * Any other $ are left as is. + * + * References: + * $(LINK2 http://en.wikipedia.org/wiki/Regular_expressions, Wikipedia) * Macros: * WIKI = StdRegexp + * DOLLAR = $ */ /* @@ -98,6 +135,7 @@ private import std.c.stdio; import std.c.stdlib; import std.c.string; + import std.stdio; import std.string; import std.ctype; import std.outbuffer; @@ -140,7 +178,20 @@ private alias char rchar; // so we can make a wchar version * pattern = Regular expression pattern. * format = Replacement string format. * attributes = Regular expression attributes. - * Returns: the resulting string. + * Returns: + * the resulting string + * Example: + * Replace the letters 'a' with the letters 'ZZ'. + * --- + * s = "Strap a rocket engine on a chicken." + * sub(s, "a", "ZZ") // result: StrZZp a rocket engine on a chicken. + * sub(s, "a", "ZZ", "g") // result: StrZZp ZZ rocket engine on ZZ chicken. + * --- + * The replacement format can reference the matches using + * the $&, $$, $', $`, $0 .. $99 notation: + * --- + * sub(s, "[ar]", "[$&]", "g") // result: St[r][a]p [a] [r]ocket engine on [a] chi + * --- */ char[] sub(char[] string, char[] pattern, char[] format, char[] attributes = null) @@ -170,6 +221,17 @@ unittest * dg = Delegate * attributes = Regular expression attributes. * Returns: the resulting string. + * Example: + * Capitalize the letters 'a' and 'r': + * --- + * s = "Strap a rocket engine on a chicken."; + * sub(s, "[ar]", + * delegate char[] (RegExp m) + * { + * return toupper(m.match(0)); + * }, + * "g"); // result: StRAp A Rocket engine on A chicken. + * --- */ char[] sub(char[] string, char[] pattern, char[] delegate(RegExp) dg, char[] attributes = null) @@ -194,11 +256,10 @@ char[] sub(char[] string, char[] pattern, char[] delegate(RegExp) dg, char[] att if (r.attributes & RegExp.REA.global && // global, so replace all !(r.attributes & RegExp.REA.ignoreCase) && // not ignoring case !(r.attributes & RegExp.REA.multiline) && // not multiline - pattern == slice && // simple pattern (exact match, no special characters) - format == replacement) // simple format, not $ formats + pattern == slice) // simple pattern (exact match, no special characters) { debug(regexp) - printf("pattern: %.*s, slice: %.*s, format: %.*s, replacement: %.*s\n",pattern,result[offset + so .. offset + eo],format,replacement); + printf("pattern: %.*s, slice: %.*s, replacement: %.*s\n",pattern,result[offset + so .. offset + eo],replacement); result = std.string.replace(result,slice,replacement); break; } @@ -230,6 +291,18 @@ unittest char[] r = sub("hello", "ll", delegate char[](RegExp r) { return "ss"; }); assert(r == "hesso"); + + r = sub("hello", "l", delegate char[](RegExp r) { return "l"; }, "g"); + assert(r == "hello"); + + auto s = sub("Strap a rocket engine on a chicken.", + "[ar]", + delegate char[] (RegExp m) + { + return std.string.toupper(m.match(0)); + }, + "g"); + assert(s == "StRAp A Rocket engine on A chicken."); } @@ -241,6 +314,12 @@ unittest * attributes = Regular expression attributes. * Returns: * index into string[] of match if found, -1 if no match. + * Example: + * --- + * auto s = "abcabcabab"; + * std.regexp.find(s, "b"); // match, returns 1 + * std.regexp.find(s, "f"); // no match, returns -1 + * --- */ int find(rchar[] string, char[] pattern, char[] attributes = null) @@ -277,6 +356,12 @@ unittest * attributes = Regular expression attributes. * Returns: * index into string[] of match if found, -1 if no match. + * Example: + * --- + * auto s = "abcabcabab"; + * std.regexp.find(s, "b"); // match, returns 9 + * std.regexp.find(s, "f"); // no match, returns -1 + * --- */ int rfind(rchar[] string, char[] pattern, char[] attributes = null) @@ -318,11 +403,23 @@ unittest /******************************************** * Split string[] into an array of strings, using the regular * expression pattern[] with attributes[] as the separator. + * Params: * string = String to search. * pattern = Regular expression pattern. * attributes = Regular expression attributes. * Returns: * array of slices into string[] + * Example: + * --- + * foreach (s; split("abcabcabab", "C.", "i")) + * { + * writefln("s = '%s'", s); + * } + * // Prints: + * // s = 'ab' + * // s = 'b' + * // s = 'bab' + * --- */ char[][] split(char[] string, char[] pattern, char[] attributes = null) @@ -342,6 +439,15 @@ unittest assert(result.length == 2); assert(result[0] == ""); assert(result[1] == "b"); + + foreach (i, s; split("abcabcabab", "C.", "i")) + { + writefln("s[%d] = '%s'", i, s); + if (i == 0) assert(s == "ab"); + else if (i == 1) assert(s == "b"); + else if (i == 2) assert(s == "bab"); + else assert(0); + } } /**************************************************** @@ -359,7 +465,7 @@ unittest * * void main() * { - * if (m; std.regexp.search("abcdef", "c")) + * if (auto m = std.regexp.search("abcdef", "c")) * { * writefln("%s[%s]%s", m.pre, m.match(0), m.post); * } @@ -383,6 +489,27 @@ RegExp search(char[] string, char[] pattern, char[] attributes = null) return r; } +unittest +{ + debug(regexp) printf("regexp.string.unittest()\n"); + + if (auto m = std.regexp.search("abcdef", "c()")) + { + auto result = std.string.format("%s[%s]%s", m.pre, m.match(0), m.post); + assert(result == "ab[c]def"); + assert(m.match(1) == null); + assert(m.match(2) == null); + } + else + assert(0); + + if (auto n = std.regexp.search("abcdef", "g")) + { + assert(0); + } +} + + /* ********************************* RegExp ******************************** */ /***************************** @@ -401,6 +528,12 @@ class RegExp * pattern = regular expression * attributes = _attributes * Throws: RegExpException if there are any compilation errors. + * Example: + * Declare two variables and assign to them a RegExp object: + * --- + * auto r = new RegExp("pattern"); + * auto s = new RegExp(r"p[1-5]\s*"); + * --- */ public this(rchar[] pattern, rchar[] attributes = null) { @@ -414,12 +547,36 @@ class RegExp * pattern = regular expression * attributes = _attributes * Throws: RegExpException if there are any compilation errors. + * Example: + * Declare two variables and assign to them a RegExp object: + * --- + * auto r = RegExp("pattern"); + * auto s = RegExp(r"p[1-5]\s*"); + * --- */ public static RegExp opCall(rchar[] pattern, rchar[] attributes = null) { return new RegExp(pattern, attributes); } + unittest + { + debug(regexp) printf("regexp.opCall.unittest()\n"); + auto r1 = RegExp("hello", "m"); + char[] msg; + try + { + auto r2 = RegExp("hello", "q"); + assert(0); + } + catch (RegExpException ree) + { + msg = ree.toString(); + //writefln("message: %s", ree); + } + assert(msg == "unrecognized attribute"); + } + /************************************ * Set up for start of foreach loop. * Returns: @@ -467,6 +624,23 @@ class RegExp return result; } + unittest + { + debug(regexp) printf("regexp.search.unittest()\n"); + + int i; + foreach(m; RegExp("ab").search("abcabcabab")) + { + auto s = std.string.format("%s[%s]%s", m.pre, m.match(0), m.post); + if (i == 0) assert(s == "[ab]cabcabab"); + else if (i == 1) assert(s == "abc[ab]cabab"); + else if (i == 2) assert(s == "abcabc[ab]ab"); + else if (i == 3) assert(s == "abcabcab[ab]"); + else assert(0); + i++; + } + } + /****************** * Retrieve match n. * @@ -908,6 +1082,11 @@ unittest result = r.replace("1ab2ac3", "x$&y"); i = std.string.cmp(result, "1xaby2xacy3"); assert(i == 0); + + r = new RegExp("ab", "g"); + result = r.replace("1ab2ac3", "xy"); + i = std.string.cmp(result, "1xy2ac3"); + assert(i == 0); } @@ -1840,6 +2019,7 @@ int parseRegexp() break; } } + assert(0); } int parsePiece() @@ -1947,6 +2127,7 @@ int parsePiece() Lerr: error("badly formed {n,m}"); + assert(0); } int parseAtom() @@ -2165,11 +2346,11 @@ class Range maxc = u; b = u / 8; if (b >= maxb) - { uint u; + { uint u2; - u = base ? base - &buf.data[0] : 0; + u2 = base ? base - &buf.data[0] : 0; buf.fill0(b - maxb + 1); - base = &buf.data[u]; + base = &buf.data[u2]; maxb = b + 1; //bits = (cast(bit*)this.base)[0 .. maxc + 1]; bits.ptr = cast(uint*)this.base; @@ -2245,6 +2426,8 @@ int parseRange() break; case RS.start: break; + default: + assert(0); } p++; break; @@ -2348,6 +2531,9 @@ int parseRange() r.bits[c] = 1; rs = RS.start; break; + + default: + assert(0); } continue; } @@ -2752,6 +2938,9 @@ int starrchars(Range r, ubyte[] prog) case REbackref: return 0; + + default: + assert(0); } } return 1; @@ -2763,34 +2952,6 @@ int starrchars(Range r, ubyte[] prog) * After a match is found with test(), this function * will take the match results and, using the format * string, generate and return a new string. - * The format string has the formatting characters: - * - $(TR $(TH Format) $(TH Replaced With)) - $(TR - $(TD $(B $$)) $(TD $) - ) - $(TR - $(TD $(B $&)) $(TD The matched substring.) - ) - $(TR - $(TD $(B $`)) $(TD The portion of string that precedes the matched substring.) - ) - $(TR - $(TD $(B $')) $(TD The portion of string that follows the matched substring.) - ) - $(TR - $(TD $(B $n)) $(TD The nth capture, where n is a single digit 1-9 - and $n is not followed by a decimal digit.) - ) - $(TR - $(TD $(B $nn)) $(TD The nnth capture, where nn is a two-digit decimal - number 01-99. - If nnth capture is undefined or more than the number - of parenthesized subexpressions, use the empty - string instead.) - ) -
- Any other $ are left as is. */ public rchar[] replace(rchar[] format) @@ -2936,11 +3097,11 @@ public rchar[] replaceOld(rchar[] format) { c = format[++i]; if (c >= '1' && c <= '9') - { uint i; + { uint j; - i = c - '0'; - if (i <= re_nsub && pmatch[i].rm_so != pmatch[i].rm_eo) - result ~= input[pmatch[i].rm_so .. pmatch[i].rm_eo]; + j = c - '0'; + if (j <= re_nsub && pmatch[j].rm_so != pmatch[j].rm_eo) + result ~= input[pmatch[j].rm_so .. pmatch[j].rm_eo]; break; } } diff --git a/std/socket.d b/std/socket.d index 69a654ead..cd9265e8e 100644 --- a/std/socket.d +++ b/std/socket.d @@ -269,7 +269,7 @@ class Service void populate(servent* serv) { name = std.string.toString(serv.s_name).dup; - port = ntohs(serv.s_port); + port = ntohs(cast(ushort)serv.s_port); protocolName = std.string.toString(serv.s_proto).dup; int i; diff --git a/std/socketstream.d b/std/socketstream.d index c974a4f48..1bc11d2ce 100644 --- a/std/socketstream.d +++ b/std/socketstream.d @@ -123,7 +123,6 @@ class SocketStream: Stream override ulong seek(long offset, SeekPos whence) { throw new SeekException("Cannot seek a socket."); - return 0; } /** diff --git a/std/stream.d b/std/stream.d index 3a93ce8c6..c32878045 100644 --- a/std/stream.d +++ b/std/stream.d @@ -771,65 +771,69 @@ class Stream : InputStream, OutputStream { ifmt = 'd'; } long n = 0; - switch (ifmt) { - case 'd': // decimal - case 'u': { - while (isdigit(c) && width) { - n = n * 10 + (c - '0'); - width--; - c = getc(); - count++; - } - } break; + switch (ifmt) + { + case 'd': // decimal + case 'u': { + while (isdigit(c) && width) { + n = n * 10 + (c - '0'); + width--; + c = getc(); + count++; + } + } break; - case 'o': { // octal - while (isoctdigit(c) && width) { - n = n * 010 + (c - '0'); - width--; - c = getc(); - count++; - } - } break; + case 'o': { // octal + while (isoctdigit(c) && width) { + n = n * 010 + (c - '0'); + width--; + c = getc(); + count++; + } + } break; - case 'x': { // hexadecimal - while (ishexdigit(c) && width) { - n *= 0x10; - if (isdigit(c)) - n += c - '0'; - else - n += 0xA + (c | 0x20) - 'a'; - width--; - c = getc(); - count++; - } - } break; + case 'x': { // hexadecimal + while (ishexdigit(c) && width) { + n *= 0x10; + if (isdigit(c)) + n += c - '0'; + else + n += 0xA + (c | 0x20) - 'a'; + width--; + c = getc(); + count++; + } + } break; + + default: + assert(0); } if (neg) n = -n; if (arguments[j] is typeid(int*)) { int* p = va_arg!(int*)(args); - *p = n; + *p = cast(int)n; } else if (arguments[j] is typeid(short*)) { short* p = va_arg!(short*)(args); - *p = n; + *p = cast(short)n; } else if (arguments[j] is typeid(byte*)) { byte* p = va_arg!(byte*)(args); - *p = n; + *p = cast(byte)n; } else if (arguments[j] is typeid(long*)) { long* p = va_arg!(long*)(args); *p = n; } else if (arguments[j] is typeid(uint*)) { uint* p = va_arg!(uint*)(args); - *p = n; + *p = cast(uint)n; } else if (arguments[j] is typeid(ushort*)) { ushort* p = va_arg!(ushort*)(args); - *p = n; + *p = cast(ushort)n; } else if (arguments[j] is typeid(ubyte*)) { ubyte* p = va_arg!(ubyte*)(args); - *p = n; + *p = cast(ubyte)n; } else if (arguments[j] is typeid(ulong*)) { ulong* p = va_arg!(ulong*)(args); - *p = n; + *p = cast(ulong)n; } j++; i++; @@ -951,14 +955,14 @@ class Stream : InputStream, OutputStream { *p = s; } else if (arguments[j] is typeid(char*)) { s ~= 0; - char* p = va_arg!(char*)(args); - p[0 .. s.length] = s[]; + char* q = va_arg!(char*)(args); + q[0 .. s.length] = s[]; } else if (arguments[j] is typeid(wchar[]*)) { - wchar[]* p = va_arg!(wchar[]*)(args); - *p = toUTF16(s); + wchar[]* q = va_arg!(wchar[]*)(args); + *q = toUTF16(s); } else if (arguments[j] is typeid(dchar[]*)) { - dchar[]* p = va_arg!(dchar[]*)(args); - *p = toUTF32(s); + dchar[]* q = va_arg!(dchar[]*)(args); + *q = toUTF32(s); } j++; i++; @@ -1203,7 +1207,7 @@ class Stream : InputStream, OutputStream { void copyFrom(Stream s, ulong count) { ubyte[128] buf; while (count > 0) { - size_t n = count 0) { rdlen = readBlock(&result[pos], blockSize); @@ -1960,12 +1964,12 @@ class File: Stream { assertSeekable(); version (Win32) { int hi = cast(int)(offset>>32); - uint low = SetFilePointer(hFile, offset, &hi, rel); + uint low = SetFilePointer(hFile, cast(int)offset, &hi, rel); if ((low == INVALID_SET_FILE_POINTER) && (GetLastError() != 0)) throw new SeekException("unable to move file pointer"); ulong result = (cast(ulong)hi << 32) + low; } else version (linux) { - ulong result = lseek(hFile, offset, rel); + ulong result = lseek(hFile, cast(int)offset, rel); if (result == 0xFFFFFFFF) throw new SeekException("unable to move file pointer"); } @@ -2055,7 +2059,7 @@ class File: Stream { file.position = 0; lines = new char[][4]; foreach(ulong n, char[] line; file) { - lines[n-1] = line.dup; + lines[cast(size_t)(n-1)] = line.dup; } assert( lines[0] == "Testing stream.d:"); assert( lines[1] == "Another line"); @@ -2125,7 +2129,7 @@ class BufferedFile: BufferedStream { assert(file.position() == 18 + 13 + 4); // we must be at the end of file assert(file.eof()); - long oldsize = file.size(); + long oldsize = cast(long)file.size(); file.close(); // no operations are allowed when file is closed assert(!file.readable && !file.writeable && !file.seekable); @@ -2508,8 +2512,8 @@ class TArrayStream(Buffer): Stream { assertReadable(); ubyte* cbuf = cast(ubyte*) buffer; if (len - cur < size) - size = len - cur; - ubyte[] ubuf = cast(ubyte[])buf[cur .. cur + size]; + size = cast(size_t)(len - cur); + ubyte[] ubuf = cast(ubyte[])buf[cast(size_t)cur .. cast(size_t)(cur + size)]; cbuf[0 .. size] = ubuf[]; cur += size; return size; @@ -2520,8 +2524,8 @@ class TArrayStream(Buffer): Stream { ubyte* cbuf = cast(ubyte*) buffer; ulong blen = buf.length; if (cur + size > blen) - size = blen - cur; - ubyte[] ubuf = cast(ubyte[])buf[cur .. cur + size]; + size = cast(size_t)(blen - cur); + ubyte[] ubuf = cast(ubyte[])buf[cast(size_t)cur .. cast(size_t)(cur + size)]; ubuf[] = cbuf[0 .. size]; cur += size; if (cur > len) @@ -2535,8 +2539,10 @@ class TArrayStream(Buffer): Stream { switch (rel) { case SeekPos.Set: scur = offset; break; - case SeekPos.Current: scur = cur + offset; break; - case SeekPos.End: scur = len + offset; break; + case SeekPos.Current: scur = cast(long)(cur + offset); break; + case SeekPos.End: scur = cast(long)(len + offset); break; + default: + assert(0); } if (scur < 0) @@ -2544,18 +2550,18 @@ class TArrayStream(Buffer): Stream { else if (scur > len) cur = len; else - cur = scur; + cur = cast(ulong)scur; return cur; } - override size_t available () { return len - cur; } + override size_t available () { return cast(size_t)(len - cur); } /// Get the current memory data in total. ubyte[] data() { if (len > size_t.max) throw new StreamException("Stream too big"); - void[] res = buf[0 .. len]; + void[] res = buf[0 .. cast(size_t)len]; return cast(ubyte[])res; } @@ -2608,7 +2614,7 @@ class MemoryStream: TArrayStream!(ubyte[]) { /// Ensure the stream can hold count bytes. void reserve(size_t count) { if (cur + count > buf.length) - buf.length = (cur + count) * 2; + buf.length = cast(uint)((cur + count) * 2); } override size_t writeBlock(void* buffer, size_t size) { @@ -2787,7 +2793,7 @@ class SliceStream : FilterStream { override size_t readBlock (void *buffer, size_t size) { assertReadable(); if (bounded && size > high - low - pos) - size = high - low - pos; + size = cast(size_t)(high - low - pos); ulong bp = s.position; if (seekable) s.position = low + pos; @@ -2802,7 +2808,7 @@ class SliceStream : FilterStream { override size_t writeBlock (void *buffer, size_t size) { assertWriteable(); if (bounded && size > high - low - pos) - size = high - low - pos; + size = cast(size_t)(high - low - pos); ulong bp = s.position; if (seekable) s.position = low + pos; @@ -2823,14 +2829,16 @@ class SliceStream : FilterStream { spos = offset; break; case SeekPos.Current: - spos = pos + offset; + spos = cast(long)(pos + offset); break; case SeekPos.End: if (bounded) - spos = high - low + offset; + spos = cast(long)(high - low + offset); else - spos = s.size - low + offset; + spos = cast(long)(s.size - low + offset); break; + default: + assert(0); } if (spos < 0) @@ -2840,7 +2848,7 @@ class SliceStream : FilterStream { else if (!bounded && spos > s.size - low) pos = s.size - low; else - pos = spos; + pos = cast(ulong)spos; readEOF = false; return pos; @@ -2851,9 +2859,9 @@ class SliceStream : FilterStream { ulong bp = s.position; if (bp <= pos+low && pos+low <= bp+res) { if (!bounded || bp+res <= high) - return bp + res - pos - low; + return cast(size_t)(bp + res - pos - low); else if (high <= bp+res) - return high - pos - low; + return cast(size_t)(high - pos - low); } return 0; } diff --git a/std/string.d b/std/string.d index 90aad1dac..8be95859d 100644 --- a/std/string.d +++ b/std/string.d @@ -2394,7 +2394,7 @@ char[] toString(long i) if (cast(int)i == i) return toString(cast(int)i); - ulong u = -i; + ulong u = cast(ulong)(-i); int ndigits = 1; while (u) { @@ -2536,12 +2536,12 @@ body uint i = buffer.length; if (value < radix && value < hexdigits.length) - return hexdigits[value .. value + 1]; + return hexdigits[cast(size_t)value .. cast(size_t)value + 1]; do { ubyte c; - c = value % radix; + c = cast(ubyte)(value % radix); value = value / radix; i--; buffer[i] = (c < 10) ? c + '0' : c + 'A' - 10; @@ -3069,6 +3069,7 @@ char[] tr(char[] str, char[] from, char[] to, char[] modifiers = null) case 'c': mod_c = 1; break; // complement case 'd': mod_d = 1; break; // delete unreplaced chars case 's': mod_s = 1; break; // squeeze duplicated replaced chars + default: assert(0); } } diff --git a/std/thread.d b/std/thread.d index 6a8f5406c..0a6a5dbd9 100644 --- a/std/thread.d +++ b/std/thread.d @@ -159,6 +159,7 @@ class Thread return fp(arg); else if (dg) return dg(); + assert(0); } /***************************** @@ -247,6 +248,8 @@ class Thread case PRIORITY.CRITICAL: nPriority = THREAD_PRIORITY_TIME_CRITICAL; break; + default: + assert(0); } if (SetThreadPriority(hdl, nPriority) == THREAD_PRIORITY_ERROR_RETURN) @@ -654,6 +657,7 @@ class Thread return fp(arg); else if (dg) return dg(); + assert(0); } void wait() diff --git a/std/typeinfo/ti_Along.d b/std/typeinfo/ti_Along.d index 1d988c26b..37fcbdf13 100644 --- a/std/typeinfo/ti_Along.d +++ b/std/typeinfo/ti_Along.d @@ -45,9 +45,10 @@ class TypeInfo_Al : TypeInfo len = s2.length; for (size_t u = 0; u < len; u++) { - int result = s1[u] - s2[u]; - if (result) - return result; + if (s1[u] < s2[u]) + return -1; + else if (s1[u] > s2[u]) + return 1; } return cast(int)s1.length - cast(int)s2.length; } diff --git a/std/typeinfo/ti_Aulong.d b/std/typeinfo/ti_Aulong.d index 14943f4e9..9a4435371 100644 --- a/std/typeinfo/ti_Aulong.d +++ b/std/typeinfo/ti_Aulong.d @@ -45,9 +45,10 @@ class TypeInfo_Am : TypeInfo len = s2.length; for (size_t u = 0; u < len; u++) { - int result = s1[u] - s2[u]; - if (result) - return result; + if (s1[u] < s2[u]) + return -1; + else if (s1[u] > s2[u]) + return 1; } return cast(int)s1.length - cast(int)s2.length; } diff --git a/std/typeinfo/ti_void.d b/std/typeinfo/ti_void.d index 56458869d..4813cd7e9 100644 --- a/std/typeinfo/ti_void.d +++ b/std/typeinfo/ti_void.d @@ -10,7 +10,6 @@ class TypeInfo_v : TypeInfo hash_t getHash(void *p) { assert(0); - return *cast(byte *)p; } int equals(void *p1, void *p2) diff --git a/std/uni.d b/std/uni.d index e324a00bd..79eee9b3c 100644 --- a/std/uni.d +++ b/std/uni.d @@ -464,7 +464,7 @@ int isUniAlpha(dchar u) low = 0; high = table.length - 1; - while (low <= high) + while (cast(int)low <= cast(int)high) { mid = (low + high) >> 1; if (u < table[mid][0]) @@ -498,4 +498,15 @@ Lis: return 1; } - +unittest +{ + for (uint i = 0; i < 0x80; i++) + { + if (i >= 'A' && i <= 'Z') + assert(isUniAlpha(i)); + else if (i >= 'a' && i <= 'z') + assert(isUniAlpha(i)); + else + assert(!isUniAlpha(i)); + } +} diff --git a/std/uri.d b/std/uri.d index ce5c4bd59..7b6116253 100644 --- a/std/uri.d +++ b/std/uri.d @@ -223,7 +223,6 @@ private char[] URI_Encode(dchar[] string, uint unescapedSet) LthrowURIerror: throw new URIerror(); - return null; } uint ascii2hex(dchar c) @@ -344,7 +343,6 @@ private dchar[] URI_Decode(char[] string, uint reservedSet) LthrowURIerror: throw new URIerror(); - return null; } /************************************* diff --git a/std/utf.d b/std/utf.d index 0d0af101d..8e8d44317 100644 --- a/std/utf.d +++ b/std/utf.d @@ -667,10 +667,7 @@ char[] toUTF8(char[4] buf, dchar c) buf[3] = cast(char)(0x80 | (c & 0x3F)); return buf[0 .. 4]; } - else - { - assert(0); - } + assert(0); } /******************* diff --git a/std/windows/registry.d b/std/windows/registry.d index a00113591..8b811942e 100644 --- a/std/windows/registry.d +++ b/std/windows/registry.d @@ -384,13 +384,14 @@ private REG_VALUE_TYPE _RVT_from_Endian(Endian endian) { case Endian.Big: return REG_VALUE_TYPE.REG_DWORD_BIG_ENDIAN; - break; + case Endian.Little: return REG_VALUE_TYPE.REG_DWORD_LITTLE_ENDIAN; - break; + default: throw new RegistryException("Invalid Endian specified"); } + assert(0); } private uint swap(in uint i) @@ -711,7 +712,7 @@ body case REG_VALUE_TYPE.REG_BINARY: case REG_VALUE_TYPE.REG_MULTI_SZ: throw new RegistryException("Cannot read the given value as a string"); - break; + case REG_VALUE_TYPE.REG_SZ: case REG_VALUE_TYPE.REG_EXPAND_SZ: value = std.string.toString(cast(char*)data); @@ -775,7 +776,7 @@ body { default: throw new RegistryException("Cannot read the given value as a string"); - break; + case REG_VALUE_TYPE.REG_MULTI_SZ: break; } @@ -807,7 +808,7 @@ body { default: throw new RegistryException("Cannot read the given value as a 32-bit integer"); - break; + version(LittleEndian) { case REG_VALUE_TYPE.REG_DWORD_LITTLE_ENDIAN: @@ -850,7 +851,7 @@ body { default: throw new RegistryException("Cannot read the given value as a 64-bit integer"); - break; + case REG_VALUE_TYPE.REG_QWORD_LITTLE_ENDIAN: break; } @@ -887,7 +888,7 @@ body { default: throw new RegistryException("Cannot read the given value as a string"); - break; + case REG_VALUE_TYPE.REG_BINARY: data.length = cbData; value = data; @@ -1748,8 +1749,8 @@ public: for(DWORD index = 0; 0 == result; ++index) { DWORD cchName; - LONG res = Reg_EnumKeyName_(hkey, index, sName, cchName); + res = Reg_EnumKeyName_(hkey, index, sName, cchName); assert(ERROR_MORE_DATA != res); if(ERROR_NO_MORE_ITEMS == res) @@ -1881,8 +1882,8 @@ public: for(DWORD index = 0; 0 == result; ++index) { DWORD cchName; - LONG res = Reg_EnumKeyName_(hkey, index, sName, cchName); + res = Reg_EnumKeyName_(hkey, index, sName, cchName); assert(ERROR_MORE_DATA != res); if(ERROR_NO_MORE_ITEMS == res) @@ -2025,8 +2026,8 @@ public: for(DWORD index = 0; 0 == result; ++index) { DWORD cchName = 1 + cchValueMaxLen; - LONG res = Reg_EnumValueName_(hkey, index, sName, cchName); + res = Reg_EnumValueName_(hkey, index, sName, cchName); if(ERROR_NO_MORE_ITEMS == res) { // Enumeration complete @@ -2152,8 +2153,8 @@ public: for(DWORD index = 0; 0 == result; ++index) { DWORD cchName = 1 + cchValueMaxLen; - LONG res = Reg_EnumValueName_(hkey, index, sName, cchName); + res = Reg_EnumValueName_(hkey, index, sName, cchName); if(ERROR_NO_MORE_ITEMS == res) { // Enumeration complete diff --git a/std/zip.d b/std/zip.d index a051e6ab5..a38f73464 100644 --- a/std/zip.d +++ b/std/zip.d @@ -212,8 +212,8 @@ class ZipArchive putUint (i + 14, de.crc32); putUint (i + 18, de.compressedSize); putUint (i + 22, de.expandedData.length); - putUshort(i + 26, de.name.length); - putUshort(i + 28, de.extra.length); + putUshort(i + 26, cast(ushort)de.name.length); + putUshort(i + 28, cast(ushort)de.extra.length); i += 30; data[i .. i + de.name.length] = cast(ubyte[])de.name[]; @@ -238,9 +238,9 @@ class ZipArchive putUint (i + 16, de.crc32); putUint (i + 20, de.compressedSize); putUint (i + 24, de.expandedSize); - putUshort(i + 28, de.name.length); - putUshort(i + 30, de.extra.length); - putUshort(i + 32, de.comment.length); + putUshort(i + 28, cast(ushort)de.name.length); + putUshort(i + 30, cast(ushort)de.extra.length); + putUshort(i + 32, cast(ushort)de.comment.length); putUshort(i + 34, de.diskNumber); putUshort(i + 36, de.internalAttributes); putUint (i + 38, de.externalAttributes); @@ -260,13 +260,13 @@ class ZipArchive // Write end record endrecOffset = i; data[i .. i + 4] = cast(ubyte[])"PK\x05\x06"; - putUshort(i + 4, diskNumber); - putUshort(i + 6, diskStartDir); - putUshort(i + 8, numEntries); - putUshort(i + 10, totalEntries); + putUshort(i + 4, cast(ushort)diskNumber); + putUshort(i + 6, cast(ushort)diskStartDir); + putUshort(i + 8, cast(ushort)numEntries); + putUshort(i + 10, cast(ushort)totalEntries); putUint (i + 12, directorySize); putUint (i + 16, directoryOffset); - putUshort(i + 20, comment.length); + putUshort(i + 20, cast(ushort)comment.length); i += 22; // Write archive comment @@ -450,6 +450,7 @@ class ZipArchive default: throw new ZipException("unsupported compression method"); } + assert(0); } /* ============ Utility =================== */ @@ -488,8 +489,8 @@ class ZipArchive } else { - data[0] = cast(ubyte)us; - data[1] = cast(ubyte)(us >> 8); + data[i] = cast(ubyte)us; + data[i + 1] = cast(ubyte)(us >> 8); } } diff --git a/std/zlib.d b/std/zlib.d index 5395515ba..6ec277430 100644 --- a/std/zlib.d +++ b/std/zlib.d @@ -191,6 +191,7 @@ void[] uncompress(void[] srcbuf, uint destlen = 0u, int winbits = 15) throw new ZlibException(err); } } + assert(0); } unittest diff --git a/unittest.d b/unittest.d index fe492f6ed..fdafff4e5 100644 --- a/unittest.d +++ b/unittest.d @@ -48,6 +48,7 @@ import std.stdio; import std.conv; import std.boxer; import std.bitarray; +import std.uni; int main(char[][] args) { @@ -108,6 +109,8 @@ printf("test2\n"); ba.length = 3; ba[0] = true; + std.uni.isUniAlpha('A'); + printf("Success\n!"); return 0; } diff --git a/win32.mak b/win32.mak index e64458cdc..fee5c2bd9 100644 --- a/win32.mak +++ b/win32.mak @@ -19,8 +19,8 @@ CP=cp CFLAGS=-mn -6 -r #CFLAGS=-g -mn -6 -r -DFLAGS=-O -release -nofloat -#DFLAGS=-unittest -g +DFLAGS=-O -release -nofloat -w +#DFLAGS=-unittest -g -w #DFLAGS=-unittest -cov -g CC=dmc @@ -73,7 +73,7 @@ OBJS= asserterror.obj deh.obj switch.obj complex.obj gcstats.obj \ socket.obj socketstream.obj loader.obj stdarg.obj format.obj stdio.obj \ perf.obj openrj.obj uni.obj winsock.obj oldsyserror.obj \ errno.obj boxer.obj cstream.obj charset.obj \ - realtest.obj gamma.obj demangle.obj cover.obj bitarray.obj \ + gamma.obj demangle.obj cover.obj bitarray.obj \ ti_Aa.obj ti_Ag.obj ti_C.obj ti_int.obj ti_char.obj \ ti_wchar.obj ti_uint.obj ti_short.obj ti_ushort.obj \ ti_byte.obj ti_ubyte.obj ti_long.obj ti_ulong.obj ti_ptr.obj \ @@ -190,7 +190,7 @@ SRC_STD_C_WIN= std\c\windows\windows.d std\c\windows\com.d \ SRC_STD_C_LINUX= std\c\linux\linux.d std\c\linux\linuxextern.d \ std\c\linux\socket.d -SRC_ETC= etc\gamma.d etc\realtest.d +SRC_ETC= etc\gamma.d SRC_ETC_C= etc\c\zlib.d @@ -478,9 +478,6 @@ stdarg.obj : std\c\stdarg.d gamma.obj : etc\gamma.d $(DMD) -c $(DFLAGS) etc\gamma.d -realtest.obj : etc\realtest.d - $(DMD) -c $(DFLAGS) etc\realtest.d - ### etc\c Czlib.obj : etc\c\zlib.d @@ -820,7 +817,7 @@ install: $(CP) $(SRC_STD_WIN) \dmd\src\phobos\std\windows $(CP) $(SRC_STD_C_WIN) \dmd\src\phobos\std\c\windows $(CP) $(SRC_STD_C_LINUX) \dmd\src\phobos\std\c\linux - #$(CP) $(SRC_ETC) \dmd\src\phobos\etc + $(CP) $(SRC_ETC) \dmd\src\phobos\etc $(CP) $(SRC_ETC_C) \dmd\src\phobos\etc\c $(CP) $(SRC_ZLIB) \dmd\src\phobos\etc\c\zlib $(CP) $(SRC_GC) \dmd\src\phobos\internal\gc