From 8cc0f2546d01a4cf442eca05f93c5a580c66271e Mon Sep 17 00:00:00 2001 From: Hackerpilot Date: Sun, 1 Sep 2013 02:23:01 -0700 Subject: [PATCH 1/5] Issue #8 Fixed configuration file parsing: byLine requires that the file be opened in text mode to properly handle CRLF line endings. Added build batch file. --- build.bat | 2 ++ server.d | 25 +++++++++++++------------ 2 files changed, 15 insertions(+), 12 deletions(-) create mode 100644 build.bat diff --git a/build.bat b/build.bat new file mode 100644 index 0000000..e47abc3 --- /dev/null +++ b/build.bat @@ -0,0 +1,2 @@ +dmd -wi client.d messages.d msgpack-d/src/msgpack.d -Imsgpack-d/src -ofdcd-client -L/exet:nt/su:windows:4.0 +dmd -wi -g server.d modulecache.d actypes.d messages.d constants.d acvisitor.d autocomplete.d dscanner/stdx/d/ast.d dscanner/stdx/d/parser.d dscanner/stdx/d/lexer.d dscanner/stdx/d/entities.d msgpack-d/src/msgpack.d -Imsgpack-d/src -Idscanner/ -ofdcd-server diff --git a/server.d b/server.d index 33e7800..5b746cf 100644 --- a/server.d +++ b/server.d @@ -143,19 +143,20 @@ int main(string[] args) string[] loadConfiguredImportDirs() { - version(Windows) - { - string fullPath = buildPath(getcwd(), CONFIG_FILE_PATH); - } - else version(Posix) - { - string fullPath = expandTilde(CONFIG_FILE_PATH); - } + version(Windows) + { + string fullPath = buildPath(getcwd(), CONFIG_FILE_PATH); + } + else version(Posix) + { + string fullPath = expandTilde(CONFIG_FILE_PATH); + } - if (!exists(fullPath)) - return []; - File f = File(fullPath); - return f.byLine(KeepTerminator.no).map!(a => a.idup).filter!(a => a.exists()).array(); + if (!exists(fullPath)) + return []; + + File f = File(fullPath, "rt"); + return f.byLine(KeepTerminator.no).map!(a => a.idup).filter!(a => a.exists()).array(); } void printHelp(string programName) From 61ec0818050ec25ab151810eae7efa3a932bac34 Mon Sep 17 00:00:00 2001 From: Hackerpilot Date: Sun, 1 Sep 2013 03:01:46 -0700 Subject: [PATCH 2/5] Issue #8: Must use binary popen to avoid CRLF screwing everything up. --- editors/textadept/modules/dmd/dcd.lua | 2 +- server.d | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/editors/textadept/modules/dmd/dcd.lua b/editors/textadept/modules/dmd/dcd.lua index 3247bf2..3ed6f29 100644 --- a/editors/textadept/modules/dmd/dcd.lua +++ b/editors/textadept/modules/dmd/dcd.lua @@ -111,7 +111,7 @@ function M.autocomplete(ch) if buffer:get_lexer() ~= "dmd" then return end local fileName = os.tmpname() local command = M.PATH_TO_DCD_CLIENT .. " -c" .. buffer.current_pos .. " > " .. fileName - local p = io.popen(command, "w") + local p = io.popen(command, "wb") p:write(buffer:get_text()) p:flush() p:close() diff --git a/server.d b/server.d index 5b746cf..3bdbc01 100644 --- a/server.d +++ b/server.d @@ -34,11 +34,11 @@ import modulecache; version(Posix) { - enum CONFIG_FILE_PATH = "~/.config/dcd"; + enum CONFIG_FILE_PATH = "~/.config/dcd"; } else version(Windows) { - enum CONFIG_FILE_PATH = "dcd.conf"; + enum CONFIG_FILE_PATH = "dcd.conf"; } int main(string[] args) From 154aa9a72d6189227f9f2e922896dce933b6d5e4 Mon Sep 17 00:00:00 2001 From: Hackerpilot Date: Sun, 1 Sep 2013 03:25:14 -0700 Subject: [PATCH 3/5] Fixed issue with missing argument to writefln --- client.d | 43 ++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 40 insertions(+), 3 deletions(-) diff --git a/client.d b/client.d index 0920ed4..fe6cd1f 100644 --- a/client.d +++ b/client.d @@ -27,11 +27,48 @@ import std.algorithm; import std.path; import std.file; import std.conv; - +//version(Windows) +//{ +// import core.runtime; +// import core.sys.windows.windows; +// import std.string; +//} import msgpack; import messages; -int main(string[] args) +//version(Windows) +//{ +// extern(Windows) int WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) +// { +// int result; +// void exceptionHandler(Throwable e) { +// throw e; +// } +// try +// { +// Runtime. +// Runtime.initialize(&exceptionHandler); +// result = _main(["dcd-client"] ~ to!string(lpCmdLine).split(" ").array()); +// Runtime.terminate(&exceptionHandler); +// } +// catch (Throwable e) // catch any uncaught exceptions +// { +// MessageBoxA(null, e.toString().toStringz(), "Error", +// MB_OK | MB_ICONEXCLAMATION); +// result = 0; // failed +// } +// return result; +// } +//} +//else +//{ +// int main(string[] args) +// { +// return _main(args); +// } +//} + +int /*_*/main(string[] args) { size_t cursorPos = size_t.max; string[] importPaths; @@ -104,7 +141,7 @@ int main(string[] args) string fileName = usingStdin ? "stdin" : args[1]; if (!usingStdin && !exists(args[1])) { - stderr.writefln("%s does not exist"); + stderr.writefln("%s does not exist", args[1]); return 1; } File f = usingStdin ? stdin : File(args[1]); From 005d761f74a4a436cfc337c6f8cb4fa8fe96f9d5 Mon Sep 17 00:00:00 2001 From: Hackerpilot Date: Sun, 1 Sep 2013 03:36:45 -0700 Subject: [PATCH 4/5] Update README.md --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index 56b09c4..9ca7aa6 100644 --- a/README.md +++ b/README.md @@ -20,10 +20,8 @@ back to the client. * *import* statement completions * Not working: * Automatic starting of the server by the client - * Windows support (I don't know that it won't work, but this program is not tested on Windows yet) * UFCS * Autocompletion of declarations with template arguments - * Fields inherited from super classes or implemented interfaces. * *auto* declarations * *alias this* * Determining the type of an enum member when no base type is specified, but the first member has an initialaizer From 2682b7dd3aa99e5cd64f1fee47efffd521560206 Mon Sep 17 00:00:00 2001 From: yazd Date: Sun, 1 Sep 2013 22:09:03 +0300 Subject: [PATCH 5/5] Fix typo (episilon -> epsilon) --- autocomplete.d | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autocomplete.d b/autocomplete.d index 8d88512..82f625e 100644 --- a/autocomplete.d +++ b/autocomplete.d @@ -594,7 +594,7 @@ static this() { s.parts ~= alignof_; s.parts ~= new ACSymbol("dig", CompletionKind.keyword, s); - s.parts ~= new ACSymbol("episilon", CompletionKind.keyword, s); + s.parts ~= new ACSymbol("epsilon", CompletionKind.keyword, s); s.parts ~= new ACSymbol("infinity", CompletionKind.keyword, s); s.parts ~= new ACSymbol("init", CompletionKind.keyword, s); s.parts ~= mangleof_;