Some ddepcheck improvements
Lars Ivar Igesund <[email protected]> Sun, 18 Apr 2004 09:40:42 +0100
| Newsgroups | gmane.comp.tools.aap.devel |
|---|---|
| Message-ID | <[email protected]> |
Here's a patch for ddepcheck. It should make it more 'robust' to additions in the standard library as long as no conventions are broken. Lars Ivar Igesund
ddepcheck.diff
(text/plain, 3.1 KB)
Index: ddepcheck.d
===================================================================
RCS file: /cvsroot/a-a-p/Exec/tools/ddepcheck.d,v
retrieving revision 1.4
diff -u -r1.4 ddepcheck.d
--- ddepcheck.d 28 Dec 2003 10:36:41 -0000 1.4
+++ ddepcheck.d 18 Apr 2004 07:31:21 -0000
@@ -1,10 +1,10 @@
/*
* ddepcheck.d
- * Version 0.9.4
- * Last modified 28th of November 2003
+ * Version 0.9.6
+ * Last modified 18th of April 2004
*
* Dependency walker for D source files.
- * Copyright 2003 Lars Ivar Igesund <larsivar'at'igesund.net>
+ * Copyright 2003-2004 Lars Ivar Igesund <larsivar'at'igesund.net>
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
@@ -20,6 +20,10 @@
import std.string;
import std.c.stdio;
+version (Win32) {
+import std.c.windows.windows;
+}
+
bool helpcalled = false;
bool versioncalled = false;
bool write = false;
@@ -40,35 +44,6 @@
char [][] depdepths;
char [][] paths;
char [][] argslist;
-/* Update the phobos array when necessary */
-const char [][] phobos = [
- "std.compiler",
- "std.conv",
- "std.ctype",
- "std.date",
- "std.file",
- "std.gc",
- "std.math",
- "object",
- "std.outbuffer",
- "std.path",
- "std.process",
- "std.random",
- "std.regexp",
- "std.stdint",
- "std.stream",
- "std.string",
- "std.system",
- "std.thread",
- "std.uri",
- "std.utf",
- "std.zip",
- "std.zlib",
- "std.c.stdio",
- "std.intrinsic",
- "std.c.windows.windows",
- "std.c.linux",
- "D.win32.registry" ];
/*
* Function called when the "help" option is specified.
@@ -88,9 +63,9 @@
" syntax. \"objectfile : src deps\"\n" ~
" -V/--version Prints the version.\n" ~
" -w/--writetofile Prints the dependencies to the file\n" ~
- " 'depfile' instead of to the console." ~
- " -l/--checkruntimelib Tries to add runtimelib dependencies." ~
- " Note that the path must be added " ~
+ " 'depfile' instead of to the console.\n" ~
+ " -l/--checkruntimelib Tries to add runtimelib dependencies.\n" ~
+ " Note that the path must be added \n" ~
" explicitly."));
}
helpcalled = true;
@@ -378,12 +353,9 @@
bool checkPhobos(char [] mod)
{
- for (int i = 0; i < phobos.length; i++) {
- if (cmp(mod, phobos[i]) == 0) {
- return true;
- }
- }
- return false;
+ if (cmp(mod, "Object") == 0) return true;
+ else if (cmp(mod[0..4], "std.") == 0) return true;
+ else return false;
}
/*
@@ -425,6 +397,11 @@
bool fileExist(char [] file)
{
+version (Win32) {
+ return (GetFileAttributesA(toStringz(file)) != 0xFFFFFFFF);
+}
+version (Linux) {
+ // FIXME: I guess there is a better way to do this. larsivi 18042004
bool result = true;
try {
read(file);
@@ -434,6 +411,7 @@
}
return result;
}
+}
/*
* Strip of the comments.