mirror of
https://github.com/dlang/phobos.git
synced 2025-05-14 17:05:58 +03:00
phobos 0.96
This commit is contained in:
parent
5a51fc091f
commit
2fd7d60c13
26 changed files with 1475 additions and 107 deletions
|
@ -28,7 +28,7 @@ struct Array
|
||||||
extern (C) Array _adReverse(Array a, int szelem)
|
extern (C) Array _adReverse(Array a, int szelem)
|
||||||
out (result)
|
out (result)
|
||||||
{
|
{
|
||||||
assert(result === a);
|
assert(result is a);
|
||||||
}
|
}
|
||||||
body
|
body
|
||||||
{
|
{
|
||||||
|
@ -81,7 +81,7 @@ unittest
|
||||||
for (i = 0; i < 5; i++)
|
for (i = 0; i < 5; i++)
|
||||||
a[i] = i;
|
a[i] = i;
|
||||||
b = a.reverse;
|
b = a.reverse;
|
||||||
assert(b === a);
|
assert(b is a);
|
||||||
for (i = 0; i < 5; i++)
|
for (i = 0; i < 5; i++)
|
||||||
assert(a[i] == 4 - i);
|
assert(a[i] == 4 - i);
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@ unittest
|
||||||
c[i].e = 10;
|
c[i].e = 10;
|
||||||
}
|
}
|
||||||
d = c.reverse;
|
d = c.reverse;
|
||||||
assert(d === c);
|
assert(d is c);
|
||||||
for (i = 0; i < 5; i++)
|
for (i = 0; i < 5; i++)
|
||||||
{
|
{
|
||||||
assert(c[i].a == 4 - i);
|
assert(c[i].a == 4 - i);
|
||||||
|
@ -114,7 +114,7 @@ unittest
|
||||||
extern (C) bit[] _adReverseBit(bit[] a)
|
extern (C) bit[] _adReverseBit(bit[] a)
|
||||||
out (result)
|
out (result)
|
||||||
{
|
{
|
||||||
assert(result === a);
|
assert(result is a);
|
||||||
}
|
}
|
||||||
body
|
body
|
||||||
{
|
{
|
||||||
|
|
|
@ -48,18 +48,18 @@ Object _d_dynamic_cast(Object o, ClassInfo c)
|
||||||
int _d_isbaseof2(ClassInfo oc, ClassInfo c, inout uint offset)
|
int _d_isbaseof2(ClassInfo oc, ClassInfo c, inout uint offset)
|
||||||
{ int i;
|
{ int i;
|
||||||
|
|
||||||
if (oc === c)
|
if (oc is c)
|
||||||
return 1;
|
return 1;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if (oc.base === c)
|
if (oc.base is c)
|
||||||
return 1;
|
return 1;
|
||||||
for (i = 0; i < oc.interfaces.length; i++)
|
for (i = 0; i < oc.interfaces.length; i++)
|
||||||
{
|
{
|
||||||
ClassInfo ic;
|
ClassInfo ic;
|
||||||
|
|
||||||
ic = oc.interfaces[i].classinfo;
|
ic = oc.interfaces[i].classinfo;
|
||||||
if (ic === c)
|
if (ic is c)
|
||||||
{ offset = oc.interfaces[i].offset;
|
{ offset = oc.interfaces[i].offset;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -82,18 +82,18 @@ int _d_isbaseof2(ClassInfo oc, ClassInfo c, inout uint offset)
|
||||||
int _d_isbaseof(ClassInfo oc, ClassInfo c)
|
int _d_isbaseof(ClassInfo oc, ClassInfo c)
|
||||||
{ int i;
|
{ int i;
|
||||||
|
|
||||||
if (oc === c)
|
if (oc is c)
|
||||||
return 1;
|
return 1;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if (oc.base === c)
|
if (oc.base is c)
|
||||||
return 1;
|
return 1;
|
||||||
for (i = 0; i < oc.interfaces.length; i++)
|
for (i = 0; i < oc.interfaces.length; i++)
|
||||||
{
|
{
|
||||||
ClassInfo ic;
|
ClassInfo ic;
|
||||||
|
|
||||||
ic = oc.interfaces[i].classinfo;
|
ic = oc.interfaces[i].classinfo;
|
||||||
if (ic === c || _d_isbaseof(ic, c))
|
if (ic is c || _d_isbaseof(ic, c))
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
oc = oc.base;
|
oc = oc.base;
|
||||||
|
@ -119,7 +119,7 @@ void *_d_interface_vtbl(ClassInfo ic, Object o)
|
||||||
ClassInfo oic;
|
ClassInfo oic;
|
||||||
|
|
||||||
oic = oc.interfaces[i].classinfo;
|
oic = oc.interfaces[i].classinfo;
|
||||||
if (oic === ic)
|
if (oic is ic)
|
||||||
{
|
{
|
||||||
return cast(void *)oc.interfaces[i].vtbl;
|
return cast(void *)oc.interfaces[i].vtbl;
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ extern (C):
|
||||||
|
|
||||||
int _d_obj_eq(Object o1, Object o2)
|
int _d_obj_eq(Object o1, Object o2)
|
||||||
{
|
{
|
||||||
return o1 === o2 || (o1 && o1.opEquals(o2));
|
return o1 is o2 || (o1 && o1.opEquals(o2));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ class Object
|
||||||
|
|
||||||
int opEquals(Object o)
|
int opEquals(Object o)
|
||||||
{
|
{
|
||||||
return this === o;
|
return this is o;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,7 +93,7 @@ class TypeInfo
|
||||||
* across DLL's. Therefore, comparing for a name match is
|
* across DLL's. Therefore, comparing for a name match is
|
||||||
* sufficient.
|
* sufficient.
|
||||||
*/
|
*/
|
||||||
return this === o || this.classinfo.name == o.classinfo.name;
|
return this is o || this.classinfo.name == o.classinfo.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint getHash(void *p) { return cast(uint)p; }
|
uint getHash(void *p) { return cast(uint)p; }
|
||||||
|
|
|
@ -56,6 +56,7 @@ OBJS= asserterror.o deh2.o switch.o complex.o gcstats.o \
|
||||||
crc32.o conv.o arraycast.o errno.o alloca.o cmath2.o \
|
crc32.o conv.o arraycast.o errno.o alloca.o cmath2.o \
|
||||||
process.o syserror.o \
|
process.o syserror.o \
|
||||||
socket.o socketstream.o stdarg.o stdio.o format.o \
|
socket.o socketstream.o stdarg.o stdio.o format.o \
|
||||||
|
perf.o \
|
||||||
ti_wchar.o ti_uint.o ti_short.o ti_ushort.o \
|
ti_wchar.o ti_uint.o ti_short.o ti_ushort.o \
|
||||||
ti_byte.o ti_ubyte.o ti_long.o ti_ulong.o ti_ptr.o \
|
ti_byte.o ti_ubyte.o ti_long.o ti_ulong.o ti_ptr.o \
|
||||||
ti_float.o ti_double.o ti_real.o ti_delegate.o \
|
ti_float.o ti_double.o ti_real.o ti_delegate.o \
|
||||||
|
@ -95,7 +96,7 @@ SRC_STD= std/zlib.d std/zip.d std/stdint.d std/conv.d std/utf.d std/uri.d \
|
||||||
std/intrinsic.d std/array.d std/switcherr.d std/syserror.d \
|
std/intrinsic.d std/array.d std/switcherr.d std/syserror.d \
|
||||||
std/regexp.d std/random.d std/stream.d std/process.d std/recls.d \
|
std/regexp.d std/random.d std/stream.d std/process.d std/recls.d \
|
||||||
std/socket.d std/socketstream.d std/loader.d std/stdarg.d \
|
std/socket.d std/socketstream.d std/loader.d std/stdarg.d \
|
||||||
std/stdio.d std/format.d
|
std/stdio.d std/format.d std/perf.d
|
||||||
|
|
||||||
SRC_STD_C= std/c/process.d std/c/stdlib.d std/c/time.d std/c/stdio.d \
|
SRC_STD_C= std/c/process.d std/c/stdlib.d std/c/time.d std/c/stdio.d \
|
||||||
std/c/math.d std/c/stdarg.d
|
std/c/math.d std/c/stdarg.d
|
||||||
|
@ -398,6 +399,9 @@ outofmemory.o : std/outofmemory.d
|
||||||
path.o : std/path.d
|
path.o : std/path.d
|
||||||
$(DMD) -c $(DFLAGS) std/path.d
|
$(DMD) -c $(DFLAGS) std/path.d
|
||||||
|
|
||||||
|
perf.o : std/perf.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/perf.d
|
||||||
|
|
||||||
process.o : std/process.d
|
process.o : std/process.d
|
||||||
$(DMD) -c $(DFLAGS) std/process.d
|
$(DMD) -c $(DFLAGS) std/process.d
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,13 @@
|
||||||
|
|
||||||
|
/* Written by Walter Bright
|
||||||
|
* www.digitalmars.com
|
||||||
|
* Placed into public domain.
|
||||||
|
*/
|
||||||
|
|
||||||
module std.c.linux.linux;
|
module std.c.linux.linux;
|
||||||
|
|
||||||
import std.c.linux.linuxextern;
|
import std.c.linux.linuxextern;
|
||||||
|
|
||||||
alias int time_t;
|
|
||||||
alias int off_t;
|
alias int off_t;
|
||||||
|
|
||||||
enum : int
|
enum : int
|
||||||
|
|
|
@ -1,4 +1,9 @@
|
||||||
|
|
||||||
|
/* Written by Walter Bright
|
||||||
|
* www.digitalmars.com
|
||||||
|
* Placed into public domain.
|
||||||
|
*/
|
||||||
|
|
||||||
module std.c.time;
|
module std.c.time;
|
||||||
|
|
||||||
extern (C):
|
extern (C):
|
||||||
|
|
|
@ -285,7 +285,7 @@ struct FILETIME {
|
||||||
DWORD dwLowDateTime;
|
DWORD dwLowDateTime;
|
||||||
DWORD dwHighDateTime;
|
DWORD dwHighDateTime;
|
||||||
}
|
}
|
||||||
alias FILETIME* PFILETIME;
|
alias FILETIME* PFILETIME, LPFILETIME;
|
||||||
|
|
||||||
struct WIN32_FIND_DATA {
|
struct WIN32_FIND_DATA {
|
||||||
DWORD dwFileAttributes;
|
DWORD dwFileAttributes;
|
||||||
|
@ -872,6 +872,7 @@ enum
|
||||||
}
|
}
|
||||||
|
|
||||||
export HANDLE GetCurrentThread();
|
export HANDLE GetCurrentThread();
|
||||||
|
export BOOL GetProcessTimes(HANDLE hProcess, LPFILETIME lpCreationTime, LPFILETIME lpExitTime, LPFILETIME lpKernelTime, LPFILETIME lpUserTime);
|
||||||
export HANDLE GetCurrentProcess();
|
export HANDLE GetCurrentProcess();
|
||||||
export BOOL DuplicateHandle (HANDLE sourceProcess, HANDLE sourceThread,
|
export BOOL DuplicateHandle (HANDLE sourceProcess, HANDLE sourceThread,
|
||||||
HANDLE targetProcessHandle, HANDLE *targetHandle, DWORD access,
|
HANDLE targetProcessHandle, HANDLE *targetHandle, DWORD access,
|
||||||
|
@ -880,6 +881,7 @@ export DWORD GetCurrentThreadId();
|
||||||
export BOOL SetThreadPriority(HANDLE hThread, int nPriority);
|
export BOOL SetThreadPriority(HANDLE hThread, int nPriority);
|
||||||
export BOOL SetThreadPriorityBoost(HANDLE hThread, BOOL bDisablePriorityBoost);
|
export BOOL SetThreadPriorityBoost(HANDLE hThread, BOOL bDisablePriorityBoost);
|
||||||
export BOOL GetThreadPriorityBoost(HANDLE hThread, PBOOL pDisablePriorityBoost);
|
export BOOL GetThreadPriorityBoost(HANDLE hThread, PBOOL pDisablePriorityBoost);
|
||||||
|
export BOOL GetThreadTimes(HANDLE hThread, LPFILETIME lpCreationTime, LPFILETIME lpExitTime, LPFILETIME lpKernelTime, LPFILETIME lpUserTime);
|
||||||
export int GetThreadPriority(HANDLE hThread);
|
export int GetThreadPriority(HANDLE hThread);
|
||||||
export BOOL GetThreadContext(HANDLE hThread, CONTEXT* lpContext);
|
export BOOL GetThreadContext(HANDLE hThread, CONTEXT* lpContext);
|
||||||
export BOOL SetThreadContext(HANDLE hThread, CONTEXT* lpContext);
|
export BOOL SetThreadContext(HANDLE hThread, CONTEXT* lpContext);
|
||||||
|
@ -889,6 +891,9 @@ export DWORD WaitForSingleObject(HANDLE hHandle, DWORD dwMilliseconds);
|
||||||
export DWORD WaitForMultipleObjects(DWORD nCount, HANDLE *lpHandles, BOOL bWaitAll, DWORD dwMilliseconds);
|
export DWORD WaitForMultipleObjects(DWORD nCount, HANDLE *lpHandles, BOOL bWaitAll, DWORD dwMilliseconds);
|
||||||
export void Sleep(DWORD dwMilliseconds);
|
export void Sleep(DWORD dwMilliseconds);
|
||||||
|
|
||||||
|
export BOOL QueryPerformanceCounter(long* lpPerformanceCount);
|
||||||
|
export BOOL QueryPerformanceFrequency(long* lpFrequency);
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
WM_NOTIFY = 0x004E,
|
WM_NOTIFY = 0x004E,
|
||||||
|
|
|
@ -1,4 +1,9 @@
|
||||||
|
|
||||||
|
/* Written by Walter Bright
|
||||||
|
* www.digitalmars.com
|
||||||
|
* Placed into Public Domain
|
||||||
|
*/
|
||||||
|
|
||||||
// Identify the compiler used and its various features.
|
// Identify the compiler used and its various features.
|
||||||
|
|
||||||
module std.compiler;
|
module std.compiler;
|
||||||
|
|
|
@ -25,7 +25,7 @@ struct Date
|
||||||
int ms; // 0..999
|
int ms; // 0..999
|
||||||
int weekday; // 0: not specified
|
int weekday; // 0: not specified
|
||||||
// 1..7: Sunday..Saturday
|
// 1..7: Sunday..Saturday
|
||||||
int tzcorrection = int.min; // -12..12 correction in hours
|
int tzcorrection = int.min; // -1200..1200 correction in hours
|
||||||
|
|
||||||
void parse(char[] s)
|
void parse(char[] s)
|
||||||
{
|
{
|
||||||
|
@ -562,7 +562,10 @@ d_time parse(char[] s)
|
||||||
if (dp.tzcorrection == Date.tzcorrection.init)
|
if (dp.tzcorrection == Date.tzcorrection.init)
|
||||||
time -= LocalTZA;
|
time -= LocalTZA;
|
||||||
else
|
else
|
||||||
time += cast(d_time)dp.tzcorrection * msPerHour;
|
{
|
||||||
|
time += cast(d_time)(dp.tzcorrection / 100) * msPerHour +
|
||||||
|
cast(d_time)(dp.tzcorrection % 100) * msPerMinute;
|
||||||
|
}
|
||||||
day = MakeDay(dp.year, dp.month - 1, dp.day);
|
day = MakeDay(dp.year, dp.month - 1, dp.day);
|
||||||
n = MakeDate(day,time);
|
n = MakeDate(day,time);
|
||||||
n = TimeClip(n);
|
n = TimeClip(n);
|
||||||
|
|
|
@ -1,8 +1,26 @@
|
||||||
|
|
||||||
// Copyright (c) 1999-2002 by Digital Mars
|
/*
|
||||||
// All Rights Reserved
|
* Copyright (C) 1999-2004 by Digital Mars, www.digitalmars.com
|
||||||
// written by Walter Bright
|
* Written by Walter Bright
|
||||||
// www.digitalmars.com
|
*
|
||||||
|
* This software is provided 'as-is', without any express or implied
|
||||||
|
* warranty. In no event will the authors be held liable for any damages
|
||||||
|
* arising from the use of this software.
|
||||||
|
*
|
||||||
|
* Permission is granted to anyone to use this software for any purpose,
|
||||||
|
* including commercial applications, and to alter it and redistribute it
|
||||||
|
* freely, subject to the following restrictions:
|
||||||
|
*
|
||||||
|
* o The origin of this software must not be misrepresented; you must not
|
||||||
|
* claim that you wrote the original software. If you use this software
|
||||||
|
* in a product, an acknowledgment in the product documentation would be
|
||||||
|
* appreciated but is not required.
|
||||||
|
* o Altered source versions must be plainly marked as such, and must not
|
||||||
|
* be misrepresented as being the original software.
|
||||||
|
* o This notice may not be removed or altered from any source
|
||||||
|
* distribution.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
module std.dateparse;
|
module std.dateparse;
|
||||||
|
|
||||||
|
@ -13,7 +31,7 @@ private
|
||||||
import std.date;
|
import std.date;
|
||||||
}
|
}
|
||||||
|
|
||||||
//debug=log;
|
//debug=dateparse;
|
||||||
|
|
||||||
class DateParseError : Error
|
class DateParseError : Error
|
||||||
{
|
{
|
||||||
|
@ -34,7 +52,7 @@ struct DateParse
|
||||||
//else
|
//else
|
||||||
//buffer = new char[s.length];
|
//buffer = new char[s.length];
|
||||||
|
|
||||||
debug(log) printf("DateParse.parse('%.*s')\n", s);
|
debug(dateparse) printf("DateParse.parse('%.*s')\n", s);
|
||||||
if (!parseString(s))
|
if (!parseString(s))
|
||||||
{
|
{
|
||||||
goto Lerror;
|
goto Lerror;
|
||||||
|
@ -45,7 +63,7 @@ struct DateParse
|
||||||
year = 0;
|
year = 0;
|
||||||
else
|
else
|
||||||
+/
|
+/
|
||||||
debug(log)
|
debug(dateparse)
|
||||||
printf("year = %d, month = %d, day = %d\n%02d:%02d:%02d.%03d\nweekday = %d, tzcorrection = %d\n",
|
printf("year = %d, month = %d, day = %d\n%02d:%02d:%02d.%03d\nweekday = %d, tzcorrection = %d\n",
|
||||||
year, month, day,
|
year, month, day,
|
||||||
hours, minutes, seconds, ms,
|
hours, minutes, seconds, ms,
|
||||||
|
@ -59,7 +77,7 @@ struct DateParse
|
||||||
(seconds < 0 || seconds > 59) ||
|
(seconds < 0 || seconds > 59) ||
|
||||||
(tzcorrection != tzcorrection.init &&
|
(tzcorrection != tzcorrection.init &&
|
||||||
((tzcorrection < -1200 || tzcorrection > 1200) ||
|
((tzcorrection < -1200 || tzcorrection > 1200) ||
|
||||||
(tzcorrection % 100)))
|
(tzcorrection % 10)))
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
Lerror:
|
Lerror:
|
||||||
|
@ -80,8 +98,8 @@ struct DateParse
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tzcorrection != tzcorrection.init)
|
// if (tzcorrection != tzcorrection.init)
|
||||||
tzcorrection /= 100;
|
// tzcorrection /= 100;
|
||||||
|
|
||||||
if (year >= 0 && year <= 99)
|
if (year >= 0 && year <= 99)
|
||||||
year += 1900;
|
year += 1900;
|
||||||
|
@ -110,7 +128,7 @@ private:
|
||||||
int ampm; // 0: not specified
|
int ampm; // 0: not specified
|
||||||
// 1: AM
|
// 1: AM
|
||||||
// 2: PM
|
// 2: PM
|
||||||
int tzcorrection = int.min; // -12..12 correction in hours
|
int tzcorrection = int.min; // -1200..1200 correction in hours
|
||||||
|
|
||||||
char[] s;
|
char[] s;
|
||||||
int si;
|
int si;
|
||||||
|
@ -518,7 +536,7 @@ private:
|
||||||
int n3;
|
int n3;
|
||||||
int dp;
|
int dp;
|
||||||
|
|
||||||
debug(log) printf("DateParse.parseCalendarDate(%d)\n", n1);
|
debug(dateparse) printf("DateParse.parseCalendarDate(%d)\n", n1);
|
||||||
dp = nextToken();
|
dp = nextToken();
|
||||||
if (dp == DP.month) // day/month
|
if (dp == DP.month) // day/month
|
||||||
{
|
{
|
||||||
|
@ -670,7 +688,7 @@ unittest
|
||||||
assert(d.second == 0);
|
assert(d.second == 0);
|
||||||
assert(d.ms == 0);
|
assert(d.ms == 0);
|
||||||
assert(d.weekday == 0);
|
assert(d.weekday == 0);
|
||||||
assert(d.tzcorrection == 8);
|
assert(d.tzcorrection == 800);
|
||||||
|
|
||||||
dp.parse("Tue Apr 02 02:04:57 GMT-0800 1996", d);
|
dp.parse("Tue Apr 02 02:04:57 GMT-0800 1996", d);
|
||||||
assert(d.year == 1996);
|
assert(d.year == 1996);
|
||||||
|
@ -681,7 +699,7 @@ unittest
|
||||||
assert(d.second == 57);
|
assert(d.second == 57);
|
||||||
assert(d.ms == 0);
|
assert(d.ms == 0);
|
||||||
assert(d.weekday == 3);
|
assert(d.weekday == 3);
|
||||||
assert(d.tzcorrection == 8);
|
assert(d.tzcorrection == 800);
|
||||||
|
|
||||||
dp.parse("March 14, -1980 21:14:50", d);
|
dp.parse("March 14, -1980 21:14:50", d);
|
||||||
assert(d.year == 1980);
|
assert(d.year == 1980);
|
||||||
|
@ -749,7 +767,18 @@ unittest
|
||||||
assert(d.weekday == 0);
|
assert(d.weekday == 0);
|
||||||
assert(d.tzcorrection == int.min);
|
assert(d.tzcorrection == int.min);
|
||||||
|
|
||||||
debug(log) printf("year = %d, month = %d, day = %d\n%02d:%02d:%02d.%03d\nweekday = %d, tzcorrection = %d\n",
|
dp.parse("Tue, 20 May 2003 15:38:58 +0530", d);
|
||||||
|
assert(d.year == 2003);
|
||||||
|
assert(d.month == 5);
|
||||||
|
assert(d.day == 20);
|
||||||
|
assert(d.hour == 15);
|
||||||
|
assert(d.minute == 38);
|
||||||
|
assert(d.second == 58);
|
||||||
|
assert(d.ms == 0);
|
||||||
|
assert(d.weekday == 3);
|
||||||
|
assert(d.tzcorrection == -530);
|
||||||
|
|
||||||
|
debug(dateparse) printf("year = %d, month = %d, day = %d\n%02d:%02d:%02d.%03d\nweekday = %d, tzcorrection = %d\n",
|
||||||
d.year, d.month, d.day,
|
d.year, d.month, d.day,
|
||||||
d.hour, d.minute, d.second, d.ms,
|
d.hour, d.minute, d.second, d.ms,
|
||||||
d.weekday, d.tzcorrection);
|
d.weekday, d.tzcorrection);
|
||||||
|
|
11
std/format.d
11
std/format.d
|
@ -399,7 +399,7 @@ void doFormat(void delegate(dchar) putc, TypeInfo[] arguments, va_list argptr)
|
||||||
dchar[] sd = va_arg!(dchar[])(argptr);
|
dchar[] sd = va_arg!(dchar[])(argptr);
|
||||||
s = toUTF8(sd);
|
s = toUTF8(sd);
|
||||||
Lputstr:
|
Lputstr:
|
||||||
if (flags & FLprecision && precision > s.length)
|
if (flags & FLprecision && precision < s.length)
|
||||||
s = s[0 .. precision];
|
s = s[0 .. precision];
|
||||||
putstr(s);
|
putstr(s);
|
||||||
break;
|
break;
|
||||||
|
@ -788,5 +788,14 @@ unittest
|
||||||
|
|
||||||
s = std.string.format("%0.0008f", 1e-05);
|
s = std.string.format("%0.0008f", 1e-05);
|
||||||
assert(s == "0.00001000");
|
assert(s == "0.00001000");
|
||||||
|
|
||||||
|
s = "helloworld";
|
||||||
|
char[] r;
|
||||||
|
r = std.string.format("%.2s", s[0..5]);
|
||||||
|
assert(r == "he");
|
||||||
|
r = std.string.format("%.20s", s[0..5]);
|
||||||
|
assert(r == "hello");
|
||||||
|
r = std.string.format("%8s", s[0..5]);
|
||||||
|
assert(r == " hello");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
24
std/loader.d
24
std/loader.d
|
@ -214,7 +214,7 @@ version(Windows)
|
||||||
{
|
{
|
||||||
HXModule hmod = cast(HXModule)LoadLibraryA(toStringz(moduleName));
|
HXModule hmod = cast(HXModule)LoadLibraryA(toStringz(moduleName));
|
||||||
|
|
||||||
if(null === hmod)
|
if(null is hmod)
|
||||||
{
|
{
|
||||||
record_error_();
|
record_error_();
|
||||||
}
|
}
|
||||||
|
@ -255,7 +255,7 @@ version(Windows)
|
||||||
{
|
{
|
||||||
void *symbol = GetProcAddress(cast(HModule_)hModule, toStringz(symbolName));
|
void *symbol = GetProcAddress(cast(HModule_)hModule, toStringz(symbolName));
|
||||||
|
|
||||||
if(null === symbol)
|
if(null is symbol)
|
||||||
{
|
{
|
||||||
record_error_();
|
record_error_();
|
||||||
}
|
}
|
||||||
|
@ -306,7 +306,7 @@ else version(Linux)
|
||||||
private void record_error_()
|
private void record_error_()
|
||||||
{
|
{
|
||||||
char *err = dlerror();
|
char *err = dlerror();
|
||||||
s_lastError = (null === err) ? "" : err[0 .. std.string.strlen(err)];
|
s_lastError = (null is err) ? "" : err[0 .. std.string.strlen(err)];
|
||||||
}
|
}
|
||||||
|
|
||||||
private int ExeModule_Init_()
|
private int ExeModule_Init_()
|
||||||
|
@ -344,7 +344,7 @@ else version(Linux)
|
||||||
{
|
{
|
||||||
HModule_ hmod = dlopen(toStringz(moduleName), RTLD_NOW);
|
HModule_ hmod = dlopen(toStringz(moduleName), RTLD_NOW);
|
||||||
|
|
||||||
if(null === hmod)
|
if(null is hmod)
|
||||||
{
|
{
|
||||||
record_error_();
|
record_error_();
|
||||||
|
|
||||||
|
@ -372,7 +372,7 @@ else version(Linux)
|
||||||
assert(null !== mi.m_hmod);
|
assert(null !== mi.m_hmod);
|
||||||
assert(null !== mi.m_name);
|
assert(null !== mi.m_name);
|
||||||
assert(null !== s_modules[mi.m_name]);
|
assert(null !== s_modules[mi.m_name]);
|
||||||
assert(mi === s_modules[mi.m_name]);
|
assert(mi is s_modules[mi.m_name]);
|
||||||
}
|
}
|
||||||
body
|
body
|
||||||
{
|
{
|
||||||
|
@ -399,7 +399,7 @@ else version(Linux)
|
||||||
assert(null !== mi.m_hmod);
|
assert(null !== mi.m_hmod);
|
||||||
assert(null !== mi.m_name);
|
assert(null !== mi.m_name);
|
||||||
assert(null !== s_modules[mi.m_name]);
|
assert(null !== s_modules[mi.m_name]);
|
||||||
assert(mi === s_modules[mi.m_name]);
|
assert(mi is s_modules[mi.m_name]);
|
||||||
}
|
}
|
||||||
body
|
body
|
||||||
{
|
{
|
||||||
|
@ -431,7 +431,7 @@ else version(Linux)
|
||||||
assert(null !== mi.m_hmod);
|
assert(null !== mi.m_hmod);
|
||||||
assert(null !== mi.m_name);
|
assert(null !== mi.m_name);
|
||||||
assert(null !== s_modules[mi.m_name]);
|
assert(null !== s_modules[mi.m_name]);
|
||||||
assert(mi === s_modules[mi.m_name]);
|
assert(mi is s_modules[mi.m_name]);
|
||||||
}
|
}
|
||||||
body
|
body
|
||||||
{
|
{
|
||||||
|
@ -462,7 +462,7 @@ else version(Linux)
|
||||||
assert(null !== mi.m_hmod);
|
assert(null !== mi.m_hmod);
|
||||||
assert(null !== mi.m_name);
|
assert(null !== mi.m_name);
|
||||||
assert(null !== s_modules[mi.m_name]);
|
assert(null !== s_modules[mi.m_name]);
|
||||||
assert(mi === s_modules[mi.m_name]);
|
assert(mi is s_modules[mi.m_name]);
|
||||||
}
|
}
|
||||||
body
|
body
|
||||||
{
|
{
|
||||||
|
@ -543,13 +543,13 @@ public:
|
||||||
version (Windows)
|
version (Windows)
|
||||||
{
|
{
|
||||||
m_hModule = cast(HXModule)LoadLibraryA(toStringz(moduleName));
|
m_hModule = cast(HXModule)LoadLibraryA(toStringz(moduleName));
|
||||||
if (null === m_hModule)
|
if (null is m_hModule)
|
||||||
throw new ExeModuleException(GetLastError());
|
throw new ExeModuleException(GetLastError());
|
||||||
}
|
}
|
||||||
else version (linux)
|
else version (linux)
|
||||||
{
|
{
|
||||||
m_hModule = ExeModule_Load(moduleName);
|
m_hModule = ExeModule_Load(moduleName);
|
||||||
if (null === m_hModule)
|
if (null is m_hModule)
|
||||||
throw new ExeModuleException(ExeModule_Error());
|
throw new ExeModuleException(ExeModule_Error());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -602,7 +602,7 @@ public:
|
||||||
version (Windows)
|
version (Windows)
|
||||||
{
|
{
|
||||||
void *symbol = GetProcAddress(cast(HModule_)m_hModule, toStringz(symbolName));
|
void *symbol = GetProcAddress(cast(HModule_)m_hModule, toStringz(symbolName));
|
||||||
if(null === symbol)
|
if(null is symbol)
|
||||||
{
|
{
|
||||||
throw new ExeModuleException(GetLastError());
|
throw new ExeModuleException(GetLastError());
|
||||||
}
|
}
|
||||||
|
@ -611,7 +611,7 @@ public:
|
||||||
{
|
{
|
||||||
void *symbol = ExeModule_GetSymbol(m_hModule, symbolName);
|
void *symbol = ExeModule_GetSymbol(m_hModule, symbolName);
|
||||||
|
|
||||||
if(null === symbol)
|
if(null is symbol)
|
||||||
{
|
{
|
||||||
throw new ExeModuleException(ExeModule_Error());
|
throw new ExeModuleException(ExeModule_Error());
|
||||||
}
|
}
|
||||||
|
|
1148
std/perf.d
Normal file
1148
std/perf.d
Normal file
File diff suppressed because it is too large
Load diff
|
@ -1,11 +1,30 @@
|
||||||
|
|
||||||
// Copyright (c) 2003 by Digital Mars
|
/*
|
||||||
// All Rights Reserved
|
* Copyright (C) 2003-2004 by Digital Mars, www.digitalmars.com
|
||||||
// www.digitalmars.com
|
* Written by Matthew Wilson and Walter Bright
|
||||||
|
*
|
||||||
|
* This software is provided 'as-is', without any express or implied
|
||||||
|
* warranty. In no event will the authors be held liable for any damages
|
||||||
|
* arising from the use of this software.
|
||||||
|
*
|
||||||
|
* Permission is granted to anyone to use this software for any purpose,
|
||||||
|
* including commercial applications, and to alter it and redistribute it
|
||||||
|
* freely, subject to the following restrictions:
|
||||||
|
*
|
||||||
|
* o The origin of this software must not be misrepresented; you must not
|
||||||
|
* claim that you wrote the original software. If you use this software
|
||||||
|
* in a product, an acknowledgment in the product documentation would be
|
||||||
|
* appreciated but is not required.
|
||||||
|
* o Altered source versions must be plainly marked as such, and must not
|
||||||
|
* be misrepresented as being the original software.
|
||||||
|
* o This notice may not be removed or altered from any source
|
||||||
|
* distribution.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
module std.process;
|
module std.process;
|
||||||
|
|
||||||
|
private import std.c.stdlib;
|
||||||
private import std.string;
|
private import std.string;
|
||||||
private import std.c.process;
|
private import std.c.process;
|
||||||
|
|
||||||
|
@ -13,3 +32,62 @@ int system(char[] command)
|
||||||
{
|
{
|
||||||
return std.c.process.system(toStringz(command));
|
return std.c.process.system(toStringz(command));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void toAStringz(char[][] a, char**az)
|
||||||
|
{
|
||||||
|
foreach(char[] s; a)
|
||||||
|
{
|
||||||
|
*az++ = toStringz(s);
|
||||||
|
}
|
||||||
|
*az = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
int execv(char[] pathname, char[][] argv)
|
||||||
|
{
|
||||||
|
char** argv_ = cast(char**)alloca((char*).sizeof * (1 + argv.length));
|
||||||
|
|
||||||
|
toAStringz(argv, argv_);
|
||||||
|
return std.c.process.execv(toStringz(pathname), argv_);
|
||||||
|
}
|
||||||
|
|
||||||
|
int execve(char[] pathname, char[][] argv, char[][] envp)
|
||||||
|
{
|
||||||
|
char** argv_ = cast(char**)alloca((char*).sizeof * (1 + argv.length));
|
||||||
|
char** envp_ = cast(char**)alloca((char*).sizeof * (1 + envp.length));
|
||||||
|
|
||||||
|
|
||||||
|
toAStringz(argv, argv_);
|
||||||
|
toAStringz(envp, envp_);
|
||||||
|
return std.c.process.execve(toStringz(pathname), argv_, envp_);
|
||||||
|
}
|
||||||
|
|
||||||
|
int execvp(char[] pathname, char[][] argv)
|
||||||
|
{
|
||||||
|
char** argv_ = cast(char**)alloca((char*).sizeof * (1 + argv.length));
|
||||||
|
toAStringz(argv, argv_);
|
||||||
|
return std.c.process.execvp(toStringz(pathname), argv_);
|
||||||
|
}
|
||||||
|
|
||||||
|
int execvpe(char[] pathname, char[][] argv, char[][] envp)
|
||||||
|
{
|
||||||
|
char** argv_ = cast(char**)alloca((char*).sizeof * (1 + argv.length));
|
||||||
|
char** envp_ = cast(char**)alloca((char*).sizeof * (1 + envp.length));
|
||||||
|
toAStringz(argv, argv_);
|
||||||
|
toAStringz(envp, envp_);
|
||||||
|
return std.c.process.execvpe(toStringz(pathname), argv_, envp_);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ////////////////////////////////////////////////////////////////////////// */
|
||||||
|
|
||||||
|
version(MainTest)
|
||||||
|
{
|
||||||
|
int main(char[][] args)
|
||||||
|
{
|
||||||
|
// int i = execv(args[1], args[2 .. args.length]);
|
||||||
|
int i = execvp(args[1], args[2 .. args.length]);
|
||||||
|
|
||||||
|
printf("exec??() has returned! Error code: %d; errno: %d\n", i, /* errno */0);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -74,6 +74,7 @@ import std.string;
|
||||||
|
|
||||||
version (linux)
|
version (linux)
|
||||||
{
|
{
|
||||||
|
private import std.c.time;
|
||||||
private import std.c.linux.linux;
|
private import std.c.linux.linux;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -227,7 +227,7 @@ void compile(tchar[] pattern, tchar[] attributes)
|
||||||
|
|
||||||
if (re_nsub > oldre_nsub)
|
if (re_nsub > oldre_nsub)
|
||||||
{
|
{
|
||||||
if (pmatch === &gmatch)
|
if (pmatch is &gmatch)
|
||||||
pmatch = null;
|
pmatch = null;
|
||||||
pmatch.length = re_nsub + 1;
|
pmatch.length = re_nsub + 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,9 @@
|
||||||
|
|
||||||
|
/* Written by Walter Bright
|
||||||
|
* www.digitalmars.com
|
||||||
|
* Placed into Public Domain
|
||||||
|
*/
|
||||||
|
|
||||||
module std.stdint;
|
module std.stdint;
|
||||||
|
|
||||||
/* Exact sizes */
|
/* Exact sizes */
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
module std.stdio;
|
module std.stdio;
|
||||||
|
|
||||||
private import std.c.stdio;
|
import std.c.stdio;
|
||||||
private import std.format;
|
private import std.format;
|
||||||
private import std.utf;
|
private import std.utf;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,9 @@
|
||||||
|
|
||||||
|
/* Written by Walter Bright
|
||||||
|
* www.digitalmars.com
|
||||||
|
* Placed into Public Domain
|
||||||
|
*/
|
||||||
|
|
||||||
// Information about the target operating system, environment, and CPU
|
// Information about the target operating system, environment, and CPU
|
||||||
|
|
||||||
module std.system;
|
module std.system;
|
||||||
|
|
33
std/thread.d
33
std/thread.d
|
@ -1,7 +1,24 @@
|
||||||
// Copyright (c) 2002-2003 by Digital Mars
|
/*
|
||||||
// All Rights Reserved
|
* Copyright (C) 2002-2004 by Digital Mars, www.digitalmars.com
|
||||||
// written by Walter Bright
|
* Written by Walter Bright
|
||||||
// www.digitalmars.com
|
*
|
||||||
|
* This software is provided 'as-is', without any express or implied
|
||||||
|
* warranty. In no event will the authors be held liable for any damages
|
||||||
|
* arising from the use of this software.
|
||||||
|
*
|
||||||
|
* Permission is granted to anyone to use this software for any purpose,
|
||||||
|
* including commercial applications, and to alter it and redistribute it
|
||||||
|
* freely, subject to the following restrictions:
|
||||||
|
*
|
||||||
|
* o The origin of this software must not be misrepresented; you must not
|
||||||
|
* claim that you wrote the original software. If you use this software
|
||||||
|
* in a product, an acknowledgment in the product documentation would be
|
||||||
|
* appreciated but is not required.
|
||||||
|
* o Altered source versions must be plainly marked as such, and must not
|
||||||
|
* be misrepresented as being the original software.
|
||||||
|
* o This notice may not be removed or altered from any source
|
||||||
|
* distribution.
|
||||||
|
*/
|
||||||
|
|
||||||
module std.thread;
|
module std.thread;
|
||||||
|
|
||||||
|
@ -97,7 +114,7 @@ class Thread
|
||||||
|
|
||||||
void wait()
|
void wait()
|
||||||
{
|
{
|
||||||
if (this === getThis())
|
if (this is getThis())
|
||||||
error("wait on self");
|
error("wait on self");
|
||||||
if (state == TS.RUNNING)
|
if (state == TS.RUNNING)
|
||||||
{ DWORD dw;
|
{ DWORD dw;
|
||||||
|
@ -108,7 +125,7 @@ class Thread
|
||||||
|
|
||||||
void wait(uint milliseconds)
|
void wait(uint milliseconds)
|
||||||
{
|
{
|
||||||
if (this === getThis())
|
if (this is getThis())
|
||||||
error("wait on self");
|
error("wait on self");
|
||||||
if (state == TS.RUNNING)
|
if (state == TS.RUNNING)
|
||||||
{ DWORD dw;
|
{ DWORD dw;
|
||||||
|
@ -500,7 +517,7 @@ class Thread
|
||||||
|
|
||||||
void wait()
|
void wait()
|
||||||
{
|
{
|
||||||
if (this === getThis())
|
if (this is getThis())
|
||||||
error("wait on self");
|
error("wait on self");
|
||||||
if (state == TS.RUNNING)
|
if (state == TS.RUNNING)
|
||||||
{ int result;
|
{ int result;
|
||||||
|
@ -516,7 +533,7 @@ class Thread
|
||||||
{
|
{
|
||||||
wait();
|
wait();
|
||||||
/+ not implemented
|
/+ not implemented
|
||||||
if (this === getThis())
|
if (this is getThis())
|
||||||
error("wait on self");
|
error("wait on self");
|
||||||
if (state == TS.RUNNING)
|
if (state == TS.RUNNING)
|
||||||
{ DWORD dw;
|
{ DWORD dw;
|
||||||
|
|
|
@ -29,8 +29,8 @@ class TypeInfo_AC : TypeInfo
|
||||||
Object o2 = s2[u];
|
Object o2 = s2[u];
|
||||||
|
|
||||||
// Do not pass null's to Object.opEquals()
|
// Do not pass null's to Object.opEquals()
|
||||||
if (o1 === o2 ||
|
if (o1 is o2 ||
|
||||||
(o1 !== null && o2 !== null && o1.opEquals(o2)))
|
(!(o1 is null) && !(o2 is null) && o1.opEquals(o2)))
|
||||||
continue;
|
continue;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,7 @@ class TypeInfo_AC : TypeInfo
|
||||||
{ Object o1 = s1[u];
|
{ Object o1 = s1[u];
|
||||||
Object o2 = s2[u];
|
Object o2 = s2[u];
|
||||||
|
|
||||||
if (o1 === o2)
|
if (o1 is o2)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Regard null references as always being "less than"
|
// Regard null references as always being "less than"
|
||||||
|
|
21
std/uri.d
21
std/uri.d
|
@ -1,3 +1,24 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2000-2004 by Digital Mars, www.digitalmars.com
|
||||||
|
* Written by Walter Bright
|
||||||
|
*
|
||||||
|
* This software is provided 'as-is', without any express or implied
|
||||||
|
* warranty. In no event will the authors be held liable for any damages
|
||||||
|
* arising from the use of this software.
|
||||||
|
*
|
||||||
|
* Permission is granted to anyone to use this software for any purpose,
|
||||||
|
* including commercial applications, and to alter it and redistribute it
|
||||||
|
* freely, subject to the following restrictions:
|
||||||
|
*
|
||||||
|
* o The origin of this software must not be misrepresented; you must not
|
||||||
|
* claim that you wrote the original software. If you use this software
|
||||||
|
* in a product, an acknowledgment in the product documentation would be
|
||||||
|
* appreciated but is not required.
|
||||||
|
* o Altered source versions must be plainly marked as such, and must not
|
||||||
|
* be misrepresented as being the original software.
|
||||||
|
* o This notice may not be removed or altered from any source
|
||||||
|
* distribution.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
module std.uri;
|
module std.uri;
|
||||||
|
|
33
std/utf.d
33
std/utf.d
|
@ -1,8 +1,26 @@
|
||||||
// utf.d
|
// utf.d
|
||||||
// Written by Walter Bright
|
|
||||||
// Copyright (c) 2003-2004 Digital Mars
|
/*
|
||||||
// All Rights Reserved
|
* Copyright (C) 2003-2004 by Digital Mars, www.digitalmars.com
|
||||||
// www.digitalmars.com
|
* Written by Walter Bright
|
||||||
|
*
|
||||||
|
* This software is provided 'as-is', without any express or implied
|
||||||
|
* warranty. In no event will the authors be held liable for any damages
|
||||||
|
* arising from the use of this software.
|
||||||
|
*
|
||||||
|
* Permission is granted to anyone to use this software for any purpose,
|
||||||
|
* including commercial applications, and to alter it and redistribute it
|
||||||
|
* freely, subject to the following restrictions:
|
||||||
|
*
|
||||||
|
* o The origin of this software must not be misrepresented; you must not
|
||||||
|
* claim that you wrote the original software. If you use this software
|
||||||
|
* in a product, an acknowledgment in the product documentation would be
|
||||||
|
* appreciated but is not required.
|
||||||
|
* o Altered source versions must be plainly marked as such, and must not
|
||||||
|
* be misrepresented as being the original software.
|
||||||
|
* o This notice may not be removed or altered from any source
|
||||||
|
* distribution.
|
||||||
|
*/
|
||||||
|
|
||||||
// Description of UTF-8 at:
|
// Description of UTF-8 at:
|
||||||
// http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
// http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||||
|
@ -25,6 +43,13 @@ class UtfError : Error
|
||||||
|
|
||||||
bit isValidDchar(dchar c)
|
bit isValidDchar(dchar c)
|
||||||
{
|
{
|
||||||
|
/* Note: FFFE and FFFF are specifically permitted by the
|
||||||
|
* Unicode standard for application internal use, but are not
|
||||||
|
* allowed for interchange.
|
||||||
|
* (thanks to Arcane Jill)
|
||||||
|
* However, we still mark them as invalid.
|
||||||
|
*/
|
||||||
|
|
||||||
return c < 0xD800 ||
|
return c < 0xD800 ||
|
||||||
(c > 0xDFFF && c <= 0x10FFFF && c != 0xFFFE && c != 0xFFFF);
|
(c > 0xDFFF && c <= 0x10FFFF && c != 0xFFFE && c != 0xFFFF);
|
||||||
}
|
}
|
||||||
|
|
|
@ -418,7 +418,7 @@ private uint swap(in uint i)
|
||||||
private char[] expand_environment_strings(in char[] value)
|
private char[] expand_environment_strings(in char[] value)
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
assert(null !== value);
|
assert(!(null is value));
|
||||||
}
|
}
|
||||||
body
|
body
|
||||||
{
|
{
|
||||||
|
@ -445,7 +445,7 @@ body
|
||||||
private LONG Reg_CloseKey_(in HKEY hkey)
|
private LONG Reg_CloseKey_(in HKEY hkey)
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
assert(null !== hkey);
|
assert(!(null is hkey));
|
||||||
}
|
}
|
||||||
body
|
body
|
||||||
{
|
{
|
||||||
|
@ -480,7 +480,7 @@ body
|
||||||
private LONG Reg_FlushKey_(in HKEY hkey)
|
private LONG Reg_FlushKey_(in HKEY hkey)
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
assert(null !== hkey);
|
assert(!(null is hkey));
|
||||||
}
|
}
|
||||||
body
|
body
|
||||||
{
|
{
|
||||||
|
@ -493,8 +493,8 @@ private LONG Reg_CreateKeyExA_( in HKEY hkey, in char[] subKey
|
||||||
, out HKEY hkeyResult, out DWORD disposition)
|
, out HKEY hkeyResult, out DWORD disposition)
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
assert(null !== hkey);
|
assert(!(null is hkey));
|
||||||
assert(null !== subKey);
|
assert(!(null is subKey));
|
||||||
}
|
}
|
||||||
body
|
body
|
||||||
{
|
{
|
||||||
|
@ -506,8 +506,8 @@ body
|
||||||
private LONG Reg_DeleteKeyA_(in HKEY hkey, in char[] subKey)
|
private LONG Reg_DeleteKeyA_(in HKEY hkey, in char[] subKey)
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
assert(null !== hkey);
|
assert(!(null is hkey));
|
||||||
assert(null !== subKey);
|
assert(!(null is subKey));
|
||||||
}
|
}
|
||||||
body
|
body
|
||||||
{
|
{
|
||||||
|
@ -517,8 +517,8 @@ body
|
||||||
private LONG Reg_DeleteValueA_(in HKEY hkey, in char[] valueName)
|
private LONG Reg_DeleteValueA_(in HKEY hkey, in char[] valueName)
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
assert(null !== hkey);
|
assert(!(null is hkey));
|
||||||
assert(null !== valueName);
|
assert(!(null is valueName));
|
||||||
}
|
}
|
||||||
body
|
body
|
||||||
{
|
{
|
||||||
|
@ -528,7 +528,7 @@ body
|
||||||
private HKEY Reg_Dup_(HKEY hkey)
|
private HKEY Reg_Dup_(HKEY hkey)
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
assert(null !== hkey);
|
assert(!(null is hkey));
|
||||||
}
|
}
|
||||||
body
|
body
|
||||||
{
|
{
|
||||||
|
@ -573,8 +573,8 @@ private LONG Reg_EnumKeyName_( in HKEY hkey, in DWORD index, inout char [] name
|
||||||
, out DWORD cchName)
|
, out DWORD cchName)
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
assert(null !== hkey);
|
assert(!(null is hkey));
|
||||||
assert(null !== name);
|
assert(!(null is name));
|
||||||
assert(0 < name.length);
|
assert(0 < name.length);
|
||||||
}
|
}
|
||||||
body
|
body
|
||||||
|
@ -609,7 +609,7 @@ private LONG Reg_EnumValueName_(in HKEY hkey, in DWORD dwIndex, in LPSTR lpName
|
||||||
, inout DWORD cchName)
|
, inout DWORD cchName)
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
assert(null !== hkey);
|
assert(!(null is hkey));
|
||||||
}
|
}
|
||||||
body
|
body
|
||||||
{
|
{
|
||||||
|
@ -620,7 +620,7 @@ private LONG Reg_GetNumSubKeys_(in HKEY hkey, out DWORD cSubKeys
|
||||||
, out DWORD cchSubKeyMaxLen)
|
, out DWORD cchSubKeyMaxLen)
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
assert(null !== hkey);
|
assert(!(null is hkey));
|
||||||
}
|
}
|
||||||
body
|
body
|
||||||
{
|
{
|
||||||
|
@ -632,7 +632,7 @@ private LONG Reg_GetNumValues_( in HKEY hkey, out DWORD cValues
|
||||||
, out DWORD cchValueMaxLen)
|
, out DWORD cchValueMaxLen)
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
assert(null !== hkey);
|
assert(!(null is hkey));
|
||||||
}
|
}
|
||||||
body
|
body
|
||||||
{
|
{
|
||||||
|
@ -644,7 +644,7 @@ private LONG Reg_GetValueType_( in HKEY hkey, in char[] name
|
||||||
, out REG_VALUE_TYPE type)
|
, out REG_VALUE_TYPE type)
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
assert(null !== hkey);
|
assert(!(null is hkey));
|
||||||
}
|
}
|
||||||
body
|
body
|
||||||
{
|
{
|
||||||
|
@ -664,8 +664,8 @@ private LONG Reg_OpenKeyExA_( in HKEY hkey, in char[] subKey
|
||||||
, in REGSAM samDesired, out HKEY hkeyResult)
|
, in REGSAM samDesired, out HKEY hkeyResult)
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
assert(null !== hkey);
|
assert(!(null is hkey));
|
||||||
assert(null !== subKey);
|
assert(!(null is subKey));
|
||||||
}
|
}
|
||||||
body
|
body
|
||||||
{
|
{
|
||||||
|
@ -676,7 +676,7 @@ private void Reg_QueryValue_( in HKEY hkey, in char[] name, out char[] value
|
||||||
, out REG_VALUE_TYPE type)
|
, out REG_VALUE_TYPE type)
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
assert(null !== hkey);
|
assert(!(null is hkey));
|
||||||
}
|
}
|
||||||
body
|
body
|
||||||
{
|
{
|
||||||
|
@ -745,7 +745,7 @@ private void Reg_QueryValue_( in HKEY hkey, in char[] name, out char[][] value
|
||||||
, out REG_VALUE_TYPE type)
|
, out REG_VALUE_TYPE type)
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
assert(null !== hkey);
|
assert(!(null is hkey));
|
||||||
}
|
}
|
||||||
body
|
body
|
||||||
{
|
{
|
||||||
|
@ -789,7 +789,7 @@ private void Reg_QueryValue_( in HKEY hkey, in char[] name, out uint value
|
||||||
, out REG_VALUE_TYPE type)
|
, out REG_VALUE_TYPE type)
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
assert(null !== hkey);
|
assert(!(null is hkey));
|
||||||
}
|
}
|
||||||
body
|
body
|
||||||
{
|
{
|
||||||
|
@ -832,7 +832,7 @@ private void Reg_QueryValue_( in HKEY hkey, in char[] name, out ulong value
|
||||||
, out REG_VALUE_TYPE type)
|
, out REG_VALUE_TYPE type)
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
assert(null !== hkey);
|
assert(!(null is hkey));
|
||||||
}
|
}
|
||||||
body
|
body
|
||||||
{
|
{
|
||||||
|
@ -861,7 +861,7 @@ private void Reg_QueryValue_( in HKEY hkey, in char[] name, out byte[] value
|
||||||
, out REG_VALUE_TYPE type)
|
, out REG_VALUE_TYPE type)
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
assert(null !== hkey);
|
assert(!(null is hkey));
|
||||||
}
|
}
|
||||||
body
|
body
|
||||||
{
|
{
|
||||||
|
@ -901,7 +901,7 @@ private void Reg_SetValueExA_( in HKEY hkey, in char[] subKey
|
||||||
, in DWORD cbData)
|
, in DWORD cbData)
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
assert(null !== hkey);
|
assert(!(null is hkey));
|
||||||
}
|
}
|
||||||
body
|
body
|
||||||
{
|
{
|
||||||
|
@ -993,7 +993,7 @@ public class Key
|
||||||
{
|
{
|
||||||
invariant
|
invariant
|
||||||
{
|
{
|
||||||
assert(null !== m_hkey);
|
assert(!(null is m_hkey));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// \name Construction
|
/// \name Construction
|
||||||
|
@ -1002,7 +1002,7 @@ private:
|
||||||
this(HKEY hkey, char[] name, boolean created)
|
this(HKEY hkey, char[] name, boolean created)
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
assert(null !== hkey);
|
assert(!(null is hkey));
|
||||||
}
|
}
|
||||||
body
|
body
|
||||||
{
|
{
|
||||||
|
@ -1102,7 +1102,7 @@ public:
|
||||||
/// \note If the key cannot be created, a RegistryException is thrown.
|
/// \note If the key cannot be created, a RegistryException is thrown.
|
||||||
Key createKey(char[] name, REGSAM access)
|
Key createKey(char[] name, REGSAM access)
|
||||||
{
|
{
|
||||||
if( null === name ||
|
if( null is name ||
|
||||||
0 == name.length)
|
0 == name.length)
|
||||||
{
|
{
|
||||||
throw new RegistryException("Key name is invalid");
|
throw new RegistryException("Key name is invalid");
|
||||||
|
@ -1120,7 +1120,7 @@ public:
|
||||||
throw new RegistryException("Failed to create requested key: \"" ~ name ~ "\"", lRes);
|
throw new RegistryException("Failed to create requested key: \"" ~ name ~ "\"", lRes);
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(null !== hkey);
|
assert(!(null is hkey));
|
||||||
|
|
||||||
// Potential resource leak here!!
|
// Potential resource leak here!!
|
||||||
//
|
//
|
||||||
|
@ -1164,7 +1164,7 @@ public:
|
||||||
/// \note This function never returns null. If a key corresponding to the requested name is not found, a RegistryException is thrown
|
/// \note This function never returns null. If a key corresponding to the requested name is not found, a RegistryException is thrown
|
||||||
Key getKey(char[] name, REGSAM access)
|
Key getKey(char[] name, REGSAM access)
|
||||||
{
|
{
|
||||||
if( null === name ||
|
if( null is name ||
|
||||||
0 == name.length)
|
0 == name.length)
|
||||||
{
|
{
|
||||||
return new Key(Reg_Dup_(m_hkey), m_name, false);
|
return new Key(Reg_Dup_(m_hkey), m_name, false);
|
||||||
|
@ -1179,7 +1179,7 @@ public:
|
||||||
throw new RegistryException("Failed to open requested key: \"" ~ name ~ "\"", lRes);
|
throw new RegistryException("Failed to open requested key: \"" ~ name ~ "\"", lRes);
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(null !== hkey);
|
assert(!(null is hkey));
|
||||||
|
|
||||||
// Potential resource leak here!!
|
// Potential resource leak here!!
|
||||||
//
|
//
|
||||||
|
@ -1220,7 +1220,7 @@ public:
|
||||||
/// \param name The name of the key to delete. May not be null
|
/// \param name The name of the key to delete. May not be null
|
||||||
void deleteKey(char[] name)
|
void deleteKey(char[] name)
|
||||||
{
|
{
|
||||||
if( null === name ||
|
if( null is name ||
|
||||||
0 == name.length)
|
0 == name.length)
|
||||||
{
|
{
|
||||||
throw new RegistryException("Key name is invalid");
|
throw new RegistryException("Key name is invalid");
|
||||||
|
@ -1408,14 +1408,14 @@ public class Value
|
||||||
{
|
{
|
||||||
invariant
|
invariant
|
||||||
{
|
{
|
||||||
assert(null !== m_key);
|
assert(!(null is m_key));
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
this(Key key, char[] name, REG_VALUE_TYPE type)
|
this(Key key, char[] name, REG_VALUE_TYPE type)
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
assert(key !== null);
|
assert(!(key is null));
|
||||||
}
|
}
|
||||||
body
|
body
|
||||||
{
|
{
|
||||||
|
@ -1675,7 +1675,7 @@ public class KeyNameSequence
|
||||||
{
|
{
|
||||||
invariant
|
invariant
|
||||||
{
|
{
|
||||||
assert(null !== m_key);
|
assert(!(null is m_key));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Construction
|
/// Construction
|
||||||
|
@ -1808,7 +1808,7 @@ public class KeySequence
|
||||||
{
|
{
|
||||||
invariant
|
invariant
|
||||||
{
|
{
|
||||||
assert(null !== m_key);
|
assert(!(null is m_key));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Construction
|
/// Construction
|
||||||
|
@ -1954,7 +1954,7 @@ public class ValueNameSequence
|
||||||
{
|
{
|
||||||
invariant
|
invariant
|
||||||
{
|
{
|
||||||
assert(null !== m_key);
|
assert(!(null is m_key));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Construction
|
/// Construction
|
||||||
|
@ -2081,7 +2081,7 @@ public class ValueSequence
|
||||||
{
|
{
|
||||||
invariant
|
invariant
|
||||||
{
|
{
|
||||||
assert(null !== m_key);
|
assert(!(null is m_key));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Construction
|
/// Construction
|
||||||
|
|
10
win32.mak
10
win32.mak
|
@ -19,8 +19,8 @@ DFLAGS=-O -release
|
||||||
#DFLAGS=-unittest -g
|
#DFLAGS=-unittest -g
|
||||||
|
|
||||||
CC=sc
|
CC=sc
|
||||||
#DMD=\dmd\bin\dmd
|
DMD=\dmd\bin\dmd
|
||||||
DMD=..\dmd
|
#DMD=..\dmd
|
||||||
|
|
||||||
.c.obj:
|
.c.obj:
|
||||||
$(CC) -c $(CFLAGS) $*
|
$(CC) -c $(CFLAGS) $*
|
||||||
|
@ -62,6 +62,7 @@ OBJS= asserterror.obj deh.obj switch.obj complex.obj gcstats.obj \
|
||||||
iunknown.obj crc32.obj conv.obj arraycast.obj utf.obj uri.obj \
|
iunknown.obj crc32.obj conv.obj arraycast.obj utf.obj uri.obj \
|
||||||
Czlib.obj Dzlib.obj zip.obj process.obj registry.obj recls.obj \
|
Czlib.obj Dzlib.obj zip.obj process.obj registry.obj recls.obj \
|
||||||
socket.obj socketstream.obj loader.obj stdarg.obj format.obj stdio.obj \
|
socket.obj socketstream.obj loader.obj stdarg.obj format.obj stdio.obj \
|
||||||
|
perf.obj \
|
||||||
ti_Aa.obj ti_Ag.obj ti_C.obj ti_int.obj ti_char.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_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 \
|
ti_byte.obj ti_ubyte.obj ti_long.obj ti_ulong.obj ti_ptr.obj \
|
||||||
|
@ -84,7 +85,7 @@ SRC_STD= std\zlib.d std\zip.d std\stdint.d std\conv.d std\utf.d std\uri.d \
|
||||||
std\intrinsic.d std\array.d std\switcherr.d std\syserror.d \
|
std\intrinsic.d std\array.d std\switcherr.d std\syserror.d \
|
||||||
std\regexp.d std\random.d std\stream.d std\process.d std\recls.d \
|
std\regexp.d std\random.d std\stream.d std\process.d std\recls.d \
|
||||||
std\socket.d std\socketstream.d std\loader.d std\stdarg.d std\format.d \
|
std\socket.d std\socketstream.d std\loader.d std\stdarg.d std\format.d \
|
||||||
std\stdio.d
|
std\stdio.d std\perf.d
|
||||||
|
|
||||||
SRC_STD_C= std\c\process.d std\c\stdlib.d std\c\time.d std\c\stdio.d \
|
SRC_STD_C= std\c\process.d std\c\stdlib.d std\c\time.d std\c\stdio.d \
|
||||||
std\c\math.d std\c\stdarg.d
|
std\c\math.d std\c\stdarg.d
|
||||||
|
@ -369,6 +370,9 @@ outofmemory.obj : std\outofmemory.d
|
||||||
path.obj : std\path.d
|
path.obj : std\path.d
|
||||||
$(DMD) -c $(DFLAGS) std\path.d
|
$(DMD) -c $(DFLAGS) std\path.d
|
||||||
|
|
||||||
|
perf.obj : std\perf.d
|
||||||
|
$(DMD) -c $(DFLAGS) std\perf.d
|
||||||
|
|
||||||
process.obj : std\process.d
|
process.obj : std\process.d
|
||||||
$(DMD) -c $(DFLAGS) std\process.d
|
$(DMD) -c $(DFLAGS) std\process.d
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue