www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - my simple but useful changes to Phobos - diff-to-115.patch

Hi, I've been playing around with D a little for a few months now and I've made
IMHO a few small useful changes/additions/fixes to Phobos v0.115.  My diff/patch
is attached.

Bug Fixes:
std/file.d  version(linux):

getAttributes() and isdir() do:
mode & S_IFXXX;
but because S_IFXXX are not necessarily single bits, the right way is:
(mode & S_IFMT) == S_IFXXX;

isdir() throws on broken symbolic links because stat() tries to follow the
symlink.  I've added islink(), which uses lstat(), and use it in isdir() to fix.

std.path.walk(), like Python's os.walk(), for use in foreach loops.  Pretty
useful to me.

std.file.{copytree(),renametree(),removetree()} which use std.path.walk().
(renametree() for moving across different filesystems because rename() can't do
this on Linux (don't know about Windows...)).

std.math.range(), like Python's range(), for use in foreach loops.

version(linux) std.file.getMode alias for getAttributes because the name is more
familiar to me.

lstat(), chmod(), and mode_t added to std/c/linux/linux.d

std.path.join() takes two or more args now (using varargs).

std.syserror.SysError.msg() uses strerror() to get errno message.

internal/dmain2.d prints "ClassName: " of caught Object instead of just "Error:

Object.toString() gives "<instance ClassName at b7da6790>"

version(linux) std.file.listdir() throws if opendir() fails.

std.math publically imports std.math2.

std.math2.min(uint,uint) I added to prevent implicit casting conflict with
min(real,real) for a min(uint,uint) I did.  (max(), etc, should also have
unsigned and signed/unsigned combintions versions as well; having to use casts
doesn't seem visually aesthetic.)

import std.socket in phobos/unittest.d


For some reason I get warnings like this when using my libphobos.a:

gcc -o unittest unittest.o libphobos.a -lpthread -lm -g
Warning: size of symbol `_D3std6stdarg9va_arg_Aa6va_argFKPvZAa' changed from 19
in libphobos.a(path.o) to 34 in libphobos.a(path.o)


Please let me know of bugs/issues/problems.

Mar 02 2005