From e0fa57d8b60f0f179c2bd6c4b3dbfddfc92eecbe Mon Sep 17 00:00:00 2001 From: Basile Burg Date: Tue, 23 Aug 2016 07:18:53 +0200 Subject: [PATCH] fix #90, dastworx issue under win32 + rework dastworx main() --- dastworx/src/main.d | 26 +++++++++++++++++--------- src/ce_dastworx.pas | 4 ---- src/ce_libman.pas | 2 +- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/dastworx/src/main.d b/dastworx/src/main.d index ea621008..73838990 100644 --- a/dastworx/src/main.d +++ b/dastworx/src/main.d @@ -35,6 +35,8 @@ void main(string[] args) version(devel) { mixin(logCall); + config = LexerConfig("", StringBehavior.source, WhitespaceBehavior.skip); + cache = construct!(StringCache)(StringCache.defaultBucketCount); File f = File(__FILE__, "r"); foreach(ref buffer; f.byChunk(4096)) source.put(buffer); @@ -42,23 +44,29 @@ void main(string[] args) } else { + // get the source to process. + // even when files are passed, the std input has to be closed by the IDE foreach(ref buffer; stdin.byChunk(4096)) source.put(buffer); + if (!source.data.length) + { + files = args[1].splitter(pathSeparator).array; + version(devel) writeln(files); + } + // when files are passed, the global cache & config cant be used + else + { + config = LexerConfig("", StringBehavior.source, WhitespaceBehavior.skip); + cache = construct!(StringCache)(StringCache.defaultBucketCount); + } } - if (args.length > 2) - { - files = args[1].splitter(pathSeparator).array; - version(devel) writeln(files); - } - - config = LexerConfig("", StringBehavior.source, WhitespaceBehavior.skip); - cache = construct!(StringCache)(StringCache.defaultBucketCount); - + // options for the worxs getopt(args, std.getopt.config.passThrough, "d", &deepSymList ); + // launch a worx directly getopt(args, std.getopt.config.passThrough, "i", &handleImportsOption, "m", &handleMainfunOption, diff --git a/src/ce_dastworx.pas b/src/ce_dastworx.pas index 2d138fc9..9bfe76f2 100644 --- a/src/ce_dastworx.pas +++ b/src/ce_dastworx.pas @@ -50,8 +50,6 @@ begin str := source.Text; prc.Input.Write(str[1], str.length); prc.CloseInput; - while prc.Running do - sleep(1); processOutputToStrings(prc, imports); finally prc.free; @@ -75,8 +73,6 @@ begin prc.ShowWindow := swoHIDE; prc.Execute; prc.CloseInput; - while prc.Running do - sleep(1); processOutputToStrings(prc, results); finally prc.free; diff --git a/src/ce_libman.pas b/src/ce_libman.pas index a53e794f..941cc226 100644 --- a/src/ce_libman.pas +++ b/src/ce_libman.pas @@ -6,7 +6,7 @@ interface uses Classes, SysUtils, FileUtil, ce_common, ce_writableComponent, LazFileUtils, - ghashmap, ghashset, process, + ghashmap, ghashset, ce_dcd, ce_dialogs, ce_projutils, ce_interfaces, ce_dlang, ce_dastworx; type