diff --git a/.gitmodules b/.gitmodules index 16193e23..73521abf 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "vdc/abothe/Parser"] path = vdc/abothe/Parser - url = https://github.com/aBothe/D_Parser.git + url = https://github.com/rainers/D_Parser.git diff --git a/CHANGES b/CHANGES index 1d744644..77b13658 100644 --- a/CHANGES +++ b/CHANGES @@ -816,7 +816,22 @@ unreleased Version 0.3.44 * when linking with MS linker, options for the map file broke the command line * bugzilla 16063: missing option -L/DLL when linking a DLL with MS linker * added integration with msbuild and VC++ projects - * added installation of mago expression evalutro to Concord debug engine + * added installation of mago expression evaluator to Concord debug engine * added $(Platform) as a settings macro replacement in addition to $(PlatformName) * changed default output directory to $(PlatformName)/$(ConfigurationName) * added x64 configurations to project templates + * added AppVeyor integration builds + * cv2pdb can now be enabled independent of debug engine + * dustmite: error messages written to stderr not grepped + * added project template to build with DMD, LDC and GDC for x86 and x64 + * VS SDK 2013 now needed to build Visual D + * added automatic brace completion + * added preliminary support for VS 2017 RC + * dparser: semantic analysis no longer times out after 500ms, but cancels previous requests + * dparser: improved performance by adding name lookup cache + * completion box no longer pops up if caret has been moved elsewhere + * menu entries now disabled if they require the focus on a D file, but it is elsewhere + * building a library with LDC now always adds "-oq -od=$(IntDir)" to the command line + * reduced idle processing by only updating the active view + * mago: display const modifier on type, recover string types + * mago concord plugin: enable conditional breakpoints \ No newline at end of file diff --git a/Makefile b/Makefile index eb7cee36..b5786df4 100644 --- a/Makefile +++ b/Makefile @@ -144,7 +144,7 @@ vdserver: devenv /Project "vdserver" /Build "Release|Win32" visuald_vs10.sln dparser: - cd vdc\abothe && $(MSBUILD) vdserver.sln /p:Configuration=Release;Platform=x86 /p:TargetFrameworkVersion=4.0 /p:DefineConstants=NET40 /t:Rebuild + cd vdc\abothe && $(MSBUILD) vdserver.sln /p:Configuration=Release;Platform="Any CPU" /p:TargetFrameworkVersion=4.0 /p:DefineConstants=NET40 /t:Rebuild vdextension: cd vdextensions && $(MSBUILD) vdextensions.csproj /p:Configuration=Release;Platform=x86 /t:Rebuild @@ -157,6 +157,9 @@ dbuild14: cd msbuild\dbuild && devenv /Build "Release-v14|AnyCPU" /Project "dbuild" dbuild.sln # cd msbuild\dbuild && $(MSBUILD) dbuild.sln /p:Configuration=Release;Platform="Any CPU" /t:Rebuild +dbuild15: + cd msbuild\dbuild && devenv /Build "Release-v15|AnyCPU" /Project "dbuild" dbuild.sln + mago: cd ..\..\mago && devenv /Build "Release|Win32" /Project "MagoNatDE" magodbg_2010.sln cd ..\..\mago && devenv /Build "Release|x64" /Project "MagoRemote" magodbg_2010.sln @@ -169,12 +172,14 @@ cv2pdb: dcxxfilt: $(DCXXFILT_EXE) $(DCXXFILT_EXE): tools\dcxxfilt.d - cd tools && set CONFIG=Release && build_dcxxfilt +# no space after Release, it will be part of environment variable + cd tools && set CONFIG=Release&& build_dcxxfilt ################################## # create installer install: all cpp2d_exe idl2d_exe + if not exist ..\downloads\nul md ..\downloads cd nsis && "$(NSIS)\makensis" /V1 visuald.nsi "$(ZIP)" -j ..\downloads\visuald_pdb.zip bin\release\visuald.pdb bin\release\vdserver.pdb @@ -182,6 +187,7 @@ install_vs: prerequisites visuald_vs vdserver cv2pdb dparser vdextension mago dc dbuild12 dbuild14 install_only install_only: + if not exist ..\downloads\nul md ..\downloads cd nsis && "$(NSIS)\makensis" /V1 visuald.nsi ################################## diff --git a/TODO b/TODO index e7bb90d7..8a52d658 100644 --- a/TODO +++ b/TODO @@ -223,4 +223,6 @@ Unsorted - follow theme colors for tool windows - version highlighting in files not in a project -- does not rebuild lib if c-file recompiled \ No newline at end of file +- does not rebuild lib if c-file recompiled + +- cannot remove deleted project from solution diff --git a/VERSION b/VERSION index 67876cab..b7bfd1aa 100644 --- a/VERSION +++ b/VERSION @@ -1,5 +1,5 @@ #define VERSION_MAJOR 0 -#define VERSION_MINOR 3 -#define VERSION_REVISION 44 +#define VERSION_MINOR 44 +#define VERSION_REVISION 0 #define VERSION_BETA -beta -#define VERSION_BUILD 1 +#define VERSION_BUILD 2 diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 00000000..c06e0d81 --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,149 @@ +#---------------------------------# +# general configuration # +#---------------------------------# + +#version: 1.0.{build}-{branch} + +# Do not build on tags (GitHub only) +skip_tags: true + +#---------------------------------# +# environment configuration # +#---------------------------------# + +# Operating system (build VM template) + +environment: + matrix: + - os: Visual Studio 2015 + VS: 14 + - os: Visual Studio 2013 + VS: 12 + +#matrix: +# allow_failures: +# - VS: 14 + +# scripts that are called at very beginning, before repo cloning +init: + - git config --global core.autocrlf input + +# scripts that run after cloning repository +install: + # show environment + - set D_COMPILER=dmd + - set + - cd c:\projects + # Download & extract D compiler + - ps: | + If ($Env:D_COMPILER -eq 'dmd') { + Start-FileDownload 'http://downloads.dlang.org/releases/2.x/2.071.1/dmd.2.071.1.windows.7z' -FileName 'dmd2.7z' + 7z x dmd2.7z > $null + Set-Item -path env:DMD -value c:\projects\dmd2\windows\bin\dmd.exe + c:\projects\dmd2\windows\bin\dmd.exe --version + } Else { + If ($Env:D_COMPILER -eq 'dmd-nightly') { + Start-FileDownload 'http://nightlies.dlang.org/dmd-nightly/dmd.master.windows.7z' -FileName 'dmd2.7z' + 7z x dmd2.7z > $null + Set-Item -path env:DMD -value c:\projects\dmd2\windows\bin\dmd.exe + c:\projects\dmd2\windows\bin\dmd.exe --version + } Else { + # LDC unsupported so far + If ($Env:D_COMPILER -eq 'ldc') { + Start-FileDownload 'http://github.com/ldc-developers/ldc/releases/download/v1.0.0/ldc2-1.0.0-win64-msvc.zip' -FileName 'ldc2.zip' + 7z x ldc2.zip > $null + Set-Item -path env:DMD -value c:\projects\ldc2-1.0.0-win64-msvc\bin\ldmd2.exe + c:\projects\ldc2-1.0.0-win64-msvc\bin\ldc2 --version + } + } + } + # Download & extract coffimplib.exe (no longer available publically as a single download) + - ps: | + Start-FileDownload 'http://ftp.digitalmars.com/Digital_Mars_C++/Patch/cd851.zip' -FileName 'cd851.zip' + 7z x cd851.zip > $null + copy c:\projects\dm\bin\coffimplib.exe c:\projects\dmd2\windows\bin + # Download & install Visual D + - ps: | + Start-FileDownload 'https://github.com/dlang/visuald/releases/download/v0.3.43/VisualD-v0.3.43.exe' -FileName 'VisualD-v0.3.43.exe' + - .\VisualD-v0.3.43.exe /S + # configure DMD path + - reg add "HKLM\SOFTWARE\Microsoft\VisualStudio\12.0\ToolsOptionsPages\Projects\Visual D Settings" /v DMDInstallDir /t REG_SZ /d c:\projects\dmd2 /reg:32 /f + - reg add "HKLM\SOFTWARE\Microsoft\VisualStudio\14.0\ToolsOptionsPages\Projects\Visual D Settings" /v DMDInstallDir /t REG_SZ /d c:\projects\dmd2 /reg:32 /f + # disable link dependencies monitoring, fails on AppVeyor server + - reg add "HKLM\SOFTWARE\Microsoft\VisualStudio\14.0\ToolsOptionsPages\Projects\Visual D Settings" /v optlinkDeps /t REG_DWORD /d 0 /reg:32 /f + # Set environment variables + - set PATH=c:\projects\dm\bin;%PATH% + - call "c:\Program Files (x86)\Microsoft Visual Studio %VS%.0\VC\vcvarsall.bat" x86 + # Print environment info + - set + - msbuild /version + - cl + +#---------------------------------# +# build configuration # +#---------------------------------# + +before_build: + - cd c:\projects + +build_script: + - cd c:\projects + - cd visuald + # ignore failure once, in case it needs reloading the sdk project + - nmake prerequisites || nmake prerequisites + # build Visual D + - nmake visuald_vs + # Fetch submodules + - git submodule update --init --recursive + - cd .. + # Clone mago/cv2pdb (need to be two levels up) + - cd .. + - git clone https://github.com/rainers/mago.git mago + - set VS_SDK_PATH=%VSSDK120Install% + - copy mago\PropSheets\Template_MagoDbg_properties.props mago\PropSheets\MagoDbg_properties.props + - md cv2pdb + - cd cv2pdb + - git clone https://github.com/rainers/cv2pdb.git trunk + - cd .. + # Download & extract binutils + - cd projects + - ps: | + Start-FileDownload 'http://ftp.gnu.org/gnu/binutils/binutils-2.25.tar.gz' -FileName 'binutils-2.25.tar.gz' + 7z x binutils-2.25.tar.gz > $null + 7z x binutils-2.25.tar > $null + - 'if "%VS%"=="12" echo #define snprintf _snprintf >binutils-2.25\config.h' + - 'if "%VS%"=="14" echo // empty >binutils-2.25\config.h' + - set BINUTILS=c:\projects\binutils-2.25 + - set DMDINSTALLDIR=c:\projects\dmd2 + # build installer + - cd visuald + - nmake install_vs + +after_build: + # publish as artifact + - cd c:\projects + - 7z a logs_and_symbols.7z -r visuald\bin\*.pdb visuald\bin\*.html + - for %%I in (downloads\*.exe) do (set BUILD_EXE=%%I && set ARTIFACT=%%~dpnI-%APPVEYOR_BUILD_NUMBER%-vs%VS%.exe) + - copy %BUILD_EXE% %ARTIFACT% + - ps: | + If ($Env:VS -eq '12') { + echo 'Creating artifacts...' + Push-AppveyorArtifact $Env:ARTIFACT + Push-AppveyorArtifact ..\cv2pdb\trunk\bin\Release\cv2pdb.exe + Push-AppveyorArtifact visuald\bin\Release\pipedmd.exe + Push-AppveyorArtifact logs_and_symbols.7z + } + +on_failure: + - cd c:\projects + - 7z a logs.7z -r visuald\bin\*.html + - ps: | + echo 'Publishing log files...' + Push-AppveyorArtifact logs.7z + +#---------------------------------# +# test configuration # +#---------------------------------# + +test_script: + - cd c:\projects diff --git a/build/build.visualdproj b/build/build.visualdproj index ce1db3ab..913f171f 100644 --- a/build/build.visualdproj +++ b/build/build.visualdproj @@ -218,6 +218,6 @@ call $(InputPath) "$(OutDir)\vsi2d.exe" "$(OutDir)\sdk.success&qu - + diff --git a/build/sdk.bat b/build/sdk.bat index 930bc28a..dea716b5 100644 --- a/build/sdk.bat +++ b/build/sdk.bat @@ -19,6 +19,7 @@ if not exist ..\sdk\vsi\nul md ..\sdk\vsi if not exist ..\sdk\win32\nul md ..\sdk\win32 if not exist %DTE_IDL_PATH%\nul md %DTE_IDL_PATH% +if "%WindowsSDKVersion%" == "\" set WindowsSDKVersion=%UCRTVersion% if "%WindowsSDKVersion%" == "" set WindowsSDKVersion=%UCRTVersion% set WINSDKINC= if not "%WindowsSDKVersion%" == "" if exist "%WindowsSdkDir%\include\%WindowsSDKVersion%\um\windows.h" set WINSDKINC=%WindowsSdkDir%\include\%WindowsSDKVersion% diff --git a/build/sdk_libs.bat b/build/sdk_libs.bat index 3c348ec6..a12d7727 100644 --- a/build/sdk_libs.bat +++ b/build/sdk_libs.bat @@ -28,8 +28,8 @@ if "%WINSDKLIB%" == "" if exist "%WindowsSdkDir%\lib\kernel32.lib" set WINSDKLIB if "%WINSDKLIB%" == "" (echo Error: could not detect the Windows SDK library folder && exit /B 1) set COFFIMPLIB=c:\l\dmc\bin\coffimplib.exe -%coffimplib% >nul 2>&1 -if errorlevel 9000 set COFFIMPLIB=coffimplib +if not exist %COFFIMPLIB% set COFFIMPLIB=%DMDInstallDir%\windows\bin\coffimplib.exe +if not exist %COFFIMPLIB% set COFFIMPLIB=coffimplib %coffimplib% >nul 2>&1 if errorlevel 9000 (echo Error: cannot execute %COFFIMPLIB%, please add to PATH && exit /B 1) diff --git a/build_doc.bat b/build_doc.bat new file mode 100644 index 00000000..ef52163e --- /dev/null +++ b/build_doc.bat @@ -0,0 +1,34 @@ +set DMD=c:\s\d\rainers\windows\bin\dmd.exe +rem set WEB=m:\s\d\rainers\web\visuald +set WEB=c:\s\d\visuald\gh-pages\visuald + +set SRC= doc/ReportingBugs.dd +set SRC=%SRC% doc/StartPage.dd +set SRC=%SRC% doc/ReportingBugs.dd +set SRC=%SRC% doc/BuildFromSource.dd +set SRC=%SRC% doc/KnownIssues.dd +set SRC=%SRC% doc/Installation.dd +set SRC=%SRC% doc/BrowseInfo.dd +set SRC=%SRC% doc/Profiling.dd +set SRC=%SRC% doc/Coverage.dd +set SRC=%SRC% doc/CppConversion.dd +set SRC=%SRC% doc/Debugging.dd +set SRC=%SRC% doc/ProjectConfig.dd +set SRC=%SRC% doc/TokenReplace.dd +set SRC=%SRC% doc/Search.dd +set SRC=%SRC% doc/Editor.dd +set SRC=%SRC% doc/ProjectWizard.dd +set SRC=%SRC% doc/GlobalOptions.dd +set SRC=%SRC% doc/Features.dd +set SRC=%SRC% doc/VersionHistory.dd +set SRC=%SRC% doc/News36.dd +set SRC=%SRC% doc/CompileCommands.dd +set SRC=%SRC% doc/DustMite.dd + +set DDOC=doc/macros.ddoc doc/html.ddoc ..\..\rainers\d-programming-language.org\dlang.org.ddoc doc/visuald.ddoc + +if not exist %WEB% md %WEB% +if not exist %WEB%\images md %WEB%\images +cp -u doc/images/* %WEB%\images +%DMD% -Dd%WEB% -o- -w %DDOC% %SRC% + diff --git a/c2d/ast.d b/c2d/ast.d index d7826a73..6731b817 100644 --- a/c2d/ast.d +++ b/c2d/ast.d @@ -1626,7 +1626,7 @@ class Expression : AST case Token.Or: return v1 | v2; case Token.AmpAmpersand: return v1 && v2; case Token.OrOr: return v1 || v2; - case Token.Comma: return v1, v2; + case Token.Comma: return /*v1,*/ v2; case Token.Tilde: case Token.Unordered: case Token.UnordGreater: diff --git a/c2d/c2d.visualdproj b/c2d/c2d.visualdproj index 8a5dbef3..9e7aec8f 100644 --- a/c2d/c2d.visualdproj +++ b/c2d/c2d.visualdproj @@ -117,7 +117,7 @@ 0 0 0 - 0 + 1 0 0 0 @@ -136,7 +136,7 @@ 0 0 0 - 0 + 1 1 0 0 @@ -525,7 +525,7 @@ 0 0 0 - 0 + 1 0 1 0 @@ -544,7 +544,7 @@ 0 0 0 - 0 + 1 1 0 0 @@ -1028,7 +1028,7 @@ 0 0 0 - 0 + 1 0 0 0 @@ -1117,7 +1117,7 @@ 1 1 0 - -m32ms + *.obj @@ -1130,7 +1130,7 @@ 0 0 0 - 0 + 1 0 0 0 @@ -1428,6 +1428,210 @@ *.obj + + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 2 + 0 + 0 + 0 + 0 + 0 + $(CC) -c + 1 + m:\s\d\rainers\windows\bin\dmd_msc.exe + .. + .. + ..\bin\$(ConfigurationName) + $(OutDir) + + + 0 + + + + + 0 + + + 1 + $(IntDir)\$(ProjectName).json + 0 + + 0 + + 0 + 0 + 0 + + + + 0 + + 1 + $(VisualDInstallDir)cv2pdb\cv2pdb.exe + 0 + 0 + 0 + + + + + + + + $(OutDir)\$(ProjectName).lib + 1 + 2 + 0 + + + + *.obj + + + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 2 + 0 + 0 + 0 + 0 + 0 + $(CC) -c + 1 + m:\s\d\rainers\windows\bin\dmd_msc.exe + .. + .. + ..\bin\$(ConfigurationName) + $(OutDir) + + + 0 + + + + + 0 + + + 1 + $(IntDir)\$(ProjectName).json + 0 + + 0 + + 0 + 0 + 0 + + + + 0 + + 1 + $(VisualDInstallDir)cv2pdb\cv2pdb.exe + 0 + 0 + 0 + + + + + + + + $(OutDir)\$(ProjectName).lib + 1 + 2 + 0 + + + + *.obj + diff --git a/c2d/cpp2d.d b/c2d/cpp2d.d index 228aa11b..9b5dcb5d 100644 --- a/c2d/cpp2d.d +++ b/c2d/cpp2d.d @@ -3065,14 +3065,14 @@ unittest unittest { string txt = - "class C {\n" - " FuncDeclaration *overloadResolve(int flags = 0);\n" - "};\n" - "FuncDeclaration *C::overloadResolve(int flags) {}\n"; + "class C {\n" + ~ " FuncDeclaration *overloadResolve(int flags = 0);\n" + ~ "};\n" + ~ "FuncDeclaration *C::overloadResolve(int flags) {}\n"; string exp = - "struct C {\n" - " FuncDeclaration *overloadResolve(int flags = 0) {}\n" - "};\n"; + "struct C {\n" + ~ " FuncDeclaration *overloadResolve(int flags = 0) {}\n" + ~ "};\n"; string res = testDmdGen(txt, 1, 0); assert(res == exp); @@ -3128,25 +3128,25 @@ unittest unittest { string txt = - "class C {\n" - " type_t foo();\n" - "};\n" - "__static_if(1) {\n" - "type_t C::foo() { return 1; }\n" - "} else {\n" - "type_t C::foo() { return 2; }\n" - "}"; + "class C {\n" + ~ " type_t foo();\n" + ~ "};\n" + ~ "__static_if(1) {\n" + ~ "type_t C::foo() { return 1; }\n" + ~ "} else {\n" + ~ "type_t C::foo() { return 2; }\n" + ~ "}"; string exp = - "struct C {\n" - "static if(1) {\n" - " type_t foo() { return 1; }\n" - "} else {\n" - " type_t foo() { return 2; }\n" - "}\n" - "};" -// "\nstatic if(1) {\n" -// "} else {\n" -// "}" + "struct C {\n" + ~ "static if(1) {\n" + ~ " type_t foo() { return 1; }\n" + ~ "} else {\n" + ~ " type_t foo() { return 2; }\n" + ~ "}\n" + ~ "};" +// ~ "\nstatic if(1) {\n" +// ~ "} else {\n" +// ~ "}" ; string res = testDmdGen(txt); @@ -3156,24 +3156,24 @@ unittest unittest { string txt = - "class C {\n" - " type_t foo();\n" - "};\n" - "__static_if(1) {\n" - "type_t C::foo() { return 1; }\n" - "}\n" - "__static_if(2) {\n" - "type_t C::foo() { return 2; }\n" - "}"; + "class C {\n" + ~ " type_t foo();\n" + ~ "};\n" + ~ "__static_if(1) {\n" + ~ "type_t C::foo() { return 1; }\n" + ~ "}\n" + ~ "__static_if(2) {\n" + ~ "type_t C::foo() { return 2; }\n" + ~ "}"; string exp = - "struct C {\n" - "static if(1) {\n" - " type_t foo() { return 1; }\n" - "}\n" - "static if(2) {\n" - " type_t foo() { return 2; }\n" - "}\n" - "};" + "struct C {\n" + ~ "static if(1) {\n" + ~ " type_t foo() { return 1; }\n" + ~ "}\n" + ~ "static if(2) {\n" + ~ " type_t foo() { return 2; }\n" + ~ "}\n" + ~ "};" // "\nstatic if(1) {\n" // "}\n" // "static if(2) {\n" @@ -3187,20 +3187,20 @@ unittest unittest { string txt = - "class C {\n" - " static int x;\n" - " static int *y;\n" - " static int z[NUM];\n" - "};\n" - "int C::x = 3;\n" - "int *C::y;\n" - "int C::z[NUM];\n"; + "class C {\n" + ~ " static int x;\n" + ~ " static int *y;\n" + ~ " static int z[NUM];\n" + ~ "};\n" + ~ "int C::x = 3;\n" + ~ "int *C::y;\n" + ~ "int C::z[NUM];\n"; string exp = - "struct C {\n" - " static int x = 3;\n" - " static int *y;\n" - " static int z[NUM];\n" - "};\n"; + "struct C {\n" + ~ " static int x = 3;\n" + ~ " static int *y;\n" + ~ " static int z[NUM];\n" + ~ "};\n"; string res = testDmdGen(txt, 3); assert(res == exp); @@ -3209,17 +3209,17 @@ unittest unittest { string txt = - "struct A : B\n" - "{\n" - " A() : B(1) { }\n" - " A(int x) : B(x) { }\n" - "};\n"; + "struct A : B\n" + ~ "{\n" + ~ " A() : B(1) { }\n" + ~ " A(int x) : B(x) { }\n" + ~ "};\n"; string exp = - "class A : B\n" - "{\n" - " this() { super(1); }\n" - " this(int x) { super(x); }\n" - "};\n"; + "class A : B\n" + ~ "{\n" + ~ " this() { super(1); }\n" + ~ " this(int x) { super(x); }\n" + ~ "};\n"; string res = testDmdGen(txt, 0); assert(res == exp); @@ -3229,13 +3229,13 @@ unittest unittest { string txt = - "int foo() {\n" - " if(memchr((char *)stringbuffer)) x;\n" - "}"; + "int foo() {\n" + ~ " if(memchr((char *)stringbuffer)) x;\n" + ~ "}"; string exp = - "int foo() {\n" - " if(memchr(cast(char *)stringbuffer)) x;\n" - "}"; + "int foo() {\n" + ~ " if(memchr(cast(char *)stringbuffer)) x;\n" + ~ "}"; string res = testDmdGen(txt, 0); assert(res == exp); @@ -3244,14 +3244,14 @@ unittest unittest { string txt = - "int a;\n" - "\n" - " int x, *y = 0;\n"; + "int a;\n" + ~ "\n" + ~ " int x, *y = 0;\n"; string exp = - "int a;\n" - "\n" - " int x;\n" - " int *y = 0;\n"; + "int a;\n" + ~ "\n" + ~ " int x;\n" + ~ " int *y = 0;\n"; string res = testDmdGen(txt, 0); assert(res == exp); @@ -3260,11 +3260,11 @@ unittest unittest { string txt = - "int a = sizeof(void*);\n" - "int b = sizeof(wchar_t);\n"; + "int a = sizeof(void*);\n" + ~ "int b = sizeof(wchar_t);\n"; string exp = - "int a = (void *).sizeof;\n" - "int b = wchar_t.sizeof;\n"; + "int a = (void *).sizeof;\n" + ~ "int b = wchar_t.sizeof;\n"; string res = testDmdGen(txt, 0); assert(res == exp); @@ -3273,23 +3273,23 @@ unittest unittest { string txt = - "int foo() {\n" - " __asm\n" - " {\n" - " mov eax,ebx ; hi\n" - "; there\n" - " mov ebx,eax ; hi\n" - " }\n" - "}"; + "int foo() {\n" + ~ " __asm\n" + ~ " {\n" + ~ " mov eax,ebx ; hi\n" + ~ "; there\n" + ~ " mov ebx,eax ; hi\n" + ~ " }\n" + ~ "}"; string exp = - "int foo() {\n" - " asm\n" - " {\n" - " mov eax,ebx; //; hi\n" - "//; there\n" - " mov ebx,eax; //; hi\n" - " }\n" - "}"; + "int foo() {\n" + ~ " asm\n" + ~ " {\n" + ~ " mov eax,ebx; //; hi\n" + ~ "//; there\n" + ~ " mov ebx,eax; //; hi\n" + ~ " }\n" + ~ "}"; string res = testDmdGen(txt, 0); assert(res == exp); @@ -3298,15 +3298,15 @@ unittest unittest { string txt = - "class A : B { };\n" - "int foo() {\n" - " A a(3);\n" - "}"; + "class A : B { };\n" + ~ "int foo() {\n" + ~ " A a(3);\n" + ~ "}"; string exp = - "class A : B { };\n" - "int foo() {\n" - " A a = new A(3);\n" - "}"; + "class A : B { };\n" + ~ "int foo() {\n" + ~ " A a = new A(3);\n" + ~ "}"; string res = testDmdGen(txt, 0); assert(res == exp); @@ -3315,26 +3315,26 @@ unittest unittest { string txt = - "class A : B {\n" - " A();\n" - " static A* bar();\n" - " #define ABC 1\n" - " virtual int foo();\n" - " virtual void baz() = 0;\n" - "};\n" - "A::A() { }\n" - "int abc = ABC;\n" - "int A::foo() { return 0; }\n" - "A *A::bar() { halt; }\n"; + "class A : B {\n" + ~ " A();\n" + ~ " static A* bar();\n" + ~ " #define ABC 1\n" + ~ " virtual int foo();\n" + ~ " virtual void baz() = 0;\n" + ~ "};\n" + ~ "A::A() { }\n" + ~ "int abc = ABC;\n" + ~ "int A::foo() { return 0; }\n" + ~ "A *A::bar() { halt; }\n"; string exp = - "class A : B {\n" - " this() { }\n" - " static A bar() { halt; }\n" - " enum ABC = 1;\n" - " int foo() { return 0; }\n" - " abstract void baz();\n" - "};\n" - "int abc = A.ABC;\n"; + "class A : B {\n" + ~ " this() { }\n" + ~ " static A bar() { halt; }\n" + ~ " enum ABC = 1;\n" + ~ " int foo() { return 0; }\n" + ~ " abstract void baz();\n" + ~ "};\n" + ~ "int abc = A.ABC;\n"; string res = testDmdGen(txt, 3); assert(res == exp); @@ -3343,26 +3343,26 @@ unittest unittest { string txt = - "class A : B {\n" - " A();\n" - "};\n" - "A::A() : B(1) {\n" - "#if 1\n" - " x = 0;\n" - "#endif\n" - " y = 1;\n" - "}\n"; + "class A : B {\n" + ~ " A();\n" + ~ "};\n" + ~ "A::A() : B(1) {\n" + ~ "#if 1\n" + ~ " x = 0;\n" + ~ "#endif\n" + ~ " y = 1;\n" + ~ "}\n"; string exp = - "class A : B {\n" - " this() { super(1);\n" - " static if(1) {\n" - //" // #if 1\n" - " x = 0;\n" - //" // #endif\n" - " }\n" - " y = 1;\n" - " }\n" - "};\n"; + "class A : B {\n" + ~ " this() { super(1);\n" + ~ " static if(1) {\n" + // ~ " // #if 1\n" + ~ " x = 0;\n" + // ~ " // #endif\n" + ~ " }\n" + ~ " y = 1;\n" + ~ " }\n" + ~ "};\n"; string res = testDmdGen(txt, 1); assert(res == exp); @@ -3371,25 +3371,25 @@ unittest unittest { string txt = - "int foo() {\n" - "#if DMDV1 /* multi\n" - " * line comment */\n" - " if(1)\n" - " x = 0;\n" - " else\n" - "#endif\n" - " x = 1;\n" - "}\n"; + "int foo() {\n" + ~ "#if DMDV1 /* multi\n" + ~ " * line comment */\n" + ~ " if(1)\n" + ~ " x = 0;\n" + ~ " else\n" + ~ "#endif\n" + ~ " x = 1;\n" + ~ "}\n"; string exp = - "int foo() {\n" - "static if(!DMDV1) goto L_F2; /* multi\n" - " * line comment */\n" - " if(1)\n" - " x = 0;\n" - " else\n" - "L_F2:\n" - " x = 1;\n" - "}\n"; + "int foo() {\n" + ~ "static if(!DMDV1) goto L_F2; /* multi\n" + ~ " * line comment */\n" + ~ " if(1)\n" + ~ " x = 0;\n" + ~ " else\n" + ~ "L_F2:\n" + ~ " x = 1;\n" + ~ "}\n"; string res = testDmdGen(txt, 0); assert(res == exp); @@ -3398,13 +3398,13 @@ unittest unittest { string txt = - "int foo(int *&x) {\n" - " x = 1;\n" - "}\n"; + "int foo(int *&x) {\n" + ~ " x = 1;\n" + ~ "}\n"; string exp = - "int foo(ref int * x) {\n" - " x = 1;\n" - "}\n"; + "int foo(ref int * x) {\n" + ~ " x = 1;\n" + ~ "}\n"; string res = testDmdGen(txt, 0); assert(res == exp); @@ -3413,8 +3413,8 @@ unittest unittest { string txt = - "#define X(op) struct op##Exp : Exp {};\n" - "X(Add)"; + "#define X(op) struct op##Exp : Exp {};\n" + ~ "X(Add)"; string exp = "class AddExp : Exp {};"; @@ -3427,23 +3427,23 @@ unittest unittest { string txt = "\n" - "struct S2 { int y; } s2;\n" - "struct P {\n" - " struct { int x; } s;\n" - " union { int u; };\n" - "};\n" - "typedef struct { int z; } T, *PS;"; + ~ "struct S2 { int y; } s2;\n" + ~ "struct P {\n" + ~ " struct { int x; } s;\n" + ~ " union { int u; };\n" + ~ "};\n" + ~ "typedef struct { int z; } T, *PS;"; string exp = "\n" - "struct S2 { int y; }\n" - "S2 s2;\n" - "struct P {\n" - " struct unnamed_4 { int x; }\n" - " unnamed_4 s;\n" - " union { int u; };\n" - "};\n" - "struct unnamed_7 { int z; }\n" - "alias unnamed_7 T;\n" - "alias unnamed_7 *PS;"; + ~ "struct S2 { int y; }\n" + ~ "S2 s2;\n" + ~ "struct P {\n" + ~ " struct unnamed_4 { int x; }\n" + ~ " unnamed_4 s;\n" + ~ " union { int u; };\n" + ~ "};\n" + ~ "struct unnamed_7 { int z; }\n" + ~ "alias unnamed_7 T;\n" + ~ "alias unnamed_7 *PS;"; string res = testDmdGen(txt, 0); assert(res == exp); @@ -3452,10 +3452,10 @@ unittest unittest { string txt = "\n" - "typedef enum { e1, e2, e3 } ENUM;\n"; + ~ "typedef enum { e1, e2, e3 } ENUM;\n"; string exp = "\n" - "enum unnamed_2 { e1, e2, e3 }\n" - "alias unnamed_2 ENUM;\n"; + ~ "enum unnamed_2 { e1, e2, e3 }\n" + ~ "alias unnamed_2 ENUM;\n"; string res = testDmdGen(txt, 0); assert(res == exp); @@ -3491,17 +3491,17 @@ unittest unittest { string txt = "#if 1\n" - "int x(), y();\n" - "#else\n" - "int a(), b();\n" - "#endif\n"; + ~ "int x(), y();\n" + ~ "#else\n" + ~ "int a(), b();\n" + ~ "#endif\n"; string exp = "static if(1) {\n" - "int x();\n" - "int y();\n" - "} else {\n" - "int a();\n" - "int b();\n" - "}\n"; + ~ "int x();\n" + ~ "int y();\n" + ~ "} else {\n" + ~ "int a();\n" + ~ "int b();\n" + ~ "}\n"; string res = testDmdGen(txt, 0, 2); // x(), y() count as one non-implemented function assert(res == exp); @@ -3510,9 +3510,9 @@ unittest unittest { string txt = "int foo(void);\n" - "int bar(void) { return x; }\n"; + ~ "int bar(void) { return x; }\n"; string exp = "int foo();\n" - "int bar() { return x; }\n"; + ~ "int bar() { return x; }\n"; string res = testDmdGen(txt, 0, 1); assert(res == exp); @@ -3530,13 +3530,13 @@ unittest unittest { string txt = "data arr[] = {\n" - " 0, 1,\n" - " 2, 3,\n" - "};\n"; + ~ " 0, 1,\n" + ~ " 2, 3,\n" + ~ "};\n"; string exp = "data arr[] = [\n" - " { 0, 1, },\n" - " { 2, 3, },\n" - "];\n"; + ~ " { 0, 1, },\n" + ~ " { 2, 3, },\n" + ~ "];\n"; string res = testDmdGen(txt, 0, 0); assert(res == exp); } @@ -3544,13 +3544,13 @@ unittest unittest { string txt = "int arr[][2] = {\n" - " 0, 1,\n" - " 2, 3,\n" - "};\n"; + ~ " 0, 1,\n" + ~ " 2, 3,\n" + ~ "};\n"; string exp = "int arr[][2] = [\n" - " [ 0, 1, ],\n" - " [ 2, 3, ],\n" - "];\n"; + ~ " [ 0, 1, ],\n" + ~ " [ 2, 3, ],\n" + ~ "];\n"; string res = testDmdGen(txt, 0, 0); assert(res == exp); } @@ -3567,11 +3567,11 @@ unittest unittest { string txt = "class Type : Obj {\n" - " Type* tbit() { return 0; }\n" - "};"; + ~ " Type* tbit() { return 0; }\n" + ~ "};"; string exp = "class Type : Obj {\n" - " Type tbit() { return 0; }\n" - "};"; + ~ " Type tbit() { return 0; }\n" + ~ "};"; string res = testDmdGen(txt, 0, 0); assert(res == exp); @@ -3580,13 +3580,13 @@ unittest unittest { string txt = "enum ENUM { kEnum };\n" - "int foo() {\n" - " Ident id = (op == kEnum) ? 0 : 1;\n" - "}"; + ~ "int foo() {\n" + ~ " Ident id = (op == kEnum) ? 0 : 1;\n" + ~ "}"; string exp = "enum ENUM { kEnum };\n" - "int foo() {\n" - " Ident id = (op == ENUM.kEnum) ? 0 : 1;\n" - "}"; + ~ "int foo() {\n" + ~ " Ident id = (op == ENUM.kEnum) ? 0 : 1;\n" + ~ "}"; string res = testDmdGen(txt, 0, 0); assert(res == exp); @@ -3595,19 +3595,19 @@ unittest unittest { string txt = - "int foo() {\n" - " search(0, 1);\n" - " search(loc, 1);\n" - " ad.search(0, 1);\n" - " Expression e = new IdentifierExp(0, id);\n" - "}"; + "int foo() {\n" + ~ " search(0, 1);\n" + ~ " search(loc, 1);\n" + ~ " ad.search(0, 1);\n" + ~ " Expression e = new IdentifierExp(0, id);\n" + ~ "}"; string exp = - "int foo() {\n" - " search(Loc(0), 1);\n" - " search(loc, 1);\n" - " ad.search(Loc(0), 1);\n" - " Expression e = new IdentifierExp(Loc(0), id);\n" - "}"; + "int foo() {\n" + ~ " search(Loc(0), 1);\n" + ~ " search(loc, 1);\n" + ~ " ad.search(Loc(0), 1);\n" + ~ " Expression e = new IdentifierExp(Loc(0), id);\n" + ~ "}"; string res = testDmdGen(txt, 0, 0); assert(res == exp); @@ -3707,17 +3707,17 @@ unittest unittest { string txt = - "#if EXP\n" - "int a;\n" - "#else\n" - "int b;\n" - "#endif\n" + "#if EXP\n" + ~ "int a;\n" + ~ "#else\n" + ~ "int b;\n" + ~ "#endif\n" ; string exp = - "// #if EXP\n" - "int a;\n" - " \n" - "// #endif\n" + "// #if EXP\n" + ~ "int a;\n" + ~ " \n" + ~ "// #endif\n" ; PP.expandConditionals["EXP"] = true; @@ -3725,11 +3725,10 @@ unittest string res = testDmdGen(txt, 0, 0, null); assert(res == exp); - exp = - "// not #if EXP\n" - " \n" - "int b;\n" - "// #endif\n" + exp = "// not #if EXP\n" + ~ " \n" + ~ "int b;\n" + ~ "// #endif\n" ; PP.expandConditionals["EXP"] = false; @@ -3744,16 +3743,16 @@ unittest { // force failure string txt = - "#define A 1\n" - "#define B A\n" - "#define C() B*B\n" - "#define SQR(a) (a)*(a)\n" + "#define A 1\n" + ~ "#define B A\n" + ~ "#define C() B*B\n" + ~ "#define SQR(a) (a)*(a)\n" ; string exp = - "enum A = 1;\n" - "alias B A;\n" - " auto C( )() { return B*B; }\n" - " auto SQR( ARG1 )(ARG1 a) { return a*a; }\n" + "enum A = 1;\n" + ~ "alias B A;\n" + ~ " auto C( )() { return B*B; }\n" + ~ " auto SQR( ARG1 )(ARG1 a) { return a*a; }\n" ; string res = testDmdGen(txt, 0, 0); @@ -3763,12 +3762,12 @@ unittest void cpp2d_test() { string txt = - "#define EXP 1 // EXP1\n" - "#define WSL EXP // comment\n" + "#define EXP 1 // EXP1\n" + ~ "#define WSL EXP // comment\n" ; string exp = - "enum EXP = 1; // EXP1\n" - "alias EXP WSL; // comment\n" + "enum EXP = 1; // EXP1\n" + ~ "alias EXP WSL; // comment\n" ; // PP.expandConditionals["EXP"] = true; diff --git a/c2d/cpp2d.visualdproj b/c2d/cpp2d.visualdproj index 2d426974..ab28eef8 100644 --- a/c2d/cpp2d.visualdproj +++ b/c2d/cpp2d.visualdproj @@ -1028,7 +1028,7 @@ 0 0 0 - 0 + 1 0 0 0 @@ -1117,7 +1117,7 @@ 1 1 0 - -m32ms + *.obj @@ -1130,7 +1130,7 @@ 0 0 0 - 0 + 1 0 0 0 @@ -1428,6 +1428,210 @@ *.obj + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 2 + 0 + 0 + 0 + 0 + 0 + $(CC) -c + 1 + m:\s\d\rainers\windows\bin\dmd_msc.exe + .. + .. + ..\bin\$(ConfigurationName) + $(OutDir) + + + 0 + + + + + 0 + + + 1 + $(IntDir)\$(ProjectName).json + 0 + + 0 + + 0 + 0 + 0 + + + + 0 + + 1 + $(VisualDInstallDir)cv2pdb\cv2pdb.exe + 0 + 0 + 0 + + + + ole32.lib oleaut32.lib + + + + $(OutDir)\$(ProjectName).exe + 1 + 1 + 0 + + + + *.obj + + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 2 + 0 + 0 + 0 + 0 + 0 + $(CC) -c + 1 + m:\s\d\rainers\windows\bin\dmd_msc.exe + .. + .. + ..\bin\$(ConfigurationName) + $(OutDir) + + + 0 + + + + + 0 + + + 1 + $(IntDir)\$(ProjectName).json + 0 + + 0 + + 0 + 0 + 0 + + + + 0 + + 1 + $(VisualDInstallDir)cv2pdb\cv2pdb.exe + 0 + 0 + 0 + + + + ole32.lib oleaut32.lib + + + + $(OutDir)\$(ProjectName).exe + 1 + 1 + 0 + + + + *.obj + diff --git a/c2d/dgutil.d b/c2d/dgutil.d index a7da9f0d..cd6e3528 100644 --- a/c2d/dgutil.d +++ b/c2d/dgutil.d @@ -179,16 +179,18 @@ unittest unittest { - string txt = "\nvoid foo()\n" - "{\n" - " if(1)\n" - "\tx = 0;\n" - "}"; - string exp = "\n void foo()\n" - " {\n" - "\tif(1)\n" - "\t x = 0;\n" - " }"; + string txt = + "\nvoid foo()\n" + ~ "{\n" + ~ " if(1)\n" + ~ "\tx = 0;\n" + ~ "}"; + string exp = + "\n void foo()\n" + ~ " {\n" + ~ "\tif(1)\n" + ~ "\t x = 0;\n" + ~ " }"; string res = reindent(txt, 4, 8); assume(res == exp); diff --git a/c2d/dmd2dport.d b/c2d/dmd2dport.d index 939f338c..4d35983d 100644 --- a/c2d/dmd2dport.d +++ b/c2d/dmd2dport.d @@ -1,6 +1,6 @@ module dmd2dport; -public +public { import std.c.stdio; import std.c.stdlib; @@ -14,7 +14,7 @@ public import std.math; import std.string; import std.md5; - + import core.stdc.errno; import core.bitop; import core.stdc.fenv; @@ -81,12 +81,12 @@ extern (Windows) } ///////////////////////////////////////////// -static Object[] allObjects; - -template toPtr(T) -{ - T* toPtr(T obj) { allObjects ~= obj; return cast(T*) &allObjects[$-1]; } -} +static Object[] allObjects; + +template toPtr(T) +{ + T* toPtr(T obj) { allObjects ~= obj; return cast(T*) &allObjects[$-1]; } +} ///////////////////////////////////////////// void* memset(void* p, int val, int len) @@ -138,11 +138,11 @@ int putenv(char*e) } // posix style write -int write(int fd, const(void)*msg, int len) -{ - char[] s = (cast(char*) msg)[0..len]; - return printf("&s", s); // writef(s); -} +int write(int fd, const(void)*msg, int len) +{ + char[] s = (cast(char*) msg)[0..len]; + return printf("&s", s); // writef(s); +} void local_assert(int line) { @@ -249,15 +249,15 @@ void MD5Init(MD5_CTX* ctx) ctx.start(); } -void MD5Update(MD5_CTX* ctx, ubyte *name, int len) -{ - ctx.update(name[0 .. len]); -} +void MD5Update(MD5_CTX* ctx, ubyte *name, int len) +{ + ctx.update(name[0 .. len]); +} -void MD5Final(MD5_CTX* ctx, ubyte[16] digest) -{ - ctx.finish(digest); -} +void MD5Final(MD5_CTX* ctx, ubyte[16] digest) +{ + ctx.finish(digest); +} ///////////////////////////////////////////// diff --git a/c2d/idl2d.d b/c2d/idl2d.d index c000673d..806adbcc 100644 --- a/c2d/idl2d.d +++ b/c2d/idl2d.d @@ -141,6 +141,10 @@ class idl2d "mprapidef.h", "lmerr.h", "lmcons.h", // Win SDK 10.0 "coml2api.h", "jobapi2.h", "propidlbase.idl", + // Win SDK 10.0.10586.0 + "enclaveapi.h", + // Win SDK 10.0.14393.0 + "dpa_dsa.h", ]) win_idl_files ~= f ~ "*"; // make it optional @@ -1042,7 +1046,8 @@ version(all) string translatePackageName(string fname) { - return fname.replace("\\shared\\", "\\").replace("\\um\\", "\\"); + // "shared", "um" added in SDK 8.0, "um\minwin" in 10.0.10586.0 + return fname.replace("\\shared\\", "\\").replace("\\um\\", "\\").replace("\\minwin\\", "\\"); } string translateFilename(string fname) @@ -1295,7 +1300,7 @@ version(all) if(currentModule == "propidlbase") { replaceTokenSequence(tokens, "_VARIANT_BOOL bool;", "/*_VARIANT_BOOL bool;*/", true); - replaceTokenSequence(tokens, "TYPEDEF_CA($_identType,$_identName);", + replaceTokenSequence(tokens, "TYPEDEF_CA($_identType,$_identName);", "struct $_identName { ULONG cElems; $_identType* pElems; };", true); } if(currentModule == "imageparameters140") @@ -1303,7 +1308,7 @@ version(all) // type name and field name identical replaceTokenSequence(tokens, "ImageMoniker ImageMoniker;", "ImageMoniker mImageMoniker;", true); } - + // select unicode version of the API when defining without postfix A/W replaceTokenSequence(tokens, "#ifdef UNICODE\nreturn $_identW(\n#else\nreturn $_identA(\n#endif\n", " return $_identW(", false); @@ -2239,6 +2244,9 @@ else case "NOT_BUILD_WINDOWS_DEPRECATE": case "DECLSPEC_ALLOCATOR": + // Windows SDK 10.0.14393.0 + case "_Outptr_result_z_": + // VS14 SDK comment after #endif case "PROXYSTUB_BUILD": return "/*" ~ text ~ "*/"; @@ -2295,7 +2303,11 @@ else string pattern = baseName(file); foreach (string name; dirEntries(path, mode)) if (globMatch(baseName(name), pattern)) + { addSource(name); + if (pattern[0] != '*') + break; // don't add optional files twice + } } void addSources(string file) @@ -2369,6 +2381,8 @@ else hdr ~= "import " ~ packageWin ~ "iprtrmib;\n"; else if(currentModule == "vssolutn") hdr ~= "import " ~ packageWin ~ "winnls;\n"; + else if(currentModule == "dpa_dsa") + hdr ~= "import " ~ packageWin ~ "objidlbase;\n"; hdr ~= "\n"; @@ -2467,6 +2481,9 @@ version(remove_pp) {} else "prefix", &keywordPrefix, "verbose", &verbose); + dte_path = replace(dte_path, "/", "\\"); + win_path = replace(win_path, "/", "\\"); + sdk_d_path = replace(sdk_d_path, "/", "\\"); if(!dte_path.empty && !_endsWith(dte_path, "\\")) dte_path ~= "\\"; if(!win_path.empty && !_endsWith(win_path, "\\")) @@ -2560,8 +2577,6 @@ version(remove_pp) {} else string sources = "SRC = \\\n"; foreach(Source src; srcs) { - writeln(src.filename); - string d_file; d_file = replace(src.filename, win_path, win_d_path); d_file = replace(d_file, vsi_path, vsi_d_path); @@ -2575,6 +2590,8 @@ version(remove_pp) {} else d_file = translateFilename(d_file); setCurrentFile(d_file); + writeln(src.filename, " -> ", d_file); + string text = convertText(src.tokens); text = removeDuplicateEmptyLines(text); diff --git a/c2d/pp.d b/c2d/pp.d index f2e7fa78..7e16e36e 100644 --- a/c2d/pp.d +++ b/c2d/pp.d @@ -1496,19 +1496,19 @@ string testPP(string txt) unittest { string txt = - " a = 1;\n" - "#if COND\n" - " b = 2;\n" - "#endif\n" - " c = 3;\n" + " a = 1;\n" + ~ "#if COND\n" + ~ " b = 2;\n" + ~ "#endif\n" + ~ " c = 3;\n" ; string exp = - " a = 1;\n" - "__static_if(COND) {\n" - " b = 2;\n" - "}\n" - " c = 3;\n" + " a = 1;\n" + ~ "__static_if(COND) {\n" + ~ " b = 2;\n" + ~ "}\n" + ~ " c = 3;\n" ; string res = testPP(txt); @@ -1518,17 +1518,17 @@ unittest unittest { string txt = - "#if COND\n" - " if(a)\n" - "#endif\n" - " b = 1;\n" + "#if COND\n" + ~ " if(a)\n" + ~ "#endif\n" + ~ " b = 1;\n" ; string exp = - "__static_if(!COND) goto L_F1;\n" - " if(a)\n" - "L_F1:\n" - " b = 1;\n" + "__static_if(!COND) goto L_F1;\n" + ~ " if(a)\n" + ~ "L_F1:\n" + ~ " b = 1;\n" ; string res = testPP(txt); @@ -1538,22 +1538,22 @@ unittest unittest { string txt = - "#if COND1 // comment\n" - " if (a)\n" - "#elif COND2\n" - " if (b)\n" - "#endif\n" - " c = 1;\n" + "#if COND1 // comment\n" + ~ " if (a)\n" + ~ "#elif COND2\n" + ~ " if (b)\n" + ~ "#endif\n" + ~ " c = 1;\n" ; string exp = - "bool cond_1;\n" - "__static_if(COND1) { // comment\n" - " cond_1 = (a);\n" - "} else __static_if(COND2) {\n" - " cond_1 = (b);\n" - "}\n" - " if (cond_1) c = 1;\n" + "bool cond_1;\n" + ~ "__static_if(COND1) { // comment\n" + ~ " cond_1 = (a);\n" + ~ "} else __static_if(COND2) {\n" + ~ " cond_1 = (b);\n" + ~ "}\n" + ~ " if (cond_1) c = 1;\n" ; string res = testPP(txt); @@ -1563,25 +1563,25 @@ unittest unittest { string txt = - " if (x)\n" - " c = 0;\n" - "#if COND1 // comment\n" - " else if (a)\n" - "#elif COND2\n" - " else if (b)\n" - "#endif\n" - " c = 1;\n" + " if (x)\n" + ~ " c = 0;\n" + ~ "#if COND1 // comment\n" + ~ " else if (a)\n" + ~ "#elif COND2\n" + ~ " else if (b)\n" + ~ "#endif\n" + ~ " c = 1;\n" ; string exp = - " if (x)\n" - " c = 0;\n" - "else if(true) __static_if(COND1) // comment\n" - " /*else*/ if (a)\n" - "goto L_T3; else goto L_F3; else __static_if(COND2)\n" - " /*else*/ if (b)\n" - "goto L_T3; else goto L_F3; else goto L_T3; else L_F3: if(0) L_T3:\n" - " c = 1;\n" + " if (x)\n" + ~ " c = 0;\n" + ~ "else if(true) __static_if(COND1) // comment\n" + ~ " /*else*/ if (a)\n" + ~ "goto L_T3; else goto L_F3; else __static_if(COND2)\n" + ~ " /*else*/ if (b)\n" + ~ "goto L_T3; else goto L_F3; else goto L_T3; else L_F3: if(0) L_T3:\n" + ~ " c = 1;\n" ; string res = testPP(txt); @@ -1591,21 +1591,21 @@ unittest unittest { string txt = - " if (a)\n" - " c = 1;\n" - "#if COND\n" - " else if (b)\n" - " c = 2;\n" - "#endif\n" + " if (a)\n" + ~ " c = 1;\n" + ~ "#if COND\n" + ~ " else if (b)\n" + ~ " c = 2;\n" + ~ "#endif\n" ; string exp = - " if (a)\n" - " c = 1;\n" - "else __static_if(COND) {\n" - " /*else*/ if (b)\n" - " c = 2;\n" - "}\n" + " if (a)\n" + ~ " c = 1;\n" + ~ "else __static_if(COND) {\n" + ~ " /*else*/ if (b)\n" + ~ " c = 2;\n" + ~ "}\n" ; string res = testPP(txt); @@ -1615,27 +1615,27 @@ unittest unittest { string txt = - "#if COND1 // comment\n" - " if (a)\n" - "#elif COND2\n" - " if (b)\n" - " c = 0;\n" - " else\n" - "#endif\n" - " c = 1;\n" + "#if COND1 // comment\n" + ~ " if (a)\n" + ~ "#elif COND2\n" + ~ " if (b)\n" + ~ " c = 0;\n" + ~ " else\n" + ~ "#endif\n" + ~ " c = 1;\n" ; string exp = - "bool cond_1;\n" - "__static_if(COND1) { // comment\n" - " cond_1 = (a);\n" - "} else __static_if(COND2) {\n" - " if (b)\n" - " c = 0;\n" - " else\n" - "cond_1 = true;\n" // todo: fix indentation - "}\n" - " if (cond_1) c = 1;\n" + "bool cond_1;\n" + ~ "__static_if(COND1) { // comment\n" + ~ " cond_1 = (a);\n" + ~ "} else __static_if(COND2) {\n" + ~ " if (b)\n" + ~ " c = 0;\n" + ~ " else\n" + ~ "cond_1 = true;\n" // todo: fix indentation + ~ "}\n" + ~ " if (cond_1) c = 1;\n" ; string res = testPP(txt); @@ -1645,25 +1645,25 @@ unittest unittest { string txt = - " if (a1)\n" - " c = 0;\n" - "#if COND // comment\n" - " else if (a2)\n" - " c = 1;\n" - "#endif\n" - " else if (a3)\n" - " c = 2;\n" + " if (a1)\n" + ~ " c = 0;\n" + ~ "#if COND // comment\n" + ~ " else if (a2)\n" + ~ " c = 1;\n" + ~ "#endif\n" + ~ " else if (a3)\n" + ~ " c = 2;\n" ; string exp = - " if (a1)\n" - " c = 0;\n" - "else __static_if(COND) // comment\n" - " /*else*/ if (a2)\n" - " c = 1;\n" - "else goto L_F3; else goto L_F3; if (true) {} else L_F3:\n" - " /*else*/ if (a3)\n" - " c = 2;\n" + " if (a1)\n" + ~ " c = 0;\n" + ~ "else __static_if(COND) // comment\n" + ~ " /*else*/ if (a2)\n" + ~ " c = 1;\n" + ~ "else goto L_F3; else goto L_F3; if (true) {} else L_F3:\n" + ~ " /*else*/ if (a3)\n" + ~ " c = 2;\n" ; string res = testPP(txt); @@ -1673,37 +1673,37 @@ unittest unittest { string txt = - " if (a1\n" - "#if COND1\n" - " && a2\n" - "#elif COND2\n" - " && b2\n" - "#endif\n" - " && a3)\n" - " c = 2;\n" - "\n" - " if (a1 ||\n" - "#if COND1\n" - " a2 ||\n" - "#elif COND2\n" - " b2 ||\n" - "#endif\n" - " a3)\n" - " c = 2;\n" + " if (a1\n" + ~ "#if COND1\n" + ~ " && a2\n" + ~ "#elif COND2\n" + ~ " && b2\n" + ~ "#endif\n" + ~ " && a3)\n" + ~ " c = 2;\n" + ~ "\n" + ~ " if (a1 ||\n" + ~ "#if COND1\n" + ~ " a2 ||\n" + ~ "#elif COND2\n" + ~ " b2 ||\n" + ~ "#endif\n" + ~ " a3)\n" + ~ " c = 2;\n" ; string exp = - " if (a1\n" - " && __static_eval(COND1, true)(a2)\n" - " && __static_eval(!(COND1) && COND2, true)(b2)\n" - " && a3)\n" - " c = 2;\n" - "\n" - " if (a1 ||\n" - " __static_eval(COND1, false)(a2) ||\n" - " __static_eval(!(COND1) && COND2, false)(b2) ||\n" - " a3)\n" - " c = 2;\n" + " if (a1\n" + ~ " && __static_eval(COND1, true)(a2)\n" + ~ " && __static_eval(!(COND1) && COND2, true)(b2)\n" + ~ " && a3)\n" + ~ " c = 2;\n" + ~ "\n" + ~ " if (a1 ||\n" + ~ " __static_eval(COND1, false)(a2) ||\n" + ~ " __static_eval(!(COND1) && COND2, false)(b2) ||\n" + ~ " a3)\n" + ~ " c = 2;\n" ; string res = testPP(txt); @@ -1713,37 +1713,37 @@ unittest unittest { string txt = - " if (a1 &&\n" - "#if COND1\n" - " a2\n" - "#elif COND2\n" - " b2\n" - "#endif\n" - " )\n" - " c = 2;\n" - "\n" - " if (a1 ||\n" - "#if COND1\n" - " a2\n" - "#elif COND2\n" - " b2\n" - "#endif\n" - " || a3)\n" - " c = 2;\n" + " if (a1 &&\n" + ~ "#if COND1\n" + ~ " a2\n" + ~ "#elif COND2\n" + ~ " b2\n" + ~ "#endif\n" + ~ " )\n" + ~ " c = 2;\n" + ~ "\n" + ~ " if (a1 ||\n" + ~ "#if COND1\n" + ~ " a2\n" + ~ "#elif COND2\n" + ~ " b2\n" + ~ "#endif\n" + ~ " || a3)\n" + ~ " c = 2;\n" ; string exp = - " if (a1 &&\n" - " __static_eval(COND1, true)(a2)\n" - " && __static_eval(!(COND1) && COND2, true)(b2)\n" - " )\n" - " c = 2;\n" - "\n" - " if (a1 ||\n" - " __static_eval(COND1, false)(a2)\n" - " || __static_eval(!(COND1) && COND2, false)(b2)\n" - " || a3)\n" - " c = 2;\n" + " if (a1 &&\n" + ~ " __static_eval(COND1, true)(a2)\n" + ~ " && __static_eval(!(COND1) && COND2, true)(b2)\n" + ~ " )\n" + ~ " c = 2;\n" + ~ "\n" + ~ " if (a1 ||\n" + ~ " __static_eval(COND1, false)(a2)\n" + ~ " || __static_eval(!(COND1) && COND2, false)(b2)\n" + ~ " || a3)\n" + ~ " c = 2;\n" ; string res = testPP(txt); @@ -1753,10 +1753,10 @@ unittest unittest { string txt = - "#ifndef HDR_H\n" - "#define HDR_H\n" - " a = 0;\n" - "#endif\n" + "#ifndef HDR_H\n" + ~ "#define HDR_H\n" + ~ " a = 0;\n" + ~ "#endif\n" ; string exp = @@ -1770,17 +1770,17 @@ unittest unittest { string txt = - " a = 0;\n" - "#ifdef __DMC__\n" - "#pragma once\n" - "#endif\n" - " b = 0;\n" + " a = 0;\n" + ~ "#ifdef __DMC__\n" + ~ "#pragma once\n" + ~ "#endif\n" + ~ " b = 0;\n" ; string exp = - " a = 0;\n" - "\n" - " b = 0;\n" + " a = 0;\n" + ~ "\n" + ~ " b = 0;\n" ; string res = testPP(txt); diff --git a/c2d/tokutil.d b/c2d/tokutil.d index 847af4b9..ecb84349 100644 --- a/c2d/tokutil.d +++ b/c2d/tokutil.d @@ -255,13 +255,13 @@ bool isBracketPair(dchar ch1, dchar ch2) { switch(ch1) { - case '{': return ch2 == '}'; - case '}': return ch2 == '{'; - case '(': return ch2 == ')'; - case ')': return ch2 == ')'; - case '[': return ch2 == ']'; - case ']': return ch2 == '['; - default: return false; + case '{': return ch2 == '}'; + case '}': return ch2 == '{'; + case '(': return ch2 == ')'; + case ')': return ch2 == ')'; + case '[': return ch2 == ']'; + case ']': return ch2 == '['; + default: return false; } } @@ -1201,18 +1201,18 @@ string testDefine(string txt, TokenList[string] defines) unittest { string txt = - "#define X(a) a\n" - "before X(1) after\n" - "#undef X\n" - "X(2)\n" - "#define X(a)\n" - "X(3)\n" + "#define X(a) a\n" + ~ "before X(1) after\n" + ~ "#undef X\n" + ~ "X(2)\n" + ~ "#define X(a)\n" + ~ "X(3)\n" ; string exp = - "before 1 after\n" - "X(2)\n" - "\n" + "before 1 after\n" + ~ "X(2)\n" + ~ "\n" ; TokenList[string] defines = [ "X" : null ]; @@ -1223,16 +1223,16 @@ unittest unittest { string txt = - "#define X(a) #a\n" - "X(1)\n" - "#undef X\n" - "#define X(a) x(#a)\n" - "X(1+2+3)\n" + "#define X(a) #a\n" + ~ "X(1)\n" + ~ "#undef X\n" + ~ "#define X(a) x(#a)\n" + ~ "X(1+2+3)\n" ; string exp = - "\"1\"\n" - "x(\"1+2+3\")\n" + "\"1\"\n" + ~ "x(\"1+2+3\")\n" ; TokenList[string] defines = [ "X" : null ]; @@ -1243,8 +1243,8 @@ unittest unittest { string txt = - "#define X(a) a##1\n" - "X(2)\n" + "#define X(a) a##1\n" + ~ "X(2)\n" ; string exp = @@ -1270,13 +1270,13 @@ string testMixin(string txt, TokenList[string] mixins) unittest { string txt = - "#define X(a) x = a;\n" - "X(b);\n" + "#define X(a) x = a;\n" + ~ "X(b);\n" ; string exp = - "static __string X(__string a) { return \"x = \" ~ a ~ \";\"; }\n" - "mixin(X(b));\n" + "static __string X(__string a) { return \"x = \" ~ a ~ \";\"; }\n" + ~ "mixin(X(b));\n" ; TokenList[string] mixins = [ "X" : null ]; @@ -1298,22 +1298,22 @@ string testReplace(string txt, TokenList[string] defines) unittest { string txt = - " if (list_freelist) {\n" - " list--;\n" - "__static_if(MEM_DEBUG) {\n" - " mem_setnewfileline(list,file,line);\n" - "}\n" - " } else {\n" - " list++;\n" - " }\n" + " if (list_freelist) {\n" + ~ " list--;\n" + ~ "__static_if(MEM_DEBUG) {\n" + ~ " mem_setnewfileline(list,file,line);\n" + ~ "}\n" + ~ " } else {\n" + ~ " list++;\n" + ~ " }\n" ; string exp = - " if (list_freelist) {\n" - " list--;\n" - " } else {\n" - " list++;\n" - " }\n" + " if (list_freelist) {\n" + ~ " list--;\n" + ~ " } else {\n" + ~ " list++;\n" + ~ " }\n" ; TokenList list = scanText(txt); @@ -1328,24 +1328,24 @@ unittest unittest { string txt = - "#define X(p) \\\n" - " int p##1(); \\\n" - " int p##2(); \\\n" - " int p##3();\n" - "X(a)\n" - "X(b)\n" - "X(c)\n"; + "#define X(p) \\\n" + ~ " int p##1(); \\\n" + ~ " int p##2(); \\\n" + ~ " int p##3();\n" + ~ "X(a)\n" + ~ "X(b)\n" + ~ "X(c)\n"; string exp = - "int a1(); \n" - " int a2(); \n" - " int a3();\n" - "int b1(); \n" - " int b2(); \n" - " int b3();\n" - "int c1(); \n" - " int c2(); \n" - " int c3();\n"; + "int a1(); \n" + ~ " int a2(); \n" + ~ " int a3();\n" + ~ "int b1(); \n" + ~ " int b2(); \n" + ~ " int b3();\n" + ~ "int c1(); \n" + ~ " int c2(); \n" + ~ " int c3();\n"; TokenList list = scanText(txt); diff --git a/c2d/vsi2d.visualdproj b/c2d/vsi2d.visualdproj index 343bf38d..d488de4c 100644 --- a/c2d/vsi2d.visualdproj +++ b/c2d/vsi2d.visualdproj @@ -824,7 +824,7 @@ 0 0 0 - 0 + 1 0 0 0 @@ -926,7 +926,7 @@ 0 0 0 - 0 + 1 0 0 0 @@ -1224,6 +1224,210 @@ *.obj + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 2 + 0 + 0 + 0 + 0 + 0 + $(CC) -c + 1 + m:\s\d\rainers\windows\bin\dmd_msc.exe + .. + .. + ..\bin\$(ConfigurationName) + $(OutDir) + + + 0 + + + + + 0 + + + 0 + $(IntDir)\$(ProjectName).json + 0 + + 0 + + 0 + 0 + 0 + + + + 0 + + 1 + $(VisualDInstallDir)cv2pdb\cv2pdb.exe + 0 + 0 + 0 + + + + + + + + $(OutDir)\$(ProjectName).exe + 1 + 1 + 0 + + + + *.obj + + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 2.043 + 0 + 0 + 0 + 0 + 1 + $(CC) -c + 1 + m:\s\d\rainers\windows\bin\dmd_msc.exe + .. + .. + ..\bin\$(ConfigurationName) + $(OutDir) + + + 0 + + + + + 0 + + + 1 + $(IntDir)\$(ProjectName).json + 0 + + 0 + + 0 + 0 + 0 + + + + 0 + + 1 + $(VisualDInstallDir)cv2pdb\cv2pdb.exe + 0 + 0 + 0 + + + + + + + + $(OutDir)\$(ProjectName).exe + 1 + 1 + 0 + + + + *.obj + diff --git a/doc/build_doc.bat b/doc/build_doc.bat deleted file mode 100644 index 3072f5c5..00000000 --- a/doc/build_doc.bat +++ /dev/null @@ -1,34 +0,0 @@ -set DMD=c:\s\d\rainers\windows\bin\dmd.exe -rem set WEB=m:\s\d\rainers\web\visuald -set WEB=c:\s\d\visuald\gh-pages\visuald - -set SRC=ReportingBugs.dd -set SRC=%SRC% StartPage.dd -set SRC=%SRC% ReportingBugs.dd -set SRC=%SRC% BuildFromSource.dd -set SRC=%SRC% KnownIssues.dd -set SRC=%SRC% Installation.dd -set SRC=%SRC% BrowseInfo.dd -set SRC=%SRC% Profiling.dd -set SRC=%SRC% Coverage.dd -set SRC=%SRC% CppConversion.dd -set SRC=%SRC% Debugging.dd -set SRC=%SRC% ProjectConfig.dd -set SRC=%SRC% TokenReplace.dd -set SRC=%SRC% Search.dd -set SRC=%SRC% Editor.dd -set SRC=%SRC% ProjectWizard.dd -set SRC=%SRC% GlobalOptions.dd -set SRC=%SRC% Features.dd -set SRC=%SRC% VersionHistory.dd -set SRC=%SRC% News36.dd -set SRC=%SRC% CompileCommands.dd -set SRC=%SRC% DustMite.dd - -set DDOC=macros.ddoc html.ddoc dlang.org.ddoc visuald.ddoc - -if not exist %WEB% md %WEB% -if not exist %WEB%\images md %WEB%\images -cp -u images/* %WEB%\images -%DMD% -Dd%WEB% -o- -w %DDOC% %SRC% - diff --git a/msbuild/d.ico b/msbuild/d.ico new file mode 100644 index 00000000..ca5f4955 Binary files /dev/null and b/msbuild/d.ico differ diff --git a/msbuild/d2.ico b/msbuild/d2.ico new file mode 100644 index 00000000..37fc8674 Binary files /dev/null and b/msbuild/d2.ico differ diff --git a/msbuild/dbuild/CompileD.cs b/msbuild/dbuild/CompileD.cs index ab21397d..0c9c639b 100644 --- a/msbuild/dbuild/CompileD.cs +++ b/msbuild/dbuild/CompileD.cs @@ -3,7 +3,7 @@ using System.Xaml; //using System.Threading.Tasks; using Microsoft.Build.Framework; -//using Microsoft.Build.Utilities; +using Microsoft.Build.Utilities; //using Microsoft.Build.Tasks; using Microsoft.Build.Tasks.Xaml; using Microsoft.Build.CPPTasks; @@ -26,6 +26,9 @@ public CompileD() private ArrayList switchOrderList = new ArrayList(); private string _compiler = "dmd"; + private Dictionary trackedInputFilesToRemove; + private Dictionary trackedOutputFilesToRemove; + public string Compiler { get { return _compiler; } @@ -91,19 +94,24 @@ protected override ArrayList SwitchOrderList get { return this.switchOrderList; } } + private string TLogPrefix + { + get { return _compiler == "LDC" ? "ldmd2-ldc2" : "dmd"; } + } + protected override string[] ReadTLogNames { - get { return new string[1] { _compiler + ".read.1.tlog" }; } + get { return new string[1] { TLogPrefix + ".read.1.tlog" }; } } protected override string[] WriteTLogNames { - get { return new string[1] { _compiler + ".write.1.tlog" }; } + get { return new string[1] { TLogPrefix + ".write.1.tlog" }; } } protected override string CommandTLogName { - get { return _compiler + ".command.1.tlog"; } + get { return "dcompile.command.1.tlog"; } } protected override string TrackerIntermediateDirectory @@ -116,7 +124,24 @@ protected override string TrackerIntermediateDirectory } } -#if TOOLS_V14 + private bool InputDependencyFilter(string fullInputPath) + { + if (fullInputPath.EndsWith(".PDB", StringComparison.OrdinalIgnoreCase) || + fullInputPath.EndsWith(".IDB", StringComparison.OrdinalIgnoreCase)) + return false; + return !this.trackedInputFilesToRemove.ContainsKey(fullInputPath); + } + + private bool OutputDependencyFilter(string fullOutputPath) + { + if (fullOutputPath.EndsWith(".TLH", StringComparison.OrdinalIgnoreCase) || + fullOutputPath.EndsWith(".TLI", StringComparison.OrdinalIgnoreCase) || + fullOutputPath.EndsWith(".DLL", StringComparison.OrdinalIgnoreCase)) + return false; + return !this.trackedOutputFilesToRemove.ContainsKey(fullOutputPath); + } + +#if TOOLS_V14 || TOOLS_V15 public #else protected @@ -131,23 +156,31 @@ protected override ITaskItem[] TrackedInputFiles get { return Sources; } // return new ITaskItem[1] { new TaskItem(this.Source) }; } - /// - /// The list of switches in the order they should appear, if set. - /// - private Dictionary parameterValues = new Dictionary(); - - private bool parseParameters(XamlTypes.Rule rule) + private Dictionary parseParamValues(string parameters) { Dictionary strOptions = new Dictionary(); - string[] paras = Parameters.Split('|'); + string[] paras = parameters.Split('|'); foreach (string p in paras) { int pos = p.IndexOf('='); - string name = p.Substring(0, pos); - string value = p.Substring(pos + 1); - strOptions[name] = value; - switchOrderList.Add(name); + if (pos >= 0) + { + string name = p.Substring(0, pos); + string value = p.Substring(pos + 1); + strOptions[name] = value; + switchOrderList.Add(name); + } } + return strOptions; + } + /// + /// The list of switches in the order they should appear, if set. + /// + private Dictionary parseParameters(XamlTypes.Rule rule) + { + Dictionary parameterValues = new Dictionary(); + + Dictionary strOptions = parseParamValues(Parameters); foreach (XamlTypes.BaseProperty property in rule.Properties) { @@ -178,15 +211,12 @@ private bool parseParameters(XamlTypes.Rule rule) parameterValues[property.Name] = val; } } - return true; + return parameterValues; } - public override bool Execute() + public string GenCmdLine(string xaml) { - if (!String.IsNullOrEmpty(TrackerLogDirectory)) - TrackFileAccess = true; - - object rootObject = XamlServices.Load(new StreamReader(Xaml)); + object rootObject = XamlServices.Load(new StreamReader(xaml)); XamlTypes.ProjectSchemaDefinitions schemas = rootObject as XamlTypes.ProjectSchemaDefinitions; if (schemas != null) { @@ -195,16 +225,27 @@ public override bool Execute() XamlTypes.Rule rule = node as XamlTypes.Rule; if (rule != null) { - parseParameters(rule); + var parameterValues = parseParameters(rule); CommandLineGenerator generator = new CommandLineGenerator(rule, parameterValues); generator.CommandLineTemplate = this.CommandLineTemplate; generator.AdditionalOptions = AdditionalOptions; - CommandLine = generator.GenerateCommandLine(); - return base.Execute(); + return generator.GenerateCommandLine(); } } } + return null; + } + + public override bool Execute() + { + if (!String.IsNullOrEmpty(TrackerLogDirectory)) + TrackFileAccess = true; + + CommandLine = GenCmdLine(Xaml); + if (CommandLine != null) + return base.Execute(); + return false; } @@ -212,6 +253,7 @@ protected override int ExecuteTool(string pathToTool, string responseFileCommand { responseFileCommands = responseFileCommands.Replace("[PackageName]", PackageName); commandLineCommands = commandLineCommands.Replace("[PackageName]", PackageName); + string src = ""; foreach (var item in Sources) src += " " + item.ToString(); @@ -219,9 +261,131 @@ protected override int ExecuteTool(string pathToTool, string responseFileCommand Log.LogMessage(MessageImportance.High, pathToTool + " " + responseFileCommands + " " + commandLineCommands); else Log.LogMessage(MessageImportance.High, "Compiling" + src); +/* return base.ExecuteTool(pathToTool, responseFileCommands, commandLineCommands); + */ + int num = 0; + try + { + num = this.TrackerExecuteTool(pathToTool, responseFileCommands, commandLineCommands); + return num; + } + finally + { + if (this.MinimalRebuildFromTracking || this.TrackFileAccess) + { + CanonicalTrackedOutputFiles trackedOutputFiles = new CanonicalTrackedOutputFiles(this.TLogWriteFiles); + CanonicalTrackedInputFiles trackedInputFiles = new CanonicalTrackedInputFiles(this.TLogReadFiles, this.Sources, this.ExcludedInputPaths, trackedOutputFiles, true, this.MaintainCompositeRootingMarkers); + DependencyFilter includeInTLog = new DependencyFilter(this.OutputDependencyFilter); + DependencyFilter dependencyFilter = new DependencyFilter(this.InputDependencyFilter); + this.trackedInputFilesToRemove = new Dictionary((IEqualityComparer) StringComparer.OrdinalIgnoreCase); + if (this.TrackedInputFilesToIgnore != null) + { + foreach (ITaskItem taskItem in this.TrackedInputFilesToIgnore) + this.trackedInputFilesToRemove.Add(taskItem.GetMetadata("FullPath"), taskItem); + } + this.trackedOutputFilesToRemove = new Dictionary((IEqualityComparer) StringComparer.OrdinalIgnoreCase); + if (this.TrackedOutputFilesToIgnore != null) + { + foreach (ITaskItem taskItem in this.TrackedOutputFilesToIgnore) + this.trackedOutputFilesToRemove.Add(taskItem.GetMetadata("FullPath"), taskItem); + } + trackedOutputFiles.RemoveDependenciesFromEntryIfMissing(this.SourcesCompiled); + trackedInputFiles.RemoveDependenciesFromEntryIfMissing(this.SourcesCompiled); + if (num != 0) + { + ITaskItem[] source1; + ITaskItem[] upToDateSources; + if (this.SourcesCompiled.Length > 1) + { + KeyValuePair[] keyValuePairArray = new KeyValuePair[]{ + new KeyValuePair("ObjectFile", true), + /* + new KeyValuePair("BrowseInformationFile", this.BrowseInformation), + new KeyValuePair("XMLDocumentationFileName", this.GenerateXMLDocumentationFiles) + */ + }; + foreach (ITaskItem source2 in this.Sources) + { + string sourceKey = FileTracker.FormatRootingMarker(source2); + foreach (KeyValuePair keyValuePair in keyValuePairArray) + { + string metadata = source2.GetMetadata(keyValuePair.Key); + if (keyValuePair.Value && !string.IsNullOrEmpty(metadata)) + trackedOutputFiles.AddComputedOutputForSourceRoot(sourceKey, metadata); + } + } + source1 = trackedInputFiles.ComputeSourcesNeedingCompilation(); + List taskItemList = new List(); + int index = 0; + foreach (ITaskItem taskItem in this.SourcesCompiled) + { + if (index >= source1.Length) + taskItemList.Add(taskItem); + else if (!source1[index].Equals((object) taskItem)) + taskItemList.Add(taskItem); + else + ++index; + } + upToDateSources = taskItemList.ToArray(); + foreach (ITaskItem source2 in this.Sources) + { + string sourceRoot = FileTracker.FormatRootingMarker(source2); + foreach (KeyValuePair keyValuePair in keyValuePairArray) + { + string metadata = source2.GetMetadata(keyValuePair.Key); + if (keyValuePair.Value && !string.IsNullOrEmpty(metadata)) + trackedOutputFiles.RemoveOutputForSourceRoot(sourceRoot, metadata); + } + } + } + else + { + source1 = this.SourcesCompiled; + upToDateSources = new ITaskItem[0]; + } + //trackedOutputFiles.RemoveEntriesForSource(source1, this.preprocessOutput); + trackedOutputFiles.SaveTlog(includeInTLog); + trackedInputFiles.RemoveEntriesForSource(source1); + trackedInputFiles.SaveTlog(dependencyFilter); + this.ConstructCommandTLog(upToDateSources, dependencyFilter); + } + else + { + this.RemoveTaskSpecificInputs(trackedInputFiles); + trackedOutputFiles.SaveTlog(includeInTLog); + trackedInputFiles.SaveTlog(dependencyFilter); + this.ConstructCommandTLog(this.SourcesCompiled, dependencyFilter); + } + TrackedVCToolTask.DeleteEmptyFile(this.TLogWriteFiles); + TrackedVCToolTask.DeleteEmptyFile(this.TLogReadFiles); + } + } + } + + private void ConstructCommandTLog(ITaskItem[] upToDateSources, DependencyFilter inputFilter) + { + IDictionary commandLines = this.MapSourcesToCommandLines(); + if (upToDateSources != null) + { + string cmdLine = GenerateCommandLineCommands(VCToolTask.CommandLineFormat.ForTracking +#if TOOLS_V14 + , EscapeFormat.Default +#endif + ); + foreach (ITaskItem upToDateSource in upToDateSources) + { + string metadata = upToDateSource.GetMetadata("FullPath"); + if (inputFilter == null || inputFilter(metadata)) + commandLines[FileTracker.FormatRootingMarker(upToDateSource)] = cmdLine; + else + commandLines.Remove(FileTracker.FormatRootingMarker(upToDateSource)); + } + } + this.WriteSourcesToCommandLinesTable(commandLines); } + ///////////////////////////////////////////// string CommandLine; protected override string GenerateCommandLineCommands(VCToolTask.CommandLineFormat format @@ -251,6 +415,57 @@ protected override string GenerateCommandLineCommands(VCToolTask.CommandLineForm return str; } + private System.DateTime _nextToolTypeCheck = new System.DateTime(1900, 1, 1); + private Microsoft.Build.Utilities.ExecutableType? _ToolType = new Microsoft.Build.Utilities.ExecutableType?(); + + protected override Microsoft.Build.Utilities.ExecutableType? ToolType + { + get + { + if (_nextToolTypeCheck <= DateTime.Now) + { + _nextToolTypeCheck = DateTime.Now.AddSeconds(5); + ushort arch = GetPEArchitecture(ToolExe); + if (arch == 0x10B) + _ToolType = Microsoft.Build.Utilities.ExecutableType.Native32Bit; + else if (arch == 0x20B) + _ToolType = Microsoft.Build.Utilities.ExecutableType.Native64Bit; + else + _ToolType = new Microsoft.Build.Utilities.ExecutableType?(); + } + return _ToolType; + } + } + + protected static ushort GetPEArchitecture(string pFilePath) + { + ushort architecture = 0; + try + { + using (System.IO.FileStream fStream = new System.IO.FileStream(pFilePath, System.IO.FileMode.Open, System.IO.FileAccess.Read)) + { + using (System.IO.BinaryReader bReader = new System.IO.BinaryReader(fStream)) + { + if (bReader.ReadUInt16() == 23117) //check the MZ signature + { + fStream.Seek(0x3A, System.IO.SeekOrigin.Current); //seek to e_lfanew. + fStream.Seek(bReader.ReadUInt32(), System.IO.SeekOrigin.Begin); //seek to the start of the NT header. + if (bReader.ReadUInt32() == 17744) //check the PE\0\0 signature. + { + fStream.Seek(20, System.IO.SeekOrigin.Current); //seek past the file header, + architecture = bReader.ReadUInt16(); //read the magic number of the optional header. + } + } + } + } + } + catch (Exception) + { + } + // if architecture returns 0, there has been an error. + return architecture; + } + } } diff --git a/msbuild/dbuild/VCProjectInterop.cs b/msbuild/dbuild/VCProjectInterop.cs new file mode 100644 index 00000000..f69f7f7a --- /dev/null +++ b/msbuild/dbuild/VCProjectInterop.cs @@ -0,0 +1,225 @@ +// This file is part of Visual D +// +// Visual D integrates the D programming language into Visual Studio +// Copyright (c) 2016 by Rainer Schuetze, All Rights Reserved +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt + +using System.Runtime.InteropServices; // DllImport + +using Microsoft.VisualStudio.Shell.Interop; +using Microsoft.VisualStudio.VCProjectEngine; +//using Microsoft.VisualStudio.Project.VisualC.VCProjectEngine.VCCustomBuildRuleShim; + +namespace vdextensions +{ + public class IID + { + public const string IVisualCHelper = "002a2de9-8bb6-484d-9911-7e4ad4084715"; + public const string VisualCHelper = "002a2de9-8bb6-484d-AA11-7e4ad4084715"; + } + + [ComVisible(true), Guid(IID.IVisualCHelper)] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface IVisualCHelper + { + void GetDCompileOptions(IVsHierarchy proj, uint itemid, out string impPath, out string stringImpPath, + out string versionids, out string debugids, out uint flags); + void GetDCommandLine(IVsHierarchy proj, uint itemid, out string cmdline); + } + + [ComVisible(true), Guid(IID.VisualCHelper)] + [ClassInterface(ClassInterfaceType.None)] + public partial class VisualCHelper : IVisualCHelper + { + /////////////////////////////////////////////////////////////////////// + static int ConfigureFlags(bool unittestOn, bool debugOn, bool x64, bool cov, bool doc, bool nobounds, bool gdc, + int versionLevel, int debugLevel, bool noDeprecated, bool ldc) + { + return (unittestOn ? 1 : 0) + | (debugOn ? 2 : 0) + | (x64 ? 4 : 0) + | (cov ? 8 : 0) + | (doc ? 16 : 0) + | (nobounds ? 32 : 0) + | (gdc ? 64 : 0) + | (noDeprecated ? 128 : 0) + | ((versionLevel & 0xff) << 8) + | ((debugLevel & 0xff) << 16) + | (ldc ? 0x4000000 : 0); + } + + + public const uint _VSITEMID_ROOT = 4294967294; + + // throws COMException if not found + static void GetVCToolProps(IVsHierarchy proj, uint itemid, + out Microsoft.VisualStudio.VCProjectEngine.VCFileConfiguration fcfg, + out Microsoft.VisualStudio.VCProjectEngine.VCConfiguration cfg, + out System.Reflection.IReflect vcrefl, + out Microsoft.VisualStudio.VCProjectEngine.IVCRulePropertyStorage vcprop) + { + object ext; + if (proj.GetProperty(itemid, (int)__VSHPROPID.VSHPROPID_ExtObject, out ext) != 0) + throw new COMException(); + + object projext; + if (proj.GetProperty(_VSITEMID_ROOT, (int)__VSHPROPID.VSHPROPID_ExtObject, out projext) != 0) + throw new COMException(); + + var envproj = projext as EnvDTE.Project; + if (envproj == null) + throw new COMException(); + + var envitem = ext as EnvDTE.ProjectItem; + if (envitem == null) + throw new COMException(); + + var cfgmgr = envproj.ConfigurationManager; + var activecfg = cfgmgr.ActiveConfiguration; + var activename = activecfg.ConfigurationName + "|" + activecfg.PlatformName; + + fcfg = null; + cfg = null; + var vcfile = envitem.Object as Microsoft.VisualStudio.VCProjectEngine.VCFile; + if (vcfile != null) + { + var vcfconfigs = vcfile.FileConfigurations as IVCCollection; + for (int c = 1; c <= vcfconfigs.Count; c++) + { + var vcfcfg = vcfconfigs.Item(c); + fcfg = vcfcfg as Microsoft.VisualStudio.VCProjectEngine.VCFileConfiguration; + if (fcfg.Name == activename) + break; + else + fcfg = null; + } + if (fcfg == null) + throw new COMException(); + + var vcftool = fcfg.Tool as Microsoft.VisualStudio.Project.VisualC.VCProjectEngine.VCToolBase; + vcprop = vcftool as Microsoft.VisualStudio.VCProjectEngine.IVCRulePropertyStorage; + if (vcftool != null && vcprop != null && vcftool.ItemType == "DCompile") + { + vcrefl = vcftool as System.Reflection.IReflect; + if (vcrefl != null) + return; + } + } + + var vcproj = envproj.Object as Microsoft.VisualStudio.VCProjectEngine.VCProject; // Project.VisualC.VCProjectEngine.VCProjectShim; + if (vcproj == null) + throw new COMException(); + + var vcconfigs = vcproj.Configurations as IVCCollection; + for (int c = 1; c <= vcconfigs.Count; c++) + { + var vccfg = vcconfigs.Item(c); + cfg = vccfg as Microsoft.VisualStudio.VCProjectEngine.VCConfiguration; + if (cfg.Name == activename) + break; + else + cfg = null; + } + if (cfg == null) + throw new COMException(); + + var tools = cfg.FileTools as IVCCollection; + for (int f = 1; f <= tools.Count; f++) + { + var obj = tools.Item(f); + var vctool = obj as Microsoft.VisualStudio.Project.VisualC.VCProjectEngine.VCToolBase; + if (vctool != null && vctool.ItemType == "DCompile") + { + vcprop = vctool as Microsoft.VisualStudio.VCProjectEngine.IVCRulePropertyStorage; + if (vcprop != null) + { + vcrefl = vctool as System.Reflection.IReflect; + if (vcrefl != null) + return; + } + } + } + throw new COMException(); + } + + public delegate string EvalFun(string value); + + public void GetDCommandLine(IVsHierarchy proj, uint itemid, out string cmdline) + { + Microsoft.VisualStudio.VCProjectEngine.VCFileConfiguration fcfg; + Microsoft.VisualStudio.VCProjectEngine.VCConfiguration cfg; + System.Reflection.IReflect vcrefl; + Microsoft.VisualStudio.VCProjectEngine.IVCRulePropertyStorage vcprop; + GetVCToolProps(proj, itemid, out fcfg, out cfg, out vcrefl, out vcprop); + + EvalFun eval = (string s) => { return fcfg != null ? fcfg.Evaluate(s) : cfg.Evaluate(s); }; + + string compiler = eval("$(DCompiler)"); + bool ldc = compiler == "LDC"; + + string assemblyFolder = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location); + string xmlFileName = System.IO.Path.Combine(assemblyFolder, compiler + ".xml"); + + var cd = new dbuild.CompileD(); + cd.Xaml = xmlFileName; + cd.Compiler = compiler; + cd.ToolExe = fcfg.Evaluate(ldc ? "$(LDCBinDir)ldmd2.exe" : "$(DMDBinDir)dmd.exe"); + cd.CommandLineTemplate = vcprop.GetEvaluatedPropertyValue("CommandLineTemplate"); + cd.AdditionalOptions = vcprop.GetEvaluatedPropertyValue("AdditionalOptions"); + cd.Sources = new Microsoft.Build.Framework.ITaskItem[1] { new Microsoft.Build.Utilities.TaskItem("dummy.d") }; + cd.Parameters = GetParametersFromFakeProperties(vcprop, vcrefl.GetProperties(0)); + cmdline = cd.ToolExe + " " + cd.GenCmdLine(xmlFileName); + } + + public void GetDCompileOptions(IVsHierarchy proj, uint itemid, + out string impPath, out string stringImpPath, + out string versionids, out string debugids, out uint flags) + { + Microsoft.VisualStudio.VCProjectEngine.VCFileConfiguration fcfg; + Microsoft.VisualStudio.VCProjectEngine.VCConfiguration cfg; + System.Reflection.IReflect vcrefl; + Microsoft.VisualStudio.VCProjectEngine.IVCRulePropertyStorage vcprop; + GetVCToolProps(proj, itemid, out fcfg, out cfg, out vcrefl, out vcprop); + + EvalFun eval = (string s) => { return fcfg != null ? fcfg.Evaluate(s) : cfg.Evaluate(s); }; + + string platform = eval("$(PlatformName)"); + string compiler = eval("$(DCompiler)"); + bool ldc = compiler == "LDC"; + + impPath = vcprop.GetEvaluatedPropertyValue("ImportPaths"); + stringImpPath = vcprop.GetEvaluatedPropertyValue("StringImportPaths"); + versionids = vcprop.GetEvaluatedPropertyValue("VersionIdentifiers"); + debugids = vcprop.GetEvaluatedPropertyValue("DebugIdentifiers"); + + bool unittestOn = vcprop.GetEvaluatedPropertyValue("Unittest") == "true"; + bool debugOn = vcprop.GetEvaluatedPropertyValue("DebugCode") == "Debug"; + bool x64 = platform == "x64"; + bool cov = vcprop.GetEvaluatedPropertyValue("Coverage") == "true"; + bool doc = vcprop.GetEvaluatedPropertyValue("DocDir") != "" || vcprop.GetEvaluatedPropertyValue("DocFile") != ""; + bool nobounds = vcprop.GetEvaluatedPropertyValue("BoundsCheck") == "On"; + bool noDeprecated = vcprop.GetEvaluatedPropertyValue("Deprecations") == "Error"; + bool gdc = false; + int versionLevel = 0; + int debugLevel = 0; + flags = (uint)ConfigureFlags(unittestOn, debugOn, x64, cov, doc, nobounds, gdc, + versionLevel, debugLevel, noDeprecated, ldc); + } + + + public static string GetParametersFromFakeProperties(Microsoft.VisualStudio.VCProjectEngine.IVCRulePropertyStorage vcfprop, + System.Reflection.PropertyInfo[] props) + { + string parameters = ""; + foreach(var p in props) + { + var val = vcfprop.GetEvaluatedPropertyValue(p.Name); + if (!string.IsNullOrEmpty(val)) + parameters = parameters + "|" + p.Name + "=" + val; + } + return parameters; + } + } +} diff --git a/msbuild/dbuild/dbuild.csproj b/msbuild/dbuild/dbuild.csproj index fe9bce95..de80614e 100644 --- a/msbuild/dbuild/dbuild.csproj +++ b/msbuild/dbuild/dbuild.csproj @@ -3,6 +3,7 @@ 12.0 $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + bin\Release-v14\ @@ -14,6 +15,26 @@ prompt MinimumRecommendedRules.ruleset + + bin\Debug-v14\ + TRACE;TOOLS_V14 + true + false + pdbonly + AnyCPU + prompt + MinimumRecommendedRules.ruleset + + + bin\Release-v15\ + TRACE;TOOLS_V15 + true + true + pdbonly + AnyCPU + prompt + MinimumRecommendedRules.ruleset + Debug @@ -23,9 +44,10 @@ Library Properties dbuild - dbuild.12.0 - dbuild.14.0 - v4.5 + dbuild.12.0 + dbuild.14.0 + dbuild.15.0 + v4.6 false false false @@ -38,12 +60,14 @@ full false ..\..\bin\Debug\dbuild\ - TRACE;DEBUG;TOOLS_V12 + DEBUG;TOOLS_V12 prompt 4 False False - true + false + AnyCPU + c:\Program Files (x86)\Microsoft Visual Studio\2017\Community\ pdbonly @@ -59,16 +83,26 @@ + - + + False + c:\Windows\assembly\GAC\Microsoft.VisualStudio.Shell.Interop\7.1.40304.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.Shell.Interop.dll + - + + + True + + + c:\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.Build\v4.0_12.0.0.0__b03f5f7f11d50a3a\Microsoft.Build.dll + False c:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.Build.CPPTasks.Common.dll @@ -84,8 +118,26 @@ False c:\Program Files (x86)\MSBuild\12.0\Bin\Microsoft.Build.Utilities.v12.0.dll + + True + + + False + True + c:\Windows\assembly\GAC\Microsoft.VisualStudio.VCProjectEngine\12.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.VCProjectEngine.dll + + + False + c:\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.VisualStudio.Project.VisualC.VCProjectEngine\v4.0_12.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.Project.VisualC.VCProjectEngine.dll + - + + + True + + + c:\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.Build\v4.0_14.0.0.0__b03f5f7f11d50a3a\Microsoft.Build.dll + False c:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.Build.CPPTasks.Common.dll @@ -102,6 +154,57 @@ False c:\Program Files (x86)\MSBuild\14.0\Bin\Microsoft.Build.Utilities.Core.dll + + True + + + False + True + c:\Windows\assembly\GAC\Microsoft.VisualStudio.VCProjectEngine\14.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.VCProjectEngine.dll + + + False + c:\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.VisualStudio.Project.VisualC.VCProjectEngine\v4.0_14.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.Project.VisualC.VCProjectEngine.dll + + + + + $(VS2017Path)MSBuild\15.0\Bin\Microsoft.Build.dll + + + False + True + $(VS2017Path)Common7\IDE\PrivateAssemblies\envdte.dll + + + False + $(VS2017Path)Common7\IDE\VC\VCTargets\Microsoft.Build.CPPTasks.Common.dll + + + $(VS2017Path)MSBuild\15.0\Bin\Microsoft.Build.Framework.dll + + + False + $(VS2017Path)MSBuild\15.0\Bin\Microsoft.Build.Tasks.Core.dll + + + False + $(VS2017Path)MSBuild\15.0\Bin\Microsoft.Build.Utilities.Core.dll + + + False + $(VS2017Path)Common7\IDE\CommonExtensions\Microsoft\VC\Project\Microsoft.VisualStudio.Project.VisualC.VCProjectEngine.dll + + + False + True + $(VS2017Path)Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.VCProject.dll + + + False + True + $(VS2017Path)Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.VCProjectEngine.dll + diff --git a/msbuild/dbuild/dbuild.sln b/msbuild/dbuild/dbuild.sln index acfe3221..d9fdd14a 100644 --- a/msbuild/dbuild/dbuild.sln +++ b/msbuild/dbuild/dbuild.sln @@ -10,6 +10,7 @@ Global Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU Release-v14|Any CPU = Release-v14|Any CPU + Release-v15|Any CPU = Release-v15|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {45508B90-440B-46DD-82CC-178196D9794E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU @@ -18,6 +19,8 @@ Global {45508B90-440B-46DD-82CC-178196D9794E}.Release|Any CPU.Build.0 = Release|Any CPU {45508B90-440B-46DD-82CC-178196D9794E}.Release-v14|Any CPU.ActiveCfg = Release-v14|Any CPU {45508B90-440B-46DD-82CC-178196D9794E}.Release-v14|Any CPU.Build.0 = Release-v14|Any CPU + {45508B90-440B-46DD-82CC-178196D9794E}.Release-v15|Any CPU.ActiveCfg = Release-v15|Any CPU + {45508B90-440B-46DD-82CC-178196D9794E}.Release-v15|Any CPU.Build.0 = Release-v15|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/msbuild/dcompile.props b/msbuild/dcompile.props index e45c18e3..eacc77b7 100644 --- a/msbuild/dcompile.props +++ b/msbuild/dcompile.props @@ -5,12 +5,15 @@ $(DMDInstallDir)\windows\lib32mscoff;%(AdditionalLibraryDirectories) $(DMDInstallDir)\windows\lib64;%(AdditionalLibraryDirectories) + phobos32mscoff.lib;%(AdditionalDependencies) + phobos64.lib;%(AdditionalDependencies) legacy_stdio_definitions.lib;%(AdditionalDependencies) $(LDCInstallDir)\lib32;%(AdditionalLibraryDirectories) $(LDCInstallDir)\lib64;%(AdditionalLibraryDirectories) - legacy_stdio_definitions.lib;phobos2-ldc.lib;druntime-ldc.lib;%(AdditionalDependencies) + phobos2-ldc.lib;druntime-ldc.lib;%(AdditionalDependencies) + legacy_stdio_definitions.lib;%(AdditionalDependencies) diff --git a/msbuild/dcompile.targets b/msbuild/dcompile.targets index ab80f94b..5979ed98 100644 --- a/msbuild/dcompile.targets +++ b/msbuild/dcompile.targets @@ -11,7 +11,11 @@ - + + $(MSBuildThisFileDirectory)dbuild.$(MsBuildToolsVersion).dll + + + $(ComputeLinkInputsTargets);ComputeDCompileOutput; @@ -25,7 +29,7 @@ - $([System.String]::Copy('%(RelativeDir)').Replace('..','__').Replace(':','_').Replace('\','.')) + $([System.String]::Copy('%(RelativeDir)|').Replace('\|','').Replace('|','').Replace('..','__').Replace(':','_').Replace('\','.')) @@ -37,13 +41,14 @@ - $(IntDir)%(PackageName).obj + $(IntDir)dpackage_%(PackageName).obj - $(IntDir)%(PackageName).%(FileName).obj + $(IntDir)%(FileName).obj + $(IntDir)%(PackageName).%(FileName).obj @@ -96,10 +101,11 @@ - - - - + + + + + @@ -111,15 +117,22 @@ <_ToolExe Condition="'$(DCompiler)' == 'LDC'">$(LDCBinDir)ldmd2.exe <_ToolExe Condition="'$(DCompiler)' != 'LDC'">$(DMDBinDir)dmd.exe + + <_Parameters>@(Parameter,'|') + $([System.String]::Copy('$(_Parameters)').Replace('?',';')) + + diff --git a/msbuild/dcompile_defaults.props b/msbuild/dcompile_defaults.props index 9a1cd729..c53001a9 100644 --- a/msbuild/dcompile_defaults.props +++ b/msbuild/dcompile_defaults.props @@ -6,13 +6,15 @@ CustomBuild $([MSBuild]::GetRegistryValueFromView('HKEY_CURRENT_USER\SOFTWARE\Microsoft\VisualStudio\$(VisualStudioVersion)\ToolsOptionsPages\Projects\Visual D Settings', 'DMDInstallDir', '', RegistryView.Registry64, RegistryView.Registry32)) - $([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\Software\DMD', 'InstallationFolder', '', RegistryView.Registry64, RegistryView.Registry32)) + $([MSBuild]::GetRegistryValueFromView('HKEY_CURRENT_USER\SOFTWARE\Microsoft\VisualStudio\$(VisualStudioVersion)_Config\ToolsOptionsPages\Projects\Visual D Settings', 'DMDInstallDir', '', RegistryView.Registry64, RegistryView.Registry32)) + $([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\Software\DMD', 'InstallationFolder', '', RegistryView.Registry32, RegistryView.Registry64)) $(DMDInstallationFolder)\dmd2\ $(DMDInstallDir)\windows\bin\ DMD - Reference compiler DMD - Reference compiler (not installed) $([MSBuild]::GetRegistryValueFromView('HKEY_CURRENT_USER\SOFTWARE\Microsoft\VisualStudio\$(VisualStudioVersion)\ToolsOptionsPages\Projects\Visual D Settings', 'LDCInstallDir', '', RegistryView.Registry64, RegistryView.Registry32)) + $([MSBuild]::GetRegistryValueFromView('HKEY_CURRENT_USER\SOFTWARE\Microsoft\VisualStudio\$(VisualStudioVersion)_Config\ToolsOptionsPages\Projects\Visual D Settings', 'LDCInstallDir', '', RegistryView.Registry64, RegistryView.Registry32)) $(registry:HKEY_LOCAL_MACHINE\Software\LDC@InstallationFolder) $(registry:HKEY_LOCAL_MACHINE\Software\Wow6432Node\LDC@InstallationFolder) $(LDCInstallDir)\bin\ @@ -55,6 +57,8 @@ Project + MultiThreaded + + $(DMDBinDir)dmd.exe + $(LDCBinDir)ldmd2.exe + -m32mscoff -c [AllOptions] [AdditionalOptions] [Inputs] -m32 -c [AllOptions] [AdditionalOptions] [Inputs] -m64 -c [AllOptions] [AdditionalOptions] [Inputs] diff --git a/msbuild/di.ico b/msbuild/di.ico new file mode 100644 index 00000000..0cc54410 Binary files /dev/null and b/msbuild/di.ico differ diff --git a/msbuild/dmd.xml b/msbuild/dmd.xml index 29524672..dcc8f491 100644 --- a/msbuild/dmd.xml +++ b/msbuild/dmd.xml @@ -34,7 +34,7 @@ + Description="compile in debug code identified by ident/<= level." Switch="-debug=[value]" /> @@ -45,9 +45,22 @@ - + + + + + + + @@ -126,7 +139,7 @@ + Description="write module dependencies to filename (only imports)." Switch="-deps="[value]"" /> + diff --git a/msbuild/ldc.xml b/msbuild/ldc.xml index bae32d3d..33174002 100644 --- a/msbuild/ldc.xml +++ b/msbuild/ldc.xml @@ -15,7 +15,7 @@ - + @@ -25,7 +25,31 @@ - + + + + + + + + + + + + + + + + @@ -40,20 +64,26 @@ - + Description="Print out what the compiler is currently doing. (-v)" /> + + Description="list all gc allocations including hidden ones. (-vgc)" /> + Description="ignore unsupported pragmas. (-ignore)" Switch="-ignore" /> + + + Description="profile runtime performance of generated code. (-profile)" /> + Description="profile runtime allocations. (-profile=gc)" Switch="-profile=gc" /> + Description="do code coverage analysis. (-cov)" Switch="-cov" /> + + - - + + @@ -84,27 +116,32 @@ - - - - - - - + + + + + + + + + + - + + DisplayName="Execute Before" Description="Specifies the targets for the build customization to run before." + Visible="False"> @@ -113,7 +150,8 @@ + DisplayName="Execute After" Description="Specifies the targets for the build customization to run after." + Visible="False"> diff --git a/nsis/visuald.nsi b/nsis/visuald.nsi index 37c3672b..40e4bf2f 100644 --- a/nsis/visuald.nsi +++ b/nsis/visuald.nsi @@ -82,6 +82,8 @@ !define VS2012_REGISTRY_KEY SOFTWARE\Microsoft\VisualStudio\11.0 !define VS2013_REGISTRY_KEY SOFTWARE\Microsoft\VisualStudio\12.0 !define VS2015_REGISTRY_KEY SOFTWARE\Microsoft\VisualStudio\14.0 + !define VS2017_REGISTRY_KEY SOFTWARE\Microsoft\VisualStudio\15.0 + !define VS2017_INSTALL_KEY SOFTWARE\Microsoft\VisualStudio\SxS\VS7 !ifdef EXPRESS !define VCEXP2008_REGISTRY_KEY SOFTWARE\Microsoft\VCExpress\9.0 !define VCEXP2010_REGISTRY_KEY SOFTWARE\Microsoft\VCExpress\10.0 @@ -208,9 +210,9 @@ Section "Visual Studio package" SecPackage ${File} ..\bin\${CONFIG}\ vdserver.exe !endif - !ifdef VDEXTENSIONS +!ifdef VDEXTENSIONS ${File} ..\bin\${CONFIG}\vdextensions\ vdextensions.dll - !endif +!endif !ifdef DPARSER ${SetOutPath} "$INSTDIR\DParser" @@ -243,6 +245,11 @@ Section "Visual Studio package" SecPackage ${File} ..\visuald\Templates\ProjectItems\ConsoleDMDLDC\ ConsoleApp.vstemplate ${File} ..\visuald\Templates\ProjectItems\ConsoleDMDLDC\ ConsoleApp.visualdproj + ${SetOutPath} "$INSTDIR\Templates\ProjectItems\ConsoleDLG" + ${File} ..\visuald\Templates\ProjectItems\ConsoleDLG\ main.d + ${File} ..\visuald\Templates\ProjectItems\ConsoleDLG\ ConsoleApp.vstemplate + ${File} ..\visuald\Templates\ProjectItems\ConsoleDLG\ ConsoleApp.visualdproj + ${SetOutPath} "$INSTDIR\Templates\ProjectItems\WindowsApp" ${File} ..\visuald\Templates\ProjectItems\WindowsApp\ winmain.d ${File} ..\visuald\Templates\ProjectItems\WindowsApp\ WindowsApp.vstemplate @@ -293,6 +300,8 @@ Section "Visual Studio package" SecPackage ${File} ..\msbuild\ dmd.xml ${File} ..\msbuild\ ldc.xml ${File} ..\msbuild\ general_d.snippet + ${File} ..\msbuild\ d2.ico + ${File} ..\msbuild\ di.ico ${File} ..\msbuild\dbuild\obj\release\ dbuild.12.0.dll ${File} ..\msbuild\dbuild\obj\release-v14\ dbuild.14.0.dll WriteRegStr HKLM "Software\${APPNAME}" "msbuild" $INSTDIR\msbuild @@ -356,10 +365,9 @@ ${MementoSection} "Register with VS 2010" SecVS2010 ${File} ..\nsis\Extensions\ extension.vsixmanifest ${File} ..\nsis\Extensions\ vdlogo.ico - !ifdef VDEXTENSIONS - GetFullPathName /SHORT $0 $INSTDIR - !insertmacro ReplaceInFile "$1${EXTENSION_DIR}\extension.vsixmanifest" "VDINSTALLPATH" "$0" NoBackup - !endif + GetFullPathName /SHORT $0 $INSTDIR + !insertmacro ReplaceInFile "$1${EXTENSION_DIR}\extension.vsixmanifest" "VDINSTALLPATH" "$0" NoBackup + !insertmacro ReplaceInFile "$1${EXTENSION_DIR}\extension.vsixmanifest" "VSVERSION" "10" NoBackup ${MementoSectionEnd} @@ -377,10 +385,9 @@ ${MementoSection} "Register with VS 2012" SecVS2012 ${File} ..\nsis\Extensions\ extension.vsixmanifest ${File} ..\nsis\Extensions\ vdlogo.ico - !ifdef VDEXTENSIONS - GetFullPathName /SHORT $0 $INSTDIR - !insertmacro ReplaceInFile "$1${EXTENSION_DIR}\extension.vsixmanifest" "VDINSTALLPATH" "$0" NoBackup - !endif + GetFullPathName /SHORT $0 $INSTDIR + !insertmacro ReplaceInFile "$1${EXTENSION_DIR}\extension.vsixmanifest" "VDINSTALLPATH" "$0" NoBackup + !insertmacro ReplaceInFile "$1${EXTENSION_DIR}\extension.vsixmanifest" "VSVERSION" "11" NoBackup !ifdef MAGO ${SetOutPath} "$1\..\Packages\Debugger" @@ -404,10 +411,9 @@ ${MementoSection} "Register with VS 2013" SecVS2013 ${File} ..\nsis\Extensions\ extension.vsixmanifest ${File} ..\nsis\Extensions\ vdlogo.ico - !ifdef VDEXTENSIONS - GetFullPathName /SHORT $0 $INSTDIR - !insertmacro ReplaceInFile "$1${EXTENSION_DIR}\extension.vsixmanifest" "VDINSTALLPATH" "$0" NoBackup - !endif + GetFullPathName /SHORT $0 $INSTDIR + !insertmacro ReplaceInFile "$1${EXTENSION_DIR}\extension.vsixmanifest" "VDINSTALLPATH" "$0" NoBackup + !insertmacro ReplaceInFile "$1${EXTENSION_DIR}\extension.vsixmanifest" "VSVERSION" "12" NoBackup !ifdef MAGO ${SetOutPath} "$1\..\Packages\Debugger" @@ -431,10 +437,9 @@ ${MementoSection} "Register with VS 2015" SecVS2015 ${File} ..\nsis\Extensions\ extension.vsixmanifest ${File} ..\nsis\Extensions\ vdlogo.ico - !ifdef VDEXTENSIONS - GetFullPathName /SHORT $0 $INSTDIR - !insertmacro ReplaceInFile "$1${EXTENSION_DIR}\extension.vsixmanifest" "VDINSTALLPATH" "$0" NoBackup - !endif + GetFullPathName /SHORT $0 $INSTDIR + !insertmacro ReplaceInFile "$1${EXTENSION_DIR}\extension.vsixmanifest" "VDINSTALLPATH" "$0" NoBackup + !insertmacro ReplaceInFile "$1${EXTENSION_DIR}\extension.vsixmanifest" "VSVERSION" "14" NoBackup !ifdef MAGO ${SetOutPath} "$1\..\Packages\Debugger" @@ -444,6 +449,32 @@ ${MementoSection} "Register with VS 2015" SecVS2015 ${MementoSectionEnd} +;-------------------------------- +${MementoSection} "Register with VS 2017" SecVS2017 + + ;ExecWait 'rundll32 "$INSTDIR\${DLLNAME}" RunDLLRegister ${VS2017_REGISTRY_KEY}' + WriteRegStr ${VS_REGISTRY_ROOT} "${VS2017_REGISTRY_KEY}${VDSETTINGS_KEY}" "DMDInstallDir" $DMDInstallDir + ${RegisterWin32Exception} ${VS2017_REGISTRY_KEY} "Win32 Exceptions\D Exception" + + ReadRegStr $1 ${VS_REGISTRY_ROOT} "${VS2017_INSTALL_KEY}" "15.0" + ExecWait 'rundll32 "$INSTDIR\${DLLNAME}" WritePackageDef ${VS2017_REGISTRY_KEY} $1Common7\IDE${EXTENSION_DIR}\visuald.pkgdef' + + ${SetOutPath} "$1Common7\IDE${EXTENSION_DIR}" + ${File} ..\nsis\Extensions\ extension.vsixmanifest + ${File} ..\nsis\Extensions\ vdlogo.ico + + GetFullPathName /SHORT $0 $INSTDIR + !insertmacro ReplaceInFile "$1Common7\IDE${EXTENSION_DIR}\extension.vsixmanifest" "VDINSTALLPATH" "$0" NoBackup + !insertmacro ReplaceInFile "$1Common7\IDE${EXTENSION_DIR}\extension.vsixmanifest" "VSVERSION" "15" NoBackup + + !ifdef MAGO + ${SetOutPath} "$1Common7\Packages\Debugger" + ${File} ${MAGO_SOURCE}\bin\Win32\Release\ MagoNatCC.dll + ${File} ${MAGO_SOURCE}\bin\Win32\Release\ MagoNatCC.vsdconfig + !endif + +${MementoSectionEnd} + !macro RegisterPlatform Vxxx Platform ${SetOutPath} "${Vxxx}\Platforms\${Platform}\ImportBefore\Default" ${File} ..\msbuild\ImportBefore\Default\ d.props @@ -455,6 +486,17 @@ ${MementoSectionEnd} !macroend !define RegisterPlatform "!insertmacro RegisterPlatform" +!macro RegisterIcons VSVer + WriteRegStr HKCR "VisualStudio.d.${VSVer}" "" "D Source" + WriteRegStr HKCR "VisualStudio.d.${VSVer}\DefaultIcon" "" "$INSTDIR\msbuild\d2.ico" + WriteRegStr ${VS_REGISTRY_ROOT} "SOFTWARE\Microsoft\VisualStudio\${VSVer}\ShellFileAssociations\.d" "" "VisualStudio.d.${VSVer}" + + WriteRegStr HKCR "VisualStudio.di.${VSVer}" "" "D Interface" + WriteRegStr HKCR "VisualStudio.di.${VSVer}\DefaultIcon" "" "$INSTDIR\msbuild\di.ico" + WriteRegStr ${VS_REGISTRY_ROOT} "SOFTWARE\Microsoft\VisualStudio\${VSVer}\ShellFileAssociations\.di" "" "VisualStudio.di.${VSVer}" +!macroend +!define RegisterIcons "!insertmacro RegisterIcons" + ;-------------------------------- !ifdef MSBUILD ${MementoSection} "Register MSBuild extensions for VS 2013/2015" SecMSBuild @@ -463,6 +505,7 @@ ${MementoSection} "Register MSBuild extensions for VS 2013/2015" SecMSBuild IfErrors NoMSBuild14 ${RegisterPlatform} "$1\Microsoft.Cpp\v4.0\V140" "x64" ${RegisterPlatform} "$1\Microsoft.Cpp\v4.0\V140" "Win32" + ${RegisterIcons} "14.0" !define V140_GENERAL_XML "$1\Microsoft.Cpp\v4.0\V140\1033\general.xml" @@ -474,6 +517,7 @@ ${MementoSection} "Register MSBuild extensions for VS 2013/2015" SecMSBuild IfErrors NoMSBuild12 ${RegisterPlatform} "$1\Microsoft.Cpp\v4.0\V120" "x64" ${RegisterPlatform} "$1\Microsoft.Cpp\v4.0\V120" "Win32" + ${RegisterIcons} "12.0" !define V120_GENERAL_XML "$1\Microsoft.Cpp\v4.0\V120\1033\general.xml" @@ -553,6 +597,10 @@ ${MementoSection} "cv2pdb" SecCv2pdb Push ${VS2015_REGISTRY_KEY} Call PatchAutoExp + Push ${SecVS2017} + Push ${VS2017_REGISTRY_KEY} + Call PatchAutoExp + ${MementoSectionEnd} !endif @@ -601,6 +649,10 @@ ${MementoSection} "mago" SecMago Push ${VS2015_REGISTRY_KEY} Call RegisterMago + Push ${SecVS2017} + Push ${VS2017_REGISTRY_KEY} + Call RegisterMago + WriteRegStr HKLM "SOFTWARE\Wow6432Node\MagoDebugger" "Remote_x64" "$INSTDIR\Mago\MagoRemote.exe" ${MementoSectionEnd} @@ -627,6 +679,7 @@ SectionEnd LangString DESC_SecVS2012 ${LANG_ENGLISH} "Register for usage in Visual Studio 2012." LangString DESC_SecVS2013 ${LANG_ENGLISH} "Register for usage in Visual Studio 2013." LangString DESC_SecVS2015 ${LANG_ENGLISH} "Register for usage in Visual Studio 2015." + LangString DESC_SecVS2017 ${LANG_ENGLISH} "Register for usage in Visual Studio 2017." !ifdef EXPRESS LangString DESC_SecVCExpress2008 ${LANG_ENGLISH} "Register for usage in Visual C++ Express 2008 (experimental and unusable)." LangString DESC_SecVCExpress2010 ${LANG_ENGLISH} "Register for usage in Visual C++ Express 2010 (experimental and unusable)." @@ -655,6 +708,7 @@ SectionEnd !insertmacro MUI_DESCRIPTION_TEXT ${SecVS2012} $(DESC_SecVS2012) !insertmacro MUI_DESCRIPTION_TEXT ${SecVS2013} $(DESC_SecVS2013) !insertmacro MUI_DESCRIPTION_TEXT ${SecVS2015} $(DESC_SecVS2015) + !insertmacro MUI_DESCRIPTION_TEXT ${SecVS2017} $(DESC_SecVS2017) !ifdef EXPRESS !insertmacro MUI_DESCRIPTION_TEXT ${SecVCExpress2008} $(DESC_SecVCExpress2008) !insertmacro MUI_DESCRIPTION_TEXT ${SecVCExpress2008} $(DESC_SecVCExpress2010) @@ -685,11 +739,19 @@ Section "Uninstall" ExecWait 'rundll32 "$INSTDIR\${DLLNAME}" RunDLLUnregister ${VS2012_REGISTRY_KEY}' ExecWait 'rundll32 "$INSTDIR\${DLLNAME}" RunDLLUnregister ${VS2013_REGISTRY_KEY}' ExecWait 'rundll32 "$INSTDIR\${DLLNAME}" RunDLLUnregister ${VS2015_REGISTRY_KEY}' + ExecWait 'rundll32 "$INSTDIR\${DLLNAME}" RunDLLUnregister ${VS2017_REGISTRY_KEY}' !ifdef EXPRESS ExecWait 'rundll32 "$INSTDIR\${DLLNAME}" RunDLLUnregister ${VCEXP2008_REGISTRY_KEY}' ExecWait 'rundll32 "$INSTDIR\${DLLNAME}" RunDLLUnregister ${VCEXP2010_REGISTRY_KEY}' !endif + ReadRegStr $1 ${VS_REGISTRY_ROOT} "${VS2017_REGISTRY_KEY}" InstallDir + IfErrors NoVS2017pkgdef + RMDir /r '$1${EXTENSION_DIR}' + RMDir '$1${EXTENSION_DIR_ROOT}\${APPNAME}' + RMDir '$1${EXTENSION_DIR_ROOT}' + NoVS2017pkgdef: + ReadRegStr $1 ${VS_REGISTRY_ROOT} "${VS2015_REGISTRY_KEY}" InstallDir IfErrors NoVS2015pkgdef RMDir /r '$1${EXTENSION_DIR}' @@ -741,6 +803,9 @@ Section "Uninstall" Push ${VS2015_REGISTRY_KEY} Call un.PatchAutoExp + + Push ${VS2017_REGISTRY_KEY} + Call un.PatchAutoExp !endif !ifdef VS_NET @@ -752,6 +817,7 @@ Section "Uninstall" DeleteRegKey ${VS_REGISTRY_ROOT} "${VS2012_REGISTRY_KEY}\${WIN32_EXCEPTION_KEY}\Win32 Exceptions\D Exception" DeleteRegKey ${VS_REGISTRY_ROOT} "${VS2013_REGISTRY_KEY}\${WIN32_EXCEPTION_KEY}\Win32 Exceptions\D Exception" DeleteRegKey ${VS_REGISTRY_ROOT} "${VS2015_REGISTRY_KEY}\${WIN32_EXCEPTION_KEY}\Win32 Exceptions\D Exception" + DeleteRegKey ${VS_REGISTRY_ROOT} "${VS2017_REGISTRY_KEY}\${WIN32_EXCEPTION_KEY}\Win32 Exceptions\D Exception" !ifdef MAGO ExecWait 'regsvr32 /u /s "$INSTDIR\Mago\MagoNatDE.dll"' @@ -778,6 +844,9 @@ Section "Uninstall" Push ${VS2015_REGISTRY_KEY} Call un.RegisterMago + + Push ${VS2017_REGISTRY_KEY} + Call un.RegisterMago !endif Call un.RegisterIVDServer @@ -792,6 +861,11 @@ Section "Uninstall" ; generated by SecMSBuild Delete "$INSTDIR\msbuild\general_d.12.0.xml" Delete "$INSTDIR\msbuild\general_d.14.0.xml" + + DeleteRegKey HKCR "VisualStudio.d.12.0" + DeleteRegKey ${VS_REGISTRY_ROOT} "SOFTWARE\Microsoft\VisualStudio\12.0\ShellFileAssociations\.d" + DeleteRegKey HKCR "VisualStudio.d.14.0" + DeleteRegKey ${VS_REGISTRY_ROOT} "SOFTWARE\Microsoft\VisualStudio\14.0\ShellFileAssociations\.d" !endif Delete "$INSTDIR\Uninstall.exe" @@ -867,6 +941,13 @@ Function .onInit SectionSetFlags ${SecVS2015} ${SF_RO} Installed_VS2015: + ; detect VS2017 + ClearErrors + ReadRegStr $1 ${VS_REGISTRY_ROOT} "${VS2017_INSTALL_KEY}" "15.0" + IfErrors 0 Installed_VS2017 + SectionSetFlags ${SecVS2017} ${SF_RO} + Installed_VS2017: + !ifdef EXPRESS ; detect VCExpress 2008 ClearErrors @@ -1003,6 +1084,9 @@ enabled: ;------ MagoNatCC WriteRegStr ${VS_REGISTRY_ROOT} "$1\${MAGO_EE_KEY}" "Language" "D" WriteRegStr ${VS_REGISTRY_ROOT} "$1\${MAGO_EE_KEY}" "Name" "D" + ; enable conditional breakpoints + WriteRegStr ${VS_REGISTRY_ROOT} "$1\${MAGO_EE_KEY}\Engine" "0" "{449EC4CC-30D2-4032-9256-EE18EB41B62B}" + WriteRegStr ${VS_REGISTRY_ROOT} "$1\${MAGO_EE_KEY}\Engine" "1" "{92EF0900-2251-11D2-B72E-0000F87572EF}" WriteRegStr ${VS_REGISTRY_ROOT} "$1\Debugger\CodeView Compilers\68:*" "LanguageID" "${LANGUAGE_CLSID}" WriteRegStr ${VS_REGISTRY_ROOT} "$1\Debugger\CodeView Compilers\68:*" "VendorID" "${VENDOR_CLSID}" diff --git a/sdk/port/bitfields.d b/sdk/port/bitfields.d index 95d87ed2..8479877a 100644 --- a/sdk/port/bitfields.d +++ b/sdk/port/bitfields.d @@ -28,7 +28,7 @@ template PadBits(T...) alias TypeTuple!(T, uint, "", 16 - bits) PadBits; else static if(bits < 32) alias TypeTuple!(T, uint, "", 32 - bits) PadBits; - else + else alias TypeTuple!(T, uint, "", 64 - bits) PadBits; } @@ -84,7 +84,7 @@ private template createAccessors( static if (is(T == bool)) { static assert(len == 1); - enum result = + enum result = // getter "bool " ~ name ~ "() { return " ~"("~store~" & "~myToString!(maskAllElse)~") != 0;}\n" @@ -97,11 +97,11 @@ private template createAccessors( { // getter enum result = T.stringof~" "~name~"() { auto result = " - "("~store~" & " + ~"("~store~" & " ~ myToString!(maskAllElse) ~ ") >>" ~ myToString!(offset) ~ ";" ~ (T.min < 0 - ? "if (result >= " ~ myToString!(signBitCheck) + ? "if (result >= " ~ myToString!(signBitCheck) ~ ") result |= " ~ myToString!(extendSign) ~ ";" : "") ~ " return cast("~T.stringof~") result;}\n" @@ -110,9 +110,9 @@ private template createAccessors( ~"assert(v >= "~name~"_min); " ~"assert(v <= "~name~"_max); " ~store~" = cast(typeof("~store~"))" - " (("~store~" & ~"~myToString!(maskAllElse)~")" - " | ((cast(typeof("~store~")) v << "~myToString!(offset)~")" - " & "~myToString!(maskAllElse)~"));}\n" + ~" (("~store~" & ~"~myToString!(maskAllElse)~")" + ~" | ((cast(typeof("~store~")) v << "~myToString!(offset)~")" + ~" & "~myToString!(maskAllElse)~"));}\n" // constants ~"enum "~T.stringof~" "~name~"_min = cast("~T.stringof~")" ~myToString!(minVal)~"; " diff --git a/sdk/port/inaddr.d b/sdk/port/inaddr.d index 6170091f..3206bc08 100644 --- a/sdk/port/inaddr.d +++ b/sdk/port/inaddr.d @@ -1,6 +1,6 @@ module sdk.port.inaddr; -import sdk.port.base; +import sdk.port.base; // // IPv4 Internet address @@ -13,9 +13,9 @@ struct in_addr struct S_union_b { UCHAR s_b1,s_b2,s_b3,s_b4; } S_union_b S_un_b; struct S_union_w { USHORT s_w1,s_w2; } S_union_w S_un_w; ULONG S_addr; - } + } S_union S_un; - + alias S_un.S_addr s_addr; /* can be used for most tcp & ip code */ alias S_un.S_un_b.s_b2 s_host; // host on imp alias S_un.S_un_b.s_b1 s_net; // network diff --git a/sdk/port/vsversion_generated.d b/sdk/port/vsversion_generated.d index 00380ddb..10d3c55d 100644 --- a/sdk/port/vsversion_generated.d +++ b/sdk/port/vsversion_generated.d @@ -7,6 +7,6 @@ enum BuildNumberMajor = 33333; enum BuildNumberMinor = 1; // needed by VS2015 SDK -enum NDPFileVersionMinor = 14; -enum NDPFileVersionBuild = 12345; -enum NDPFileVersionRevision = 1; +enum NDPFileVersionMinor = 14; +enum NDPFileVersionBuild = 12345; +enum NDPFileVersionRevision = 1; diff --git a/sdk/vsi.visualdproj b/sdk/vsi.visualdproj index 2ee854a4..673f7802 100644 --- a/sdk/vsi.visualdproj +++ b/sdk/vsi.visualdproj @@ -1028,7 +1028,7 @@ 0 2 0 - 0 + 1 0 0 0 @@ -1117,7 +1117,7 @@ 1 1 0 - -m32ms + *.obj @@ -1130,7 +1130,7 @@ 0 2 0 - 0 + 1 0 0 0 @@ -1260,7 +1260,7 @@ 0 1 1 - 0 + 1 1 0 0 @@ -1362,7 +1362,7 @@ 0 0 1 - 0 + 1 1 0 0 @@ -1428,6 +1428,210 @@ *.obj + + 0 + 0 + 1 + 0 + 0 + 2 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 2 + 0 + 0 + 0 + 0 + 0 + $(CC) -c + 1 + m:\s\d\rainers\windows\bin\dmd_msc.exe + .. + + ..\bin\$(ConfigurationName) + $(OutDir)\vsi + + + 0 + + + + + 0 + + + 1 + $(IntDir)\$(ProjectName).json + 0 + + 0 + + 0 + 0 + 0 + + + + 0 + + 1 + "$(VisualDInstallDir)cv2pdb.exe" + 0 + 0 + 0 + + + + + + + + $(OutDir)\$(ProjectName).lib + 1 + 2 + 0 + + + + *.obj + + + 0 + 0 + 1 + 0 + 0 + 2 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 2 + 0 + 0 + 0 + 0 + 1 + $(CC) -c + 1 + m:\s\d\rainers\windows\bin\dmd_msc.exe + .. + + ..\bin\$(ConfigurationName) + $(OutDir)\vsi + + + 0 + + + + + 0 + + + 1 + $(IntDir)\$(ProjectName).json + 0 + + 0 + + 0 + 0 + 0 + + + + 0 + + 1 + "$(VisualDInstallDir)cv2pdb.exe" + 0 + 0 + 0 + + + + + + + + $(OutDir)\$(ProjectName).lib + 1 + 2 + 0 + + + + *.obj + @@ -1443,6 +1647,7 @@ + diff --git a/stdext/com.d b/stdext/com.d index 3fa5ced9..5390cd0f 100644 --- a/stdext/com.d +++ b/stdext/com.d @@ -24,6 +24,9 @@ import sdk.win32.oleauto; import sdk.win32.objbase; /////////////////////////////////////////////////////////////////////////////// +// TypeInfo.initializer added by dmd 2.072 +static if (!__traits(compiles, TypeInfo.initializer)) + const(void)[] initializer(TypeInfo ti) { return ti.init(); } extern(C) void* gc_malloc(size_t sz, uint ba = 0, const TypeInfo ti=null); @@ -32,9 +35,10 @@ C _newCom(C, T...)(T arguments) static assert(!__traits(isAbstractClass,C)); // avoid special casing in _d_newclass, where COM objects are not garbage collected - size_t size = typeid(C).init.length; + auto ini = typeid(C).initializer; + size_t size = ini.length; void* p = gc_malloc(size, 1, typeid(C)); // BlkAttr.FINALIZE - memcpy(p, typeid(C).init.ptr, size); + memcpy(p, ini.ptr, size); C c = cast(C) p; static if(arguments.length || __traits(compiles,c.__ctor(arguments))) c.__ctor(arguments); diff --git a/stdext/httpget.d b/stdext/httpget.d index bd39a071..a2947e35 100644 --- a/stdext/httpget.d +++ b/stdext/httpget.d @@ -69,7 +69,7 @@ ulong httpget(string domain, ushort port, string url, string dstfile, ulong part domain = domain ~ ":" ~ to!string(port); string request = "GET " ~ url ~ " HTTP/1.0\r\n" - "Host: " ~ domain ~ "\r\n"; + ~ "Host: " ~ domain ~ "\r\n"; if(partial_length < ulong.max) { string range = to!string(partial_start) ~ "-" ~ to!string(partial_start + partial_length - 1); @@ -112,128 +112,128 @@ ulong httpget(string domain, ushort port, string url, string dstfile, ulong part // deprecated in phobos 2.069, so extract what's needed class SocketStream { - private Socket sock; - + private Socket sock; + this(Socket s) { sock = s; } - /** - * Attempts to read the entire block, waiting if necessary. - */ - size_t readBlock(void* _buffer, size_t size) - { - if (size == 0) - return size; - - ubyte* buffer = cast(ubyte*)_buffer; - auto len = sock.receive(buffer[0 .. size]); - //readEOF = cast(bool)(len == 0); - if (len == sock.ERROR) - len = 0; - return len; - } - - // reads a line, terminated by either CR, LF, CR/LF, or EOF - char[] readLine() - { - return readLine(null); - } - - // reads a line, terminated by either CR, LF, CR/LF, or EOF - // reusing the memory in buffer if result will fit and otherwise - // allocates a new string - char[] readLine(char[] result) - { - size_t strlen = 0; - char ch = getc(); - while (true) { - switch (ch) { - case '\r': - prevCr = true; - goto case; - case '\n': - case char.init: - result.length = strlen; - return result; - - default: - if (strlen < result.length) { - result[strlen] = ch; - } else { - result ~= ch; - } - strlen++; - } - ch = getc(); - } - result.length = strlen; - return result; - } - - // unget buffer - private wchar[] unget; - final bool ungetAvailable() { return unget.length > 1; } - private bool prevCr = false; - - // reads and returns next character from the stream, - // handles characters pushed back by ungetc() - // returns char.init on eof. - char getc() - { - char c; - if (prevCr) { - prevCr = false; - c = getc(); - if (c != '\n') - return c; - } - if (unget.length > 1) { - c = cast(char)unget[unget.length - 1]; - unget.length = unget.length - 1; - } else { - readBlock(&c,1); - } - return c; - } - - - /** - * Attempts to write the entire block, waiting if necessary. - */ - size_t writeBlock(const void* _buffer, size_t size) - { - if (size == 0) - return size; - - ubyte* buffer = cast(ubyte*)_buffer; - auto len = sock.send(buffer[0 .. size]); - //readEOF = cast(bool)(len == 0); - if (len == sock.ERROR) - len = 0; - return len; - } - - // writes block of data of specified size, - // throws WriteException on error - void writeExact(const void* buffer, size_t size) - { - const(void)* p = buffer; - for(;;) { - if (!size) return; - size_t writesize = writeBlock(p, size); - if (writesize == 0) break; - p += writesize; - size -= writesize; - } - if (size != 0) - throw new Exception("unable to write to stream"); - } - - // writes a string, throws WriteException on error - void writeString(const(char)[] s) - { - writeExact(s.ptr, s.length); - } + /** + * Attempts to read the entire block, waiting if necessary. + */ + size_t readBlock(void* _buffer, size_t size) + { + if (size == 0) + return size; + + ubyte* buffer = cast(ubyte*)_buffer; + auto len = sock.receive(buffer[0 .. size]); + //readEOF = cast(bool)(len == 0); + if (len == sock.ERROR) + len = 0; + return len; + } + + // reads a line, terminated by either CR, LF, CR/LF, or EOF + char[] readLine() + { + return readLine(null); + } + + // reads a line, terminated by either CR, LF, CR/LF, or EOF + // reusing the memory in buffer if result will fit and otherwise + // allocates a new string + char[] readLine(char[] result) + { + size_t strlen = 0; + char ch = getc(); + while (true) { + switch (ch) { + case '\r': + prevCr = true; + goto case; + case '\n': + case char.init: + result.length = strlen; + return result; + + default: + if (strlen < result.length) { + result[strlen] = ch; + } else { + result ~= ch; + } + strlen++; + } + ch = getc(); + } + result.length = strlen; + return result; + } + + // unget buffer + private wchar[] unget; + final bool ungetAvailable() { return unget.length > 1; } + private bool prevCr = false; + + // reads and returns next character from the stream, + // handles characters pushed back by ungetc() + // returns char.init on eof. + char getc() + { + char c; + if (prevCr) { + prevCr = false; + c = getc(); + if (c != '\n') + return c; + } + if (unget.length > 1) { + c = cast(char)unget[unget.length - 1]; + unget.length = unget.length - 1; + } else { + readBlock(&c,1); + } + return c; + } + + + /** + * Attempts to write the entire block, waiting if necessary. + */ + size_t writeBlock(const void* _buffer, size_t size) + { + if (size == 0) + return size; + + ubyte* buffer = cast(ubyte*)_buffer; + auto len = sock.send(buffer[0 .. size]); + //readEOF = cast(bool)(len == 0); + if (len == sock.ERROR) + len = 0; + return len; + } + + // writes block of data of specified size, + // throws WriteException on error + void writeExact(const void* buffer, size_t size) + { + const(void)* p = buffer; + for(;;) { + if (!size) return; + size_t writesize = writeBlock(p, size); + if (writesize == 0) break; + p += writesize; + size -= writesize; + } + if (size != 0) + throw new Exception("unable to write to stream"); + } + + // writes a string, throws WriteException on error + void writeString(const(char)[] s) + { + writeExact(s.ptr, s.length); + } } diff --git a/stdext/path.d b/stdext/path.d index a32f202b..670dfdd5 100644 --- a/stdext/path.d +++ b/stdext/path.d @@ -57,7 +57,7 @@ void makeFilenamesAbsolute(string[] files, string workdir) string removeDotDotPath(string file) { // assumes \\ used as path separator - for( ; ; ) + for( ; file.length >= 2; ) { // remove duplicate back slashes auto pos = indexOf(file[1..$], "\\\\"); diff --git a/stdext/stdext.visualdproj b/stdext/stdext.visualdproj index c7c55387..4eba676d 100644 --- a/stdext/stdext.visualdproj +++ b/stdext/stdext.visualdproj @@ -1028,7 +1028,7 @@ 0 2 0 - 0 + 1 0 0 0 @@ -1117,7 +1117,7 @@ 1 1 0 - -m32ms + *.obj;*.cmd;*.build;*.json;*.dep @@ -1130,7 +1130,7 @@ 0 0 0 - 0 + 1 0 0 0 @@ -1428,6 +1428,210 @@ *.obj;*.cmd;*.build;*.json;*.dep + + 0 + 0 + 1 + 0 + 0 + 2 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 2 + 0 + 0 + 0 + 0 + 0 + $(CC) -c + 1 + m:\s\d\rainers\windows\bin\dmd_msc.exe + .. + + ..\bin\$(ConfigurationName) + $(OutDir)\obj + + + 0 + + + + + 0 + + + 1 + $(IntDir)\$(TargetName).json + 0 + + 0 + + 0 + 0 + 0 + + + + 0 + + 1 + $(VisualDInstallDir)cv2pdb\cv2pdb.exe + 0 + 0 + 0 + + + + + + + + $(OutDir)\$(ProjectName).lib + 1 + 2 + 0 + + + + *.obj;*.cmd;*.build;*.json;*.dep + + + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 2 + 0 + 0 + 0 + 0 + 0 + $(CC) -c + 1 + m:\s\d\rainers\windows\bin\dmd_msc.exe + .. + + ..\bin\$(ConfigurationName) + $(OutDir)\obj + + + 0 + + + + + 0 + + + 1 + $(IntDir)\$(TargetName).json + 0 + + 0 + + 0 + 0 + 0 + + + + 0 + + 1 + $(VisualDInstallDir)cv2pdb\cv2pdb.exe + 0 + 0 + 0 + + + + + + + + $(OutDir)\$(ProjectName).lib + 1 + 2 + 0 + + + + *.obj;*.cmd;*.build;*.json;*.dep + diff --git a/tools/build_dcxxfilt.bat b/tools/build_dcxxfilt.bat index 03a78e34..450db367 100644 --- a/tools/build_dcxxfilt.bat +++ b/tools/build_dcxxfilt.bat @@ -3,7 +3,7 @@ rem unpack and configure binutils 2.25+ rem don't use spaces in path names! setlocal -if "%DMDINSTALLDIR%" == "" set DMDINSTALLDIR=m:\s\d\rainers +if "%DMDINSTALLDIR%" == "" set DMDINSTALLDIR=c:\s\d\rainers if "%DMD%" == "" set DMD=%DMDINSTALLDIR%\windows\bin\dmd if "%BINUTILS%" == "" set BINUTILS=c:\s\cpp\cxxfilt @@ -22,5 +22,6 @@ set SRC=%SRC% %LIBIBERTY%\safe-ctype.c set SRC=%SRC% %LIBIBERTY%\alloca.c set COPT=-I %BINUTILS% -I %BINUTILS%\include -I %BINUTILS%\binutils -DHAVE_CONFIG_H -set LIB=%LIB%;%DMDINSTALLDIR%\lib32 +set LIB=%LIB%;%DMDINSTALLDIR%\windows\lib32mscoff +if exist "%VCINSTALLDIR%\lib\legacy_stdio_definitions.lib" set SRC=%SRC% legacy_stdio_definitions.lib cl /Ox /Fe%OUTDIR%\dcxxfilt.exe /Fo%OUTDIR%\ %COPT% %SRC% %OUTDIR%\dcxxfilt.obj dbghelp.lib diff --git a/tools/dcxxfilt.d b/tools/dcxxfilt.d index a1c0b7c4..4e3996bc 100644 --- a/tools/dcxxfilt.d +++ b/tools/dcxxfilt.d @@ -1,25 +1,25 @@ -/* Demangler for D/C++ - gcc and MS style mangling - - Copyright (C) 2015 Free Software Foundation, Inc. - Written by Rainer Schuetze (r.sagitario@gmx.de) - - This file is using part of GNU Binutils, inspired by cxxfilt - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or (at - your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with GCC; see the file COPYING. If not, write to the Free - Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA - 02110-1301, USA. */ - +/* Demangler for D/C++ - gcc and MS style mangling + + Copyright (C) 2015 Free Software Foundation, Inc. + Written by Rainer Schuetze (r.sagitario@gmx.de) + + This file is using part of GNU Binutils, inspired by cxxfilt + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or (at + your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GCC; see the file COPYING. If not, write to the Free + Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ + import core.demangle; import core.stdc.stdio; import core.stdc.stdlib; @@ -30,9 +30,9 @@ extern(Windows) uint UnDecorateSymbolName(in char* DecoratedName, char* UnDecora extern(C) char* dlang_demangle(const char* mangled_name, uint flags); extern(C) char* cplus_demangle(const char* mangled_name, uint flags); -enum DMGL_PARAMS = (1 << 0); /* Include function args */ -enum DMGL_ANSI = (1 << 1); /* Include const, volatile, etc */ -enum DMGL_VERBOSE = (1 << 3); /* Include implementation details. */ +enum DMGL_PARAMS = (1 << 0); /* Include function args */ +enum DMGL_ANSI = (1 << 1); /* Include const, volatile, etc */ +enum DMGL_VERBOSE = (1 << 3); /* Include implementation details. */ uint flags = DMGL_PARAMS | DMGL_ANSI | DMGL_VERBOSE; char msvc_buffer[32768]; @@ -47,22 +47,22 @@ char* msvc_demangle (char *mangled_name) char* d_demangle (char[] mangled) { size_t pos = 0; - string s = decodeDmdString (mangled, pos); - char[] obuf; - if (pos == mangled.length) - obuf = demangle(s, msvc_buffer); - else - obuf = demangle(mangled, msvc_buffer); - if (obuf.ptr != msvc_buffer.ptr) - return null; - msvc_buffer[obuf.length] = 0; + string s = decodeDmdString (mangled, pos); + char[] obuf; + if (pos == mangled.length) + obuf = demangle(s, msvc_buffer); + else + obuf = demangle(mangled, msvc_buffer); + if (obuf.ptr != msvc_buffer.ptr) + return null; + msvc_buffer[obuf.length] = 0; return msvc_buffer.ptr; } void print_demangled (char[] mangled) { char *result; - char[] initial = mangled; + char[] initial = mangled; /* . and $ are sometimes found at the start of function names in assembler sources in order to distinguish them from other @@ -98,16 +98,16 @@ int main (char[][] argv) { int c; const char *valid_symbols = "_$.?@"; - - if (argv.length > 1) - { - foreach(a; argv[1..$]) - { - print_demangled(a); - putchar ('\n'); - } - return 0; - } + + if (argv.length > 1) + { + foreach(a; argv[1..$]) + { + print_demangled(a); + putchar ('\n'); + } + return 0; + } for (;;) { static char mbuffer[32767]; diff --git a/tools/pipedmd.d b/tools/pipedmd.d index 4a4149bf..598b1aa9 100644 --- a/tools/pipedmd.d +++ b/tools/pipedmd.d @@ -260,38 +260,50 @@ int runProcess(string command, string depsfile, bool doDemangle, bool demangleAl ResumeThread(piProcInfo.hThread); char[] buffer = new char[2048]; + size_t bytesFilled = 0; + DWORD bytesAvailable = 0; DWORD bytesRead = 0; - DWORD bytesAvaiable = 0; DWORD exitCode = 0; bool linkerFound = gdcMode || msMode || demangleAll; + L_loop: while(true) { - bSuccess = PeekNamedPipe(hStdOutRead, buffer.ptr, buffer.length, &bytesRead, &bytesAvaiable, null); - if(bSuccess && bytesAvaiable > 0) + bSuccess = PeekNamedPipe(hStdOutRead, buffer.ptr + bytesFilled, buffer.length - bytesFilled, &bytesRead, &bytesAvailable, null); + if (bSuccess && bytesRead > 0) + bSuccess = ReadFile(hStdOutRead, buffer.ptr + bytesFilled, buffer.length - bytesFilled, &bytesRead, null); + if(bSuccess && bytesRead > 0) { - size_t lineLength = 0; - for(; lineLength < buffer.length && lineLength < bytesAvaiable && buffer[lineLength] != '\n'; lineLength++){} - if(lineLength >= bytesAvaiable) + size_t lineLength = bytesFilled; // no need to search before previous end + bytesFilled += bytesRead; + for(; lineLength < buffer.length && lineLength < bytesFilled; lineLength++) { - // if no line end found, retry with larger buffer - if(lineLength >= buffer.length) - buffer.length = buffer.length * 2; + if (buffer[lineLength] == '\n') + { + size_t len = lineLength + 1; + demangleLine(buffer[0 .. len], doDemangle, demangleAll, msMode, gdcMode, cp, linkerFound); + memmove(buffer.ptr, buffer.ptr + len, bytesFilled - len); + bytesFilled -= len; + lineLength = 0; + } + } + // if no line end found, retry with larger buffer + if(bytesFilled >= buffer.length) + { + buffer.length = buffer.length * 2; continue; } - bSuccess = ReadFile(hStdOutRead, buffer.ptr, lineLength+1, &bytesRead, null); - if(!bSuccess || bytesRead == 0) - break; - - demangleLine(buffer[0 .. bytesRead], doDemangle, demangleAll, msMode, gdcMode, cp, linkerFound); } - else + + bSuccess = GetExitCodeProcess(piProcInfo.hProcess, &exitCode); + if(!bSuccess || exitCode != 259) //259 == STILL_ACTIVE { - bSuccess = GetExitCodeProcess(piProcInfo.hProcess, &exitCode); - if(!bSuccess || exitCode != 259) //259 == STILL_ACTIVE - break; - Sleep(5); + // process trailing text if not terminated by a newline + if (bytesFilled > 0) + demangleLine(buffer[0 .. bytesFilled], doDemangle, demangleAll, msMode, gdcMode, cp, linkerFound); + break; } + Sleep(5); } //close the handles to the process @@ -745,10 +757,10 @@ extern(C) WORD e_cs; // Initial (relative) CS value WORD e_lfarlc; // File address of relocation table WORD e_ovno; // Overlay number - WORD e_res[4]; // Reserved words + WORD[4] e_res; // Reserved words WORD e_oemid; // OEM identifier (for e_oeminfo) WORD e_oeminfo; // OEM information; e_oemid specific - WORD e_res2[10]; // Reserved words + WORD[10] e_res2; // Reserved words LONG e_lfanew; // File address of new exe header } diff --git a/tools/tlb2idl.d b/tools/tlb2idl.d index 528e0cc4..b04acf59 100644 --- a/tools/tlb2idl.d +++ b/tools/tlb2idl.d @@ -142,7 +142,7 @@ int WindowProc(HWND hWnd, uint uMsg, WPARAM wParam, LPARAM lParam) nothrow { idltext = toUTF8(buffer[0..$-1]); } - catch + catch(Throwable) { } if(idltext.length > 0) diff --git a/vdc/abothe/Parser b/vdc/abothe/Parser index aa801f76..474b12d2 160000 --- a/vdc/abothe/Parser +++ b/vdc/abothe/Parser @@ -1 +1 @@ -Subproject commit aa801f76386f988f1b0b0068cdfe4afec9517deb +Subproject commit 474b12d2dd8723b03b724ef6b820c8fe8afaff9b diff --git a/vdc/abothe/VDServer.sln b/vdc/abothe/VDServer.sln index 05ccda70..4f89653a 100644 --- a/vdc/abothe/VDServer.sln +++ b/vdc/abothe/VDServer.sln @@ -46,7 +46,8 @@ Global {7B4FB722-905A-4851-8399-1E0F3361CCD8}.Debug-Linux|x86.ActiveCfg = Debug|Any CPU {7B4FB722-905A-4851-8399-1E0F3361CCD8}.Release|Any CPU.ActiveCfg = Release|Any CPU {7B4FB722-905A-4851-8399-1E0F3361CCD8}.Release|Any CPU.Build.0 = Release|Any CPU - {7B4FB722-905A-4851-8399-1E0F3361CCD8}.Release|x86.ActiveCfg = Release|Any CPU + {7B4FB722-905A-4851-8399-1E0F3361CCD8}.Release|x86.ActiveCfg = Release|x86 + {7B4FB722-905A-4851-8399-1E0F3361CCD8}.Release|x86.Build.0 = Release|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/vdc/abothe/comserver/DParserCOMServer.cs b/vdc/abothe/comserver/DParserCOMServer.cs index 946b2dc2..514e02e3 100644 --- a/vdc/abothe/comserver/DParserCOMServer.cs +++ b/vdc/abothe/comserver/DParserCOMServer.cs @@ -106,6 +106,8 @@ public static ExeCOMServer Instance // The timer to trigger GC every 5 seconds private Timer _gcTimer; + private static uint _lastActivity; + /// /// The method is call every 5 seconds to GC the managed heap after /// the COM server is started. @@ -113,7 +115,12 @@ public static ExeCOMServer Instance /// private static void GarbageCollect(object stateInfo) { - GC.Collect(); // GC + uint activity = VDServer.Activity; + if (activity != _lastActivity) + { + _lastActivity = activity; + GC.Collect(); // GC + } } private uint _cookie; diff --git a/vdc/abothe/comserver/DParserCOMServer.csproj b/vdc/abothe/comserver/DParserCOMServer.csproj index dd668b7d..0be135d8 100644 --- a/vdc/abothe/comserver/DParserCOMServer.csproj +++ b/vdc/abothe/comserver/DParserCOMServer.csproj @@ -36,6 +36,24 @@ x86 false + + true + bin\x86\Debug\ + DEBUG;TRACE + full + x86 + prompt + MinimumRecommendedRules.ruleset + + + ..\..\..\bin\Release\DParserCOMServer\ + TRACE + true + pdbonly + x86 + prompt + MinimumRecommendedRules.ruleset + @@ -71,7 +89,4 @@ DParser2 - - - \ No newline at end of file diff --git a/vdc/abothe/comserver/VDServer.cs b/vdc/abothe/comserver/VDServer.cs index 4162e38e..46e5ea60 100644 --- a/vdc/abothe/comserver/VDServer.cs +++ b/vdc/abothe/comserver/VDServer.cs @@ -1,70 +1,71 @@ -// -// To be used by Visual D, set registry entry -// HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\9.0D\ToolsOptionsPages\Projects\Visual D Settings\VDServerIID -// to "{002a2de9-8bb6-484d-AA05-7e4ad4084715}" - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Windows.Forms; -using System.Runtime.InteropServices; -using System.ComponentModel; -using System.IO; -using Microsoft.Win32; -using System.Reflection; - -using D_Parser.Parser; -using D_Parser.Misc; -using D_Parser.Dom; -using D_Parser.Completion; -using D_Parser.Resolver; -using D_Parser.Resolver.TypeResolution; +// +// To be used by Visual D, set registry entry +// HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\9.0D\ToolsOptionsPages\Projects\Visual D Settings\VDServerIID +// to "{002a2de9-8bb6-484d-AA05-7e4ad4084715}" + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Windows.Forms; +using System.Runtime.InteropServices; +using System.ComponentModel; +using System.IO; +using System.Threading; +using Microsoft.Win32; +using System.Reflection; + +using D_Parser.Parser; +using D_Parser.Misc; +using D_Parser.Dom; +using D_Parser.Completion; +using D_Parser.Resolver; +using D_Parser.Resolver.TypeResolution; using D_Parser.Completion.ToolTips; using D_Parser.Refactoring; - -namespace DParserCOMServer -{ - public class IID - { - public const string IVDServer = "002a2de9-8bb6-484d-9901-7e4ad4084715"; - public const string VDServer = "002a2de9-8bb6-484d-AA05-7e4ad4084715"; - } - - [ComVisible(true), Guid(IID.IVDServer)] - [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] - public interface IVDServer - { - void ConfigureSemanticProject(string filename, string imp, string stringImp, string versionids, string debugids, uint flags); - void ClearSemanticProject(); - void UpdateModule(string filename, string srcText, bool verbose); - void GetTip(string filename, int startLine, int startIndex, int endLine, int endIndex); - void GetTipResult(out int startLine, out int startIndex, out int endLine, out int endIndex, out string answer); - void GetSemanticExpansions(string filename, string tok, uint line, uint idx, string expr); - void GetSemanticExpansionsResult(out string stringList); - void IsBinaryOperator(string filename, uint startLine, uint startIndex, uint endLine, uint endIndex, out bool pIsOp); - void GetParseErrors(string filename, out string errors); - void GetBinaryIsInLocations(string filename, out uint[] locs); // array of pairs of DWORD - void GetLastMessage(out string message); - void GetDefinition(string filename, int startLine, int startIndex, int endLine, int endIndex); + +namespace DParserCOMServer +{ + public class IID + { + public const string IVDServer = "002a2de9-8bb6-484d-9901-7e4ad4084715"; + public const string VDServer = "002a2de9-8bb6-484d-AA05-7e4ad4084715"; + } + + [ComVisible(true), Guid(IID.IVDServer)] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface IVDServer + { + void ConfigureSemanticProject(string filename, string imp, string stringImp, string versionids, string debugids, uint flags); + void ClearSemanticProject(); + void UpdateModule(string filename, string srcText, bool verbose); + void GetTip(string filename, int startLine, int startIndex, int endLine, int endIndex); + void GetTipResult(out int startLine, out int startIndex, out int endLine, out int endIndex, out string answer); + void GetSemanticExpansions(string filename, string tok, uint line, uint idx, string expr); + void GetSemanticExpansionsResult(out string stringList); + void IsBinaryOperator(string filename, uint startLine, uint startIndex, uint endLine, uint endIndex, out bool pIsOp); + void GetParseErrors(string filename, out string errors); + void GetBinaryIsInLocations(string filename, out uint[] locs); // array of pairs of DWORD + void GetLastMessage(out string message); + void GetDefinition(string filename, int startLine, int startIndex, int endLine, int endIndex); void GetDefinitionResult(out int startLine, out int startIndex, out int endLine, out int endIndex, out string filename); void GetReferences(string filename, string tok, uint line, uint idx, string expr); void GetReferencesResult(out string stringList); - } - - class NodeToolTipContentGen : NodeTooltipRepresentationGen - { - public static readonly NodeToolTipContentGen Instance = new NodeToolTipContentGen(); - - private NodeToolTipContentGen() { - SignatureFlags = TooltipSignatureFlags.NoEnsquaredDefaultParams | TooltipSignatureFlags.NoLineBreakedMethodParameters; - } - - protected override void AppendFormat (string content, StringBuilder sb, FormatFlags flags, double r = 0, double g = 0, double b = 0) - { - sb.Append (content); - //base.AppendFormat (content, sb, flags, r, g, b); - } + } + + class NodeToolTipContentGen : NodeTooltipRepresentationGen + { + public static readonly NodeToolTipContentGen Instance = new NodeToolTipContentGen(); + + private NodeToolTipContentGen() { + SignatureFlags = TooltipSignatureFlags.NoEnsquaredDefaultParams | TooltipSignatureFlags.NoLineBreakedMethodParameters; + } + + protected override void AppendFormat (string content, StringBuilder sb, FormatFlags flags, double r = 0, double g = 0, double b = 0) + { + sb.Append (content); + //base.AppendFormat (content, sb, flags, r, g, b); + } } public class VDserverParseCacheView : ParseCacheView @@ -104,41 +105,60 @@ public void Add(IEnumerable roots) if ((rp = GlobalParseCache.GetRootPackage(r)) != null && !packs.Contains(rp)) packs.Add(rp); } - } - - - [ComVisible(true), Guid(IID.VDServer)] - [ClassInterface(ClassInterfaceType.None)] - public class VDServer : IVDServer - { - private CodeLocation _tipStart, _tipEnd; - private readonly StringBuilder _tipText = new StringBuilder(); - private StringBuilder _expansions; - private StringBuilder _references; - private string _imports; - private string _stringImports; - private string _versionIds; - private string _debugIds; - private uint _flags; - EditorData _editorData = new EditorData(); - - // remember modules, the global cache might not yet be ready or might have forgotten a module - public Dictionary _modules = new Dictionary(); - - public DModule GetModule(string fileName) - { - DModule mod; + } + + public class Request + { + public const byte None = 0; + public const byte Tip = 1; + public const byte Expansions = 2; + public const byte Definition = 3; + public const byte References = 4; + } + + [ComVisible(true), Guid(IID.VDServer)] + [ClassInterface(ClassInterfaceType.None)] + public class VDServer : IVDServer + { + private CodeLocation _tipStart, _tipEnd; + + private string _result; + private byte _request = Request.None; + + private string _imports; + private string _stringImports; + private string _versionIds; + private string _debugIds; + private uint _flags; + + private static uint _activityCounter; + + public static uint Activity { get { return _activityCounter; } } + + EditorData _editorData = new EditorData(); + + // remember modules, the global cache might not yet be ready or might have forgotten a module + public Dictionary _modules = new Dictionary(); + + public DModule GetModule(string fileName) + { + DModule mod; mod = GlobalParseCache.GetModule (fileName); if (mod == null) _modules.TryGetValue(fileName, out mod); - return mod; - } - public Dictionary _sources = new Dictionary(); - - public VDServer() - { - // MessageBox.Show("VDServer()"); + return mod; } + public Dictionary _sources = new Dictionary(); + + public VDServer() + { + // MessageBox.Show("VDServer()"); + } + + ~VDServer() + { + StopCompletionThread(); + } private static string normalizePath(string path) { @@ -178,180 +198,280 @@ private string[] uniqueDirectories(string imp) return uniqueDirs; } - public void ConfigureSemanticProject(string filename, string imp, string stringImp, string versionids, string debugids, uint flags) - { - if (_imports != imp) + public void ConfigureSemanticProject(string filename, string imp, string stringImp, string versionids, string debugids, uint flags) + { + if (_imports != imp) { - string[] uniqueDirs = uniqueDirectories(imp); - GlobalParseCache.BeginAddOrUpdatePaths(uniqueDirs); - } - _imports = imp; - _stringImports = stringImp; - _versionIds = versionids; - _debugIds = debugids; - _flags = flags; - _setupEditorData(); - //MessageBox.Show("ConfigureSemanticProject()"); - //throw new NotImplementedException(); - } - public void ClearSemanticProject() - { - //MessageBox.Show("ClearSemanticProject()"); - //throw new NotImplementedException(); - } - public void UpdateModule(string filename, string srcText, bool verbose) + string[] uniqueDirs = uniqueDirectories(imp); + GlobalParseCache.BeginAddOrUpdatePaths(uniqueDirs); + _activityCounter++; + } + _imports = imp; + _stringImports = stringImp; + _versionIds = versionids; + _debugIds = debugids; + _flags = flags; + _setupEditorData(); + //MessageBox.Show("ConfigureSemanticProject()"); + //throw new NotImplementedException(); + } + public void ClearSemanticProject() { - filename = normalizePath(filename); - DModule ast; - try - { - ast = DParser.ParseString(srcText, false); - } - catch(Exception ex) - { - ast = new DModule{ ParseErrors = new System.Collections.ObjectModel.ReadOnlyCollection( - new List{ - new ParserError(false, ex.Message + "\n\n" + ex.StackTrace, DTokens.Invariant, CodeLocation.Empty) - }) }; //WTF - } - if(string.IsNullOrEmpty(ast.ModuleName)) - ast.ModuleName = Path.GetFileNameWithoutExtension(filename); - ast.FileName = filename; - - _modules [filename] = ast; - GlobalParseCache.AddOrUpdateModule(ast); - - _sources[filename] = srcText; - //MessageBox.Show("UpdateModule(" + filename + ")"); - //throw new NotImplementedException(); - } - - static int getCodeOffset(string s, CodeLocation loc) - { - // column/line 1-based - int off = 0; - for (int ln = 1; ln < loc.Line; ln++) - off = s.IndexOf('\n', off) + 1; - return off + loc.Column - 1; - } - - public void GetTip(string filename, int startLine, int startIndex, int endLine, int endIndex) + //MessageBox.Show("ClearSemanticProject()"); + //throw new NotImplementedException(); + } + public void UpdateModule(string filename, string srcText, bool verbose) { filename = normalizePath(filename); - var ast = GetModule(filename); - - if (ast == null) - throw new COMException("module not found", 1); - - _tipStart = new CodeLocation(startIndex + 1, startLine); - _tipEnd = new CodeLocation(startIndex + 2, startLine); - _tipText.Clear(); - - _setupEditorData(); - _editorData.CaretLocation = _tipStart; - _editorData.SyntaxTree = ast as DModule; - _editorData.ModuleCode = _sources[filename]; - // codeOffset+1 because otherwise it does not work on the first character - _editorData.CaretOffset = getCodeOffset(_editorData.ModuleCode, _tipStart) + 1; - - ISyntaxRegion sr = DResolver.GetScopedCodeObject(_editorData); - LooseResolution.NodeResolutionAttempt attempt; - var types = sr != null ? LooseResolution.ResolveTypeLoosely(_editorData, sr, out attempt, true) : null; - - _tipText.Clear(); - - if (types != null) + DModule ast; + try { - if (sr != null) - { - _tipStart = sr.Location; - _tipEnd = sr.EndLocation; - } - - DNode dn = null; - - foreach (var t in AmbiguousType.TryDissolve(types)){ - _tipText.Append(NodeToolTipContentGen.Instance.GenTooltipSignature(t)).Append("\a"); - if (t is DSymbol) - dn = (t as DSymbol).Definition; - } - - while (_tipText.Length > 0 && _tipText[_tipText.Length - 1] == '\a') - _tipText.Length--; - - if (dn != null) - VDServerCompletionDataGenerator.GenerateNodeTooltipBody(dn, _tipText); - - while (_tipText.Length > 0 && _tipText[_tipText.Length - 1] == '\a') - _tipText.Length--; - } - } - public void GetTipResult(out int startLine, out int startIndex, out int endLine, out int endIndex, out string answer) - { - startLine = _tipStart.Line; - startIndex = _tipStart.Column - 1; - endLine = _tipEnd.Line; - endIndex = _tipEnd.Column - 1; - answer = _tipText.ToString(); - //MessageBox.Show("GetTipResult()"); - //throw new NotImplementedException(); - } - - public void GetSemanticExpansions(string filename, string tok, uint line, uint idx, string expr) + ast = DParser.ParseString(srcText, false); + } + catch(Exception ex) + { + ast = new DModule{ ParseErrors = new System.Collections.ObjectModel.ReadOnlyCollection( + new List{ + new ParserError(false, ex.Message + "\n\n" + ex.StackTrace, DTokens.Invariant, CodeLocation.Empty) + }) }; //WTF + } + if(string.IsNullOrEmpty(ast.ModuleName)) + ast.ModuleName = Path.GetFileNameWithoutExtension(filename); + ast.FileName = filename; + + _modules [filename] = ast; + GlobalParseCache.AddOrUpdateModule(ast); + + _sources[filename] = srcText; + //MessageBox.Show("UpdateModule(" + filename + ")"); + //throw new NotImplementedException(); + _activityCounter++; + } + + static int getCodeOffset(string s, CodeLocation loc) + { + // column/line 1-based + int off = 0; + for (int ln = 1; ln < loc.Line; ln++) + off = s.IndexOf('\n', off) + 1; + return off + loc.Column - 1; + } + + Thread completionThread; + AutoResetEvent completionEvent = new AutoResetEvent(true); + Mutex completionMutex = new Mutex(); + Action runningAction; + Action nextAction; + CancellationTokenSource cancelTokenSource = new CancellationTokenSource(); + + void LaunchCompletionThread() + { + if (completionMutex.WaitOne(0)) + { + if (completionThread == null || !completionThread.IsAlive) + { + completionThread = new Thread(runAsyncCompletionLoop) + { + IsBackground = true, + Name = "completion thread", + Priority = ThreadPriority.BelowNormal + }; + completionThread.Start(); + } + completionMutex.ReleaseMutex(); + } + } + void StopCompletionThread() + { + if (completionMutex.WaitOne(0)) + { + if (completionThread != null && completionThread.IsAlive) + completionEvent.Set(); + completionThread = null; + completionMutex.ReleaseMutex(); + } + } + + void runAsyncCompletionLoop() + { + while (completionThread != null) + { + if (nextAction == null) + { + completionEvent.WaitOne(100); + continue; + } + if (completionMutex.WaitOne(100)) + { + runningAction = nextAction; + nextAction = null; + completionMutex.ReleaseMutex(); + } + if (runningAction != null) + { + cancelTokenSource = new CancellationTokenSource(); +#if NET40 +#else + if (CompletionOptions.Instance.CompletionTimeout > 0) + cancelTokenSource.CancelAfter(CompletionOptions.Instance.CompletionTimeout); +#endif + _editorData.CancelToken = cancelTokenSource.Token; + runningAction(); + _activityCounter++; + } + } + } + + void runAsync(Action a) + { + LaunchCompletionThread(); + if (completionMutex.WaitOne(0)) + { + cancelTokenSource.Cancel(); + nextAction = a; + completionMutex.ReleaseMutex(); + } + } + + public void GetTip(string filename, int startLine, int startIndex, int endLine, int endIndex) { filename = normalizePath(filename); - var ast = GetModule(filename); - - if (ast == null) - throw new COMException("module not found", 1); - - _setupEditorData(); - CodeLocation loc = new CodeLocation((int)idx + 1, (int) line); - _editorData.SyntaxTree = ast as DModule; - _editorData.ModuleCode = _sources[filename]; - _editorData.CaretOffset = getCodeOffset(_editorData.ModuleCode, loc); - // step back to beginning of identifier - while(_editorData.CaretOffset > 0 && Lexer.IsIdentifierPart(_editorData.ModuleCode[_editorData.CaretOffset-1])) - { - _editorData.CaretOffset--; - if(idx > 0) - idx--; - } - _editorData.CaretLocation = new CodeLocation((int)idx + 1, (int) line); - - char triggerChar = string.IsNullOrEmpty(tok) ? '\0' : tok[0]; - VDServerCompletionDataGenerator cdgen = new VDServerCompletionDataGenerator(tok); - CodeCompletion.GenerateCompletionData(_editorData, cdgen, triggerChar); - - _expansions = cdgen.expansions; - } - public void GetSemanticExpansionsResult(out string stringList) - { - stringList = _expansions != null ? _expansions.ToString() : null; - //MessageBox.Show("GetSemanticExpansionsResult()"); - //throw new NotImplementedException(); - } - - public void GetParseErrors(string filename, out string errors) + var ast = GetModule(filename); + + if (ast == null) + throw new COMException("module not found", 1); + + _tipStart = new CodeLocation(startIndex + 1, startLine); + _tipEnd = new CodeLocation(startIndex + 2, startLine); + + _request = Request.Tip; + _result = "__pending__"; + + Action dg = () => + { + _setupEditorData(); + _editorData.CaretLocation = _tipStart; + _editorData.SyntaxTree = ast as DModule; + _editorData.ModuleCode = _sources[filename]; + // codeOffset+1 because otherwise it does not work on the first character + _editorData.CaretOffset = getCodeOffset(_editorData.ModuleCode, _tipStart) + 1; + + ISyntaxRegion sr = DResolver.GetScopedCodeObject(_editorData); + LooseResolution.NodeResolutionAttempt attempt; + AbstractType types = sr != null ? LooseResolution.ResolveTypeLoosely(_editorData, sr, out attempt, true) : null; + + if (_editorData.CancelToken.IsCancellationRequested) + return; + + StringBuilder tipText = new StringBuilder(); + if (types != null) + { + if (sr != null) + { + _tipStart = sr.Location; + _tipEnd = sr.EndLocation; + } + + DNode dn = null; + + foreach (var t in AmbiguousType.TryDissolve(types)) + { + tipText.Append(NodeToolTipContentGen.Instance.GenTooltipSignature(t)).Append("\a"); + if (t is DSymbol) + dn = (t as DSymbol).Definition; + } + + while (tipText.Length > 0 && tipText[tipText.Length - 1] == '\a') + tipText.Length--; + + if (dn != null) + VDServerCompletionDataGenerator.GenerateNodeTooltipBody(dn, tipText); + + while (tipText.Length > 0 && tipText[tipText.Length - 1] == '\a') + tipText.Length--; + } + if (_request == Request.Tip) + _result = tipText.ToString(); + }; + runAsync (dg); + + } + public void GetTipResult(out int startLine, out int startIndex, out int endLine, out int endIndex, out string answer) + { + startLine = _tipStart.Line; + startIndex = _tipStart.Column - 1; + endLine = _tipEnd.Line; + endIndex = _tipEnd.Column - 1; + answer = _request == Request.Tip ? _result : "__cancelled__"; + //MessageBox.Show("GetTipResult()"); + //throw new NotImplementedException(); + } + + public void GetSemanticExpansions(string filename, string tok, uint line, uint idx, string expr) + { + filename = normalizePath(filename); + var ast = GetModule(filename); + + if (ast == null) + throw new COMException("module not found", 1); + + _request = Request.Expansions; + _result = "__pending__"; + + Action dg = () => + { + _setupEditorData(); + CodeLocation loc = new CodeLocation((int)idx + 1, (int) line); + _editorData.SyntaxTree = ast as DModule; + _editorData.ModuleCode = _sources[filename]; + _editorData.CaretOffset = getCodeOffset(_editorData.ModuleCode, loc); + // step back to beginning of identifier + while(_editorData.CaretOffset > 0 && Lexer.IsIdentifierPart(_editorData.ModuleCode[_editorData.CaretOffset-1])) + { + _editorData.CaretOffset--; + if(idx > 0) + idx--; + } + _editorData.CaretLocation = new CodeLocation((int)idx + 1, (int) line); + + char triggerChar = string.IsNullOrEmpty(tok) ? '\0' : tok[0]; + + VDServerCompletionDataGenerator cdgen = new VDServerCompletionDataGenerator(tok); + CodeCompletion.GenerateCompletionData(_editorData, cdgen, triggerChar); + if (!_editorData.CancelToken.IsCancellationRequested && _request == Request.Expansions) + { + _result = cdgen.expansions.ToString(); + } + }; + runAsync (dg); + } + public void GetSemanticExpansionsResult(out string stringList) + { + stringList = _request == Request.Expansions ? _result : "__cancelled__"; + //MessageBox.Show("GetSemanticExpansionsResult()"); + //throw new NotImplementedException(); + } + + public void GetParseErrors(string filename, out string errors) { filename = normalizePath(filename); - var ast = GetModule(filename); - - if (ast == null) - throw new COMException("module not found", 1); - - var asterrors = ast.ParseErrors; - - string errs = ""; - int cnt = asterrors.Count(); - for (int i = 0; i < cnt; i++) - { - var err = asterrors[i]; - errs += String.Format("{0},{1},{2},{3}:{4}\n", err.Location.Line, err.Location.Column - 1, err.Location.Line, err.Location.Column, err.Message); - } - errors = errs; - //MessageBox.Show("GetParseErrors()"); - //throw new COMException("No Message", 1); + var ast = GetModule(filename); + + if (ast == null) + throw new COMException("module not found", 1); + + var asterrors = ast.ParseErrors; + + string errs = ""; + int cnt = asterrors.Count(); + for (int i = 0; i < cnt; i++) + { + var err = asterrors[i]; + errs += String.Format("{0},{1},{2},{3}:{4}\n", err.Location.Line, err.Location.Column - 1, err.Location.Line, err.Location.Column, err.Message); + } + errors = errs; + //MessageBox.Show("GetParseErrors()"); + //throw new COMException("No Message", 1); } public void IsBinaryOperator(string filename, uint startLine, uint startIndex, uint endLine, uint endIndex, out bool pIsOp) @@ -365,82 +485,90 @@ public void IsBinaryOperator(string filename, uint startLine, uint startIndex, u //MessageBox.Show("IsBinaryOperator()"); throw new NotImplementedException(); } - public void GetBinaryIsInLocations(string filename, out uint[] locs) // array of pairs of DWORD - { - //MessageBox.Show("GetBinaryIsInLocations()"); - locs = null; - //throw new COMException("No Message", 1); - } - - public void GetLastMessage(out string message) - { - //MessageBox.Show("GetLastMessage()"); - message = "__no_message__"; // avoid throwing exception - //throw new COMException("No Message", 1); - } - - public void GetDefinition(string filename, int startLine, int startIndex, int endLine, int endIndex) + public void GetBinaryIsInLocations(string filename, out uint[] locs) // array of pairs of DWORD + { + //MessageBox.Show("GetBinaryIsInLocations()"); + locs = null; + //throw new COMException("No Message", 1); + } + + public void GetLastMessage(out string message) + { + //MessageBox.Show("GetLastMessage()"); + message = "__no_message__"; // avoid throwing exception + //throw new COMException("No Message", 1); + } + + public void GetDefinition(string filename, int startLine, int startIndex, int endLine, int endIndex) { filename = normalizePath(filename); - var ast = GetModule(filename); - - if (ast == null) - throw new COMException("module not found", 1); - - _tipStart = new CodeLocation(startIndex + 1, startLine); - _tipEnd = new CodeLocation(endIndex + 1, endLine); - _tipText.Clear(); - - _setupEditorData(); - _editorData.CaretLocation = _tipEnd; - _editorData.SyntaxTree = ast as DModule; - _editorData.ModuleCode = _sources[filename]; - // codeOffset+1 because otherwise it does not work on the first character - _editorData.CaretOffset = getCodeOffset(_editorData.ModuleCode, _tipStart) + 2; - - ISyntaxRegion sr = DResolver.GetScopedCodeObject(_editorData); - LooseResolution.NodeResolutionAttempt attempt; - var rr = sr != null ? LooseResolution.ResolveTypeLoosely(_editorData, sr, out attempt, true) : null; - - _tipText.Clear(); - if (rr != null) - { - DNode n = null; - foreach (var t in AmbiguousType.TryDissolve(rr)) - { - n = DResolver.GetResultMember(t, true); - if (n != null) - break; - } + var ast = GetModule(filename); + + if (ast == null) + throw new COMException("module not found", 1); + + _tipStart = new CodeLocation(startIndex + 1, startLine); + _tipEnd = new CodeLocation(endIndex + 1, endLine); + + _request = Request.Definition; + _result = "__pending__"; - if (n != null) + Action dg = () => + { + _setupEditorData(); + _editorData.CaretLocation = _tipEnd; + _editorData.SyntaxTree = ast as DModule; + _editorData.ModuleCode = _sources[filename]; + // codeOffset+1 because otherwise it does not work on the first character + _editorData.CaretOffset = getCodeOffset(_editorData.ModuleCode, _tipStart) + 2; + + ISyntaxRegion sr = DResolver.GetScopedCodeObject(_editorData); + LooseResolution.NodeResolutionAttempt attempt; + var rr = sr != null ? LooseResolution.ResolveTypeLoosely(_editorData, sr, out attempt, true) : null; + + StringBuilder tipText = new StringBuilder(); + if (rr != null) { - if (_tipText.Length > 0) - _tipText.Append("\n"); - bool decl = false; - var mthd = n as DMethod; - if (mthd != null) - decl = mthd.Body == null; - else if (n.ContainsAttribute(DTokens.Extern)) - decl = true; - if (decl) - _tipText.Append("EXTERN:"); - - _tipStart = n.Location; - _tipEnd = n.EndLocation; - INode node = n.NodeRoot; - if(node is DModule) - _tipText.Append((node as DModule).FileName); + DNode n = null; + foreach (var t in AmbiguousType.TryDissolve(rr)) + { + n = DResolver.GetResultMember(t, true); + if (n != null) + break; + } + + if (n != null) + { + if (tipText.Length > 0) + tipText.Append("\n"); + bool decl = false; + var mthd = n as DMethod; + if (mthd != null) + decl = mthd.Body == null; + else if (n.ContainsAttribute(DTokens.Extern)) + decl = true; + if (decl) + tipText.Append("EXTERN:"); + + _tipStart = n.Location; + _tipEnd = n.EndLocation; + INode node = n.NodeRoot; + if (node is DModule) + tipText.Append((node as DModule).FileName); + } } - } - } - public void GetDefinitionResult(out int startLine, out int startIndex, out int endLine, out int endIndex, out string filename) - { - startLine = _tipStart.Line; - startIndex = _tipStart.Column - 1; - endLine = _tipEnd.Line; - endIndex = _tipEnd.Column - 1; - filename = _tipText.ToString(); + if (!_editorData.CancelToken.IsCancellationRequested && _request == Request.Definition) + _result = tipText.ToString(); + }; + runAsync (dg); + } + public void GetDefinitionResult(out int startLine, out int startIndex, out int endLine, out int endIndex, out string filename) + { + startLine = _tipStart.Line; + startIndex = _tipStart.Column - 1; + endLine = _tipEnd.Line; + endIndex = _tipEnd.Column - 1; + filename = _request == Request.Definition ? _result : "__cancelled__"; } public void GetReferences(string filename, string tok, uint line, uint idx, string expr) @@ -451,41 +579,46 @@ public void GetReferences(string filename, string tok, uint line, uint idx, stri if (ast == null) throw new COMException("module not found", 1); - _setupEditorData(); - CodeLocation loc = new CodeLocation((int)idx + 1, (int)line); - _editorData.CaretLocation = loc; - _editorData.SyntaxTree = ast as DModule; - _editorData.ModuleCode = _sources[filename]; - _editorData.CaretOffset = getCodeOffset(_editorData.ModuleCode, loc); - - _references = null; - - ISyntaxRegion sr = DResolver.GetScopedCodeObject(_editorData); - LooseResolution.NodeResolutionAttempt attempt; - var rr = sr != null ? LooseResolution.ResolveTypeLoosely(_editorData, sr, out attempt, true) : null; - - StringBuilder refs = new StringBuilder(); - if (rr != null) - { - var n = DResolver.GetResultMember(rr, true); - - if (n != null) + _request = Request.References; + _result = "__pending__"; + + Action dg = () => + { + _setupEditorData(); + CodeLocation loc = new CodeLocation((int)idx + 1, (int)line); + _editorData.CaretLocation = loc; + _editorData.SyntaxTree = ast as DModule; + _editorData.ModuleCode = _sources[filename]; + _editorData.CaretOffset = getCodeOffset(_editorData.ModuleCode, loc); + + ISyntaxRegion sr = DResolver.GetScopedCodeObject(_editorData); + LooseResolution.NodeResolutionAttempt attempt; + var rr = sr != null ? LooseResolution.ResolveTypeLoosely(_editorData, sr, out attempt, true) : null; + + StringBuilder refs = new StringBuilder(); + if (rr != null) { - var ctxt = ResolutionContext.Create(_editorData, true); - if (n.ContainsAttribute(DTokens.Private) || ((n is DVariable) && (n as DVariable).IsLocal)) - { - GetReferencesInModule(ast, refs, n, ctxt); - } - else + var n = DResolver.GetResultMember(rr, true); + + if (n != null) { - foreach (var basePath in _imports.Split('\n')) - foreach (var mod in GlobalParseCache.EnumModulesRecursively(basePath)) - GetReferencesInModule(mod, refs, n, ctxt); + var ctxt = ResolutionContext.Create(_editorData, true); + if (n.ContainsAttribute(DTokens.Private) || ((n is DVariable) && (n as DVariable).IsLocal)) + { + GetReferencesInModule(ast, refs, n, ctxt); + } + else + { + foreach (var basePath in _imports.Split('\n')) + foreach (var mod in GlobalParseCache.EnumModulesRecursively(basePath)) + GetReferencesInModule(mod, refs, n, ctxt); + } } + //var res = TypeReferenceFinder.Scan(_editorData, System.Threading.CancellationToken.None, null); } - //var res = TypeReferenceFinder.Scan(_editorData, System.Threading.CancellationToken.None, null); - } - _references = refs; + if (!_editorData.CancelToken.IsCancellationRequested && _request == Request.References) + _result = refs.ToString(); + }; } private static void GetReferencesInModule(DModule ast, StringBuilder refs, DNode n, ResolutionContext ctxt) @@ -503,29 +636,29 @@ private static void GetReferencesInModule(DModule ast, StringBuilder refs, DNode } public void GetReferencesResult(out string stringList) { - stringList = _references != null ? _references.ToString() : null; + stringList = _request == Request.Definition ? _result : "__cancelled__"; //MessageBox.Show("GetSemanticExpansionsResult()"); //throw new NotImplementedException(); } - /////////////////////////////////// - void _setupEditorData() - { - string versions = _versionIds; - versions += "Windows\n" + "LittleEndian\n" + "D_HardFloat\n" + "all\n" + "D_Version2\n"; - if ((_flags & 1) != 0) - versions += "unittest\n"; - if ((_flags & 2) != 0) - versions += "assert\n"; - if ((_flags & 4) != 0) - versions += "Win64\n" + "X86_64\n" + "D_InlineAsm_X86_64\n" + "D_LP64\n"; - else - versions += "Win32\n" + "X86\n" + "D_InlineAsm_X86\n"; - if ((_flags & 8) != 0) - versions += "D_Coverage\n"; - if ((_flags & 16) != 0) - versions += "D_Ddoc\n"; - if ((_flags & 32) != 0) + /////////////////////////////////// + void _setupEditorData() + { + string versions = _versionIds; + versions += "Windows\n" + "LittleEndian\n" + "D_HardFloat\n" + "all\n" + "D_Version2\n"; + if ((_flags & 1) != 0) + versions += "unittest\n"; + if ((_flags & 2) != 0) + versions += "assert\n"; + if ((_flags & 4) != 0) + versions += "Win64\n" + "X86_64\n" + "D_InlineAsm_X86_64\n" + "D_LP64\n"; + else + versions += "Win32\n" + "X86\n" + "D_InlineAsm_X86\n"; + if ((_flags & 8) != 0) + versions += "D_Coverage\n"; + if ((_flags & 16) != 0) + versions += "D_Ddoc\n"; + if ((_flags & 32) != 0) versions += "D_NoBoundsChecks\n"; if ((_flags & 64) != 0) versions += "GNU\n"; @@ -541,95 +674,95 @@ void _setupEditorData() versions += "CRuntime_DigitalMars\n"; string[] uniqueDirs = uniqueDirectories(_imports); - _editorData.ParseCache = new VDserverParseCacheView(uniqueDirs); - _editorData.IsDebug = (_flags & 2) != 0; - _editorData.DebugLevel = (_flags >> 16) & 0xff; - _editorData.VersionNumber = (_flags >> 8) & 0xff; - _editorData.GlobalVersionIds = versions.Split('\n'); - _editorData.GlobalDebugIds = _debugIds.Split('\n'); - CompletionOptions.Instance.ShowUFCSItems = (_flags & 0x2000000) != 0; - CompletionOptions.Instance.DisableMixinAnalysis = (_flags & 0x1000000) == 0; - CompletionOptions.Instance.HideDeprecatedNodes = (_flags & 128) != 0; - CompletionOptions.Instance.CompletionTimeout = 500; - } - -#if false - [EditorBrowsable(EditorBrowsableState.Never)] - [ComRegisterFunction()] - public static void Register(Type t) - { - try - { - RegasmRegisterLocalServer(t); - } - catch (Exception ex) - { - Console.WriteLine(ex.Message); // Log the error - throw ex; // Re-throw the exception - } - } - - [EditorBrowsable(EditorBrowsableState.Never)] - [ComUnregisterFunction()] - public static void Unregister(Type t) - { - try - { - RegasmUnregisterLocalServer(t); - } - catch (Exception ex) - { - Console.WriteLine(ex.Message); // Log the error - throw ex; // Re-throw the exception - } - } - - /// - /// Register the component as a local server. - /// - /// - public static void RegasmRegisterLocalServer(Type t) - { - GuardNullType(t, "t"); // Check the argument - - // Open the CLSID key of the component. - using (RegistryKey keyCLSID = Registry.ClassesRoot.OpenSubKey( - @"CLSID\" + t.GUID.ToString("B"), /*writable*/true)) - { - // Remove the auto-generated InprocServer32 key after registration - // (REGASM puts it there but we are going out-of-proc). - keyCLSID.DeleteSubKeyTree("InprocServer32"); - - // Create "LocalServer32" under the CLSID key - using (RegistryKey subkey = keyCLSID.CreateSubKey("LocalServer32")) - { - subkey.SetValue("", Assembly.GetExecutingAssembly().Location, - RegistryValueKind.String); - } - } - } - - /// - /// Unregister the component. - /// - /// - public static void RegasmUnregisterLocalServer(Type t) - { - GuardNullType(t, "t"); // Check the argument - - // Delete the CLSID key of the component - Registry.ClassesRoot.DeleteSubKeyTree(@"CLSID\" + t.GUID.ToString("B")); - } - - private static void GuardNullType(Type t, String param) - { - if (t == null) - { - throw new ArgumentException("The CLR type must be specified.", param); - } - } -#endif - } -} - - + _editorData.ParseCache = new VDserverParseCacheView(uniqueDirs); + _editorData.IsDebug = (_flags & 2) != 0; + _editorData.DebugLevel = (_flags >> 16) & 0xff; + _editorData.VersionNumber = (_flags >> 8) & 0xff; + _editorData.GlobalVersionIds = versions.Split('\n'); + _editorData.GlobalDebugIds = _debugIds.Split('\n'); + CompletionOptions.Instance.ShowUFCSItems = (_flags & 0x2000000) != 0; + CompletionOptions.Instance.DisableMixinAnalysis = (_flags & 0x1000000) == 0; + CompletionOptions.Instance.HideDeprecatedNodes = (_flags & 128) != 0; + CompletionOptions.Instance.CompletionTimeout = -1; // 2000; + } + +#if false + [EditorBrowsable(EditorBrowsableState.Never)] + [ComRegisterFunction()] + public static void Register(Type t) + { + try + { + RegasmRegisterLocalServer(t); + } + catch (Exception ex) + { + Console.WriteLine(ex.Message); // Log the error + throw ex; // Re-throw the exception + } + } + + [EditorBrowsable(EditorBrowsableState.Never)] + [ComUnregisterFunction()] + public static void Unregister(Type t) + { + try + { + RegasmUnregisterLocalServer(t); + } + catch (Exception ex) + { + Console.WriteLine(ex.Message); // Log the error + throw ex; // Re-throw the exception + } + } + + /// + /// Register the component as a local server. + /// + /// + public static void RegasmRegisterLocalServer(Type t) + { + GuardNullType(t, "t"); // Check the argument + + // Open the CLSID key of the component. + using (RegistryKey keyCLSID = Registry.ClassesRoot.OpenSubKey( + @"CLSID\" + t.GUID.ToString("B"), /*writable*/true)) + { + // Remove the auto-generated InprocServer32 key after registration + // (REGASM puts it there but we are going out-of-proc). + keyCLSID.DeleteSubKeyTree("InprocServer32"); + + // Create "LocalServer32" under the CLSID key + using (RegistryKey subkey = keyCLSID.CreateSubKey("LocalServer32")) + { + subkey.SetValue("", Assembly.GetExecutingAssembly().Location, + RegistryValueKind.String); + } + } + } + + /// + /// Unregister the component. + /// + /// + public static void RegasmUnregisterLocalServer(Type t) + { + GuardNullType(t, "t"); // Check the argument + + // Delete the CLSID key of the component + Registry.ClassesRoot.DeleteSubKeyTree(@"CLSID\" + t.GUID.ToString("B")); + } + + private static void GuardNullType(Type t, String param) + { + if (t == null) + { + throw new ArgumentException("The CLR type must be specified.", param); + } + } +#endif + } +} + + diff --git a/vdc/lexer.d b/vdc/lexer.d index 72a1d26f..d7149de3 100644 --- a/vdc/lexer.d +++ b/vdc/lexer.d @@ -539,6 +539,28 @@ L_integer: return ch == ']' || ch == ')' || ch == '}'; } + static char closingBracket(dchar ch) + { + switch(ch) + { + case '{': return '}'; + case '(': return ')'; + case '[': return ']'; + default: return char.init; + } + } + + static char openingBracket(dchar ch) + { + switch(ch) + { + case '}': return '{'; + case ')': return '('; + case ']': return '['; + default: return char.init; + } + } + static dchar openingBracket(State s) { switch(s) diff --git a/vdc/logger.d b/vdc/logger.d index 72b00d5b..c5f88a64 100644 --- a/vdc/logger.d +++ b/vdc/logger.d @@ -48,7 +48,7 @@ version(enableLog) { static shared(Object) logSync = new shared(Object); - void logInfo(...) + void logInfo(T...)(string fmt, T args) { auto buffer = new char[17 + 1]; SysTime now = Clock.currTime(); @@ -58,13 +58,8 @@ version(enableLog) { string s = to!string(buffer[0..len]); s ~= replicate(" ", gLogIndent); - void putc(dchar c) - { - s ~= c; - } - try { - std.format.doFormat(&putc, _arguments, _argptr); + s ~= std.format.format(fmt, args); } catch(Exception e) { diff --git a/vdc/parser.visualdproj b/vdc/parser.visualdproj index 170de83c..39b69bd0 100644 --- a/vdc/parser.visualdproj +++ b/vdc/parser.visualdproj @@ -1028,7 +1028,7 @@ 0 2 0 - 0 + 1 0 0 0 @@ -1117,7 +1117,7 @@ 1 1 0 - -m32ms + *.obj @@ -1130,7 +1130,7 @@ 0 0 0 - 0 + 1 0 0 0 @@ -1428,6 +1428,210 @@ *.obj + + 0 + 0 + 1 + 0 + 0 + 2 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 1 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 2 + 0 + 0 + 0 + 0 + 0 + $(CC) -c + 1 + m:\s\d\rainers\windows\bin\dmd_msc.exe + .. + . + ..\bin\$(ConfigurationName) + $(OutDir)\parser + + + 0 + $(OutDir)\doc + + + + 0 + $(OutDir)\di + + 1 + $(IntDir)\$(ProjectName).json + 0 + + 0 + + 0 + 0 + 0 + + + + 0 + + 0 + $(VisualDInstallDir)cv2pdb\cv2pdb.exe + 0 + 0 + 0 + + + + + + + + $(OutDir)\$(ProjectName).lib + 1 + 2 + 0 + + + + *.obj + + + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 2.043 + 0 + 0 + 0 + 0 + 1 + $(CC) -c + 1 + m:\s\d\rainers\windows\bin\dmd_msc.exe + .. + . + ..\bin\$(ConfigurationName) + $(OutDir)\parser + + + 0 + $(OutDir)\doc + + + + 0 + $(OutDir)\di + + 1 + $(IntDir)\$(ProjectName).json + 0 + + 0 + + 0 + 0 + 0 + + + + 0 + + 1 + $(VisualDInstallDir)cv2pdb\cv2pdb.exe + 0 + 0 + 0 + + + + + + + + $(OutDir)\$(ProjectName).lib + 1 + 2 + 0 + + + + *.obj + diff --git a/vdc/vdserver.visualdproj b/vdc/vdserver.visualdproj index 0d0c362a..de021e70 100644 --- a/vdc/vdserver.visualdproj +++ b/vdc/vdserver.visualdproj @@ -824,7 +824,7 @@ 0 0 0 - 0 + 1 0 0 0 @@ -913,7 +913,7 @@ 1 1 0 - -L/SUBSYSTEM:WINDOWS -m32ms -debuglib=phobos,druntime + -L/SUBSYSTEM:WINDOWS *.obj;*.cmd;*.build;*.json;*.dep @@ -926,7 +926,7 @@ 0 0 0 - 0 + 1 0 0 0 @@ -1224,11 +1224,215 @@ *.obj;*.cmd;*.build;*.json;*.dep + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 2 + 0 + 0 + 0 + 0 + 0 + $(CC) -c + 1 + m:\s\d\rainers\windows\bin\dmd_msc.exe + .. + + ..\bin\$(ConfigurationName) + $(OutDir)\vdserver + + + 0 + ..\doc + + + + 0 + + + 1 + $(IntDir)\$(TargetName).json + 0 + + 0 + + 0 + 3 + 0 + + + + 0 + + 0 + $(VisualDInstallDir)cv2pdb\cv2pdb.exe + 0 + 0 + 0 + + + + ole32.lib oleaut32.lib + + + + $(OutDir)\$(ProjectName)_d.exe + 1 + 1 + 0 + -L/SUBSYSTEM:WINDOWS + + + *.obj;*.cmd;*.build;*.json;*.dep + + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 2.043 + 0 + 0 + 0 + 0 + 1 + $(CC) -c + 1 + m:\s\d\rainers\windows\bin\dmd_msc.exe + .. + + ..\bin\$(ConfigurationName) + $(OutDir)\vdserver + + + 0 + + + + + 0 + + + 1 + $(IntDir)\$(TargetName).json + 0 + + 0 + + 0 + 0 + 0 + + + + 0 + + 1 + $(VisualDInstallDir)cv2pdb\cv2pdb.exe + 0 + 0 + 0 + + + + ole32.lib oleaut32.lib + + + + $(OutDir)\$(ProjectName).exe + 1 + 1 + 0 + -L/SUBSYSTEM:WINDOWS + + + *.obj;*.cmd;*.build;*.json;*.dep + - - diff --git a/vdextensions/CoverageMargin.cs b/vdextensions/CoverageMargin.cs index de6570ac..b0b0207b 100644 --- a/vdextensions/CoverageMargin.cs +++ b/vdextensions/CoverageMargin.cs @@ -26,12 +26,12 @@ namespace vdextensions { /* [PackageRegistration(UseManagedResourcesOnly=true)] - class VDExtensionPackage : Package - { - } + class VDExtensionPackage : Package + { + } */ - #region covmargin Factory + #region covmargin Factory /// /// Export a , which returns an /// instance of the margin for the editor to use. @@ -47,15 +47,15 @@ internal sealed class MarginFactory : IWpfTextViewMarginProvider [Import] internal IEditorFormatMapService FormatMapService = null; - [Import(typeof(IVsEditorAdaptersFactoryService))] - internal IVsEditorAdaptersFactoryService editorFactory = null; + [Import(typeof(IVsEditorAdaptersFactoryService))] + internal IVsEditorAdaptersFactoryService editorFactory = null; - public IWpfTextViewMargin CreateMargin(IWpfTextViewHost textViewHost, IWpfTextViewMargin containerMargin) + public IWpfTextViewMargin CreateMargin(IWpfTextViewHost textViewHost, IWpfTextViewMargin containerMargin) { - if (!VisualDHelper.setFactory(editorFactory)) - return null; + if (!VisualDHelper.setFactory(editorFactory)) + return null; - //MessageBox.Show("CreateMargin"); + //MessageBox.Show("CreateMargin"); return new CoverageMargin(textViewHost.TextView, FormatMapService.GetEditorFormatMap(textViewHost.TextView)); } } @@ -82,21 +82,21 @@ class CoverageMargin : Canvas, IWpfTextViewMargin //, IClassifier private Color[] _backgroundColor = new Color[2]; private Color[] _foregroundColor = new Color[2]; - [DllImport("visuald.dll")] - public static extern bool GetCoverageData(string fname, int line, int[] data, int cnt, out float covPercent); - - static bool GetCoverage(string fname, int line, int[] data, int cnt, out float covPercent) - { - try - { - return GetCoverageData(fname, line, data, cnt, out covPercent); - } - catch - { - covPercent = -1; - return false; - } - } + [DllImport("visuald.dll")] + public static extern bool GetCoverageData(string fname, int line, int[] data, int cnt, out float covPercent); + + static bool GetCoverage(string fname, int line, int[] data, int cnt, out float covPercent) + { + try + { + return GetCoverageData(fname, line, data, cnt, out covPercent); + } + catch + { + covPercent = -1; + return false; + } + } /// /// Creates a for a given . @@ -132,14 +132,14 @@ public CoverageMargin(IWpfTextView textView, IEditorFormatMap formatMap) _formatMap.FormatMappingChanged += (sender, args) => OnFormatMappingChanged(); this.ToolTip = "To customize coverage margin colors select:\n" + - " Tools -> Options -> Fonts and Colors -> " + CovColorName; + " Tools -> Options -> Fonts and Colors -> " + CovColorName; } private void OnLayoutChanged(object sender, TextViewLayoutChangedEventArgs e) { //if (e.VerticalTranslation || e.NewOrReformattedLines.Count > 1) { - OnFormatMappingChanged(); + OnFormatMappingChanged(); } } @@ -148,12 +148,12 @@ private void OnFormatMappingChanged() _fontFamily = _textView.FormattedLineSource.DefaultTextProperties.Typeface.FontFamily; _fontEmSize = _textView.FormattedLineSource.DefaultTextProperties.FontRenderingEmSize; - float covPercent; - if (GetCoverage(_fileName, 0, null, 0, out covPercent)) - this.MinWidth = GetMarginWidth(new Typeface(_fontFamily.Source), _fontEmSize) + 2 * _labelOffsetX; - else - this.MinWidth = 0; - this.Width = this.MinWidth; + float covPercent; + if (GetCoverage(_fileName, 0, null, 0, out covPercent)) + this.MinWidth = GetMarginWidth(new Typeface(_fontFamily.Source), _fontEmSize) + 2 * _labelOffsetX; + else + this.MinWidth = 0; + this.Width = this.MinWidth; DrawLineNumbers(); } @@ -162,10 +162,10 @@ private void DrawLineNumbers() { if (this.Width <= 0) return; - if (_textView.InLayout) - return; + if (_textView.InLayout) + return; - // Get the index from the line collection where the cursor is currently sitting + // Get the index from the line collection where the cursor is currently sitting IVsTextBuffer buffer; _textView.TextBuffer.Properties.TryGetProperty(typeof(IVsTextBuffer), out buffer); int firstLine = 0; @@ -185,8 +185,8 @@ private void DrawLineNumbers() int lines = lastLine + 1 - firstLine; int[] covdata = new int[lines]; - float covPercent; - bool hasCoverage = GetCoverage(_fileName, firstLine, covdata, lines, out covPercent); + float covPercent; + bool hasCoverage = GetCoverage(_fileName, firstLine, covdata, lines, out covPercent); // GetColors(); if(!hasCoverage) return; @@ -198,7 +198,7 @@ private void DrawLineNumbers() FontWeight fontWeight = Convert.ToBoolean(bold) ? FontWeights.Bold : FontWeights.Normal; ResourceDictionary rd2 = _formatMap.GetProperties(NoCovColorName); - SolidColorBrush fgBrush2 = toBrush(rd2[EditorFormatDefinition.ForegroundBrushId]); + SolidColorBrush fgBrush2 = toBrush(rd2[EditorFormatDefinition.ForegroundBrushId]); SolidColorBrush bgBrush2 = toBrush(rd2[EditorFormatDefinition.BackgroundBrushId]); var bold2 = rd2[ClassificationFormatDefinition.IsBoldId]; FontWeight fontWeight2 = Convert.ToBoolean(bold2) ? FontWeights.Bold : FontWeights.Normal; @@ -214,8 +214,8 @@ private void DrawLineNumbers() buffer.GetLineIndexOfPosition(line.End, out last, out col); int cov = -1; bool hasNonCov = false; - bool showPercent = false; - for (int ln = first; ln <= last; ln++) + bool showPercent = false; + for (int ln = first; ln <= last; ln++) { int c = ln < firstLine || ln > lastLine ? -1 : covdata[ln - firstLine]; if(c == 0) @@ -225,27 +225,27 @@ private void DrawLineNumbers() else if(c >= 0) cov += c; } - if (cov < 0) - { - if (first > 0 || covPercent < 0) - continue; - showPercent = true; - } - - double zoom = _textView.ZoomLevel * 0.01; + if (cov < 0) + { + if (first > 0 || covPercent < 0) + continue; + showPercent = true; + } + + double zoom = _textView.ZoomLevel * 0.01; TextBlock tb = new TextBlock(); - tb.FontFamily = _fontFamily; - tb.FontSize = _fontEmSize * zoom; - if (showPercent) - tb.Text = string.Format("{0,3}%", (int)covPercent); - else - { - tb.Text = string.Format("{0,4}", cov); - tb.Foreground = hasNonCov ? fgBrush2 : fgBrush; - tb.FontWeight = hasNonCov ? fontWeight2 : fontWeight; - tb.Background = hasNonCov ? bgBrush2 : bgBrush; - } - Canvas.SetLeft(tb, _labelOffsetX); + tb.FontFamily = _fontFamily; + tb.FontSize = _fontEmSize * zoom; + if (showPercent) + tb.Text = string.Format("{0,3}%", (int)covPercent); + else + { + tb.Text = string.Format("{0,4}", cov); + tb.Foreground = hasNonCov ? fgBrush2 : fgBrush; + tb.FontWeight = hasNonCov ? fontWeight2 : fontWeight; + tb.Background = hasNonCov ? bgBrush2 : bgBrush; + } + Canvas.SetLeft(tb, _labelOffsetX); Canvas.SetTop(tb, (_textView.TextViewLines[i].TextTop - _textView.ViewportTop) * zoom); _canvas.Children.Add(tb); @@ -267,7 +267,7 @@ private void GetColors() storage = Package.GetGlobalService(typeof(SVsFontAndColorStorage)) as IVsFontAndColorStorage; var guid = new Guid("A27B4E24-A735-4d1d-B8E7-9716E1E3D8E0"); // text editor if (storage != null && storage.OpenCategory(ref guid, (uint)(__FCSTORAGEFLAGS.FCSF_NOAUTOCOLORS | - __FCSTORAGEFLAGS.FCSF_LOADDEFAULTS)) == 0) + __FCSTORAGEFLAGS.FCSF_LOADDEFAULTS)) == 0) { var info = new ColorableItemInfo[1]; storage.GetItem(NoCovColorName, info); @@ -288,16 +288,16 @@ public static Color ConvertFromWin32Color(uint color) { byte r = (byte)(color & 0x000000FF); byte g = (byte)((color & 0x0000FF00) >> 8); - byte b = (byte)((color & 0x00FF0000) >> 16); + byte b = (byte)((color & 0x00FF0000) >> 16); return Color.FromRgb(r, g, b); } private double GetMarginWidth(Typeface fontTypeFace, double fontSize) { FormattedText formattedText = new FormattedText("9999+", System.Globalization.CultureInfo.GetCultureInfo("en-us"), - System.Windows.FlowDirection.LeftToRight, fontTypeFace, fontSize, Brushes.Black); + System.Windows.FlowDirection.LeftToRight, fontTypeFace, fontSize, Brushes.Black); - return formattedText.MinWidth * _textView.ZoomLevel * 0.01; + return formattedText.MinWidth * _textView.ZoomLevel * 0.01; } private void ThrowIfDisposed() @@ -320,8 +320,8 @@ public double MarginSize get { ThrowIfDisposed(); - float covPercent; - if (GetCoverage(_fileName, 0, null, 0, out covPercent)) + float covPercent; + if (GetCoverage(_fileName, 0, null, 0, out covPercent)) return this.ActualWidth; return 0; } @@ -332,8 +332,8 @@ public bool Enabled get { ThrowIfDisposed(); - float covPercent; - return GetCoverage(_fileName, 0, null, 0, out covPercent); + float covPercent; + return GetCoverage(_fileName, 0, null, 0, out covPercent); } } @@ -352,58 +352,4 @@ public void Dispose() } } - public class IID - { - public const string IVisualDHelper = "002a2de9-8bb6-484d-9910-7e4ad4084715"; - public const string VisualDHelper = "002a2de9-8bb6-484d-AA10-7e4ad4084715"; - } - - [ComVisible(true), Guid(IID.IVisualDHelper)] - [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] - public interface IVisualDHelper - { - void GetTextOptions(IVsTextView view, out int flags, out int tabsize, out int indentsize); - } - - [ComVisible(true), Guid(IID.VisualDHelper)] - [ClassInterface(ClassInterfaceType.None)] - public class VisualDHelper : IVisualDHelper - { - [DllImport("visuald.dll")] - public static extern int RegisterHelper(IVisualDHelper helper); - [DllImport("visuald.dll")] - public static extern int UnregisterHelper(IVisualDHelper helper); - - static IVsEditorAdaptersFactoryService editorFactory; - - public static bool setFactory(IVsEditorAdaptersFactoryService factory) - { - editorFactory = factory; - return true; - } - - public VisualDHelper() - { - } - - public void Dispose() - { - } - - public void GetTextOptions(IVsTextView view, out int flags, out int tabsize, out int indentsize) - { - if (editorFactory == null) - throw new COMException(); - - IWpfTextView wv = editorFactory.GetWpfTextView(view); - if (wv == null || wv.Options == null) - throw new COMException(); - - bool spaces = wv.Options.GetOptionValue(DefaultOptions.ConvertTabsToSpacesOptionId); - flags = spaces ? 1 : 0; - tabsize = wv.Options.GetOptionValue(DefaultOptions.TabSizeOptionId); - indentsize = wv.Options.GetOptionValue(DefaultOptions.IndentSizeOptionId); - } - - } } diff --git a/vdextensions/vdextensions.cs b/vdextensions/vdextensions.cs new file mode 100644 index 00000000..342e6218 --- /dev/null +++ b/vdextensions/vdextensions.cs @@ -0,0 +1,68 @@ +// This file is part of Visual D +// +// Visual D integrates the D programming language into Visual Studio +// Copyright (c) 2016 by Rainer Schuetze, All Rights Reserved +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt + +using System; +using System.Runtime.InteropServices; // DllImport + +using Microsoft.VisualStudio.Text.Editor; +using Microsoft.VisualStudio.Editor; +using Microsoft.VisualStudio.TextManager.Interop; +using Microsoft.VisualStudio.Shell.Interop; + +namespace vdextensions +{ + public class IID + { + public const string IVisualDHelper = "002a2de9-8bb6-484d-9910-7e4ad4084715"; + public const string VisualDHelper = "002a2de9-8bb6-484d-AA10-7e4ad4084715"; + } + + [ComVisible(true), Guid(IID.IVisualDHelper)] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface IVisualDHelper + { + void GetTextOptions(IVsTextView view, out int flags, out int tabsize, out int indentsize); + } + + [ComVisible(true), Guid(IID.VisualDHelper)] + [ClassInterface(ClassInterfaceType.None)] + public partial class VisualDHelper : IVisualDHelper + { + static IVsEditorAdaptersFactoryService editorFactory; + + public static bool setFactory(IVsEditorAdaptersFactoryService factory) + { + editorFactory = factory; + return true; + } + + public VisualDHelper() + { + } + + public void Dispose() + { + } + + public void GetTextOptions(IVsTextView view, out int flags, out int tabsize, out int indentsize) + { + if (editorFactory == null) + throw new COMException(); + + IWpfTextView wv = editorFactory.GetWpfTextView(view); + if (wv == null || wv.Options == null) + throw new COMException(); + + bool spaces = wv.Options.GetOptionValue(DefaultOptions.ConvertTabsToSpacesOptionId); + flags = spaces ? 1 : 0; + tabsize = wv.Options.GetOptionValue(DefaultOptions.TabSizeOptionId); + indentsize = wv.Options.GetOptionValue(DefaultOptions.IndentSizeOptionId); + } + + } +} diff --git a/vdextensions/vdextensions.csproj b/vdextensions/vdextensions.csproj index 6841a0de..1cac247c 100644 --- a/vdextensions/vdextensions.csproj +++ b/vdextensions/vdextensions.csproj @@ -9,6 +9,8 @@ Library vdextensions vdextensions + assembly + c:\Windows\Microsoft.NET\assembly\GAC_MSIL True @@ -48,37 +50,40 @@ MinimumRecommendedRules.ruleset + + False + False - assembly\Microsoft.VisualStudio.ComponentModelHost\v4.0_10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.ComponentModelHost.dll + $(GAC_HintPath)\Microsoft.VisualStudio.ComponentModelHost\v4.0_10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.ComponentModelHost.dll False - assembly\Microsoft.VisualStudio.CoreUtility\v4.0_10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.CoreUtility.dll + $(GAC_HintPath)\Microsoft.VisualStudio.CoreUtility\v4.0_10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.CoreUtility.dll False - assembly\Microsoft.VisualStudio.Editor\v4.0_10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.Editor.dll + $(GAC_HintPath)\Microsoft.VisualStudio.Editor\v4.0_10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.Editor.dll False - assembly\Microsoft.VisualStudio.Shell.9.0\v4.0_10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.Shell.9.0.dll + $(GAC_HintPath)\Microsoft.VisualStudio.Shell.9.0\v4.0_10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.Shell.9.0.dll False - assembly\Microsoft.VisualStudio.Text.Data\v4.0_10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.Text.Data.dll + $(GAC_HintPath)\Microsoft.VisualStudio.Text.Data\v4.0_10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.Text.Data.dll False - assembly\Microsoft.VisualStudio.Text.Logic\v4.0_10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.Text.Logic.dll + $(GAC_HintPath)\Microsoft.VisualStudio.Text.Logic\v4.0_10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.Text.Logic.dll False - assembly\Microsoft.VisualStudio.Text.UI\v4.0_10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.Text.UI.dll + $(GAC_HintPath)\Microsoft.VisualStudio.Text.UI\v4.0_10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.Text.UI.dll False - assembly\Microsoft.VisualStudio.Text.UI.Wpf\v4.0_10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.Text.UI.Wpf.dll + $(GAC_HintPath)\Microsoft.VisualStudio.Text.UI.Wpf\v4.0_10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.Text.UI.Wpf.dll @@ -110,6 +115,7 @@ + diff --git a/vdextensions/vdextensions.sln b/vdextensions/vdextensions.sln index 432ff019..6ac19e70 100644 --- a/vdextensions/vdextensions.sln +++ b/vdextensions/vdextensions.sln @@ -1,26 +1,154 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 2013 -VisualStudioVersion = 12.0.21005.1 +VisualStudioVersion = 12.0.31101.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "vdextensions", "vdextensions.csproj", "{3A338E86-A08A-4F9A-8DB1-A5C280773BA3}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "dbuild", "..\msbuild\dbuild\dbuild.csproj", "{45508B90-440B-46DD-82CC-178196D9794E}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DParserCOMServer", "..\vdc\abothe\comserver\DParserCOMServer.csproj", "{7B4FB722-905A-4851-8399-1E0F3361CCD8}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DParser2", "..\vdc\abothe\Parser\DParser2\DParser2.csproj", "{0290A229-9AA1-41C3-B525-CAFB86D8BC42}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU + Debug|Mixed Platforms = Debug|Mixed Platforms Debug|x86 = Debug|x86 + Debug-Linux|Any CPU = Debug-Linux|Any CPU + Debug-Linux|Mixed Platforms = Debug-Linux|Mixed Platforms + Debug-Linux|x86 = Debug-Linux|x86 + Debug-v14|Any CPU = Debug-v14|Any CPU + Debug-v14|Mixed Platforms = Debug-v14|Mixed Platforms + Debug-v14|x86 = Debug-v14|x86 Release|Any CPU = Release|Any CPU + Release|Mixed Platforms = Release|Mixed Platforms Release|x86 = Release|x86 + Release-v14|Any CPU = Release-v14|Any CPU + Release-v14|Mixed Platforms = Release-v14|Mixed Platforms + Release-v14|x86 = Release-v14|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {3A338E86-A08A-4F9A-8DB1-A5C280773BA3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {3A338E86-A08A-4F9A-8DB1-A5C280773BA3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3A338E86-A08A-4F9A-8DB1-A5C280773BA3}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 + {3A338E86-A08A-4F9A-8DB1-A5C280773BA3}.Debug|Mixed Platforms.Build.0 = Debug|x86 {3A338E86-A08A-4F9A-8DB1-A5C280773BA3}.Debug|x86.ActiveCfg = Debug|x86 {3A338E86-A08A-4F9A-8DB1-A5C280773BA3}.Debug|x86.Build.0 = Debug|x86 + {3A338E86-A08A-4F9A-8DB1-A5C280773BA3}.Debug-Linux|Any CPU.ActiveCfg = Debug|Any CPU + {3A338E86-A08A-4F9A-8DB1-A5C280773BA3}.Debug-Linux|Any CPU.Build.0 = Debug|Any CPU + {3A338E86-A08A-4F9A-8DB1-A5C280773BA3}.Debug-Linux|Mixed Platforms.ActiveCfg = Debug|x86 + {3A338E86-A08A-4F9A-8DB1-A5C280773BA3}.Debug-Linux|Mixed Platforms.Build.0 = Debug|x86 + {3A338E86-A08A-4F9A-8DB1-A5C280773BA3}.Debug-Linux|x86.ActiveCfg = Debug|x86 + {3A338E86-A08A-4F9A-8DB1-A5C280773BA3}.Debug-Linux|x86.Build.0 = Debug|x86 + {3A338E86-A08A-4F9A-8DB1-A5C280773BA3}.Debug-v14|Any CPU.ActiveCfg = Debug|Any CPU + {3A338E86-A08A-4F9A-8DB1-A5C280773BA3}.Debug-v14|Any CPU.Build.0 = Debug|Any CPU + {3A338E86-A08A-4F9A-8DB1-A5C280773BA3}.Debug-v14|Mixed Platforms.ActiveCfg = Debug|x86 + {3A338E86-A08A-4F9A-8DB1-A5C280773BA3}.Debug-v14|Mixed Platforms.Build.0 = Debug|x86 + {3A338E86-A08A-4F9A-8DB1-A5C280773BA3}.Debug-v14|x86.ActiveCfg = Debug|x86 + {3A338E86-A08A-4F9A-8DB1-A5C280773BA3}.Debug-v14|x86.Build.0 = Debug|x86 {3A338E86-A08A-4F9A-8DB1-A5C280773BA3}.Release|Any CPU.ActiveCfg = Debug|x86 {3A338E86-A08A-4F9A-8DB1-A5C280773BA3}.Release|Any CPU.Build.0 = Debug|x86 + {3A338E86-A08A-4F9A-8DB1-A5C280773BA3}.Release|Mixed Platforms.ActiveCfg = Release|x86 + {3A338E86-A08A-4F9A-8DB1-A5C280773BA3}.Release|Mixed Platforms.Build.0 = Release|x86 {3A338E86-A08A-4F9A-8DB1-A5C280773BA3}.Release|x86.ActiveCfg = Release|x86 {3A338E86-A08A-4F9A-8DB1-A5C280773BA3}.Release|x86.Build.0 = Release|x86 + {3A338E86-A08A-4F9A-8DB1-A5C280773BA3}.Release-v14|Any CPU.ActiveCfg = Release|Any CPU + {3A338E86-A08A-4F9A-8DB1-A5C280773BA3}.Release-v14|Any CPU.Build.0 = Release|Any CPU + {3A338E86-A08A-4F9A-8DB1-A5C280773BA3}.Release-v14|Mixed Platforms.ActiveCfg = Release|x86 + {3A338E86-A08A-4F9A-8DB1-A5C280773BA3}.Release-v14|Mixed Platforms.Build.0 = Release|x86 + {3A338E86-A08A-4F9A-8DB1-A5C280773BA3}.Release-v14|x86.ActiveCfg = Release|x86 + {3A338E86-A08A-4F9A-8DB1-A5C280773BA3}.Release-v14|x86.Build.0 = Release|x86 + {45508B90-440B-46DD-82CC-178196D9794E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {45508B90-440B-46DD-82CC-178196D9794E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {45508B90-440B-46DD-82CC-178196D9794E}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {45508B90-440B-46DD-82CC-178196D9794E}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {45508B90-440B-46DD-82CC-178196D9794E}.Debug|x86.ActiveCfg = Debug|Any CPU + {45508B90-440B-46DD-82CC-178196D9794E}.Debug|x86.Build.0 = Debug|Any CPU + {45508B90-440B-46DD-82CC-178196D9794E}.Debug-Linux|Any CPU.ActiveCfg = Debug-v14|Any CPU + {45508B90-440B-46DD-82CC-178196D9794E}.Debug-Linux|Any CPU.Build.0 = Debug-v14|Any CPU + {45508B90-440B-46DD-82CC-178196D9794E}.Debug-Linux|Mixed Platforms.ActiveCfg = Debug-v14|Any CPU + {45508B90-440B-46DD-82CC-178196D9794E}.Debug-Linux|Mixed Platforms.Build.0 = Debug-v14|Any CPU + {45508B90-440B-46DD-82CC-178196D9794E}.Debug-Linux|x86.ActiveCfg = Debug-v14|Any CPU + {45508B90-440B-46DD-82CC-178196D9794E}.Debug-v14|Any CPU.ActiveCfg = Debug-v14|Any CPU + {45508B90-440B-46DD-82CC-178196D9794E}.Debug-v14|Any CPU.Build.0 = Debug-v14|Any CPU + {45508B90-440B-46DD-82CC-178196D9794E}.Debug-v14|Mixed Platforms.ActiveCfg = Debug-v14|Any CPU + {45508B90-440B-46DD-82CC-178196D9794E}.Debug-v14|Mixed Platforms.Build.0 = Debug-v14|Any CPU + {45508B90-440B-46DD-82CC-178196D9794E}.Debug-v14|x86.ActiveCfg = Debug-v14|Any CPU + {45508B90-440B-46DD-82CC-178196D9794E}.Debug-v14|x86.Build.0 = Debug-v14|Any CPU + {45508B90-440B-46DD-82CC-178196D9794E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {45508B90-440B-46DD-82CC-178196D9794E}.Release|Any CPU.Build.0 = Release|Any CPU + {45508B90-440B-46DD-82CC-178196D9794E}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {45508B90-440B-46DD-82CC-178196D9794E}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {45508B90-440B-46DD-82CC-178196D9794E}.Release|x86.ActiveCfg = Release|Any CPU + {45508B90-440B-46DD-82CC-178196D9794E}.Release|x86.Build.0 = Release|Any CPU + {45508B90-440B-46DD-82CC-178196D9794E}.Release-v14|Any CPU.ActiveCfg = Release-v14|Any CPU + {45508B90-440B-46DD-82CC-178196D9794E}.Release-v14|Any CPU.Build.0 = Release-v14|Any CPU + {45508B90-440B-46DD-82CC-178196D9794E}.Release-v14|Mixed Platforms.ActiveCfg = Release-v14|Any CPU + {45508B90-440B-46DD-82CC-178196D9794E}.Release-v14|Mixed Platforms.Build.0 = Release-v14|Any CPU + {45508B90-440B-46DD-82CC-178196D9794E}.Release-v14|x86.ActiveCfg = Release-v14|Any CPU + {45508B90-440B-46DD-82CC-178196D9794E}.Release-v14|x86.Build.0 = Release-v14|Any CPU + {7B4FB722-905A-4851-8399-1E0F3361CCD8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7B4FB722-905A-4851-8399-1E0F3361CCD8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7B4FB722-905A-4851-8399-1E0F3361CCD8}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 + {7B4FB722-905A-4851-8399-1E0F3361CCD8}.Debug|Mixed Platforms.Build.0 = Debug|x86 + {7B4FB722-905A-4851-8399-1E0F3361CCD8}.Debug|x86.ActiveCfg = Debug|x86 + {7B4FB722-905A-4851-8399-1E0F3361CCD8}.Debug|x86.Build.0 = Debug|x86 + {7B4FB722-905A-4851-8399-1E0F3361CCD8}.Debug-Linux|Any CPU.ActiveCfg = Debug|Any CPU + {7B4FB722-905A-4851-8399-1E0F3361CCD8}.Debug-Linux|Any CPU.Build.0 = Debug|Any CPU + {7B4FB722-905A-4851-8399-1E0F3361CCD8}.Debug-Linux|Mixed Platforms.ActiveCfg = Debug|x86 + {7B4FB722-905A-4851-8399-1E0F3361CCD8}.Debug-Linux|Mixed Platforms.Build.0 = Debug|x86 + {7B4FB722-905A-4851-8399-1E0F3361CCD8}.Debug-Linux|x86.ActiveCfg = Debug|x86 + {7B4FB722-905A-4851-8399-1E0F3361CCD8}.Debug-Linux|x86.Build.0 = Debug|x86 + {7B4FB722-905A-4851-8399-1E0F3361CCD8}.Debug-v14|Any CPU.ActiveCfg = Debug|Any CPU + {7B4FB722-905A-4851-8399-1E0F3361CCD8}.Debug-v14|Any CPU.Build.0 = Debug|Any CPU + {7B4FB722-905A-4851-8399-1E0F3361CCD8}.Debug-v14|Mixed Platforms.ActiveCfg = Debug|x86 + {7B4FB722-905A-4851-8399-1E0F3361CCD8}.Debug-v14|Mixed Platforms.Build.0 = Debug|x86 + {7B4FB722-905A-4851-8399-1E0F3361CCD8}.Debug-v14|x86.ActiveCfg = Debug|x86 + {7B4FB722-905A-4851-8399-1E0F3361CCD8}.Debug-v14|x86.Build.0 = Debug|x86 + {7B4FB722-905A-4851-8399-1E0F3361CCD8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7B4FB722-905A-4851-8399-1E0F3361CCD8}.Release|Any CPU.Build.0 = Release|Any CPU + {7B4FB722-905A-4851-8399-1E0F3361CCD8}.Release|Mixed Platforms.ActiveCfg = Release|x86 + {7B4FB722-905A-4851-8399-1E0F3361CCD8}.Release|Mixed Platforms.Build.0 = Release|x86 + {7B4FB722-905A-4851-8399-1E0F3361CCD8}.Release|x86.ActiveCfg = Release|x86 + {7B4FB722-905A-4851-8399-1E0F3361CCD8}.Release|x86.Build.0 = Release|x86 + {7B4FB722-905A-4851-8399-1E0F3361CCD8}.Release-v14|Any CPU.ActiveCfg = Release|Any CPU + {7B4FB722-905A-4851-8399-1E0F3361CCD8}.Release-v14|Any CPU.Build.0 = Release|Any CPU + {7B4FB722-905A-4851-8399-1E0F3361CCD8}.Release-v14|Mixed Platforms.ActiveCfg = Release|x86 + {7B4FB722-905A-4851-8399-1E0F3361CCD8}.Release-v14|Mixed Platforms.Build.0 = Release|x86 + {7B4FB722-905A-4851-8399-1E0F3361CCD8}.Release-v14|x86.ActiveCfg = Release|x86 + {7B4FB722-905A-4851-8399-1E0F3361CCD8}.Release-v14|x86.Build.0 = Release|x86 + {0290A229-9AA1-41C3-B525-CAFB86D8BC42}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0290A229-9AA1-41C3-B525-CAFB86D8BC42}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0290A229-9AA1-41C3-B525-CAFB86D8BC42}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 + {0290A229-9AA1-41C3-B525-CAFB86D8BC42}.Debug|Mixed Platforms.Build.0 = Debug|x86 + {0290A229-9AA1-41C3-B525-CAFB86D8BC42}.Debug|x86.ActiveCfg = Debug|x86 + {0290A229-9AA1-41C3-B525-CAFB86D8BC42}.Debug|x86.Build.0 = Debug|x86 + {0290A229-9AA1-41C3-B525-CAFB86D8BC42}.Debug-Linux|Any CPU.ActiveCfg = Debug-Linux|Any CPU + {0290A229-9AA1-41C3-B525-CAFB86D8BC42}.Debug-Linux|Any CPU.Build.0 = Debug-Linux|Any CPU + {0290A229-9AA1-41C3-B525-CAFB86D8BC42}.Debug-Linux|Mixed Platforms.ActiveCfg = Debug-Linux|x86 + {0290A229-9AA1-41C3-B525-CAFB86D8BC42}.Debug-Linux|Mixed Platforms.Build.0 = Debug-Linux|x86 + {0290A229-9AA1-41C3-B525-CAFB86D8BC42}.Debug-Linux|x86.ActiveCfg = Debug-Linux|x86 + {0290A229-9AA1-41C3-B525-CAFB86D8BC42}.Debug-Linux|x86.Build.0 = Debug-Linux|x86 + {0290A229-9AA1-41C3-B525-CAFB86D8BC42}.Debug-v14|Any CPU.ActiveCfg = Debug-Linux|Any CPU + {0290A229-9AA1-41C3-B525-CAFB86D8BC42}.Debug-v14|Any CPU.Build.0 = Debug-Linux|Any CPU + {0290A229-9AA1-41C3-B525-CAFB86D8BC42}.Debug-v14|Mixed Platforms.ActiveCfg = Debug-Linux|x86 + {0290A229-9AA1-41C3-B525-CAFB86D8BC42}.Debug-v14|Mixed Platforms.Build.0 = Debug-Linux|x86 + {0290A229-9AA1-41C3-B525-CAFB86D8BC42}.Debug-v14|x86.ActiveCfg = Debug|x86 + {0290A229-9AA1-41C3-B525-CAFB86D8BC42}.Debug-v14|x86.Build.0 = Debug|x86 + {0290A229-9AA1-41C3-B525-CAFB86D8BC42}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0290A229-9AA1-41C3-B525-CAFB86D8BC42}.Release|Any CPU.Build.0 = Release|Any CPU + {0290A229-9AA1-41C3-B525-CAFB86D8BC42}.Release|Mixed Platforms.ActiveCfg = Release|x86 + {0290A229-9AA1-41C3-B525-CAFB86D8BC42}.Release|Mixed Platforms.Build.0 = Release|x86 + {0290A229-9AA1-41C3-B525-CAFB86D8BC42}.Release|x86.ActiveCfg = Release|x86 + {0290A229-9AA1-41C3-B525-CAFB86D8BC42}.Release|x86.Build.0 = Release|x86 + {0290A229-9AA1-41C3-B525-CAFB86D8BC42}.Release-v14|Any CPU.ActiveCfg = Release|Any CPU + {0290A229-9AA1-41C3-B525-CAFB86D8BC42}.Release-v14|Any CPU.Build.0 = Release|Any CPU + {0290A229-9AA1-41C3-B525-CAFB86D8BC42}.Release-v14|Mixed Platforms.ActiveCfg = Release|x86 + {0290A229-9AA1-41C3-B525-CAFB86D8BC42}.Release-v14|Mixed Platforms.Build.0 = Release|x86 + {0290A229-9AA1-41C3-B525-CAFB86D8BC42}.Release-v14|x86.ActiveCfg = Release|x86 + {0290A229-9AA1-41C3-B525-CAFB86D8BC42}.Release-v14|x86.Build.0 = Release|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/visuald/Templates/ProjectItems/ConsoleDLG/ConsoleApp.visualdproj b/visuald/Templates/ProjectItems/ConsoleDLG/ConsoleApp.visualdproj new file mode 100644 index 00000000..bd325c1d --- /dev/null +++ b/visuald/Templates/ProjectItems/ConsoleDLG/ConsoleApp.visualdproj @@ -0,0 +1,96 @@ + + $guid1$ + + 0 + 0 + 1 + 1 + 0 + + + 0 + 0 + 0 + 1 + 1 + 1 + + + 1 + 0 + 1 + 1 + 0 + + + 1 + 0 + 0 + 1 + 1 + 1 + + + 0 + 2 + 1 + 1 + 0 + + + 0 + 2 + 0 + 1 + 1 + 1 + + + 1 + 2 + 1 + 1 + 0 + + + 1 + 2 + 0 + 1 + 1 + 1 + + + 0 + 1 + 1 + 1 + 0 + + + 0 + 1 + 0 + 1 + 1 + 1 + + + 1 + 1 + 1 + 1 + 0 + + + 1 + 1 + 0 + 1 + 1 + 1 + + + + + diff --git a/visuald/Templates/ProjectItems/ConsoleDLG/ConsoleApp.vstemplate b/visuald/Templates/ProjectItems/ConsoleDLG/ConsoleApp.vstemplate new file mode 100644 index 00000000..3d62dc14 --- /dev/null +++ b/visuald/Templates/ProjectItems/ConsoleDLG/ConsoleApp.vstemplate @@ -0,0 +1,18 @@ + + + Console Application DMD/LDC/GDC x86/x64 + A project for creating a command-line application with DMD/LDC/GDC for x86/x64 + __TemplateIcon.ico + D + 50 + 1 + true + ConsoleApplication + true + + + + main.d + + + diff --git a/visuald/Templates/ProjectItems/ConsoleDLG/main.d b/visuald/Templates/ProjectItems/ConsoleDLG/main.d new file mode 100644 index 00000000..91c90e7a --- /dev/null +++ b/visuald/Templates/ProjectItems/ConsoleDLG/main.d @@ -0,0 +1,7 @@ +import std.stdio; + +int main(string[] argv) +{ + writeln("Hello D-World!"); + return 0; +} diff --git a/visuald/Templates/Projects/DTemplates.vsdir b/visuald/Templates/Projects/DTemplates.vsdir index 9f8ff868..fdb0863d 100644 --- a/visuald/Templates/Projects/DTemplates.vsdir +++ b/visuald/Templates/Projects/DTemplates.vsdir @@ -1,6 +1,7 @@ ..\ProjectItems\ConsoleApp\ConsoleApp.vstemplate|{002A2DE9-8BB6-484D-987F-7E4AD4084715}|Console Application|30|A project for creating a command-line application|0|#1000|0|ConsoleApp ..\ProjectItems\ConsoleDMDGDC\ConsoleApp.vstemplate|{002A2DE9-8BB6-484D-987F-7E4AD4084715}|Console Application DMD/GDC|30|A project for creating a command-line application with DMD/GDC for x86/x64|0|#1000|0|ConsoleApp ..\ProjectItems\ConsoleDMDLDC\ConsoleApp.vstemplate|{002A2DE9-8BB6-484D-987F-7E4AD4084715}|Console Application DMD/LDC|30|A project for creating a command-line application with DMD/LDC for x86/x64|0|#1000|0|ConsoleApp +..\ProjectItems\ConsoleDLG\ConsoleApp.vstemplate|{002A2DE9-8BB6-484D-987F-7E4AD4084715}|Console Application DMD/LDC/GDC|30|A project for creating a command-line application with DMD/LDC/GDC for x86/x64|0|#1000|0|ConsoleApp ..\ProjectItems\WindowsApp\WindowsApp.vstemplate|{002A2DE9-8BB6-484D-987F-7E4AD4084715}|Windows Application|30|A project for creating a Windows application|0|#1000|0|WindowsApp ..\ProjectItems\DynamicLib\DynamicLib.vstemplate|{002A2DE9-8BB6-484D-987F-7E4AD4084715}|Dynamic Library (DLL)|30|A project for creating a dynamic library|0|#1000|0|DynamicLib ..\ProjectItems\StaticLib\StaticLib.vstemplate|{002A2DE9-8BB6-484D-987F-7E4AD4084715}|Static Library|30|A project for creating a static library|0|#1000|0|StaticLib diff --git a/visuald/build.d b/visuald/build.d index 9dd9b9e4..26b2c173 100644 --- a/visuald/build.d +++ b/visuald/build.d @@ -1063,7 +1063,7 @@ bool isInitializedRE(T)(ref T re) static if(__traits(compiles,re.ir)) return re.ir !is null; // stdext.fred else - return re.captures() > 0; // std.regex + return !re.empty; // std.regex } bool parseOutputStringForTaskItem(string outputLine, out uint nPriority, diff --git a/visuald/colorizer.d b/visuald/colorizer.d index a8e0b16f..f0ed4833 100644 --- a/visuald/colorizer.d +++ b/visuald/colorizer.d @@ -751,7 +751,7 @@ class Colorizer : DisposingComObject, IVsColorizer, ConfigModifiedListener if (debugOrVersion) { - if(ident.length == 0 && mConfigRelease != 0) + if(ident.length == 0 && mConfigRelease == 0) return true; } else diff --git a/visuald/completion.d b/visuald/completion.d index 2cb418a4..44bda7e6 100644 --- a/visuald/completion.d +++ b/visuald/completion.d @@ -406,15 +406,15 @@ class Declarations if(tok.length && !dLex.isIdentifierCharOrDigit(tok.front)) tok = ""; - int line, idx; - int hr = textView.GetCaretPos(&line, &idx); + int caretLine, caretIdx; + int hr = textView.GetCaretPos(&caretLine, &caretIdx); src.ensureCurrentTextParsed(); // pass new text before expansion request auto langsvc = Package.GetLanguageService(); mPendingSource = src; mPendingView = textView; - mPendingRequest = langsvc.GetSemanticExpansions(src, tok, line, idx, &OnExpansions); + mPendingRequest = langsvc.GetSemanticExpansions(src, tok, caretLine, caretIdx, &OnExpansions); return true; } catch(Error e) @@ -429,45 +429,53 @@ class Declarations if(request != mPendingRequest) return; - if(symbols.length > 0 && mPendingSource) + if(symbols.length > 0 && mPendingSource && mPendingView) { - // split after second ':' to combine same name and type - static string splitName(string name, ref string desc) - { - auto pos = name.indexOf(':'); - if(pos < 0) - return name; - pos = name.indexOf(':', pos + 1); - if(pos < 0) - return name; - desc = name[pos..$]; - return name[0..pos]; - } + auto activeView = GetActiveView(); + scope(exit) release(activeView); - // go through assoc array for faster uniqueness check - string[string] names; - foreach(n; mNames) - { - string desc; - string name = splitName(n, desc); - names[name] = desc; - } - foreach(s; symbols) + int caretLine, caretIdx; + int hr = mPendingView.GetCaretPos(&caretLine, &caretIdx); + if (activeView == mPendingView && line == caretLine && idx == caretIdx) { - string desc; - string name = splitName(s, desc); - if(auto p = name in names) - *p ~= "\a\a" ~ desc[1..$]; // strip ":" - else + // split after second ':' to combine same name and type + static string splitName(string name, ref string desc) + { + auto pos = name.indexOf(':'); + if(pos < 0) + return name; + pos = name.indexOf(':', pos + 1); + if(pos < 0) + return name; + desc = name[pos..$]; + return name[0..pos]; + } + + // go through assoc array for faster uniqueness check + string[string] names; + foreach(n; mNames) + { + string desc; + string name = splitName(n, desc); names[name] = desc; - } - mNames.length = names.length; - size_t i = 0; - foreach(n, desc; names) - mNames[i++] = n ~ desc; + } + foreach(s; symbols) + { + string desc; + string name = splitName(s, desc); + if(auto p = name in names) + *p ~= "\a\a" ~ desc[1..$]; // strip ":" + else + names[name] = desc; + } + mNames.length = names.length; + size_t i = 0; + foreach(n, desc; names) + mNames[i++] = n ~ desc; - sort!("icmp(a, b) < 0", SwapStrategy.stable)(mNames); - mPendingSource.GetCompletionSet().Init(mPendingView, this, false); + sort!("icmp(a, b) < 0", SwapStrategy.stable)(mNames); + mPendingSource.GetCompletionSet().Init(mPendingView, this, false); + } } mPendingRequest = 0; mPendingView = null; diff --git a/visuald/config.d b/visuald/config.d index 7e594a24..cc570c86 100644 --- a/visuald/config.d +++ b/visuald/config.d @@ -46,6 +46,7 @@ import visuald.fileutil; import visuald.lexutil; import visuald.pkgutil; import visuald.vdextensions; +import visuald.register; version = hasOutputGroup; // implementation of IVsProfilableProjectCfg is incomplete (profiler doesn't stop) @@ -67,7 +68,7 @@ const GUID g_unmarshalTargetInfoCLSID = uuid("002a2de9-8bb6-484d-980f-7e4ad40847 T clone(T)(T object) { - auto size = typeid(object).init.length; + auto size = typeid(object).initializer.length; object = cast(T) ((cast(void*)object) [0..size].dup.ptr ); // object.__monitor = null; return object; @@ -222,7 +223,7 @@ class ProjectOptions bool run; // run resulting executable string runargs; // arguments for executable - bool runCv2pdb; // run cv2pdb on executable + ubyte runCv2pdb; // run cv2pdb on executable (0: no, 1: suitable for debug engine, 2: yes) bool cv2pdbPre2043; // pass version before 2.043 for older aa implementation bool cv2pdbNoDemangle; // do not demangle symbols bool cv2pdbEnumType; // use enumerator type @@ -290,7 +291,7 @@ class ProjectOptions void setDebug(bool dbg) { - runCv2pdb = dbg && !isX86_64; + runCv2pdb = dbg && !isX86_64 ? 1 : 0; symdebug = dbg ? 3 : 0; release = dbg ? 0 : 1; optimize = release == 1; @@ -303,6 +304,18 @@ class ProjectOptions cRuntime = CRuntime.StaticDebug; } + override bool opEquals(Object obj) const + { + auto other = cast(ProjectOptions) obj; + if (!other) + return false; + + foreach (i, f; this.tupleof) + if (this.tupleof[i] != other.tupleof[i]) + return false; + return true; + } + string objectFileExtension() { return compiler != Compiler.GDC ? "obj" : "o"; } string otherCompilerPath() { return otherDMD ? program : null; } @@ -619,7 +632,7 @@ class ProjectOptions cmd = "\"$(VisualDInstallDir)pipedmd.exe\" " ~ cmd; if(lib == OutputType.StaticLib && performLink) - cmd ~= " -lib"; + cmd ~= " -lib -oq -od=\"$(IntDir)\""; if(isX86_64) cmd ~= " -m64"; else @@ -874,14 +887,13 @@ class ProjectOptions return cmd; } - string optlinkCommandLine(string[] lnkfiles, string inioptions, string workdir, bool mslink) + string optlinkCommandLine(string[] lnkfiles, string inioptions, string workdir, bool mslink, string plus) { string cmd; string dmdoutfile = getTargetPath(); if(usesCv2pdb()) dmdoutfile ~= "_cv"; string mapfile = "\"$(INTDIR)\\$(SAFEPROJECTNAME).map\""; - string plus = mslink ? " " : "+"; static string plusList(string[] lnkfiles, string ext, string sep) { @@ -923,7 +935,7 @@ class ProjectOptions libs ~= "user32.lib"; libs ~= "kernel32.lib"; if(useMSVCRT()) - if(std.file.exists(Package.GetGlobalOptions().VCInstallDir ~ "lib\\legacy_stdio_definitions.lib")) + if(std.file.exists(Package.GetGlobalOptions().getVCDir("lib\\legacy_stdio_definitions.lib", isX86_64, true))) libs ~= "legacy_stdio_definitions.lib"; cmd ~= plusList(lnkfiles ~ libs, ".lib", plus); @@ -1052,7 +1064,12 @@ class ProjectOptions string cmd = cccmd; if(cc == 1 && setenv) - cmd = `call "%VCINSTALLDIR%\vcvarsall.bat" ` ~ (isX86_64 ? "x86_amd64" : "x86") ~ "\n" ~ cmd; + { + if (std.file.exists(Package.GetGlobalOptions().VCInstallDir ~ "vcvarsall.bat")) + cmd = `call "%VCINSTALLDIR%\vcvarsall.bat" ` ~ (isX86_64 ? "x86_amd64" : "x86") ~ "\n" ~ cmd; + else if (std.file.exists(Package.GetGlobalOptions().VCInstallDir ~ r"Auxiliary\Build\vcvarsall.bat")) + cmd = `call "%VCINSTALLDIR%\Auxiliary\Build\vcvarsall.bat" ` ~ (isX86_64 ? "x86_amd64" : "x86") ~ "\n" ~ cmd; + } static string[4] outObj = [ " -o", " -Fo", " -o", " -o " ]; if (file.length) @@ -1145,7 +1162,11 @@ class ProjectOptions { if(compiler == Compiler.DMD && (isX86_64 || mscoff)) return false; // should generate correct debug info directly - return (/*compiler == Compiler.DMD && */symdebug && runCv2pdb && lib != OutputType.StaticLib && debugEngine != 1); + if (!symdebug || lib == OutputType.StaticLib) + return false; + if (runCv2pdb == 2) + return true; + return (runCv2pdb == 1 && debugEngine != 1); // not for mago } string appendCv2pdb() @@ -1980,7 +2001,7 @@ class Config : DisposingComObject, { logCall("%s.get_IsDebugOnly(pfIsDebugOnly=%s)", this, _toLog(pfIsDebugOnly)); - *pfIsDebugOnly = (mName == "Debug"); + *pfIsDebugOnly = mProjectOptions.release != 1; return S_OK; } @@ -1988,7 +2009,7 @@ class Config : DisposingComObject, { logCall("%s.get_IsReleaseOnly(pfIsReleaseOnly=%s)", this, _toLog(pfIsReleaseOnly)); - *pfIsReleaseOnly = (mName == "Release"); + *pfIsReleaseOnly = mProjectOptions.release == 1; return S_OK; } @@ -2173,7 +2194,6 @@ class Config : DisposingComObject, switch(engine) { case 1: - GUID GUID_MaGoDebugger = uuid("{97348AC0-2B6B-4B99-A245-4C7E2C09D403}"); return GUID_MaGoDebugger; case 2: return GUID_COMPlusNativeEng; // the mixed-mode debugger (works only on x86) @@ -2255,20 +2275,20 @@ class Config : DisposingComObject, } // IVsDebuggableProjectCfg2 - HRESULT OnBeforeDebugLaunch(in VSDBGLAUNCHFLAGS grfLaunch) - { + HRESULT OnBeforeDebugLaunch(in VSDBGLAUNCHFLAGS grfLaunch) + { mixin(LogCallMix); return S_OK; // returnError(E_NOTIMPL); - } + } // IVsQueryDebuggableProjectCfg - HRESULT QueryDebugTargets(in VSDBGLAUNCHFLAGS grfLaunch, in ULONG cTargets, - VsDebugTargetInfo2 *dti, ULONG *pcActual) - { - if(cTargets > 0) - { - if(!dti) - return E_INVALIDARG; + HRESULT QueryDebugTargets(in VSDBGLAUNCHFLAGS grfLaunch, in ULONG cTargets, + VsDebugTargetInfo2 *dti, ULONG *pcActual) + { + if(cTargets > 0) + { + if(!dti) + return E_INVALIDARG; string remote = mProjectOptions.replaceEnvironment(mProjectOptions.debugremote, this); string prg = mProjectOptions.replaceEnvironment(mProjectOptions.debugtarget, this); string args = mProjectOptions.replaceEnvironment(mProjectOptions.debugarguments, this); @@ -2277,74 +2297,74 @@ class Config : DisposingComObject, workdir = GetProjectDir() ~ "\\" ~ workdir; prg = makeFilenameAbsolute(prg, workdir); - dti.cbSize = VsDebugTargetInfo2.sizeof; - dti.dlo = DLO_CreateProcess; // specifies how this process should be launched or attached - dti.LaunchFlags = grfLaunch; // launch flags that were passed to IVsDebuggableProjectCfg::Launch - dti.bstrRemoteMachine = remote.length ? allocBSTR(remote) : null; // NULL for local machine, or remote machine name - dti.bstrExe = allocBSTR(prg); - dti.bstrArg = allocBSTR(args); - dti.bstrCurDir = allocBSTR(workdir); - dti.bstrEnv = null; - dti.guidLaunchDebugEngine = getDebugEngineUID(mProjectOptions.debugEngine); - dti.dwDebugEngineCount = 1; - dti.pDebugEngines = cast(GUID*)CoTaskMemAlloc(GUID.sizeof); - *(dti.pDebugEngines) = dti.guidLaunchDebugEngine; - /+ - dti.guidPortSupplier; // port supplier guid - dti.bstrPortName; // name of port from above supplier (NULL is fine) - dti.bstrOptions; // custom options, specific to each guidLaunchDebugEngine (NULL is recommended) - dti.hStdInput; // for file redirection - dti.hStdOutput; // for file redirection - dti.hStdError; // for file redirection - dti.fSendToOutputWindow; // if TRUE, stdout and stderr will be routed to the output window - dti.dwProcessId; // process id (DLO_AlreadyRunning) - dti.pUnknown; // interface pointer - usage depends on DEBUG_LAUNCH_OPERATION - dti.guidProcessLanguage; // Language of the hosting process. Used to preload EE's - +/ - } - if (pcActual) - *pcActual = 1; - return S_OK; - } + dti.cbSize = VsDebugTargetInfo2.sizeof; + dti.dlo = DLO_CreateProcess; // specifies how this process should be launched or attached + dti.LaunchFlags = grfLaunch; // launch flags that were passed to IVsDebuggableProjectCfg::Launch + dti.bstrRemoteMachine = remote.length ? allocBSTR(remote) : null; // NULL for local machine, or remote machine name + dti.bstrExe = allocBSTR(prg); + dti.bstrArg = allocBSTR(args); + dti.bstrCurDir = allocBSTR(workdir); + dti.bstrEnv = null; + dti.guidLaunchDebugEngine = getDebugEngineUID(mProjectOptions.debugEngine); + dti.dwDebugEngineCount = 1; + dti.pDebugEngines = cast(GUID*)CoTaskMemAlloc(GUID.sizeof); + *(dti.pDebugEngines) = dti.guidLaunchDebugEngine; + /+ + dti.guidPortSupplier; // port supplier guid + dti.bstrPortName; // name of port from above supplier (NULL is fine) + dti.bstrOptions; // custom options, specific to each guidLaunchDebugEngine (NULL is recommended) + dti.hStdInput; // for file redirection + dti.hStdOutput; // for file redirection + dti.hStdError; // for file redirection + dti.fSendToOutputWindow; // if TRUE, stdout and stderr will be routed to the output window + dti.dwProcessId; // process id (DLO_AlreadyRunning) + dti.pUnknown; // interface pointer - usage depends on DEBUG_LAUNCH_OPERATION + dti.guidProcessLanguage; // Language of the hosting process. Used to preload EE's + +/ + } + if (pcActual) + *pcActual = 1; + return S_OK; + } /////////////////////////////////////////////////////////////// - // IVsProfilableProjectCfg - override HRESULT get_SuppressSignedAssemblyWarnings(/+[retval, out]+/VARIANT_BOOL* suppress) - { + // IVsProfilableProjectCfg + override HRESULT get_SuppressSignedAssemblyWarnings(/+[retval, out]+/VARIANT_BOOL* suppress) + { mixin(LogCallMix); *suppress = FALSE; - return S_OK; - } - override HRESULT get_LegacyWebSupportRequired(/+[retval, out]+/VARIANT_BOOL* required) - { + return S_OK; + } + override HRESULT get_LegacyWebSupportRequired(/+[retval, out]+/VARIANT_BOOL* required) + { mixin(LogCallMix); *required = FALSE; - return S_OK; - } - - HRESULT GetSupportedProfilingTasks(/+[out]+/ SAFEARRAY *tasks) - { + return S_OK; + } + + HRESULT GetSupportedProfilingTasks(/+[out]+/ SAFEARRAY *tasks) + { mixin(LogCallMix); BSTR task = allocBSTR("ClassicCPUSampling"); int index = 0; SafeArrayPutElement(tasks, &index, &task); - return S_OK; - } - HRESULT BeforeLaunch(in BSTR profilingTask) - { + return S_OK; + } + HRESULT BeforeLaunch(in BSTR profilingTask) + { mixin(LogCallMix); - return S_OK; - } - HRESULT BeforeTargetsLaunched() - { + return S_OK; + } + HRESULT BeforeTargetsLaunched() + { mixin(LogCallMix); - return S_OK; - } - HRESULT LaunchProfiler() - { + return S_OK; + } + HRESULT LaunchProfiler() + { mixin(LogCallMix); version(hasProfilableConfig) - { + { IVsProfilerLauncher launcher; GUID svcid = uuid_SVsProfilerLauncher; GUID clsid = uuid_IVsProfilerLauncher; @@ -2353,7 +2373,7 @@ class Config : DisposingComObject, if (!launcher) return E_NOTIMPL; - auto infos = addref(newCom!EnumVsProfilerTargetInfos(this)); + auto infos = addref(newCom!EnumVsProfilerTargetInfos(this)); scope(exit) release(launcher); scope(exit) release(infos); @@ -2362,28 +2382,28 @@ class Config : DisposingComObject, } else return returnError(E_NOTIMPL); - } - HRESULT QueryProfilerTargetInfoEnum(/+[out]+/ IEnumVsProfilerTargetInfos *targetsEnum) - { + } + HRESULT QueryProfilerTargetInfoEnum(/+[out]+/ IEnumVsProfilerTargetInfos *targetsEnum) + { version(hasProfilableConfig) - { + { mixin(LogCallMix); - *targetsEnum = addref(newCom!EnumVsProfilerTargetInfos(this)); - return S_OK; - } + *targetsEnum = addref(newCom!EnumVsProfilerTargetInfos(this)); + return S_OK; + } else return returnError(E_NOTIMPL); - } - HRESULT AllBrowserTargetsFinished() - { + } + HRESULT AllBrowserTargetsFinished() + { mixin(LogCallMix); - return S_OK; - } - HRESULT ProfilerAnalysisFinished() - { + return S_OK; + } + HRESULT ProfilerAnalysisFinished() + { mixin(LogCallMix); - return S_OK; - } + return S_OK; + } /////////////////////////////////////////////////////////////// // IVsBuildableProjectCfg @@ -2879,7 +2899,7 @@ class Config : DisposingComObject, else cmd ~= " -c " ~ mProjectOptions.getOutputFileOption(outfile) ~ mProjectOptions.getDependenciesFileOption(depfile); - cmd ~= " " ~ file.GetFilename(); + cmd ~= " " ~ quoteFilename(file.GetFilename()); foreach(ddoc; getDDocFileList()) cmd ~= " " ~ ddoc; } @@ -2903,7 +2923,7 @@ class Config : DisposingComObject, cmd ~= opts.buildCommandLine(true, !syntaxOnly, false, syntaxOnly); if(syntaxOnly) cmd ~= " --build-only"; - cmd ~= addopt ~ " " ~ file.GetFilename(); + cmd ~= addopt ~ " " ~ quoteFilename(file.GetFilename()); addopt = ""; // must be before filename for rdmd if (!syntaxOnly) { @@ -2977,6 +2997,8 @@ class Config : DisposingComObject, cmd ~= "set WindowsSdkDir=" ~ globOpt.WindowsSdkDir ~ "\n"; if(globOpt.VCInstallDir.length) cmd ~= "set VCINSTALLDIR=" ~ globOpt.VCInstallDir ~ "\n"; + if(globOpt.VCToolsInstallDir.length) + cmd ~= "set VCTOOLSINSTALLDIR=" ~ globOpt.VCToolsInstallDir ~ "\n"; if(globOpt.VSInstallDir.length) cmd ~= "set VSINSTALLDIR=" ~ globOpt.VSInstallDir ~ "\n"; } @@ -3353,7 +3375,8 @@ class Config : DisposingComObject, ~ lnkcmd; string[] lnkfiles = getObjectFileList(files); // convert D files to object files, but leaves anything else untouched - string cmdfiles = mProjectOptions.optlinkCommandLine(lnkfiles, options, workdir, x64 || mscoff); + string plus = x64 || mscoff ? " " : "+"; + string cmdfiles = mProjectOptions.optlinkCommandLine(lnkfiles, options, workdir, x64 || mscoff, plus); if(cmdfiles.length > 100) { string lnkresponsefile = GetCommandLinePath() ~ ".lnkarg"; @@ -3369,8 +3392,11 @@ class Config : DisposingComObject, else lnkresponsefile = shortresponsefile; } + plus ~= " >> " ~ lnkresponsefile ~ "\necho "; + cmdfiles = mProjectOptions.optlinkCommandLine(lnkfiles, options, workdir, x64 || mscoff, plus); + prelnk ~= "echo. > " ~ lnkresponsefile ~ "\n"; - prelnk ~= "echo " ~ cmdfiles.replace("+", "+ >> " ~ lnkresponsefile ~ "\necho "); + prelnk ~= "echo " ~ cmdfiles; prelnk ~= " >> " ~ lnkresponsefile ~ "\n\n"; lnkcmd ~= "@" ~ lnkresponsefile; } @@ -4165,18 +4191,18 @@ class TargetInfoFactory : DComObject, IClassFactory } } -class ProfilerTargetInfo : DComObject, IVsProfilerTargetInfo, IVsProfilerLaunchExeTargetInfo, IMarshal -{ - string mPlatform; - string mWorkdir; - string mProgram; - string mArgs; - - this(Config cfg) - { - if(cfg) - { - mPlatform = cfg.mPlatform; +class ProfilerTargetInfo : DComObject, IVsProfilerTargetInfo, IVsProfilerLaunchExeTargetInfo, IMarshal +{ + string mPlatform; + string mWorkdir; + string mProgram; + string mArgs; + + this(Config cfg) + { + if(cfg) + { + mPlatform = cfg.mPlatform; mWorkdir = cfg.mProjectOptions.replaceEnvironment(cfg.mProjectOptions.debugworkingdir, cfg); if(!isAbsolute(mWorkdir)) mWorkdir = cfg.GetProjectDir() ~ "\\" ~ mWorkdir; @@ -4184,9 +4210,9 @@ class ProfilerTargetInfo : DComObject, IVsProfilerTargetInfo, IVsProfilerLaunchE if(!isAbsolute(mProgram)) mProgram = makeFilenameAbsolute(mProgram, mWorkdir); mArgs = cfg.mProjectOptions.replaceEnvironment(cfg.mProjectOptions.debugarguments, cfg); - } - } - + } + } + override HRESULT QueryInterface(in IID* riid, void** pvObject) { if(queryInterface!(IVsProfilerTargetInfo) (this, riid, pvObject)) @@ -4200,52 +4226,52 @@ class ProfilerTargetInfo : DComObject, IVsProfilerTargetInfo, IVsProfilerLaunchE return super.QueryInterface(riid, pvObject); } // IVsProfilerTargetInfo - HRESULT ProcessArchitecture(VSPROFILERPROCESSARCHTYPE* arch) - { + HRESULT ProcessArchitecture(VSPROFILERPROCESSARCHTYPE* arch) + { mixin(LogCallMix2); - if(mPlatform == "x64") - *arch = ARCH_X64; - else - *arch = ARCH_X86; - return S_OK; + if(mPlatform == "x64") + *arch = ARCH_X64; + else + *arch = ARCH_X86; + return S_OK; } // IVsProfilerLaunchTargetInfo - HRESULT References(SAFEARRAY* rgbstr) - { + HRESULT References(SAFEARRAY* rgbstr) + { mixin(LogCallMix2); - return S_OK; - } - HRESULT EnvironmentSettings(SAFEARRAY* pbstr) - { + return S_OK; + } + HRESULT EnvironmentSettings(SAFEARRAY* pbstr) + { mixin(LogCallMix2); - return S_OK; - } - HRESULT LaunchProfilerFlags(VSPROFILERLAUNCHOPTS* opts) - { + return S_OK; + } + HRESULT LaunchProfilerFlags(VSPROFILERLAUNCHOPTS* opts) + { mixin(LogCallMix2); - *opts = VSPLO_NOPROFILE; // to just launch the exe!? - return S_OK; - } - // IVsProfilerLaunchExeTargetInfo - HRESULT ExecutableArguments(BSTR* pbstr) - { + *opts = VSPLO_NOPROFILE; // to just launch the exe!? + return S_OK; + } + // IVsProfilerLaunchExeTargetInfo + HRESULT ExecutableArguments(BSTR* pbstr) + { mixin(LogCallMix2); *pbstr = allocBSTR(mArgs); return S_OK; - } - HRESULT ExecutablePath (BSTR* pbstr) - { + } + HRESULT ExecutablePath (BSTR* pbstr) + { mixin(LogCallMix2); *pbstr = allocBSTR(mProgram); return S_OK; - } - HRESULT WorkingDirectory (BSTR* pbstr) - { + } + HRESULT WorkingDirectory (BSTR* pbstr) + { mixin(LogCallMix2); *pbstr = allocBSTR(mWorkdir[0..$-1]); return S_OK; - } - + } + // IMarshall override HRESULT GetUnmarshalClass( /+[in]+/ in IID* riid, @@ -4356,72 +4382,55 @@ class ProfilerTargetInfo : DComObject, IVsProfilerTargetInfo, IVsProfilerLaunchE logCall("%s.DisconnectObject(dwReserved=%s)", this, _toLog(dwReserved)); return returnError(E_NOTIMPL); } - + int mExternalReferences; -} - -class EnumVsProfilerTargetInfos : DComObject, IEnumVsProfilerTargetInfos -{ - Config mConfig; - int mPos; - - this(Config cfg) - { - mConfig = cfg; - mPos = 0; - } +} + +class EnumVsProfilerTargetInfos : DComObject, IEnumVsProfilerTargetInfos +{ + Config mConfig; + int mPos; + + this(Config cfg) + { + mConfig = cfg; + mPos = 0; + } override HRESULT QueryInterface(in IID* riid, void** pvObject) { if(queryInterface2!(IEnumVsProfilerTargetInfos) (this, uuid_IEnumVsProfilerTargetInfos, riid, pvObject)) return S_OK; return super.QueryInterface(riid, pvObject); } - - HRESULT Next(in ULONG celt, IVsProfilerTargetInfo *rgelt, ULONG *pceltFetched) - { - ULONG fetched = 0; - if(mPos == 0 && celt > 0) - { - *rgelt = addref(newCom!ProfilerTargetInfo(mConfig)); - fetched = 1; - mPos++; - } - if(pceltFetched) - *pceltFetched = fetched; - return fetched > 0 ? S_OK : S_FALSE; - } - HRESULT Skip(in ULONG celt) - { - mPos += celt; - return S_OK; - } - HRESULT Reset() - { - mPos = 0; - return S_OK; - } - HRESULT Clone(IEnumVsProfilerTargetInfos *ppenum) - { - *ppenum = addref(newCom!EnumVsProfilerTargetInfos(mConfig)); - return S_OK; - } -} -} // version(hasProfilableConfig) - -Config GetActiveConfig(IVsHierarchy pHierarchy) -{ - if(!pHierarchy) - return null; - - auto solutionBuildManager = queryService!(IVsSolutionBuildManager)(); - scope(exit) release(solutionBuildManager); - IVsProjectCfg activeCfg; - if(solutionBuildManager.FindActiveProjectCfg(null, null, pHierarchy, &activeCfg) == S_OK) + HRESULT Next(in ULONG celt, IVsProfilerTargetInfo *rgelt, ULONG *pceltFetched) { - scope(exit) release(activeCfg); - if(Config cfg = qi_cast!Config(activeCfg)) - return cfg; + ULONG fetched = 0; + if(mPos == 0 && celt > 0) + { + *rgelt = addref(newCom!ProfilerTargetInfo(mConfig)); + fetched = 1; + mPos++; + } + if(pceltFetched) + *pceltFetched = fetched; + return fetched > 0 ? S_OK : S_FALSE; + } + HRESULT Skip(in ULONG celt) + { + mPos += celt; + return S_OK; + } + HRESULT Reset() + { + mPos = 0; + return S_OK; + } + HRESULT Clone(IEnumVsProfilerTargetInfos *ppenum) + { + *ppenum = addref(newCom!EnumVsProfilerTargetInfos(mConfig)); + return S_OK; } - return null; } +} // version(hasProfilableConfig) + diff --git a/visuald/dlangsvc.d b/visuald/dlangsvc.d index d2bdd9ba..bfe3b224 100644 --- a/visuald/dlangsvc.d +++ b/visuald/dlangsvc.d @@ -53,6 +53,7 @@ import std.string; import std.ascii; import std.utf; import std.conv; +import std.path; import std.algorithm; import std.array; import std.datetime; @@ -64,6 +65,7 @@ import sdk.port.vsi; import sdk.vsi.textmgr; import sdk.vsi.textmgr2; import sdk.vsi.textmgr90; +import sdk.vsi.textmgr120; import sdk.vsi.vsshell; import sdk.vsi.vsshell80; import sdk.vsi.singlefileeditor; @@ -79,22 +81,22 @@ version = threadedOutlining; __gshared Lexer dLex; /////////////////////////////////////////////////////////////////////////////// -class LanguageService : DisposingComObject, - IVsLanguageInfo, - IVsLanguageDebugInfo, +class LanguageService : DisposingComObject, + IVsLanguageInfo, + IVsLanguageDebugInfo, IVsLanguageDebugInfo2, IVsLanguageDebugInfoRemap, - IVsProvideColorableItems, - IVsLanguageContextProvider, - IServiceProvider, -// ISynchronizeInvoke, - IVsDebuggerEvents, + IVsProvideColorableItems, + IVsLanguageContextProvider, + IServiceProvider, +// ISynchronizeInvoke, + IVsDebuggerEvents, IVsFormatFilterProvider, IVsOutliningCapableLanguage, IVsUpdateSolutionEvents { static const GUID iid = g_languageCLSID; - + this(Package pkg) { //mPackage = pkg; @@ -136,7 +138,7 @@ class LanguageService : DisposingComObject, // return S_OK; if(queryInterface!(IVsOutliningCapableLanguage) (this, riid, pvObject)) return S_OK; - + return super.QueryInterface(riid, pvObject); } @@ -158,11 +160,11 @@ class LanguageService : DisposingComObject, closeSearchWindow(); setDebugger(null); - + foreach(Source src; mSources) src.Release(); mSources = mSources.init; - + foreach(CodeWindowManager mgr; mCodeWinMgrs) mgr.Release(); mCodeWinMgrs = mCodeWinMgrs.init; @@ -180,7 +182,7 @@ class LanguageService : DisposingComObject, mUpdateSolutionEventsCookie = VSCOOKIE_NIL; } } - + cdwLastSource = null; mLastActiveView = null; } @@ -300,16 +302,16 @@ class LanguageService : DisposingComObject, HRESULT QueryCommonLanguageBlock( /+[in]+/ IVsTextBuffer pBuffer, //code buffer containing a break point in int iLine, //line for a break point - in int iCol, //column for a break point + in int iCol, //column for a break point in DWORD dwFlag, //common language block being queried. see LANGUAGECOMMONBLOCK /+[out]+/ BOOL *pfInBlock) //true if iLine and iCol is inside common language block;otherwise, false; { mixin(LogCallMix); return E_NOTIMPL; } - + HRESULT ValidateInstructionpointLocation( - /+[in]+/ IVsTextBuffer pBuffer, //code buffer containing an instruction point(IP) + /+[in]+/ IVsTextBuffer pBuffer, //code buffer containing an instruction point(IP) in int iLine, //line for the existing IP in int iCol, //column for the existing IP /+[out]+/ TextSpan *pCodeSpan) //new IP code span @@ -330,7 +332,7 @@ class LanguageService : DisposingComObject, } // IVsLanguageDebugInfoRemap ////////////////////////////////////// - HRESULT RemapBreakpoint(/+[in]+/ IUnknown pUserBreakpointRequest, + HRESULT RemapBreakpoint(/+[in]+/ IUnknown pUserBreakpointRequest, /+[out]+/IUnknown* ppMappedBreakpointRequest) { mixin(LogCallMix); @@ -342,7 +344,7 @@ class LanguageService : DisposingComObject, BP_LOCATION_TYPE type; HRESULT hr = bp.GetLocationType(&type); logCall("type = %x", type); - + BP_REQUEST_INFO info; bp.GetRequestInfo(BPREQI_ALLFIELDS, &info); if((type & BPLT_LOCATION_TYPE_MASK) == BPLT_FILE_LINE) @@ -357,19 +359,19 @@ class LanguageService : DisposingComObject, } BP_REQUEST_INFO2 info2; bp.GetRequestInfo2(BPREQI_ALLFIELDS, &info2); - + } +/ - + return S_FALSE; } // IVsProvideColorableItems ////////////////////////////////////// __gshared ColorableItem[] colorableItems; - + // delete \FontAndColors\Cache\{A27B4E24-A735-4D1D-B8E7-9716E1E3D8E0}\Version // if the list of colorableItems changes - + static void shared_static_this() { colorableItems = [ @@ -380,14 +382,14 @@ class LanguageService : DisposingComObject, newCom!ColorableItem("String", CI_MAROON, CI_USERTEXT_BK), newCom!ColorableItem("Number", CI_USERTEXT_FG, CI_USERTEXT_BK), newCom!ColorableItem("Text", CI_USERTEXT_FG, CI_USERTEXT_BK), - + // Visual D specific (must match Lexer.TokenCat) newCom!ColorableItem("Visual D Operator", CI_USERTEXT_FG, CI_USERTEXT_BK), newCom!ColorableItem("Visual D Register", -1, CI_USERTEXT_BK, RGB(128, 0, 128)), newCom!ColorableItem("Visual D Mnemonic", CI_AQUAMARINE, CI_USERTEXT_BK), newCom!ColorableItem("Visual D Type", -1, CI_USERTEXT_BK, RGB(0, 0, 160)), newCom!ColorableItem("Visual D Predefined Version", -1, CI_USERTEXT_BK, RGB(160, 0, 0)), - + newCom!ColorableItem("Visual D Disabled Keyword", -1, CI_USERTEXT_BK, RGB(128, 160, 224)), newCom!ColorableItem("Visual D Disabled Comment", -1, CI_USERTEXT_BK, RGB(96, 128, 96)), newCom!ColorableItem("Visual D Disabled Identifier", CI_DARKGRAY, CI_USERTEXT_BK), @@ -456,7 +458,7 @@ class LanguageService : DisposingComObject, { if(iIndex < 1 || iIndex > colorableItems.length) return E_INVALIDARG; - + *ppItem = addref(colorableItems[iIndex-1]); return S_OK; } @@ -493,13 +495,22 @@ class LanguageService : DisposingComObject, override HRESULT CurFileExtensionFormat(in BSTR bstrFileName, uint* pdwExtnIndex) { mixin(LogCallMix2); - return E_NOTIMPL; + string filename = to_string(bstrFileName); + string ext = toLower(extension(filename)); + if (ext == ".d") + *pdwExtnIndex = 0; + else if (ext == ".di") + *pdwExtnIndex = 1; + else + return E_FAIL; + return S_OK; } override HRESULT GetFormatFilterList(BSTR* pbstrFilterList) { mixin(LogCallMix); - return E_NOTIMPL; + *pbstrFilterList = allocBSTR("D Source Files (*.d)\n*.d\nD Interface Files (*.di)\n*.di\n"); + return S_OK; } override HRESULT QueryInvalidEncoding(in uint Format, BSTR* pbstrMessage) @@ -515,12 +526,12 @@ class LanguageService : DisposingComObject, *pfCancelUpdate = false; return S_OK; } - + HRESULT UpdateSolution_Done(in BOOL fSucceeded, in BOOL fModified, in BOOL fCancelCommand) { return S_OK; } - + HRESULT UpdateSolution_StartUpdate( /+[in, out]+/ BOOL *pfCancelUpdate ) { if(pfCancelUpdate) @@ -532,10 +543,10 @@ class LanguageService : DisposingComObject, { return S_OK; } - + HRESULT OnActiveProjectCfgChange(/+[in]+/ IVsHierarchy pIVsHierarchy) { - UpdateColorizer(false); + UpdateColorizer(false); return S_OK; } @@ -602,12 +613,12 @@ class LanguageService : DisposingComObject, Definition[] defs = Package.GetLibInfos().findDefinition(word); if(defs.length == 0) return false; - + string srcfile = src.GetFileName(); string abspath; if(FindFileInSolution(defs[0].filename, srcfile, abspath) != S_OK) return false; - + return jumpToDefinitionInCodeWindow("", abspath, defs[0].line, 0, false); } @@ -658,14 +669,38 @@ class LanguageService : DisposingComObject, if(mVDServerClient) mVDServerClient.onIdle(); + enum idleActiveViewOnly = true; + + if(IVsTextLines buffer = GetCurrentTextBuffer(null)) + { + scope(exit) release(buffer); + if(Source src = GetSource(buffer, false)) + { + static if(idleActiveViewOnly) + { + if(src.OnIdle()) + return true; + foreach(CodeWindowManager mgr; mCodeWinMgrs) + if (mgr.mSource is src) + mgr.OnIdle(); + } + if(auto cfg = getProjectConfig(src.GetFileName())) // this triggers an update of the colorizer if VC config changed + release(cfg); + } + } + CheckGC(false); - for(int i = 0; i < mSources.length; i++) - if(mSources[i].OnIdle()) - return true; - foreach(CodeWindowManager mgr; mCodeWinMgrs) - if(mgr.OnIdle()) - return true; - + + static if(!idleActiveViewOnly) + { + for(int i = 0; i < mSources.length; i++) + if(mSources[i].OnIdle()) + return true; + foreach(CodeWindowManager mgr; mCodeWinMgrs) + if(mgr.OnIdle()) + return true; + } + if(mLastActiveView && mLastActiveView.mView) { int line, idx; @@ -675,7 +710,7 @@ class LanguageService : DisposingComObject, } return false; } - + Source GetSource(IVsTextLines buffer, bool create = true) { Source src; @@ -803,27 +838,28 @@ class LanguageService : DisposingComObject, void ConfigureSemanticProject(Source src) { string file = src.GetFileName(); - string[] imp = GetImportPaths(file); + Config cfg = getProjectConfig(file); + if(!cfg) + cfg = getCurrentStartupConfig(); + + string[] imp = GetImportPaths(cfg) ~ Package.GetGlobalOptions().getImportPaths(); string[] stringImp; string[] versionids; string[] debugids; uint flags = 0; - Config cfg = getProjectConfig(file); - if(!cfg) - cfg = getCurrentStartupConfig(); if(cfg) { scope(exit) release(cfg); auto cfgopts = cfg.GetProjectOptions(); auto globopts = Package.GetGlobalOptions(); - flags = ConfigureFlags!()(cfgopts.useUnitTests, !cfgopts.release, cfgopts.isX86_64, - cfgopts.cov, cfgopts.doDocComments, cfgopts.noboundscheck, - cfgopts.compiler == Compiler.GDC, + flags = ConfigureFlags!()(cfgopts.useUnitTests, !cfgopts.release, cfgopts.isX86_64, + cfgopts.cov, cfgopts.doDocComments, cfgopts.noboundscheck, + cfgopts.compiler == Compiler.GDC, cfgopts.versionlevel, cfgopts.debuglevel, cfgopts.errDeprecated, cfgopts.compiler == Compiler.LDC, cfgopts.useMSVCRT (), globopts.mixinAnalysis, globopts.UFCSExpansions); - + string strimp = cfgopts.replaceEnvironment(cfgopts.fileImppath, cfg); stringImp = tokenizeArgs(strimp); foreach(ref i; stringImp) @@ -831,7 +867,7 @@ class LanguageService : DisposingComObject, makeFilenamesAbsolute(stringImp, cfg.GetProjectDir()); versionids = tokenizeArgs(cfgopts.versionids); - debugids = tokenizeArgs(cfgopts.debugids); + debugids = tokenizeArgs(cfgopts.debugids); } vdServerClient.ConfigureSemanticProject(file, assumeUnique(imp), assumeUnique(stringImp), assumeUnique(versionids), assumeUnique(debugids), flags); } @@ -848,7 +884,7 @@ private: Source[] mSources; CodeWindowManager[] mCodeWinMgrs; DBGMODE mDbgMode; - + VDServerClient mVDServerClient; IVsDebugger mDebugger; VSCOOKIE mCookieDebuggerEvents = VSCOOKIE_NIL; @@ -861,12 +897,12 @@ private: class UpdateSolutionEvents : DComObject, IVsUpdateSolutionEvents { LanguageService mLangSvc; - + this(LanguageService svc) { mLangSvc = svc; } - + override HRESULT QueryInterface(in IID* riid, void** pvObject) { if(queryInterface!(IVsUpdateSolutionEvents) (this, riid, pvObject)) @@ -879,12 +915,12 @@ class UpdateSolutionEvents : DComObject, IVsUpdateSolutionEvents { return mLangSvc.UpdateSolution_Begin(pfCancelUpdate); } - + HRESULT UpdateSolution_Done(in BOOL fSucceeded, in BOOL fModified, in BOOL fCancelCommand) { return mLangSvc.UpdateSolution_Done(fSucceeded, fModified, fCancelCommand); } - + HRESULT UpdateSolution_StartUpdate( /+[in, out]+/ BOOL *pfCancelUpdate ) { return mLangSvc.UpdateSolution_StartUpdate(pfCancelUpdate); @@ -894,7 +930,7 @@ class UpdateSolutionEvents : DComObject, IVsUpdateSolutionEvents { return mLangSvc.UpdateSolution_Cancel(); } - + HRESULT OnActiveProjectCfgChange(/+[in]+/ IVsHierarchy pIVsHierarchy) { return mLangSvc.OnActiveProjectCfgChange(pIVsHierarchy); @@ -994,7 +1030,7 @@ class CodeWindowManager : DisposingComObject, IVsCodeWindowManager return true; return false; } - + void CloseFilters() { foreach(ViewFilter vf; mViewFilters) @@ -1012,7 +1048,7 @@ class CodeWindowManager : DisposingComObject, IVsCodeWindowManager } ///////////////////////////////////////////////////////////////////////// -class CodeDefViewContext : DComObject, IVsCodeDefViewContext +class CodeDefViewContext : DComObject, IVsCodeDefViewContext { private string symbol; private string filename; @@ -1100,11 +1136,44 @@ HRESULT reloadTextBuffer(string fname) scope(exit) release(textBuffer); if (auto docdata = qi_cast!IVsPersistDocData(srpIUnknown)) + { docdata.ReloadDocData(RDD_IgnoreNextFileChange|RDD_RemoveUndoStack); + release(docdata); + } return textBuffer.Reload(true); } +HRESULT saveTextBuffer(string fname) +{ + IVsRunningDocumentTable pRDT = queryService!(IVsRunningDocumentTable); + if(!pRDT) + return E_FAIL; + scope(exit) release(pRDT); + + auto docname = _toUTF16z(fname); + IVsHierarchy srpIVsHierarchy; + VSITEMID vsItemId = VSITEMID_NIL; + IUnknown srpIUnknown; + VSDOCCOOKIE vsDocCookie = VSDOCCOOKIE_NIL; + HRESULT hr = pRDT.FindAndLockDocument(/* [in] VSRDTFLAGS dwRDTLockType */ RDT_NoLock, + /* [in] LPCOLESTR pszMkDocument */ docname, + /* [out] IVsHierarchy **ppHier */ &srpIVsHierarchy, + /* [out] VSITEMID *pitemid */ &vsItemId, + /* [out] IUnknown **ppunkDocData */ &srpIUnknown, + /* [out] VSCOOKIE *pdwCookie */ &vsDocCookie); + + // FindAndLockDocument returns S_FALSE if the doc is not in the RDT + if (hr != S_OK) + return hr; + + scope(exit) release(srpIUnknown); + scope(exit) release(srpIVsHierarchy); + + hr = pRDT.SaveDocuments(RDTSAVEOPT_SaveIfDirty, srpIVsHierarchy, vsItemId, vsDocCookie); + return hr; +} + IVsTextView findCodeDefinitionWindow() { IVsCodeDefView cdv = queryService!(SVsCodeDefView,IVsCodeDefView); @@ -1161,16 +1230,27 @@ bool jumpToDefinitionInCodeWindow(string symbol, string filename, int line, int /////////////////////////////////////////////////////////////////////////////// -int GetUserPreferences(LANGPREFERENCES *langPrefs, IVsTextView view) +int GetUserPreferences(LANGPREFERENCES3 *langPrefs, IVsTextView view) { IVsTextManager textmgr = queryService!(VsTextManager, IVsTextManager); if(!textmgr) return E_FAIL; scope(exit) release(textmgr); - + langPrefs.guidLang = g_languageCLSID; - if(int rc = textmgr.GetUserPreferences(null, null, langPrefs, null)) - return rc; + IVsTextManager4 textmgr4; + IID txtmgr4_iid = uuid_IVsTextManager4; // taking address of enum not allowed + if(textmgr.QueryInterface(&txtmgr4_iid, cast(void**)&textmgr4) == S_OK && textmgr4) + { + scope(exit) release(textmgr4); + if(int rc = textmgr4.GetUserPreferences4(null, langPrefs, null)) + return rc; + } + else + { + if(int rc = textmgr.GetUserPreferences(null, null, cast(LANGPREFERENCES*)langPrefs, null)) + return rc; + } if (view) { @@ -1191,7 +1271,7 @@ class SourceEvents : DisposingComObject, IVsUserDataEvents, IVsTextLinesEvents Source mSource; uint mCookieUserDataEvents; uint mCookieTextLinesEvents; - + this(Source src, IVsTextLines buffer) { mSource = src; @@ -1202,7 +1282,7 @@ class SourceEvents : DisposingComObject, IVsUserDataEvents, IVsTextLinesEvents mCookieTextLinesEvents = Advise!(IVsTextLinesEvents)(buffer, this); } } - + override void Dispose() { IVsTextLines buffer = mSource.mBuffer; @@ -1235,7 +1315,7 @@ class SourceEvents : DisposingComObject, IVsUserDataEvents, IVsTextLinesEvents { return mSource.OnChangeLineText(pTextLineChange, fLast); } - + override int OnChangeLineAttributes(in int iFirstLine, in int iLastLine) { return mSource.OnChangeLineAttributes(iFirstLine, iLastLine); @@ -1260,7 +1340,7 @@ class Source : DisposingComObject, IVsUserDataEvents, IVsTextLinesEvents, IVsTex bool mStopOutlining; bool mVerifiedEncoding; IVsHiddenTextSession mHiddenTextSession; - + static struct LineChange { int oldLine, newLine; } LineChange[] mLineChanges; size_t mLastSaveLineChangePos; @@ -1343,7 +1423,7 @@ class Source : DisposingComObject, IVsUserDataEvents, IVsTextLinesEvents, IVsTex } } } - + // IVsUserDataEvents ////////////////////////////////////// override int OnUserDataChange(in GUID* riidKey, in VARIANT vtNewValue) { @@ -1378,13 +1458,13 @@ class Source : DisposingComObject, IVsUserDataEvents, IVsTextLinesEvents, IVsTex CheckOutlining(pTextLineChange); return mColorizer.OnLinesChanged(pTextLineChange.iStartLine, pTextLineChange.iOldEndLine, pTextLineChange.iNewEndLine, fLast != 0); } - + void ClearLineChanges() { mLineChanges = mLineChanges.init; mLastSaveLineChangePos = 0; } - + override int OnChangeLineAttributes(in int iFirstLine, in int iLastLine) { return S_OK; @@ -1426,7 +1506,7 @@ class Source : DisposingComObject, IVsUserDataEvents, IVsTextLinesEvents, IVsTex return S_OK; } - override HRESULT GetTipText(/+[in]+/ IVsTextMarker pMarker, + override HRESULT GetTipText(/+[in]+/ IVsTextMarker pMarker, /+[out, optional]+/ BSTR *pbstrText) { if(auto marker = qi_cast!IVsTextLineMarker(pMarker)) @@ -1459,8 +1539,8 @@ class Source : DisposingComObject, IVsUserDataEvents, IVsTextLinesEvents, IVsTex // Commands -- see MarkerCommandValues for meaning of iItem param - override HRESULT GetMarkerCommandInfo(/+[in]+/ IVsTextMarker pMarker, in int iItem, - /+[out, custom(uuid_IVsTextMarkerClient, "optional")]+/ BSTR * pbstrText, + override HRESULT GetMarkerCommandInfo(/+[in]+/ IVsTextMarker pMarker, in int iItem, + /+[out, custom(uuid_IVsTextMarkerClient, "optional")]+/ BSTR * pbstrText, /+[out]+/ DWORD* pcmdf) { return E_NOTIMPL; @@ -1494,7 +1574,7 @@ class Source : DisposingComObject, IVsUserDataEvents, IVsTextLinesEvents, IVsTex asmfile ~= ".mangled"; mDisasmSymInfo = readDisasmFile(asmfile); mDisasmLineInfo = readLineInfoFile(linefile, GetFileName()); - + // force update to Code Definition Window auto langsvc = Package.GetLanguageService(); int line, idx; @@ -1549,7 +1629,7 @@ class Source : DisposingComObject, IVsUserDataEvents, IVsTextLinesEvents, IVsTex kOutlineStateDirtyIdle2, } int mOutlineState = kOutlineStateDirty; - + bool OnIdle() { if(mColorizer.UpdateCoverage(false)) @@ -1558,7 +1638,7 @@ class Source : DisposingComObject, IVsUserDataEvents, IVsTextLinesEvents, IVsTex if(startParsing()) return true; -version(threadedOutlining) +version(threadedOutlining) { return false; } else { @@ -1582,7 +1662,7 @@ version(threadedOutlining) } } } - + void CheckOutlining(in TextLineChange *pTextLineChange) { version(threadedOutlining) {} else @@ -1593,7 +1673,7 @@ version(threadedOutlining) {} else { if(mHiddenTextSession) return mHiddenTextSession; - + if(auto htm = queryService!(VsTextManager, IVsHiddenTextManager)) { scope(exit) release(htm); @@ -1602,9 +1682,9 @@ version(threadedOutlining) {} else } return mHiddenTextSession; } - + enum int kHiddenRegionCookie = 37; - + bool AnyOutlineExpanded(IVsHiddenTextSession session) { IVsEnumHiddenRegions penum; @@ -1621,7 +1701,7 @@ version(threadedOutlining) {} else region.GetState(&state); region.GetSpan(&span); release(region); - + if(span.iStartLine <= hiddenLine) continue; if(state == hrsExpanded) @@ -1631,19 +1711,19 @@ version(threadedOutlining) {} else release(penum); return expanded; } - + void UpdateOutlining() { if(auto session = GetHiddenTextSession()) UpdateOutlining(session, hrsExpanded); } - + HRESULT StopOutlining() { if(mOutlining) { mStopOutlining = true; - version(threadedOutlining) + version(threadedOutlining) mModificationCount++; // trigger reparsing else CheckOutlining(null); @@ -1660,7 +1740,7 @@ version(threadedOutlining) {} else } return S_OK; } - + void UpdateOutlining(IVsHiddenTextSession session, int state) { NewHiddenRegion[] rgns = CreateOutlineRegions(state); @@ -1689,7 +1769,7 @@ version(threadedOutlining) {} else wstring source = GetText(); // should not be read from another thread return CreateOutlineRegions(source, expansionState); } - + NewHiddenRegion[] CreateOutlineRegions(wstring source, int expansionState) { NewHiddenRegion[] rgns; @@ -1709,7 +1789,7 @@ version(threadedOutlining) {} else //wstring txt = GetText(ln, 0, ln, -1); if(txt.length > 0 && txt[$-1] == '\r') txt = txt[0..$-1]; - + uint pos = 0; bool isSpaceOrComment = true; bool isComment = false; @@ -1793,7 +1873,7 @@ version(threadedOutlining) {} else } return rgns; } - + version(none) unittest { const(void)* p = typeid(NewHiddenRegion).rtInfo; @@ -1802,7 +1882,7 @@ version(threadedOutlining) {} else bool DiffRegions(IVsHiddenTextSession session, ref NewHiddenRegion[] rgns) { - // Compare the existing regions with the new regions and + // Compare the existing regions with the new regions and // remove any that do not match the new regions. IVsEnumHiddenRegions penum; TextSpan span = TextSpan(0, 0, 0, GetLineCount()); @@ -1915,7 +1995,7 @@ version(threadedOutlining) {} else } } } - + foreach(rgn; rgns) release(rgn); release(penum); @@ -1944,7 +2024,7 @@ version(threadedOutlining) {} else HRESULT hr = mBuffer.GetLineText(0, 0, endLine, endCol, &text); return wdetachBSTR(text); } - + bool GetWordExtent(int line, int idx, WORDEXTFLAGS flags, out int startIdx, out int endIdx) { startIdx = endIdx = idx; @@ -1988,8 +2068,8 @@ else // are doing intellisense in which case we want to match the entire value // of quoted strings. TokenCat type = info.type; - if ((flags != WORDEXT_FINDTOKEN || type != TokenCat.String) && - (type == TokenCat.Comment || type == TokenCat.Text || + if ((flags != WORDEXT_FINDTOKEN || type != TokenCat.String) && + (type == TokenCat.Comment || type == TokenCat.Text || type == TokenCat.String || type == TokenCat.Literal || type == TokenCat.Operator)) return false; @@ -2090,12 +2170,12 @@ else mBuffer.GetLineCount(&lineCount); return lineCount; } - + int GetLastLineIndex(ref int endLine, ref int endCol) { return mBuffer.GetLastLineIndex(&endLine, &endCol); } - + TokenInfo[] GetLineInfo(int line, wstring *ptext = null) { wstring text = GetText(line, 0, line, -1); @@ -2141,7 +2221,7 @@ else return -1; } - wstring _getToken(ref TokenInfo[] infoArray, ref int line, ref int col, + wstring _getToken(ref TokenInfo[] infoArray, ref int line, ref int col, ref TokenInfo info, int idx, bool skipComments) { wstring text; @@ -2165,7 +2245,7 @@ else mBuffer.GetLineCount(&lineCount); if(line >= lineCount) return ""; - + infoArray = GetLineInfo(line); idx = 0; } @@ -2173,15 +2253,15 @@ else col = infoArray[idx].StartIndex; return text[infoArray[idx].StartIndex .. infoArray[idx].EndIndex]; } - - wstring GetToken(ref TokenInfo[] infoArray, ref int line, ref int col, + + wstring GetToken(ref TokenInfo[] infoArray, ref int line, ref int col, ref TokenInfo info, bool skipComments = true) { int idx = GetTokenInfoAt(infoArray, col, info); return _getToken(infoArray, line, col, info, idx, skipComments); } - - wstring GetNextToken(ref TokenInfo[] infoArray, ref int line, ref int col, + + wstring GetNextToken(ref TokenInfo[] infoArray, ref int line, ref int col, ref TokenInfo info, bool skipComments = true) { int idx = GetTokenInfoAt(infoArray, col, info); @@ -2189,7 +2269,7 @@ else idx++; return _getToken(infoArray, line, col, info, idx, skipComments); } - + string GetFileName() { if(!mBuffer) @@ -2237,7 +2317,7 @@ else if(testNextFn && lineInfo[inf].type == TokenCat.Identifier) fn = txt[lineInfo[inf].StartIndex .. lineInfo[inf].EndIndex]; testNextFn = false; - + if(Lexer.isClosingBracket(ch)) level++; else if(Lexer.isOpeningBracket(ch) && level > 0) @@ -2252,10 +2332,10 @@ else } cl = -1; } - + return false; } - + wstring getScopeIdentifer(int line, int col, wstring fn) { TokenInfo info; @@ -2275,7 +2355,7 @@ else if(next == ":" || next == "{") return tok; // unnamed class/struct/enum return next; - + case "mixin": case "static": case "final": @@ -2296,7 +2376,7 @@ else case "public": case "export": break; - + case "align": case "extern": next = GetNextToken(infoArray, line, col, info); @@ -2320,7 +2400,7 @@ else next = GetNextToken(infoArray, line, col, info); } return tok; - + case "scope": next = GetNextToken(infoArray, line, col, info); if(next == "("w) @@ -2331,7 +2411,7 @@ else return tok; } break; - + case "debug": case "version": next = GetNextToken(infoArray, line, col, info); @@ -2342,7 +2422,7 @@ else tok ~= GetNextToken(infoArray, line, col, info); } return tok; - + case "this": case "if": case "else": @@ -2358,16 +2438,16 @@ else case "foreach": case "foreach_reverse": return tok; - + default: return fn.length ? fn ~ "()"w : tok; } tok = GetNextToken(infoArray, line, col, info); } } - + ////////////////////////////////////////////////////////////// - int ReplaceLineIndent(int line, LANGPREFERENCES* langPrefs, ref CacheLineIndentInfo cacheInfo) + int ReplaceLineIndent(int line, LANGPREFERENCES3* langPrefs, ref CacheLineIndentInfo cacheInfo) { wstring linetxt = GetText(line, 0, line, -1); int p, orgn = countVisualSpaces(linetxt, langPrefs.uTabSize, &p); @@ -2381,8 +2461,8 @@ else return doReplaceLineIndent(line, p, n, langPrefs); } - - int doReplaceLineIndent(int line, int idx, int n, LANGPREFERENCES* langPrefs) + + int doReplaceLineIndent(int line, int idx, int n, LANGPREFERENCES3* langPrefs) { int tabsz = (langPrefs.fInsertTabs && langPrefs.uTabSize > 0 ? langPrefs.uTabSize : n + 1); string spc = replicate("\t", n / tabsz) ~ replicate(" ", n % tabsz); @@ -2397,30 +2477,30 @@ else int line; int tok; SRC src; - + wstring lineText; TokenInfo[] lineInfo; - + this(SRC _src, int _line, int _tok) { src = _src; set(_line, _tok); } - + void set(int _line, int _tok) { line = _line; tok = _tok; lineInfo = src.GetLineInfo(line, &lineText); } - + bool advance() { while(tok + 1 >= lineInfo.length) { if(line + 1 >= src.GetLineCount()) return false; - + line++; lineInfo = src.GetLineInfo(line, &lineText); tok = -1; @@ -2439,7 +2519,7 @@ else return (lineInfo[tok].type == TokenCat.Comment || (lineInfo[tok].type == TokenCat.Text && isWhite(lineText[lineInfo[tok].StartIndex]))); } - + bool advanceOverSpaces() { while(advance()) @@ -2476,7 +2556,7 @@ else { if(tok < lineInfo.length && !onCommentOrSpace()) return true; - + if(!skipLines) { while(tok + 1 < lineInfo.length) @@ -2489,14 +2569,14 @@ else } return advanceOverComments(); } - + bool retreat() { while(tok <= 0) { if(line <= 0) return false; - + line--; lineInfo = src.GetLineInfo(line, &lineText); tok = lineInfo.length; @@ -2530,7 +2610,7 @@ else } return retreatOverComments(); } - + wstring getText() { if(tok < lineInfo.length) @@ -2581,7 +2661,7 @@ else return it.getText(); } } - + alias _LineTokenIterator!Source LineTokenIterator; static struct CacheLineIndentInfo @@ -2606,13 +2686,13 @@ else // - while *tokIt is not the stop marker or '{' or ';' // - move back one matching braces // - if the token before the given line is not ';' or '}', indent by one level more - + // special handling for: // - comma at the end of next line // - case/default // - label: - int CalcLineIndent(int line, dchar ch, LANGPREFERENCES* langPrefs, ref CacheLineIndentInfo cacheInfo) + int CalcLineIndent(int line, dchar ch, LANGPREFERENCES3* langPrefs, ref CacheLineIndentInfo cacheInfo) { LineTokenIterator lntokIt = LineTokenIterator(this, line, 0); wstring startTok; @@ -2627,7 +2707,7 @@ else if(!lntokIt.retreatOverComments()) return 0; - + bool isOpenBraceOrCase(ref LineTokenIterator it) { wstring txt = it.getText(); @@ -2687,7 +2767,7 @@ else return saveCacheInfo(false); } - + int findPreviousCaseIndent() { do @@ -2785,7 +2865,7 @@ else } if(isOpenBraceOrCase(lntokIt)) return saveCacheInfo(countVisualSpaces(lntokIt.lineText, langPrefs.uTabSize) + langPrefs.uTabSize); - + if(txt == "}" || txt == ";") // triggers the end of a statement, but not do {} while() { // indent once from line with first comma @@ -2803,7 +2883,7 @@ else return findMatchingIf(); if(startTok == "case" || startTok == "default") return findPreviousCaseIndent(); - + LineTokenIterator it = lntokIt; bool hasOpenBrace = findOpenBrace(it); if(hasOpenBrace && txt == "(") @@ -2819,11 +2899,11 @@ else return countVisualSpaces(it.lineText, langPrefs.uTabSize); return 0; } - + wstring prevTok = lntokIt.getText(); if(prevTok == ",") return findCommaIndent(); - + int indent = 0, labelIndent = 0; bool newStmt = (prevTok == ";" || prevTok == "}" || prevTok == "{" || prevTok == ":"); if(newStmt)// || prevTok == ":") @@ -2852,7 +2932,7 @@ else return visiblePosition(lntokIt.lineText, langPrefs.uTabSize, lntokIt.getIndex() + 1); if(isOpenBraceOrCase(lntokIt)) return countVisualSpaces(lntokIt.lineText, langPrefs.uTabSize) + langPrefs.uTabSize + indent + labelIndent; - + if(txt == "}" || txt == ";") // triggers the end of a statement, but not do {} while() { // use indentation of next statement @@ -2882,12 +2962,12 @@ else int ReindentLines(IVsTextView view, int startline, int endline) { - LANGPREFERENCES langPrefs; + LANGPREFERENCES3 langPrefs; if(int rc = GetUserPreferences(&langPrefs, view)) return rc; if(langPrefs.IndentStyle != vsIndentStyleSmart) return S_FALSE; - + CacheLineIndentInfo cacheInfo; for(int line = startline; line <= endline; line++) { @@ -2911,7 +2991,7 @@ else lntokIt.retreatOverComments(); if(lntokIt.getText() != ".") return null; - + caretLine = lntokIt.line; caretIndex = lntokIt.getIndex(); lntokIt.retreatOverComments(); @@ -2954,10 +3034,10 @@ else int CommentLines(IVsTextView view, int startline, int endline, int commentMode) { - LANGPREFERENCES langPrefs; + LANGPREFERENCES3 langPrefs; if(int rc = GetUserPreferences(&langPrefs, view)) return rc; - + wstring[] lines; wstring txt; int n, m, p, indent = -1; @@ -2971,7 +3051,7 @@ else indent = (indent < 0 || indent > n ? n : indent); lines ~= txt; } - + for(line = startline; line <= endline; line++) { txt = lines[line - startline]; @@ -2992,12 +3072,12 @@ else assert(n == indent && txt[p] == '/' && txt[p+1] == '/'); txt = txt[0..p] ~ " " ~ txt[p+2..$]; m = countVisualSpaces(txt, langPrefs.uTabSize, &p) - 2; - + if(p >= txt.length) txt = ""; else txt = createVisualSpaces!wstring(m, langPrefs.fInsertTabs ? langPrefs.uTabSize : 0); - + TextSpan changedSpan; if (int hr = mBuffer.ReplaceLines(line, 0, line, p, txt.ptr, txt.length, &changedSpan)) return hr; @@ -3008,7 +3088,7 @@ else // insert comment int tabsz = (langPrefs.fInsertTabs ? langPrefs.uTabSize : 0); wstring pfx = createVisualSpaces!wstring(indent, tabsz) ~ "//"w; - + for(line = startline; line <= endline; line++) { txt = lines[line - startline]; @@ -3047,19 +3127,19 @@ else dLex.scan(state, text, p); if(p > idx) return tok; - + tok++; } return -1; } - // continuing from FindLineToken - bool FindEndOfTokens(ref int iState, ref int line, ref uint pos, + // continuing from FindLineToken + bool FindEndOfTokens(ref int iState, ref int line, ref uint pos, bool function(int state, int data) testFn, int data) { int lineCount; mBuffer.GetLineCount(&lineCount); - + uint plinepos = pos; while(line < lineCount) { @@ -3088,7 +3168,7 @@ else } return false; } - + static bool testEndComment(int state, int level) { int slevel = Lexer.nestingLevel(state); @@ -3099,7 +3179,7 @@ else return slevel <= level; return sstate != Lexer.State.kBlockComment; } - + bool FindEndOfComment(int startState, ref int iState, ref int line, ref uint pos) { int level = Lexer.nestingLevel(startState); @@ -3107,12 +3187,12 @@ else return true; return FindEndOfTokens(iState, line, pos, &testEndComment, level); } - + static bool testEndString(int state, int level) { if(Lexer.tokenStringLevel(state) > level) return false; - + auto sstate = Lexer.scanState(state); return !Lexer.isStringState(sstate); } @@ -3123,7 +3203,7 @@ else return true; return FindEndOfTokens(iState, line, pos, &testEndString, level); } - + bool FindStartOfTokens(ref int iState, ref int line, ref uint pos, bool function(int state, int data) testFn, int data) { @@ -3138,7 +3218,7 @@ else uint len = (plinepos > text.length ? text.length : plinepos); plinepos = 0; - + if(testFn(lineState, data)) foundpos = 0; while(plinepos < len) @@ -3153,7 +3233,7 @@ else pos = foundpos; return true; } - + plinepos = uint.max; line--; } @@ -3167,7 +3247,7 @@ else int slevel = Lexer.nestingLevel(state); return slevel < level; } - + bool FindStartOfComment(ref int iState, ref int line, ref uint pos) { // comment ends after the token that starts at (line,pos) with state iState @@ -3180,7 +3260,7 @@ else int level = Lexer.nestingLevel(iState); return FindStartOfTokens(iState, line, pos, &testStartComment, level); } - + bool FindStartOfString(ref int iState, ref int line, ref uint pos) { int level = Lexer.tokenStringLevel(iState); @@ -3188,7 +3268,7 @@ else return true; return FindStartOfTokens(iState, line, pos, &testEndString, level); } - + bool FindClosingBracketForward(int line, int idx, out int otherLine, out int otherIndex) { int iState; @@ -3205,7 +3285,7 @@ else return FindClosingBracketForward(line, iState, pos, otherLine, otherIndex); } - + bool FindClosingBracketForward(int line, int iState, uint pos, out int otherLine, out int otherIndex) { int lineCount; @@ -3249,17 +3329,17 @@ else int[] tokpos; int[] toktype; uint pos = 0; - + int iState = mColorizer.GetLineState(line); if(iState == -1) break; - + while(pos < text.length) { tokpos ~= pos; toktype ~= dLex.scan(iState, text, pos); } - int p = (tok >= 0 ? tok : tokpos.length) - 1; + int p = (tok >= 0 ? tok : tokpos.length) - 1; for( ; p >= 0; p--) { pos = tokpos[p]; @@ -3284,7 +3364,7 @@ else return false; } - bool ScanBackward(int line, int tok, + bool ScanBackward(int line, int tok, bool delegate(wstring text, uint pos, uint ppos, int type) dg) { while(line >= 0) @@ -3297,7 +3377,7 @@ else int iState = mColorizer.GetLineState(line); if(iState == -1) break; - + while(pos < text.length) { tokpos ~= pos; @@ -3317,7 +3397,7 @@ else } return false; } - + // tok is sitting on the opening parenthesis, return method name and its position wstring FindMethodIdentifierBackward(int line, int tok, int* pline, int* pindex) { @@ -3371,6 +3451,181 @@ else return null; } + ////////////////////////////////////////////////////////////// + wstring mLastBraceCompletionText; + int mLastBraceCompletionLine; + + int CompleteOpenBrace(int line, int col, dchar ch) + { + // a closing brace is added if + // - the remaining line is empty + // - or the rest of the line was inserted by previous automatic additions + if (mLastBraceCompletionLine != line) + mLastBraceCompletionText = null; + + wstring text = GetText(line, 0, line, -1); + if (text.length < col) + return S_FALSE; + + wstring tail = strip(text[col..$]); + if (!tail.empty && tail != mLastBraceCompletionText) + return S_FALSE; + + wchar closech = Lexer.closingBracket(ch); + TextSpan changedSpan; + if (int rc = mBuffer.ReplaceLines(line, col, line, col, &closech, 1, &changedSpan)) + return rc; + + mLastBraceCompletionText = closech ~ mLastBraceCompletionText; + mLastBraceCompletionLine = line; + + return S_OK; + } + + int DeleteClosingBrace(ref int line, ref int col, dchar ch) + { + // assume the closing brace being already inserted. Remove the subsequent + // identical brace if it has been inserted by open brace completion + if (mLastBraceCompletionLine != line || mLastBraceCompletionText.empty) + return S_FALSE; + + TextSpan changedSpan; + wstring text = GetText(line, 0, line, -1); + if (text.length <= col || text[col] != ch || mLastBraceCompletionText[0] != ch) + { + if (mLastBraceCompletionText[0] == '\n' && + mLastBraceCompletionText.length > 1 && mLastBraceCompletionText[1] == ch) + { + wstring ntext = GetText(line + 1, 0, line + 1, -1); + wstring nt = stripLeft(ntext); + if (nt.length > 0 && nt[0] == ch) + { + wstring t = strip(text); + if (t.length > 0 && t[$-1] == ch) + { + int ncol = ntext.length - nt.length; + if (t.length == 1) + { + // remove empty auto inserted line + if (int rc = mBuffer.ReplaceLines(line, col, line + 1, ncol + 1, null, 0, &changedSpan)) + return rc; + } + else + { + // remove just inserted brace and move forward behind existing + if (int rc = mBuffer.ReplaceLines(line, col - 1, line, col, null, 0, &changedSpan)) + return rc; + col = ncol + 1; + line = line + 1; + mLastBraceCompletionLine = line; + } + mLastBraceCompletionText = mLastBraceCompletionText[2..$]; + return S_OK; + } + } + } + + return S_FALSE; + } + + if (int rc = mBuffer.ReplaceLines(line, col, line, col + 1, null, 0, &changedSpan)) + return rc; + + mLastBraceCompletionText = mLastBraceCompletionText[1..$]; + return S_OK; + } + + int CompleteQuote(int line, int col, dchar ch) + { + if (mLastBraceCompletionLine != line) + mLastBraceCompletionText = null; + + // a closing quote is added if the cursor is inside a string + int state = mColorizer.GetLineState(line); + if(state == -1) + return S_FALSE; + + // get the lexer state at the current edit position + wstring text = GetText(line, 0, line, -1); + if(text.length < col) + return S_FALSE; + + wstring tail = strip(text[col..$]); + text = text[0..col]; + + uint pos = 0; + int id = -1; + while(pos < text.length) + dLex.scan(state, text, pos, id); + + Lexer.State s = Lexer.scanState(state); + int nesting = Lexer.nestingLevel(state); + int tokLevel = Lexer.tokenStringLevel(state); + int otherState = Lexer.getOtherState(state); + + switch(s) + { + case Lexer.State.kStringToken: + case Lexer.State.kStringCStyle: + case Lexer.State.kStringWysiwyg: + case Lexer.State.kStringAltWysiwyg: + case Lexer.State.kStringDelimited: + break; + default: + return DeleteClosingBrace(line, col, ch); + } + + // only auto append on end of line + if (!tail.empty && tail != mLastBraceCompletionText) + return S_FALSE; + + wstring close; + close ~= ch; + TextSpan changedSpan; + if (int rc = mBuffer.ReplaceLines(line, col, line, col, close.ptr, close.length, &changedSpan)) + return rc; + + mLastBraceCompletionText = close ~ mLastBraceCompletionText; + mLastBraceCompletionLine = line; + return S_OK; + } + + int CompleteLineBreak(int line, int col, ref LANGPREFERENCES3 langPrefs) + { + if (mLastBraceCompletionLine != line - 1) + return S_FALSE; + + mLastBraceCompletionLine = line; + + if (mLastBraceCompletionText.length && mLastBraceCompletionText[0] == '}') + { + wstring newline = "\n"w; + TextSpan changedSpan; + if (int rc = mBuffer.ReplaceLines(line, col, line, col, newline.ptr, newline.length, &changedSpan)) + return rc; + CacheLineIndentInfo cacheInfo; + if (int rc = ReplaceLineIndent(line + 1, &langPrefs, cacheInfo)) + return rc; + + mLastBraceCompletionText = newline ~ mLastBraceCompletionText; + } + return S_OK; + } + + int AutoCompleteBrace(ref int line, ref int col, dchar ch, ref LANGPREFERENCES3 langPrefs) + { + if(ch == '\n') + return CompleteLineBreak(line, col, langPrefs); + + if(ch == '"' || ch == '`' || ch == '\'') + return CompleteQuote(line, col, ch); + + if(ch == '(' || ch == '[' || ch == '{') + return CompleteOpenBrace(line, col, ch); + + return DeleteClosingBrace(line, col, ch); + } + ////////////////////////////////////////////////////////////// class ClippingSource @@ -3445,7 +3700,7 @@ else lntokIt.retreatOverComments(); L_eol: wstring tok = lntokIt.getText(); - while((tok == "static" || tok == "public" || tok == "private") + while((tok == "static" || tok == "public" || tok == "private") && lntokIt.advanceOverComments()) tok = lntokIt.getText(); @@ -3478,7 +3733,7 @@ else } ////////////////////////////////////////////////////////////// - + // create our own task pool to be able to destroy it (it keeps a the // arguments to the last task, so they are never collected) __gshared TaskPool parseTaskPool; @@ -3499,15 +3754,15 @@ else auto task = task(dg); parseTaskPool.put(task); } - + bool startParsing() { if(!Package.GetGlobalOptions().parseSource && !mOutlining) return false; - + if(mParsingState > 1) return finishParsing(); - + if(mParsingState != 0 || mModificationCountAST == mModificationCount) return false; @@ -3516,7 +3771,7 @@ else mParsingState = 1; mModificationCountAST = mModificationCount; runTask(&doParse); - + if(Package.GetGlobalOptions().parseSource) { auto langsvc = Package.GetLanguageService(); @@ -3594,7 +3849,7 @@ else { auto span = mParseErrors[i].span; IVsTextLineMarker marker; - mBuffer.CreateLineMarker(MARKER_CODESENSE_ERROR, span.iStartLine - 1, span.iStartIndex, + mBuffer.CreateLineMarker(MARKER_CODESENSE_ERROR, span.iStartLine - 1, span.iStartIndex, span.iEndLine - 1, span.iEndIndex, this, &marker); } } @@ -3622,7 +3877,7 @@ else ReColorizeLines(0, -1); return true; } - + void doParse() { if(mOutlining) @@ -3631,7 +3886,7 @@ else } mParsingState = 2; } - + bool hasParseError(ParserSpan span) { for(int i = 0; i < mParseErrors.length; i++) @@ -3639,7 +3894,7 @@ else return true; return false; } - + string getParseError(int line, int index) { for(int i = 0; i < mParseErrors.length; i++) @@ -3647,7 +3902,7 @@ else return mParseErrors[i].msg; return null; } - + ////////////////////////////////////////////////////////////// ExpansionProvider GetExpansionProvider() diff --git a/visuald/dpackage.d b/visuald/dpackage.d index f5f293be..ad055c11 100644 --- a/visuald/dpackage.d +++ b/visuald/dpackage.d @@ -73,11 +73,12 @@ struct LanguageProperty DWORD value; } -const string plk_version = extractDefine(import("version"), "VERSION_MAJOR") ~ "." ~ +const string pkg_version = extractDefine(import("version"), "VERSION_MAJOR") ~ "." ~ extractDefine(import("version"), "VERSION_MINOR"); +const string plk_version = "0.3"; // for VS2008 or earlier const string bld_version = extractDefine(import("version"), "VERSION_BUILD"); const string beta_version = extractDefine(import("version"), "VERSION_BETA"); -const string full_version = plk_version ~ "." ~ +const string full_version = pkg_version ~ "." ~ extractDefine(import("version"), "VERSION_REVISION") ~ (bld_version != "0" ? beta_version ~ bld_version : ""); @@ -86,7 +87,7 @@ const string full_version = plk_version ~ "." ~ *---------------------------------------------------------*/ const wstring g_languageName = "D"w; const wstring g_packageName = "Visual D"w; -const string g_packageVersion = plk_version; +const string g_packageVersion = pkg_version; const wstring g_packageCompany = "Rainer Schuetze"w; const wstring[] g_languageFileExtensions = [ ".d"w, ".di"w, ".mixin"w ]; const wstring g_defaultProjectFileExtension = "visualdproj"w; @@ -116,24 +117,27 @@ const GUID g_unmarshalEnumOutCLSID = uuid("002a2de9-8bb6-484d-980e-7e4ad40 // const GUID g_unmarshalTargetInfoCLSID = uuid("002a2de9-8bb6-484d-980f-7e4ad4084715"); // defined in config.d const GUID g_VisualDHelperCLSID = uuid("002a2de9-8bb6-484d-aa10-7e4ad4084715"); +const GUID g_VisualCHelperCLSID = uuid("002a2de9-8bb6-484d-aa11-7e4ad4084715"); // more guids in propertypage.d starting with 9810 const LanguageProperty[] g_languageProperties = [ - // see http://msdn.microsoft.com/en-us/library/bb166421.aspx - { "RequestStockColors"w, 0 }, - { "ShowCompletion"w, 1 }, - { "ShowSmartIndent"w, 1 }, - { "ShowHotURLs"w, 1 }, - { "Default to Non Hot URLs"w, 1 }, - { "DefaultToInsertSpaces"w, 0 }, - { "ShowDropdownBarOption "w, 1 }, - { "Single Code Window Only"w, 1 }, - { "EnableAdvancedMembersOption"w, 1 }, - { "Support CF_HTML"w, 0 }, - { "EnableLineNumbersOption"w, 1 }, - { "HideAdvancedMembersByDefault"w, 0 }, + // see http://msdn.microsoft.com/en-us/library/bb166421.aspx + { "RequestStockColors"w, 0 }, + { "ShowCompletion"w, 1 }, + { "ShowSmartIndent"w, 1 }, + { "ShowHotURLs"w, 1 }, + { "Default to Non Hot URLs"w, 1 }, + { "DefaultToInsertSpaces"w, 0 }, + { "ShowDropdownBarOption "w, 1 }, + { "Single Code Window Only"w, 1 }, + { "EnableAdvancedMembersOption"w, 1 }, + { "Support CF_HTML"w, 0 }, + { "EnableLineNumbersOption"w, 1 }, + { "HideAdvancedMembersByDefault"w, 0 }, + { "ShowBraceCompletion"w, 1 }, + ]; /////////////////////////////////////////////////////////////////////// @@ -485,9 +489,9 @@ version(none) { OLECRINFO crinfo; crinfo.cbSize = crinfo.sizeof; - crinfo.grfcrf = olecrfNeedIdleTime | olecrfNeedPeriodicIdleTime | olecrfNeedAllActiveNotifs | olecrfNeedSpecActiveNotifs; + crinfo.grfcrf = olecrfNeedPeriodicIdleTime | olecrfNeedAllActiveNotifs | olecrfNeedSpecActiveNotifs; crinfo.grfcadvf = olecadvfModal | olecadvfRedrawOff | olecadvfWarningsOff; - crinfo.uIdleTimeInterval = 1000; + crinfo.uIdleTimeInterval = 500; if(!componentManager.FRegisterComponent(this, &crinfo, &mComponentID)) OutputDebugLog("FRegisterComponent failed"); } @@ -571,6 +575,7 @@ version(none) prgCmds[i].cmdf = OLECMDF_SUPPORTED | OLECMDF_ENABLED; break; default: + prgCmds[i].cmdf = OLECMDF_SUPPORTED; break; } } @@ -668,8 +673,11 @@ version(none) mWantsUpdateLibInfos = false; Package.GetLibInfos().updateDefinitions(); } - mLangsvc.OnIdle(); OutputPaneBuffer.flush(); + + if (mLangsvc.OnIdle()) + return true; + return false; } @@ -1102,6 +1110,12 @@ version(none) return s_instance.mLangsvc; } + static ProjectFactory GetProjectFactory() + { + assert(s_instance); + return s_instance.mProjFactory; + } + static GlobalOptions GetGlobalOptions() { assert(s_instance); @@ -1190,6 +1204,7 @@ class GlobalOptions string DevEnvDir; string VSInstallDir; string VCInstallDir; + string VCToolsInstallDir; // used by VS 2017 string VisualDInstallDir; bool timeBuilds; @@ -1333,7 +1348,7 @@ class GlobalOptions } } - void detectVCInstallDir() + void detectVSInstallDir() { if(char* pe = getenv("VSINSTALLDIR")) VSInstallDir = fromMBSz(cast(immutable)pe); @@ -1348,16 +1363,54 @@ class GlobalOptions VSInstallDir = normalizeDir(VSInstallDir); } - void detectVSInstallDir() + void detectVCInstallDir() { - if(char* pe = getenv("VCINSTALLDIR")) - VCInstallDir = fromMBSz(cast(immutable)pe); + string defverFile = VSInstallDir ~ r"VC\Auxiliary\Build\Microsoft.VCToolsVersion.default.txt"; + if (std.file.exists(defverFile)) + { + // VS 2017 + try + { + string ver = strip(readUtf8(defverFile)); + VCInstallDir = VSInstallDir ~ r"VC\"; + if (!ver.empty) + VCToolsInstallDir = VCInstallDir ~ r"Tools\MSVC\" ~ ver ~ r"\"; + } + catch(Exception) + { + } + } + if (VCInstallDir.empty) + { + if(char* pe = getenv("VCINSTALLDIR")) + VCInstallDir = fromMBSz(cast(immutable)pe); + else + { + scope RegKey keyVS = new RegKey(hConfigKey, regConfigRoot ~ "\\Setup\\VC", false); + VCInstallDir = toUTF8(keyVS.GetString("ProductDir")); + } + VCInstallDir = normalizeDir(VCInstallDir); + } + } + + string getVCDir(string sub, bool x64, bool expand = false) + { + string dir; + if (!VCToolsInstallDir.empty) + { + dir = (expand ? VCToolsInstallDir : "$(VCTOOLSINSTALLDIR)"); + if (sub.startsWith("bin")) + sub = (x64 ? "bin\\HostX86\\x64" : "bin\\HostX86\\x86") ~ sub[3 .. $]; + if (sub.startsWith("lib")) + sub = (x64 ? "lib\\x64" : "lib\\x86") ~ sub[3 .. $]; + } else { - scope RegKey keyVS = new RegKey(hConfigKey, regConfigRoot ~ "\\Setup\\VC", false); - VCInstallDir = toUTF8(keyVS.GetString("ProductDir")); + dir = (expand ? VCInstallDir : "$(VCINSTALLDIR)"); + if (sub.startsWith("lib") && x64) + sub = "lib\\amd64" ~ sub[3 .. $]; } - VCInstallDir = normalizeDir(VCInstallDir); + return dir ~ sub; } bool initFromRegistry() @@ -1374,7 +1427,7 @@ class GlobalOptions bool rc = true; try { - wstring defUserTypesSpec = "Object string wstring dstring ClassInfo\n" + wstring defUserTypesSpec = "Object string wstring dstring ClassInfo\n" ~ "hash_t ptrdiff_t size_t sizediff_t"; // get defaults from global config scope RegKey keyToolOpts = new RegKey(hConfigKey, regConfigRoot ~ regPathToolsOptions, false); @@ -1385,6 +1438,14 @@ class GlobalOptions detectVSInstallDir(); detectVCInstallDir(); + //UtilMessageBox("getVCDir = " ~ getVCDir("lib\\legacy_stdio_definitions.lib", true, true) + //UtilMessageBox("VSInstallDir = "~VSInstallDir ~"\n" ~ + // "VCInstallDir = "~VCInstallDir ~"\n" ~ + // "VCToolsInstallDir = "~VCToolsInstallDir ~ "\n" ~ + // "regConfig = " ~ to!string(regConfigRoot) ~ "\n" ~ + // "regUser = " ~ to!string(regUserRoot) + // , MB_OK, "Visual D - init"); + wstring getWStringOpt(wstring tag, wstring def = null) { wstring ws = keyToolOpts.GetString(tag, def); @@ -1435,8 +1496,9 @@ class GlobalOptions string getDefaultLibPathCOFF64() { - string libpath = r"$(VCInstallDir)\lib\amd64"; - if(std.file.exists(VCInstallDir ~ "lib\\legacy_stdio_definitions.lib")) + string libpath = getVCDir ("lib", true); + string dir = replaceGlobalMacros(libpath); + if(std.file.exists(dir ~ "\\legacy_stdio_definitions.lib")) libpath ~= "\n$(UCRTSdkDir)Lib\\$(UCRTVersion)\\ucrt\\x64"; if(WindowsSdkDir.length) @@ -1453,8 +1515,9 @@ class GlobalOptions string getDefaultLibPathCOFF32() { - string libpath = r"$(VCInstallDir)\lib"; - if(std.file.exists(VCInstallDir ~ "lib\\legacy_stdio_definitions.lib")) + string libpath = getVCDir ("lib", false); + string dir = replaceGlobalMacros(libpath); + if(std.file.exists(dir ~ "\\legacy_stdio_definitions.lib")) libpath ~= "\n$(UCRTSdkDir)Lib\\$(UCRTVersion)\\ucrt\\x86"; if(WindowsSdkDir.length) @@ -1484,8 +1547,9 @@ class GlobalOptions opt.LibSearchPath64 = getPathsOpt(prefix ~ "LibSearchPath64", opt.LibSearchPath64); opt.DisasmCommand64 = getPathsOpt(prefix ~ "DisasmCommand64", opt.DisasmCommand64); + wstring linkPath = to!wstring(getVCDir("bin\\link.exe", false)); opt.overrideIni64 = getBoolOpt(prefix ~ "overrideIni64", dmd); - opt.overrideLinker64 = getStringOpt(prefix ~ "overrideLinker64", dmd ? r"$(VCINSTALLDIR)\bin\link.exe" : ""); + opt.overrideLinker64 = getStringOpt(prefix ~ "overrideLinker64", dmd ? linkPath : ""); opt.overrideOptions64 = getStringOpt(prefix ~ "overrideOptions64"); if (dmd) @@ -1493,8 +1557,8 @@ class GlobalOptions opt.ExeSearchPath32coff = getPathsOpt(prefix ~ "ExeSearchPath32coff", opt.ExeSearchPath32coff); opt.LibSearchPath32coff = getPathsOpt(prefix ~ "LibSearchPath32coff", opt.LibSearchPath32coff); opt.DisasmCommand32coff = getPathsOpt(prefix ~ "DisasmCommand32coff", opt.DisasmCommand32coff); - opt.overrideIni32coff = getBoolOpt(prefix ~ "overrideIni32coff", dmd); - opt.overrideLinker32coff = getStringOpt(prefix ~ "overrideLinker32coff", dmd ? r"$(VCINSTALLDIR)\bin\link.exe" : ""); + opt.overrideIni32coff = getBoolOpt(prefix ~ "overrideIni32coff", true); + opt.overrideLinker32coff = getStringOpt(prefix ~ "overrideLinker32coff", linkPath); opt.overrideOptions32coff = getStringOpt(prefix ~ "overrideOptions32coff"); } } @@ -1502,13 +1566,13 @@ class GlobalOptions // $(WindowsSdkDir)\bin needed for rc.exe // $(VCInstallDir)\bin needed to compile C + link.exe + DLLs // $(VSINSTALLDIR)\Common7\IDE needed for some VS versions for cv2pdb - DMD.ExeSearchPath = r"$(VCInstallDir)\bin;$(VSINSTALLDIR)\Common7\IDE;$(WindowsSdkDir)\bin;$(DMDInstallDir)windows\bin"; + DMD.ExeSearchPath = getVCDir("bin", false) ~ r";$(VSINSTALLDIR)Common7\IDE;$(WindowsSdkDir)bin;$(DMDInstallDir)windows\bin"; DMD.ExeSearchPath64 = DMD.ExeSearchPath; DMD.ExeSearchPath32coff = DMD.ExeSearchPath; - GDC.ExeSearchPath = r"$(GDCInstallDir)\bin;$(VSINSTALLDIR)\Common7\IDE;$(WindowsSdkDir)\bin"; + GDC.ExeSearchPath = r"$(GDCInstallDir)bin;$(VSINSTALLDIR)Common7\IDE;$(WindowsSdkDir)bin"; GDC.ExeSearchPath64 = GDC.ExeSearchPath; - LDC.ExeSearchPath = r"$(LDCInstallDir)\bin;$(VCInstallDir)\bin;$(VSINSTALLDIR)\Common7\IDE;$(WindowsSdkDir)\bin"; - LDC.ExeSearchPath64 = r"$(LDCInstallDir)\bin;$(VCInstallDir)\bin\amd64;$(WindowsSdkDir)\bin"; + LDC.ExeSearchPath = r"$(LDCInstallDir)bin;" ~ getVCDir("bin", false) ~ r";$(VSINSTALLDIR)Common7\IDE;$(WindowsSdkDir)bin"; + LDC.ExeSearchPath64 = r"$(LDCInstallDir)bin;" ~ getVCDir("bin", true) ~ r";$(WindowsSdkDir)bin"; DMD.LibSearchPath64 = getDefaultLibPathCOFF64(); LDC.LibSearchPath64 = DMD.LibSearchPath64; @@ -1516,8 +1580,8 @@ class GlobalOptions LDC.LibSearchPath = DMD.LibSearchPath32coff; DMD.DisasmCommand = `"obj2asm" -x "$(InputPath)" >"$(TargetPath)"`; - DMD.DisasmCommand64 = `"$(VCInstallDir)\bin\amd64\dumpbin" /disasm:nobytes "$(InputPath)" >"$(TargetPath)"`; - DMD.DisasmCommand32coff = `"$(VCInstallDir)\bin\dumpbin" /disasm:nobytes "$(InputPath)" >"$(TargetPath)"`; + DMD.DisasmCommand64 = `"` ~ getVCDir("bin\\dumpbin", true) ~ `" /disasm:nobytes "$(InputPath)" >"$(TargetPath)"`; + DMD.DisasmCommand32coff = `"` ~ getVCDir("bin\\dumpbin", false) ~ `" /disasm:nobytes "$(InputPath)" >"$(TargetPath)"`; GDC.DisasmCommand = DMD.DisasmCommand32coff; LDC.DisasmCommand = DMD.DisasmCommand32coff; @@ -1529,7 +1593,7 @@ class GlobalOptions readCompilerOptions!"LDC"(LDC); JSNSearchPath = getPathsOpt("JSNSearchPath"); - IncSearchPath = getStringOpt("IncSearchPath", r"$(WindowsSdkDir)\include;$(VCInstallDir)\include"); + IncSearchPath = getStringOpt("IncSearchPath", r"$(WindowsSdkDir)include;"w ~ to!wstring(getVCDir("include", false))); VDServerIID = getStringOpt("VDServerIID"); compileAndRunOpts = getStringOpt("compileAndRunOpts", "-unittest"); compileAndDbgOpts = getStringOpt("compileAndDbgOpts", "-g"); @@ -1702,6 +1766,7 @@ class GlobalOptions replacements["UCRTVERSION"] = UCRTVersion; replacements["DEVENVDIR"] = DevEnvDir; replacements["VCINSTALLDIR"] = VCInstallDir; + replacements["VCTOOLSINSTALLDIR"] = VCToolsInstallDir; replacements["VSINSTALLDIR"] = VSInstallDir; replacements["VISUALDINSTALLDIR"] = VisualDInstallDir; } @@ -2251,7 +2316,7 @@ class ItemWizard : DisposingDispatchObject, dte.IDTWizard silent = var.boolVal != 0; } - UtilMessageBox("Sorry, it does not make sense to add a package without specifying a folder.\n" + UtilMessageBox("Sorry, it does not make sense to add a package without specifying a folder.\n" ~ "Please use the \"Add new item\" command from the project context menu.", MB_OK, "Visual D - Add package"); if(retval) diff --git a/visuald/dproject.d b/visuald/dproject.d index a69fa921..ce4486ef 100644 --- a/visuald/dproject.d +++ b/visuald/dproject.d @@ -84,7 +84,7 @@ class ProjectFactory : DComObject, IVsProjectFactory return S_OK; } - override int CreateProject(in wchar* pszFilename, in wchar* pszLocation, in wchar* pszName, in VSCREATEPROJFLAGS grfCreateFlags, + override int CreateProject(in wchar* pszFilename, in wchar* pszLocation, in wchar* pszName, in VSCREATEPROJFLAGS grfCreateFlags, in IID* iidProject, void** ppvProject, BOOL* pfCanceled) { mixin(LogCallMix); @@ -96,7 +96,7 @@ class ProjectFactory : DComObject, IVsProjectFactory int hr = CoCreateInstance(&VCProjectEngineObject.iid, null, CLSCTX_INPROC_SERVER, &VCProjectEngine.iid, cast(void*)&spEngine); if( hr != S_OK || !spEngine ) { - CoUninitialize(); + CoUninitialize(); return returnError(E_FAIL); } @@ -104,7 +104,7 @@ class ProjectFactory : DComObject, IVsProjectFactory IDispatch *spDispProj = spEngine.CreateProject(pszFilename); if(!spDispProj) { - CoUninitialize(); + CoUninitialize(); return returnError(E_FAIL); } } // version @@ -225,7 +225,7 @@ class Project : CVsHierarchy, mCaption = mName = name; mFilename = filename; mConfigProvider = addref(newCom!ConfigProvider(this)); - + parseXML(); } this(ProjectFactory factory, string name, string filename, string platform, string config) @@ -234,8 +234,10 @@ class Project : CVsHierarchy, mCaption = mName = name; mFilename = filename; mConfigProvider = addref(newCom!ConfigProvider(this)); - - mConfigProvider.addConfig(platform, config); + + if (platform && config) + mConfigProvider.addConfig(platform, config); + CProjectNode rootnode = newCom!CProjectNode(filename, this); rootnode.SetName(name); SetRootNode(rootnode); @@ -296,7 +298,7 @@ class Project : CVsHierarchy, return S_OK; if(queryInterface!(IVsSccProject2) (this, riid, pvObject)) return S_OK; - + //if(queryInterface!(IRpcOptions) (this, riid, pvObject)) // return S_OK; //if(queryInterface!(IPerPropertyBrowsing) (this, riid, pvObject)) @@ -308,9 +310,9 @@ class Project : CVsHierarchy, __gshared ComTypeInfoHolder mTypeHolder; static void shared_static_this_typeHolder() { - static class _ComTypeInfoHolder : ComTypeInfoHolder + static class _ComTypeInfoHolder : ComTypeInfoHolder { - override int GetIDsOfNames( + override int GetIDsOfNames( /* [size_is][in] */ in LPOLESTR *rgszNames, /* [in] */ in UINT cNames, /* [size_is][out] */ MEMBERID *pMemId) @@ -339,7 +341,7 @@ class Project : CVsHierarchy, override ComTypeInfoHolder getTypeHolder () { return mTypeHolder; } - override int Invoke( + override int Invoke( /* [in] */ in DISPID dispIdMember, /* [in] */ in IID* riid, /* [in] */ in LCID lcid, @@ -393,12 +395,12 @@ class Project : CVsHierarchy, mixin(LogCallMix); if(CFileNode pNode = cast(CFileNode) VSITEMID2Node(itemid)) - return OpenDoc(pNode, false /*fNewFile*/, + return OpenDoc(pNode, false /*fNewFile*/, false /*fUseOpenWith*/, false /*fShow*/, rguidLogicalView, &GUID_NULL, null, - punkDocDataExisting, + punkDocDataExisting, ppWindowFrame); return returnError(E_UNEXPECTED); @@ -408,12 +410,12 @@ class Project : CVsHierarchy, { logCall("GetItemContext(itemid=%s, ppSP=%s)", _toLog(itemid), _toLog(ppSP)); - // NOTE: this method allows a project to provide project context services + // NOTE: this method allows a project to provide project context services // to an item (document) editor. If the project does not need to provide special // services to its items then it should return null. Under no circumstances // should you return the IServiceProvider pointer that was passed to our // package from the Environment via IVsPackage::SetSite. The global services - // will automatically be made available to editors. + // will automatically be made available to editors. *ppSP = null; return S_OK; } @@ -453,9 +455,9 @@ class Project : CVsHierarchy, return returnError(E_INVALIDARG); } - override int AddItem(in VSITEMID itemidLoc, in VSADDITEMOPERATION dwAddItemOperation, + override int AddItem(in VSITEMID itemidLoc, in VSADDITEMOPERATION dwAddItemOperation, in LPCOLESTR pszItemName, - in ULONG cFilesToOpen, in LPCOLESTR * rgpszFilesToOpen, + in ULONG cFilesToOpen, in LPCOLESTR * rgpszFilesToOpen, in HWND hwndDlgOwner, VSADDRESULT* pResult) { mixin(LogCallMix); @@ -475,7 +477,7 @@ class Project : CVsHierarchy, } // IVsProject2 - override int RemoveItem( + override int RemoveItem( /* [in] */ in DWORD dwReserved, /* [in] */ in VSITEMID itemid, /* [retval][out] */ BOOL *pfResult) @@ -490,8 +492,8 @@ class Project : CVsHierarchy, return hr; } - - override int ReopenItem( + + override int ReopenItem( /* [in] */ in VSITEMID itemid, /* [in] */ in GUID* rguidEditorType, /* [in] */ in wchar* pszPhysicalView, @@ -502,19 +504,19 @@ class Project : CVsHierarchy, mixin(LogCallMix); if(CFileNode pNode = cast(CFileNode) VSITEMID2Node(itemid)) - return OpenDoc(pNode, false /*fNewFile*/, + return OpenDoc(pNode, false /*fNewFile*/, false /*fUseOpenWith*/, false /*fShow*/, rguidLogicalView, rguidEditorType, pszPhysicalView, - punkDocDataExisting, + punkDocDataExisting, ppWindowFrame); return returnError(E_UNEXPECTED); } - + // IVsProject3 - override int AddItemWithSpecific( + override int AddItemWithSpecific( /* [in] */ in VSITEMID itemidLoc, /* [in] */ in VSADDITEMOPERATION dwAddItemOperation, /* [in] */ in wchar* pszItemName, @@ -527,8 +529,8 @@ class Project : CVsHierarchy, /* [in] */ in GUID* rguidLogicalView, /* [retval][out] */ VSADDRESULT* pResult) { - // AddItemWithSpecific is used to add item(s) to the project and - // additionally ask the project to open the item using the specified + // AddItemWithSpecific is used to add item(s) to the project and + // additionally ask the project to open the item using the specified // editor information. An extension of IVsProject::AddItem(). mixin(LogCallMix); @@ -551,8 +553,8 @@ class Project : CVsHierarchy, return returnError(E_UNEXPECTED); } - - override int OpenItemWithSpecific( + + override int OpenItemWithSpecific( /* [in] */ in VSITEMID itemid, /* [in] */ in VSSPECIFICEDITORFLAGS grfEditorFlags, /* [in] */ in GUID* rguidEditorType, @@ -565,8 +567,8 @@ class Project : CVsHierarchy, return returnError(E_NOTIMPL); } - - override int TransferItem( + + override int TransferItem( /* [in] */ in wchar* pszMkDocumentOld, /* [in] */ in wchar* pszMkDocumentNew, /* [in] */ IVsWindowFrame punkWindowFrame) @@ -576,7 +578,7 @@ class Project : CVsHierarchy, return returnError(E_NOTIMPL); } - override int QueryDeleteItem( + override int QueryDeleteItem( /* [in] */ in VSDELETEITEMOPERATION dwDelItemOp, /* [in] */ in VSITEMID itemid, /* [retval][out] */ BOOL *pfCanDelete) @@ -595,7 +597,7 @@ class Project : CVsHierarchy, return S_OK; } - override int DeleteItem( + override int DeleteItem( /* [in] */ in VSDELETEITEMOPERATION dwDelItemOp, /* [in] */ in VSITEMID itemid) { @@ -616,7 +618,7 @@ class Project : CVsHierarchy, { string sfiles = (nodes.length == 1 ? "file" : to!string(nodes.length) ~ " files"); int answer = UtilMessageBox("Do you want to delete the " ~ sfiles ~ " on disk?\n\n" ~ - "You can permanently answer this dialog in the global Visual D settings.", MB_YESNOCANCEL | MB_ICONEXCLAMATION, + "You can permanently answer this dialog in the global Visual D settings.", MB_YESNOCANCEL | MB_ICONEXCLAMATION, "Remove file from project"); if(answer == IDCANCEL) return S_FALSE; @@ -655,7 +657,7 @@ class Project : CVsHierarchy, return rc; return S_OK; } - + override int GetGuidProperty(in VSITEMID itemid, in VSHPROPID propid, GUID* pguid) { mixin(LogCallMix); @@ -676,7 +678,7 @@ class Project : CVsHierarchy, } return super.GetGuidProperty(itemid, propid, pguid); } - + /*override*/ int SetGuidProperty(in VSITEMID itemid, in VSHPROPID propid, in GUID* rguid) { mixin(LogCallMix2); @@ -731,7 +733,7 @@ class Project : CVsHierarchy, var.vt = VT_BSTR; var.bstrVal = allocBSTR("typename"); break; - case VSHPROPID_SaveName: + case VSHPROPID_SaveName: var.vt = VT_BSTR; var.bstrVal = allocBSTR(mFilename); break; @@ -752,7 +754,7 @@ class Project : CVsHierarchy, var.vt = VT_UNKNOWN; return GetCfgProvider(cast(IVsCfgProvider*)&var.punkVal); //return QueryInterface(&IVsGetCfgProvider.iid, cast(void **)&var.punkVal); - + case VSHPROPID_ProjectDir: // IsNonSearchable, HasEnumerationSideEffects // 1001 @@ -762,11 +764,11 @@ class Project : CVsHierarchy, default: logCall("Getting unknown property %d for item %x!", propid, itemid); return DISP_E_MEMBERNOTFOUND; - // return returnError(E_NOTIMPL); // DISP_E_MEMBERNOTFOUND; + // return returnError(E_NOTIMPL); // DISP_E_MEMBERNOTFOUND; } return S_OK; } - + override int SetProperty(in VSITEMID itemid, in VSHPROPID propid, in VARIANT var) { mixin(LogCallMix); @@ -793,11 +795,11 @@ class Project : CVsHierarchy, // use this as an callback of the project load being complete if(mLastHierarchyEventSinkCookie == 0) Package.scheduleUpdateLibrary(); - + return super.AdviseHierarchyEvents(pEventSink, pdwCookie); } - // IVsGetCfgProvider + // IVsGetCfgProvider override int GetCfgProvider(IVsCfgProvider* pCfgProvider) { //mixin(LogCallMix); @@ -815,14 +817,14 @@ class Project : CVsHierarchy, } // IVsAggregatableProject - override int SetInnerProject( + override int SetInnerProject( /* [in] */ IUnknown punkInner) { logCall("%S.SetInnerProject(punkInner=%s)", this, _toLog(punkInner)); return returnError(E_NOTIMPL); } - - override int InitializeForOuter( + + override int InitializeForOuter( /* [in] */ in wchar* pszFilename, /* [in] */ in wchar* pszLocation, /* [in] */ in wchar* pszName, @@ -835,15 +837,15 @@ class Project : CVsHierarchy, return returnError(E_NOTIMPL); } - + override int OnAggregationComplete() { mixin(LogCallMix); return returnError(E_NOTIMPL); } - - override int GetAggregateProjectTypeGuids( + + override int GetAggregateProjectTypeGuids( /* [out] */ BSTR *pbstrProjTypeGuids) { logCall("GetAggregateProjectTypeGuids(pbstrProjTypeGuids=%s)", _toLog(pbstrProjTypeGuids)); @@ -852,17 +854,17 @@ class Project : CVsHierarchy, return S_OK; } - - override int SetAggregateProjectTypeGuids( + + override int SetAggregateProjectTypeGuids( /* [in] */ in wchar* lpstrProjTypeGuids) { logCall("SetAggregateProjectTypeGuids(lpstrProjTypeGuids=%s)", _toLog(lpstrProjTypeGuids)); return returnError(E_NOTIMPL); } - + // IVsProjectFlavorCfgProvider - override int CreateProjectFlavorCfg( + override int CreateProjectFlavorCfg( /* [in] */ IVsCfg pBaseProjectCfg, /* [out] */ IVsProjectFlavorCfg *ppFlavorCfg) { @@ -881,7 +883,7 @@ class Project : CVsHierarchy, } // IPersistFileFormat - override int IsDirty( + override int IsDirty( /* [out] */ BOOL *pfIsDirty) { logCall("IsDirty(pfIsDirty=%s)", _toLog(pfIsDirty)); @@ -891,8 +893,8 @@ class Project : CVsHierarchy, return E_FAIL; return S_OK; } - - override int InitNew( + + override int InitNew( /* [in] */ in DWORD nFormatIndex) { logCall("InitNew(nFormatIndex=%s)", _toLog(nFormatIndex)); @@ -900,8 +902,8 @@ class Project : CVsHierarchy, return returnError(E_NOTIMPL); } - - override int Load( + + override int Load( /* [in] */ in wchar* pszFilename, /* [in] */ in DWORD grfMode, /* [in] */ in BOOL fReadOnly) @@ -910,14 +912,14 @@ class Project : CVsHierarchy, return returnError(E_NOTIMPL); } - - override int Save( + + override int Save( /* [in] */ in wchar* pszFilename, /* [in] */ in BOOL fRemember, /* [in] */ in DWORD nFormatIndex) { mixin(LogCallMix); - + string filename = to_string(pszFilename); bool msbuild = filename.toLower().endsWith(".dproj"); auto doc = msbuild ? createMSBuildDoc() : createDoc(); @@ -927,8 +929,8 @@ class Project : CVsHierarchy, return S_OK; } - - override int SaveCompleted( + + override int SaveCompleted( /* [in] */ in wchar* pszFilename) { logCall("SaveCompleted(pszFilename=%s)", _toLog(pszFilename)); @@ -939,8 +941,8 @@ class Project : CVsHierarchy, return S_OK; //returnError(E_NOTIMPL); } - - override int GetCurFile( + + override int GetCurFile( /* [out] */ LPOLESTR *ppszFilename, /* [out] */ DWORD *pnFormatIndex) { @@ -951,8 +953,8 @@ class Project : CVsHierarchy, return S_OK; } - - override int GetFormatList( + + override int GetFormatList( /* [out] */ LPOLESTR *ppszFormatList) { logCall("GetFormatList(pbstrProjTypeGuids=%s)", _toLog(ppszFormatList)); @@ -961,7 +963,7 @@ class Project : CVsHierarchy, } // IVsProjectBuildSystem - override int SetHostObject( + override int SetHostObject( /* [in] */ in wchar* pszTargetName, /* [in] */ in wchar* pszTaskName, /* [in] */ IUnknown punkHostObject) @@ -970,29 +972,29 @@ class Project : CVsHierarchy, return returnError(E_NOTIMPL); } - + override int StartBatchEdit() { mixin(LogCallMix); return returnError(E_NOTIMPL); } - + override int EndBatchEdit() { mixin(LogCallMix); return returnError(E_NOTIMPL); } - + override int CancelBatchEdit() { mixin(LogCallMix); return returnError(E_NOTIMPL); } - - override int BuildTarget( + + override int BuildTarget( /* [in] */ in wchar* pszTargetName, /* [retval][out] */ VARIANT_BOOL *pbSuccess) { @@ -1000,8 +1002,8 @@ class Project : CVsHierarchy, return returnError(E_NOTIMPL); } - - override int GetBuildSystemKind( + + override int GetBuildSystemKind( /* [retval][out] */ BuildSystemKindFlags *pBuildSystemKind) { // mixin(LogCallMix); @@ -1017,7 +1019,7 @@ class Project : CVsHierarchy, } // IVsBuildPropertyStorage - override int GetPropertyValue( + override int GetPropertyValue( /* [in] */ in wchar* pszPropName, /* [in] */ in wchar* pszConfigName, /* [in] */ in PersistStorageType storage, @@ -1037,8 +1039,8 @@ class Project : CVsHierarchy, *pbstrPropValue = allocBSTR(value); return S_OK; } - - override int SetPropertyValue( + + override int SetPropertyValue( /* [in] */ in wchar* pszPropName, /* [in] */ in wchar* pszConfigName, /* [in] */ in PersistStorageType storage, @@ -1048,8 +1050,8 @@ class Project : CVsHierarchy, return returnError(E_NOTIMPL); } - - override int RemoveProperty( + + override int RemoveProperty( /* [in] */ in wchar* pszPropName, /* [in] */ in wchar* pszConfigName, /* [in] */ in PersistStorageType storage) @@ -1058,8 +1060,8 @@ class Project : CVsHierarchy, return returnError(E_NOTIMPL); } - - override int GetItemAttribute( + + override int GetItemAttribute( /* [in] */ in VSITEMID item, /* [in] */ in wchar* pszAttributeName, /* [out] */ BSTR *pbstrAttributeValue) @@ -1068,8 +1070,8 @@ class Project : CVsHierarchy, return returnError(E_NOTIMPL); } - - override int SetItemAttribute( + + override int SetItemAttribute( /* [in] */ in VSITEMID item, /* [in] */ in wchar* pszAttributeName, /* [in] */ in wchar* pszAttributeValue) @@ -1080,7 +1082,7 @@ class Project : CVsHierarchy, } // IVsComponentUser - override int AddComponent( + override int AddComponent( /* [in] */ in VSADDCOMPOPERATION dwAddCompOperation, /* [in] */ in ULONG cComponents, /* [size_is][in] */ in PVSCOMPONENTSELECTORDATA *rgpcsdComponents, @@ -1093,15 +1095,15 @@ class Project : CVsHierarchy, } // IVsDependencyProvider - override int EnumDependencies( + override int EnumDependencies( /* [out] */ IVsEnumDependencies *ppIVsEnumDependencies) { mixin(LogCallMix); return returnError(E_NOTIMPL); } - - override int OpenDependency( + + override int OpenDependency( /* [in] */ in wchar* szDependencyCanonicalName, /* [out] */ IVsDependency *ppIVsDependency) { @@ -1111,7 +1113,7 @@ class Project : CVsHierarchy, } // IVsProjectSpecialFiles - override int GetFile( + override int GetFile( /* [in] */ in PSFFILEID fileID, /* [in] */ in PSFFLAGS grfFlags, /* [out] */ VSITEMID *pitemid, @@ -1122,13 +1124,13 @@ class Project : CVsHierarchy, return returnError(E_NOTIMPL); } - // IVsParentProject + // IVsParentProject override int OpenChildren() { mixin(LogCallMix); // config not yet known here - + return returnError(E_NOTIMPL); } @@ -1142,7 +1144,7 @@ class Project : CVsHierarchy, // CVsHierarchy override HRESULT QueryStatusSelection(in GUID *pguidCmdGroup, in ULONG cCmds, OLECMD *prgCmds, OLECMDTEXT *pCmdText, - ref CHierNode[] rgSelection, + ref CHierNode[] rgSelection, bool bIsHierCmd)// TRUE if cmd originated via CVSUiHierarchy::ExecCommand { assert(pguidCmdGroup); @@ -1180,7 +1182,7 @@ class Project : CVsHierarchy, switch(Cmd.cmdID) { - // Forward the following commands to the project node whenever our project is + // Forward the following commands to the project node whenever our project is // the active project. case cmdidAddNewItem: case cmdidAddExistingItem: @@ -1229,7 +1231,7 @@ class Project : CVsHierarchy, } } - // Node commands + // Node commands if (!fHandled) { fHandled = true; @@ -1284,7 +1286,7 @@ class Project : CVsHierarchy, } // IVsGlobalsCallback - override int WriteVariablesToData( + override int WriteVariablesToData( /* [in] */ in wchar* pVariableName, /* [in] */ in VARIANT *varData) { @@ -1324,7 +1326,7 @@ class Project : CVsHierarchy, // IPerPropertyBrowsing - override int GetDisplayString( + override int GetDisplayString( /* [in] */ in DISPID dispID, /* [out] */ BSTR *pBstr) { @@ -1332,7 +1334,7 @@ class Project : CVsHierarchy, return returnError(E_NOTIMPL); } - override int MapPropertyToPage( + override int MapPropertyToPage( /* [in] */ in DISPID dispID, /* [out] */ CLSID *pClsid) { @@ -1343,7 +1345,7 @@ class Project : CVsHierarchy, //return returnError(E_NOTIMPL); } - override int GetPredefinedStrings( + override int GetPredefinedStrings( /* [in] */ in DISPID dispID, /* [out] */ CALPOLESTR *pCaStringsOut, /* [out] */ CADWORD *pCaCookiesOut) @@ -1352,7 +1354,7 @@ class Project : CVsHierarchy, return returnError(E_NOTIMPL); } - override int GetPredefinedValue( + override int GetPredefinedValue( /* [in] */ in DISPID dispID, /* [in] */ in DWORD dwCookie, /* [out] */ VARIANT *pVarOut) @@ -1379,18 +1381,18 @@ class Project : CVsHierarchy, override HRESULT Query(/+[in]+/ IUnknown pPrx, in DWORD dwProperty, /+[out]+/ ULONG_PTR * pdwValue) { mixin(LogCallMix); - + if(dwProperty == COMBND_RPCTIMEOUT) *pdwValue = RPC_C_BINDING_MAX_TIMEOUT; else if(dwProperty == COMBND_SERVER_LOCALITY) *pdwValue = SERVER_LOCALITY_PROCESS_LOCAL; else return E_NOTIMPL; - + return S_OK; } +/ - + // IVsSccProject2 override HRESULT SccGlyphChanged(in int cAffectedNodes, /+[size_is(cAffectedNodes)]+/in VSITEMID *rgitemidAffectedNodes, @@ -1398,11 +1400,11 @@ class Project : CVsHierarchy, /+[size_is(cAffectedNodes)]+/in DWORD *rgdwNewSccStatus) { mixin(LogCallMix); - + if(cAffectedNodes == 0) { searchNode(GetRootNode(), delegate (CHierNode n) - { + { foreach (advise; mHierarchyEventSinks) advise.OnPropertyChanged(GetVsItemID(n), VSHPROPID_StateIconIndex, 0); return false; @@ -1416,7 +1418,7 @@ class Project : CVsHierarchy, } return S_OK; } - + override HRESULT SetSccLocation(in LPCOLESTR pszSccProjectName, // opaque to project in LPCOLESTR pszSccAuxPath, // opaque to project in LPCOLESTR pszSccLocalPath, // opaque to project @@ -1425,7 +1427,7 @@ class Project : CVsHierarchy, mixin(LogCallMix); return E_NOTIMPL; } - + override HRESULT GetSccFiles(in VSITEMID itemid, // Node in project hierarchy /+[out]+/ CALPOLESTR *pCaStringsOut, // Files associated with node /+[out]+/ CADWORD *pCaFlagsOut) // Flags per file @@ -1449,7 +1451,7 @@ class Project : CVsHierarchy, return S_FALSE; } - + override HRESULT GetSccSpecialFiles(in VSITEMID itemid, // node in project hierarchy in LPCOLESTR pszSccFile, // one of the files associated with the node /+[out]+/ CALPOLESTR *pCaStringsOut, // special files associated with above file @@ -1458,16 +1460,16 @@ class Project : CVsHierarchy, mixin(LogCallMix); return E_NOTIMPL; } - + /////////////////////////////////////////////////////////////////////// // IVsHierarchyDropDataSource - override int GetDropInfo( + override int GetDropInfo( /* [out] */ DWORD *pdwOKEffects, /* [out] */ IDataObject *ppDataObject, /* [out] */ IDropSource *ppDropSource) { mixin(LogCallMix); - + *pdwOKEffects = DROPEFFECT_NONE; *ppDataObject = null; *ppDropSource = null; @@ -1475,26 +1477,26 @@ class Project : CVsHierarchy, HRESULT hr = PackageSelectionDataObject(ppDataObject, FALSE); if(FAILED(hr)) return returnError(hr); - + *pdwOKEffects = DROPEFFECT_MOVE | DROPEFFECT_COPY; mDDT = DropDataType.DDT_VSREF; mfDragSource = TRUE; return S_OK; } - override int OnDropNotify( + override int OnDropNotify( /* [in] */ in BOOL fDropped, /* [in] */ in DWORD dwEffects) { mixin(LogCallMix); - + mfDragSource = FALSE; mDDT = DropDataType.DDT_NONE; return CleanupSelectionDataObject(fDropped, FALSE, dwEffects == DROPEFFECT_MOVE); } // IVsHierarchyDropDataSource2 - override int OnBeforeDropNotify( + override int OnBeforeDropNotify( /* [in] */ IDataObject pDataObject, /* [in] */ in DWORD dwEffect, /* [retval][out] */ BOOL *pfCancelDrop) @@ -1532,7 +1534,7 @@ class Project : CVsHierarchy, } // if there are no dirty docs we are ok to proceed - if (!fDirty) + if (!fDirty) return S_OK; // prompt to save if there are dirty docs @@ -1563,7 +1565,7 @@ class Project : CVsHierarchy, } // IVsHierarchyDropDataTarget - override int DragEnter( + override int DragEnter( /* [in] */ IDataObject pDataObject, /* [in] */ in DWORD grfKeyState, /* [in] */ in VSITEMID itemid, @@ -1581,7 +1583,7 @@ class Project : CVsHierarchy, return QueryDropEffect(mDDT, grfKeyState, pdwEffect); } - override int DragOver( + override int DragOver( /* [in] */ in DWORD grfKeyState, /* [in] */ in VSITEMID itemid, /* [out][in] */ DWORD *pdwEffect) @@ -1598,7 +1600,7 @@ class Project : CVsHierarchy, return S_OK; } - override int Drop( + override int Drop( /* [in] */ IDataObject pDataObject, /* [in] */ in DWORD grfKeyState, /* [in] */ in VSITEMID itemid, @@ -1613,7 +1615,7 @@ class Project : CVsHierarchy, *pdwEffect = DROPEFFECT_NONE; HRESULT hr = S_OK; -// if (mfDragSource) +// if (mfDragSource) // return S_OK; CHierNode dropNode = VSITEMID2Node(itemid); @@ -1625,7 +1627,7 @@ class Project : CVsHierarchy, DropDataType ddt; hr = ProcessSelectionDataObject(dropContainer, - /* [in] IDataObject* pDataObject*/ pDataObject, + /* [in] IDataObject* pDataObject*/ pDataObject, /* [in] DWORD grfKeyState*/ grfKeyState, /* [out] DropDataType* */ &ddt); @@ -1786,14 +1788,14 @@ class Project : CVsHierarchy, { if(srpIVsHierarchy !is this) return false; - + CHierNode dropSource = VSITEMID2Node(itemidLoc); for(CHierNode c = dropTarget; c; c = c.GetParent()) if(dropSource == c) return true; return false; } - + HRESULT copyVirtualFolder(CHierContainer dropContainer, IVsHierarchy srpIVsHierarchy, VSITEMID itemidLoc) { if(isChildItem(dropContainer, srpIVsHierarchy, itemidLoc)) @@ -1812,10 +1814,10 @@ class Project : CVsHierarchy, string name = detachBSTR(cbstrMoniker); CFolderNode pFolder = newCom!CFolderNode; - + string strThisFolder = baseName(name); pFolder.SetName(strThisFolder); - + VARIANT var; if(srpIVsHierarchy.GetProperty(itemidLoc, VSHPROPID_FirstChild, &var) == S_OK && (var.vt == VT_INT_PTR || var.vt == VT_I4 || var.vt == VT_INT)) @@ -1825,7 +1827,7 @@ class Project : CVsHierarchy, { if(HRESULT hr = processVSItem(pFolder, srpIVsHierarchy, chid)) return hr; - + if(srpIVsHierarchy.GetProperty(chid, VSHPROPID_NextSibling, &var) != S_OK || (var.vt != VT_INT_PTR && var.vt != VT_I4 && var.vt != VT_INT)) break; @@ -1836,7 +1838,7 @@ class Project : CVsHierarchy, dropContainer.Add(pFolder); return S_OK; } - + HRESULT processVSItem(CHierContainer dropContainer, IVsHierarchy srpIVsHierarchy, VSITEMID itemidLoc) { // If this is a virtual item, we skip it @@ -1848,7 +1850,7 @@ class Project : CVsHierarchy, if(SUCCEEDED(hr) && typeGuid != GUID_ItemType_PhysicalFile) return S_FALSE; - + if(hr == E_ABORT || hr == OLE_E_PROMPTSAVECANCELLED) return OLE_E_PROMPTSAVECANCELLED; @@ -1858,7 +1860,7 @@ class Project : CVsHierarchy, hr = srpIVsHierarchy.QueryInterface(&IVsProject.iid, cast(void **)&srpIVsProject); if(FAILED(hr) || !srpIVsProject) return hr; - + BSTR cbstrMoniker; hr = srpIVsProject.GetMkDocument(itemidLoc, &cbstrMoniker); if (FAILED(hr)) @@ -1883,10 +1885,10 @@ class Project : CVsHierarchy, return OLE_E_PROMPTSAVECANCELLED; return hr; } - + HRESULT ProcessSelectionDataObject( /* [in] */ CHierContainer dropContainer, - /* [in] */ IDataObject pDataObject, + /* [in] */ IDataObject pDataObject, /* [in] */ DWORD grfKeyState, /* [out] */ DropDataType* pddt) { @@ -1993,7 +1995,7 @@ AttemptVSStgFormat: pDataObject.GetData(&fmtetc, &stgmedium) != S_OK || stgmedium.tymed != TYMED_HGLOBAL || !stgmedium.hGlobal) goto Error; - + hDropInfo = stgmedium.hGlobal; ddt = DropDataType.DDT_VSSTG; @@ -2001,8 +2003,8 @@ AddFiles: if(IVsSolution srpIVsSolution = queryService!(IVsSolution)) { scope(exit) release(srpIVsSolution); - - // Note that we do NOT use ::DragQueryFile as this function will + + // Note that we do NOT use ::DragQueryFile as this function will // NOT work with unicode strings on win9x - even // with the unicode wrappers - and the projitem ref format is in unicode string[] rgSrcFiles; @@ -2057,7 +2059,7 @@ Error: } HRESULT PackageSelectionDataObject( - /* [out] */ IDataObject * ppDataObject, + /* [out] */ IDataObject * ppDataObject, /* [in] */ BOOL fCutHighlightItems) { HRESULT hr = S_OK; @@ -2083,16 +2085,16 @@ Error: IVsHierarchy srpIVsHierarchy_selection; IVsMultiItemSelect srpIVsMultiItemSelect; hr = srpIVsMonitorSelection.GetCurrentSelection( - /* [out] IVsHierarchy** */ &srpIVsHierarchy_selection, - /* [out] VSITEMID* */ &vsitemid, - /* [out] IVsMultiItemSelect** */ &srpIVsMultiItemSelect, + /* [out] IVsHierarchy** */ &srpIVsHierarchy_selection, + /* [out] VSITEMID* */ &vsitemid, + /* [out] IVsMultiItemSelect** */ &srpIVsMultiItemSelect, /* [out] ISelectionContainer** */ null); if(FAILED(hr)) return hr; scope(exit) release(srpIVsHierarchy_selection); scope(exit) release(srpIVsMultiItemSelect); LONG lLenGlobal = 0; // length of the file names including null chars - + IVsHierarchy srpIVsHierarchy_this = this; // GetIVsHierarchy(); if(srpIVsHierarchy_selection !is srpIVsHierarchy_this || @@ -2109,7 +2111,7 @@ Error: if (itemsDragged > uint.max / VSITEMSELECTION.sizeof) return E_OUTOFMEMORY; - + mItemSelDragged.length = itemsDragged; hr = srpIVsMultiItemSelect.GetSelectedItems(GSI_fOmitHierPtrs, itemsDragged, mItemSelDragged.ptr); @@ -2172,7 +2174,7 @@ Error: // final null terminator as per CF_VSSTGPROJECTITEMS format spec pFiles[nCurPos] = 0; - + int res = GlobalUnlock(hGlobal); OleDataSource pDataObject = newCom!OleDataSource; // has ref count of 0 @@ -2188,7 +2190,7 @@ Error: stgmedium.hGlobal = hGlobal; stgmedium.pUnkForRelease = null; - pDataObject.CacheData(fmtetc.cfFormat, &stgmedium, &fmtetc); + pDataObject.CacheData(fmtetc.cfFormat, &stgmedium, &fmtetc); *ppDataObject = addref(pDataObject); Error: @@ -2212,7 +2214,7 @@ Error: HRESULT CleanupSelectionDataObject( /* [in] */ BOOL fDropped, - /* [in] */ BOOL fCut, + /* [in] */ BOOL fCut, /* [in] */ BOOL fMoved) { // we save if something fails but we are trying to do as much as possible @@ -2229,7 +2231,7 @@ Error: if (!srpIVsUIHierarchyWindow) hrRet = E_UNEXPECTED; +/ - + for (ULONG i = 0; i < mItemSelDragged.length; i++) { if((fMoved && fDropped) || fCut) @@ -2292,7 +2294,7 @@ Error: void ClearLineChanges() { auto langsvc = Package.GetLanguageService(); - + searchNode(GetRootNode(), delegate (CHierNode n) { string file = n.GetCanonicalName(); if(auto src = langsvc.GetSource(file)) @@ -2330,7 +2332,7 @@ Error: text = text[decidx..$]; if(!startsWith(text, "` ~ text; - + xml.Document doc = xml.readDocument(text); return doc; } @@ -2339,13 +2341,13 @@ Error: string msg = rc.toString(); writeToBuildOutputPane(msg); logCall(msg); - } + } catch(xml.XmlException rc) { string msg = rc.toString(); writeToBuildOutputPane(msg); logCall(msg); - } + } return null; } @@ -2372,7 +2374,7 @@ Error: { string lhs = strip(cond[0 .. pos]); string rhs = strip(cond[pos + 2 .. $]); - if (lhs == "'$(Configuration)|$(Platform)'" && + if (lhs == "'$(Configuration)|$(Platform)'" && rhs.length > 2 && rhs[0] == '\'' && rhs[$-1] =='\'') { rhs = rhs[1 .. $-1]; @@ -2462,7 +2464,7 @@ Error: CProjectNode rootnode = newCom!CProjectNode("", this); rootnode.SetName("Failed to load " ~ projectName); SetRootNode(rootnode); - + return false; } @@ -2658,6 +2660,7 @@ Error: } } + ConfigProvider GetConfigProvider() { return mConfigProvider; } string GetFilename() { return mFilename; } string GetName() { return mName; } string GetCaption() { return mCaption; } @@ -2677,7 +2680,7 @@ private: DropDataType mDDT; VSITEMSELECTION[] mItemSelDragged; - + xml.Document mDoc; } @@ -2721,9 +2724,10 @@ string getSelectedTextInBuildPane() scope(exit) release(opane); if(auto owin = qi_cast!IVsTextView(opane)) { + scope(exit) release(owin); BSTR selText; - if (owin.GetSelectedText (&selText) == S_OK) - return detachBSTR(selText); + if (owin.GetSelectedText (&selText) == S_OK) + return detachBSTR(selText); } } return null; @@ -2734,13 +2738,13 @@ string getCurrentErrorText() if (auto tasklist = queryService!(SVsErrorList, IVsTaskList2)()) { scope(exit) release(tasklist); - IVsTaskItem item; + IVsTaskItem item; if (tasklist.GetCaretPos(&item) == S_OK && item) { scope(exit) release(item); BSTR text; - if (item.get_Text (&text) == S_OK) - return detachBSTR(text); + if (item.get_Text (&text) == S_OK) + return detachBSTR(text); } } return null; @@ -2752,10 +2756,11 @@ HRESULT DustMiteProject() scope(exit) release(solutionBuildManager); IVsHierarchy phier; - if(solutionBuildManager.get_StartupProject(&phier) != S_OK) - return E_FAIL; - Project proj = qi_cast!Project(phier); + if(solutionBuildManager.get_StartupProject(&phier) != S_OK) + return E_FAIL; scope(exit) release(phier); + Project proj = qi_cast!Project(phier); + scope(exit) release(proj); Config cfg; IVsProjectCfg activeCfg; @@ -2767,6 +2772,7 @@ HRESULT DustMiteProject() if(!cfg) return E_FAIL; + scope(exit) release(cfg); string errmsg = getSelectedTextInBuildPane(); if (errmsg.length == 0) @@ -2806,7 +2812,10 @@ HRESULT DustMiteProject() npath = copyProjectFolder(proj, dustmitepath); if (npath.length == 0) - return pane.OutputString("cannot determine common root folder for all sources\n"w.ptr), S_FALSE; + { + pane.OutputString("cannot determine common root folder for all sources\n"w.ptr); + return S_FALSE; + } pane.OutputString(_toUTF16z("created clean copy of the project in " ~ dustmitepath ~ "\n")); nworkdir = npath; // TODO @@ -2825,7 +2834,7 @@ HRESULT DustMiteProject() cmdfile = npath ~ "build.dustmite.bat"; std.file.write(cmdfile, cmdline); cmdfile = makeRelative(cmdfile, npath); - string dustcmd = quoteFilename(cmdfile) ~ " | find \"" ~ errmsg ~ "\""; + string dustcmd = quoteFilename(cmdfile) ~ " 2>&1 | find \"" ~ errmsg ~ "\""; dustcmd = dustcmd.replace("\"", "\\\""); string intdir = makeFilenameAbsolute(cfg.GetIntermediateDir(), workdir); @@ -2862,4 +2871,4 @@ class DustMiteThread : CBuilderThread override bool needsOutputParser() { return false; } string mBuildDir; -} \ No newline at end of file +} diff --git a/visuald/fileutil.d b/visuald/fileutil.d index ab92b3a5..0d930050 100644 --- a/visuald/fileutil.d +++ b/visuald/fileutil.d @@ -239,18 +239,18 @@ SymLineInfo[string] readDisasmFile(string asmfile) __gshared static Regex!char resym, resym2, resym3, resym4, reoff, reoff2; - if(resym.ir is null) // dumpbin/llvm-objdump + if(resym.empty) // dumpbin/llvm-objdump resym = regex(r"^([A-Za-z_][^ \t:]*):$"); // : - if(resym2.ir is null) // obj2asm + if(resym2.empty) // obj2asm resym2 = regex(r"^[ \t]*assume[ \t]+[Cc][Ss]:([A-Za-z_][^ \t]*)[ \t]*$"); // assume CS: - if(resym3.ir is null) // objconv + if(resym3.empty) // objconv resym3 = regex(r"^([A-Za-z_][^ \t]*)[ \t]+PROC[ \t]+NEAR[ \t]*$"); // PROC NEAR - if(resym4.ir is null) // gcc-objdump + if(resym4.empty) // gcc-objdump resym4 = regex(r"^[0-9A-Fa-f]+[ \t]*\<([A-Za-z_][^>]*)\>:[ \t]*$"); // 000000 - if(reoff.ir is null) + if(reoff.empty()) reoff = regex(r"^([0-9A-Fa-f]+):.*$"); // : - if(reoff2.ir is null) + if(reoff2.empty()) reoff2 = regex(r"[^;]*;[ \t:]*([0-9A-Fa-f]+) _.*$"); // ; _ int ln = 0; @@ -336,7 +336,7 @@ _WinMain@16 PROC NEAR mov ebp, esp ; 0001 _ 8B. EC ASSUME fs:NOTHING push 48 ; 0003 _ 6A, 30 - " /* explicite trailing spaces before nl */ " + " /* explicite trailing spaces before nl */ ~ " ; Note: No jump seems to point here mov ecx, offset FLAT:?_009 ; 0005 _ B9, 00000000(segrel) @@ -371,7 +371,7 @@ struct LineInfo LineInfo[] readLineInfoFile(string linefile, string srcfile) { __gshared static Regex!char reoffline; - if(reoffline.ir is null) + if(reoffline.empty) reoffline = regex(r"^Off 0x([0-9A-Fa-f]+): *Line ([0-9]+)$"); // Off 0x%x: Line %d srcfile = toLower(normalizePath(srcfile)); @@ -427,7 +427,7 @@ File: WindowsApp1\winmain.d Off 0x0: Line 11 Off 0xc: Line 13 Off 0x19: Line 14 - Off 0xfffffffe: Line 16" /* bad offset generated by DMD */ " + Off 0xfffffffe: Line 16" /* bad offset generated by DMD */ ~ " "; auto deleteme = "deleteme"; std.file.write(deleteme, dumpline); diff --git a/visuald/getmsobj.d b/visuald/getmsobj.d index 3ae9385a..e5a2a7ee 100644 --- a/visuald/getmsobj.d +++ b/visuald/getmsobj.d @@ -25,7 +25,7 @@ import core.stdc.stdlib; // for msobj80.dll // http://download.microsoft.com/download/2/E/9/2E911956-F90F-4BFB-8231-E292A7B6F287/GRMSDK_EN_DVD.iso // FL_msobj71_dll_1_60033_x86_ln.3643236F_FC70_11D3_A536_0090278A1BB8 -// in vc_stdx86.cab +// in vc_stdx86.cab // for msobj100.dll // @@ -61,8 +61,8 @@ HRESULT VerifyMSObjectParser(wstring winstallDir) if(exists(absmsobj)) return S_OK; - int res = UtilMessageBox("The file " ~ msobj ~ "\n" - "is missing in your Visual Studio installation.\n" + int res = UtilMessageBox("The file " ~ msobj ~ "\n" ~ + "is missing in your Visual Studio installation.\n" ~ "Would you like to download it from the Windows 7 SDK?", MB_YESNO, "Visual Studio Shell detected"); if(res == IDYES) diff --git a/visuald/help.d b/visuald/help.d index 27431850..654c5b16 100644 --- a/visuald/help.d +++ b/visuald/help.d @@ -131,7 +131,7 @@ string createDisambiguationPage(string word, string[] files) { string installdir = normalizeDir(Package.GetGlobalOptions().DMD.InstallDir) ~ "html/d/"; string fallback = `
` - `
`; + ~ `
`; string html = fallback; string idxfile = installdir ~ "index.html"; diff --git a/visuald/hierarchy.d b/visuald/hierarchy.d index 015f47f8..3e9cfd9b 100644 --- a/visuald/hierarchy.d +++ b/visuald/hierarchy.d @@ -403,8 +403,11 @@ class CFileNode : CHierNode, if (FAILED(hr)) return hr; - scope(exit) release(srpIUnknown); - scope(exit) release(srpIVsHierarchy); + scope(exit) + { + release(srpIUnknown); + release(srpIVsHierarchy); + } // now return the requested info if (ppIVsHierarchy && srpIVsHierarchy) diff --git a/visuald/hierutil.d b/visuald/hierutil.d index 05ca2d5d..bf6abe89 100644 --- a/visuald/hierutil.d +++ b/visuald/hierutil.d @@ -39,6 +39,7 @@ import visuald.chiercontainer; import visuald.hierarchy; import visuald.config; import visuald.winctrl; +import visuald.vdextensions; const uint _MAX_PATH = 260; @@ -68,7 +69,7 @@ bool CheckFileName(string fileName) { if (fileName.length == 0 || fileName.length >= _MAX_PATH) return false; - + string base = baseName(fileName); if(base.length == 0) return false; @@ -78,11 +79,11 @@ bool CheckFileName(string fileName) if(base.length == 0) return true; // file starts with '.' - static string[] reservedNames = + static string[] reservedNames = [ - "CON", "PRN", "AUX", "CLOCK$", "NUL", + "CON", "PRN", "AUX", "CLOCK$", "NUL", "COM1","COM2", "COM3","COM4","COM5", "COM6", "COM7","COM8", "COM9", - "LPT1","LPT2", "LPT3","LPT4","LPT5", "LPT6", "LPT7","LPT8", "LPT9" + "LPT1","LPT2", "LPT3","LPT4","LPT5", "LPT6", "LPT7","LPT8", "LPT9" ]; base = toUpper(base); @@ -96,7 +97,7 @@ bool CheckFileName(string fileName) // Class: CVsModalState // Manage Modal State //--------------------------------------------------------------------------- -class CVsModalState +class CVsModalState { public: this(bool bDisableDlgOwnerHwnd = false) @@ -169,10 +170,10 @@ struct DROPFILES } //----------------------------------------------------------------------------- -// Returns a cstring array populated with the files from a PROJREF drop. Note that -// we can't use the systems DragQueryFile() functions because they will NOT work -// on win9x with unicode strings. Returns the count of files. The format looks like -// the following: DROPFILES structure with pFiles member containing the offset to +// Returns a cstring array populated with the files from a PROJREF drop. Note that +// we can't use the systems DragQueryFile() functions because they will NOT work +// on win9x with unicode strings. Returns the count of files. The format looks like +// the following: DROPFILES structure with pFiles member containing the offset to // the list of files: // ---------------------------------------------------------------------------- // |{DROPFILES structure}|ProjRefItem1|0|ProjRefItem2|0|.......|ProjRefItemN|0|0| @@ -192,7 +193,7 @@ int UtilGetFilesFromPROJITEMDrop(HGLOBAL h, ref string[] rgFiles) { // The first member of the structure contains the offset to the files wchar* wzBuffer = cast(wchar*)(cast(byte*)pszDropFiles + pszDropFiles.pFiles); - + // We go until *wzBuffer is null since we don't allow empty strings. while(*wzBuffer) { @@ -311,7 +312,7 @@ CHierNode searchNode(CHierNode root, bool delegate(CHierNode) pred, bool fDispla } /////////////////////////////////////////////////////////////////////////////// -// VsLocalCreateInstance +// VsLocalCreateInstance /////////////////////////////////////////////////////////////////////////////// I VsLocalCreateInstance(I)(const GUID* clsid, DWORD dwFlags) { @@ -320,14 +321,14 @@ I VsLocalCreateInstance(I)(const GUID* clsid, DWORD dwFlags) scope(exit) release(srpLocalReg); IUnknown punkOuter = null; I inst; - if(FAILED(srpLocalReg.CreateInstance(*clsid, punkOuter, &I.iid, dwFlags, + if(FAILED(srpLocalReg.CreateInstance(*clsid, punkOuter, &I.iid, dwFlags, cast(void**) &inst))) return null; return inst; } return null; } - + /////////////////////////////////////////////////////////////////////////////// dte2.DTE2 GetDTE() { @@ -335,7 +336,7 @@ dte2.DTE2 GetDTE() if(!_dte) return null; scope(exit) release(_dte); - + dte2.DTE2 spvsDTE = qi_cast!(dte2.DTE2)(_dte); return spvsDTE; } @@ -472,7 +473,7 @@ void updateEnvironmentFont() } //////////////////////////////////////////////////////////////////////// -IVsTextLines GetCurrentTextBuffer(IVsTextView* pview) +IVsTextView GetActiveView() { IVsTextManager textmgr = queryService!(VsTextManager, IVsTextManager); if(!textmgr) @@ -482,10 +483,19 @@ IVsTextLines GetCurrentTextBuffer(IVsTextView* pview) IVsTextView view; if(textmgr.GetActiveView(false, null, &view) != S_OK) return null; + return view; +} + +//////////////////////////////////////////////////////////////////////// +IVsTextLines GetCurrentTextBuffer(IVsTextView* pview) +{ + IVsTextView view = GetActiveView(); + if (!view) + return null; scope(exit) release(view); if(pview) *pview = addref(view); - + IVsTextLines buffer; view.GetBuffer(&buffer); return buffer; @@ -498,7 +508,7 @@ string GetSolutionFilename() if(srpSolution) { scope(exit) srpSolution.Release(); - + BSTR pbstrSolutionFile; if(srpSolution.GetSolutionInfo(null, &pbstrSolutionFile, null) == S_OK) return detachBSTR(pbstrSolutionFile); @@ -509,11 +519,11 @@ string GetSolutionFilename() //////////////////////////////////////////////////////////////////////// -HRESULT FindFileInSolution(IVsUIShellOpenDocument pIVsUIShellOpenDocument, string filename, string srcfile, +HRESULT FindFileInSolution(IVsUIShellOpenDocument pIVsUIShellOpenDocument, string filename, string srcfile, out BSTR bstrAbsPath) { auto wstrPath = _toUTF16z(filename); - + HRESULT hr; hr = pIVsUIShellOpenDocument.SearchProjectsForRelativePath(RPS_UseAllSearchStrategies, wstrPath, &bstrAbsPath); if(hr != S_OK || !bstrAbsPath || !isAbsolute(to_string(bstrAbsPath))) @@ -542,7 +552,7 @@ HRESULT FindFileInSolution(string filename, string srcfile, out string absPath) if(!pIVsUIShellOpenDocument) return returnError(E_FAIL); scope(exit) release(pIVsUIShellOpenDocument); - + BSTR bstrAbsPath; HRESULT hr = FindFileInSolution(pIVsUIShellOpenDocument, filename, srcfile, bstrAbsPath); if(hr != S_OK) @@ -558,13 +568,13 @@ HRESULT OpenFileInSolution(string filename, int line, int col = 0, string srcfil if(!pIVsUIShellOpenDocument) return returnError(E_FAIL); scope(exit) release(pIVsUIShellOpenDocument); - + BSTR bstrAbsPath; HRESULT hr = FindFileInSolution(pIVsUIShellOpenDocument, filename, srcfile, bstrAbsPath); if(hr != S_OK) return returnError(hr); scope(exit) detachBSTR(bstrAbsPath); - + IVsWindowFrame srpIVsWindowFrame; hr = pIVsUIShellOpenDocument.OpenDocumentViaProject(bstrAbsPath, &LOGVIEWID_Primary, null, null, null, @@ -584,9 +594,9 @@ HRESULT OpenFileInSolution(string filename, int line, int col = 0, string srcfil if(FAILED(hr) || !srpIVsWindowFrame) return returnError(hr); scope(exit) release(srpIVsWindowFrame); - + srpIVsWindowFrame.Show(); - + VARIANT var; hr = srpIVsWindowFrame.GetProperty(VSFPROPID_DocData, &var); if(FAILED(hr) || var.vt != VT_UNKNOWN || !var.punkVal) @@ -609,7 +619,7 @@ HRESULT OpenFileInSolution(string filename, int line, int col = 0, string srcfil if(adjustLineToChanges) if(auto src = Package.GetLanguageService().GetSource(textBuffer)) line = src.adjustLineNumberSinceLastBuild(line, false); - + return NavigateTo(textBuffer, line, col, line, col); } @@ -626,16 +636,16 @@ HRESULT NavigateTo(IVsTextBuffer textBuffer, int line1, int col1, int line2, int HRESULT OpenFileInSolutionWithScope(string fname, int line, int col, string scop, bool adjustLineToChanges = false) { HRESULT hr = OpenFileInSolution(fname, line, col, "", adjustLineToChanges); - + if(hr != S_OK && !isAbsolute(fname) && scop.length) { - // guess import path from filename (e.g. "src\core\mem.d") and + // guess import path from filename (e.g. "src\core\mem.d") and // scope (e.g. "core.mem.gc.Proxy") to try opening // the file ("core\mem.d") string inScope = toLower(scop); string path = normalizeDir(dirName(toLower(fname))); inScope = replace(inScope, ".", "\\"); - + int i; for(i = 1; i < path.length; i++) if(startsWith(inScope, path[i .. $])) @@ -654,7 +664,7 @@ string commonProjectFolder(Project proj) { string workdir = normalizeDir(dirName(proj.GetFilename())); string path = workdir; - searchNode(proj.GetRootNode(), delegate (CHierNode n) + searchNode(proj.GetRootNode(), delegate (CHierNode n) { if(CFileNode file = cast(CFileNode) n) path = commonParentDir(path, makeFilenameAbsolute(file.GetFilename(), workdir)); @@ -672,7 +682,7 @@ string copyProjectFolder(Project proj, string ncommonpath) string npath = normalizeDir(ncommonpath); string workdir = normalizeDir(dirName(proj.GetFilename())); - searchNode(proj.GetRootNode(), delegate (CHierNode n) + searchNode(proj.GetRootNode(), delegate (CHierNode n) { if(CFileNode file = cast(CFileNode) n) { @@ -700,11 +710,11 @@ string GetFolderPath(CFolderNode folder) /////////////////////////////////////////////////////////////// // returns addref'd Config -Config getProjectConfig(string file) +Config getProjectConfig(string file, bool genCmdLine = false) { if(file.length == 0) return null; - + auto srpSolution = queryService!(IVsSolution); scope(exit) release(srpSolution); auto solutionBuildManager = queryService!(IVsSolutionBuildManager)(); @@ -755,6 +765,121 @@ Config getProjectConfig(string file) } } } + return getVisualCppConfig(file, genCmdLine); +} + +/////////////////////////////////////////////////////////////// +class VCConfig : Config +{ + string mCmdLine; + + this(string projectfile, string projectname, string platform, string config) + { + Project prj = newCom!Project(Package.GetProjectFactory(), projectname, projectfile, platform, config); + super(prj.GetConfigProvider(), config, platform); + } + + this(IVsHierarchy pHierarchy) + { + string projectFile; + string projectName; + VARIANT var; + BSTR name; + if(pHierarchy.GetCanonicalName(VSITEMID_ROOT, &name) == S_OK) + projectFile = detachBSTR(name); + + if(pHierarchy.GetProperty(VSITEMID_ROOT, VSHPROPID_EditLabel, &var) == S_OK && var.vt == VT_BSTR) + projectName = detachBSTR(var.bstrVal); + + Project prj = newCom!Project(Package.GetProjectFactory(), projectName, projectFile, null, null); + super(prj.GetConfigProvider(), "Debug", "Win32"); + } + + override string GetOutputFile(CFileNode file, string tool = null) + { + if (file) + return super.GetOutputFile(file, tool); + return null; + } + override string GetCompileCommand(CFileNode file, bool syntaxOnly = false, string tool = null, string addopt = null) + { + if (file) + return super.GetCompileCommand(file, syntaxOnly, tool, addopt); + return addopt && mCmdLine ? mCmdLine ~ " " ~ addopt : mCmdLine ~ addopt; + } + + override string GetCppCompiler() { return "cl"; } +} + +// cache a configuration for each file +struct VCFile +{ + IVsHierarchy pHierarchy; + VSITEMID itemid; + bool opEquals(ref const VCFile other) const + { + return pHierarchy is other.pHierarchy && itemid == other.itemid; + } + hash_t toHash() @trusted nothrow const + { + // hash the pointer, not the interface (crashes anyway) + return cast(hash_t) cast(void*)pHierarchy ^ itemid; + } +} +__gshared VCConfig[VCFile] vcFileConfigs; + +Config getVisualCppConfig(string file, bool genCmdLine = false) +{ + auto srpSolution = queryService!(IVsSolution); + scope(exit) release(srpSolution); + auto solutionBuildManager = queryService!(IVsSolutionBuildManager)(); + scope(exit) release(solutionBuildManager); + + if(srpSolution && solutionBuildManager) + { + auto wfile = _toUTF16z(file); + IEnumHierarchies pEnum; + const GUID vcxprojCLSID = uuid("8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942"); + + if(srpSolution.GetProjectEnum(EPF_LOADEDINSOLUTION|EPF_MATCHTYPE, &vcxprojCLSID, &pEnum) == S_OK) + { + scope(exit) release(pEnum); + IVsHierarchy pHierarchy; + while(pEnum.Next(1, &pHierarchy, null) == S_OK) + { + scope(exit) release(pHierarchy); + + VSITEMID itemid; + if(pHierarchy.ParseCanonicalName(wfile, &itemid) == S_OK) + { + VCConfig cfg; + if (auto pcfg = VCFile(pHierarchy, itemid) in vcFileConfigs) + cfg = *pcfg; + else + { + cfg = newCom!VCConfig(pHierarchy); + cfg.GetProject().GetRootNode().AddTail(newCom!CFileNode(file)); + vcFileConfigs[VCFile(pHierarchy, itemid)] = cfg; + } + + ProjectOptions opts = cfg.GetProjectOptions(); + ProjectOptions cmpopts = clone(opts); + if (vdhelper_GetDCompileOptions(pHierarchy, itemid, opts) == S_OK) + { + if (genCmdLine) + { + string cmd; + if (vdhelper_GetDCommandLine(pHierarchy, itemid, cmd) == S_OK) + cfg.mCmdLine = cmd; + } + if (opts != cmpopts) + cfg.SetDirty(); + return addref(cfg); + } + } + } + } + } return null; } @@ -762,7 +887,7 @@ Config getCurrentStartupConfig() { auto solutionBuildManager = queryService!(IVsSolutionBuildManager)(); scope(exit) release(solutionBuildManager); - + if(solutionBuildManager) { IVsHierarchy pHierarchy; @@ -781,28 +906,88 @@ Config getCurrentStartupConfig() return null; } +// returns reference counted config +Config GetActiveConfig(IVsHierarchy pHierarchy) +{ + if(!pHierarchy) + return null; + + auto solutionBuildManager = queryService!(IVsSolutionBuildManager)(); + scope(exit) release(solutionBuildManager); + + IVsProjectCfg activeCfg; + if(solutionBuildManager.FindActiveProjectCfg(null, null, pHierarchy, &activeCfg) == S_OK) + { + scope(exit) release(activeCfg); + if(Config cfg = qi_cast!Config(activeCfg)) + return cfg; + } + return null; +} + +// return current config and platform of the startup +string GetActiveSolutionConfig(string* platform = null) +{ + auto solutionBuildManager = queryService!(IVsSolutionBuildManager)(); + scope(exit) release(solutionBuildManager); + + IVsHierarchy pHierarchy; + if (solutionBuildManager.get_StartupProject(&pHierarchy) != S_OK) + return null; + scope(exit) release(pHierarchy); + + IVsProjectCfg activeCfg; + if(solutionBuildManager.FindActiveProjectCfg(null, null, pHierarchy, &activeCfg) != S_OK) + return null; + scope(exit) release(activeCfg); + + BSTR bstrName; + if (activeCfg.get_DisplayName(&bstrName) != S_OK) + return null; + + string config = detachBSTR(bstrName); + auto parts = split(config, '|'); + if (parts.length == 2) + { + if (platform) + *platform = parts[1]; + config = parts[0]; + } + return config; +} + //////////////////////////////////////////////////////////////////////// -string[] GetImportPaths(string file) +string[] GetImportPaths(Config cfg) { string[] imports; - if(Config cfg = getProjectConfig(file)) - { - scope(exit) release(cfg); - ProjectOptions opt = cfg.GetProjectOptions(); - string projectpath = cfg.GetProjectDir(); + if (!cfg) + return null; + + ProjectOptions opt = cfg.GetProjectOptions(); + string projectpath = cfg.GetProjectDir(); - string imp = opt.imppath; - imp = opt.replaceEnvironment(imp, cfg); - imports = tokenizeArgs(imp); + string imp = opt.imppath; + imp = opt.replaceEnvironment(imp, cfg); + imports = tokenizeArgs(imp); - string addopts = opt.replaceEnvironment(opt.additionalOptions, cfg); - addunique(imports, GlobalOptions.getOptionImportPaths(addopts, projectpath)); + string addopts = opt.replaceEnvironment(opt.additionalOptions, cfg); + addunique(imports, GlobalOptions.getOptionImportPaths(addopts, projectpath)); - foreach(ref i; imports) - i = makeDirnameCanonical(unquoteArgument(i), projectpath); + foreach(ref i; imports) + i = makeDirnameCanonical(unquoteArgument(i), projectpath); - addunique(imports, projectpath); + addunique(imports, projectpath); + return imports; +} + +string[] GetImportPaths(string file) +{ + string[] imports; + if(Config cfg = getProjectConfig(file)) + { + scope(exit) release(cfg); + imports = GetImportPaths(cfg); } imports ~= Package.GetGlobalOptions().getImportPaths(); return imports; diff --git a/visuald/intellisense.d b/visuald/intellisense.d index 33d1a67f..97eb3e0d 100644 --- a/visuald/intellisense.d +++ b/visuald/intellisense.d @@ -911,7 +911,8 @@ class BrowseInfo createModules(info); if(Config cfg = getProjectConfig(mFilename)) { - cfg.GetProject().ClearLineChanges(); + if (auto proj = cfg.GetProject()) + proj.ClearLineChanges(); release(cfg); } return true; diff --git a/visuald/library.d b/visuald/library.d index 07c12642..e71faea8 100644 --- a/visuald/library.d +++ b/visuald/library.d @@ -37,7 +37,7 @@ class LibraryManager : DComObject, IVsLibraryMgr { Close(); } - + HRESULT Close() { foreach(lib; mLibraries) @@ -57,7 +57,7 @@ class LibraryManager : DComObject, IVsLibraryMgr HRESULT GetCount(ULONG *pnCount) { mixin(LogCallMix2); - + if(!pnCount) return E_INVALIDARG; @@ -68,7 +68,7 @@ class LibraryManager : DComObject, IVsLibraryMgr HRESULT GetLibraryAt(in ULONG uIndex, IVsLibrary *pLibrary) { mixin(LogCallMix); - + if(!pLibrary) return E_INVALIDARG; if (!IsValidIndex(uIndex)) @@ -80,7 +80,7 @@ class LibraryManager : DComObject, IVsLibraryMgr HRESULT GetNameAt(in ULONG uIndex, WCHAR ** pszName) { mixin(LogCallMix2); - + if(!pszName) return E_INVALIDARG; if (!IsValidIndex(uIndex)) @@ -92,18 +92,18 @@ class LibraryManager : DComObject, IVsLibraryMgr HRESULT ToggleCheckAt(in ULONG uIndex) { mixin(LogCallMix2); - + if (!IsValidIndex(uIndex)) return E_UNEXPECTED; - mLibraries[uIndex].ToggleCheck(); + mLibraries[uIndex].ToggleCheck(); return S_OK; } HRESULT GetCheckAt(in ULONG uIndex, LIB_CHECKSTATE *pstate) { mixin(LogCallMix2); - + if(!pstate) return E_INVALIDARG; if (!IsValidIndex(uIndex)) @@ -115,7 +115,7 @@ class LibraryManager : DComObject, IVsLibraryMgr HRESULT SetLibraryGroupEnabled(in LIB_PERSISTTYPE lpt, in BOOL fEnable) { mixin(LogCallMix2); - + return E_NOTIMPL; } @@ -133,16 +133,16 @@ class Library : DComObject, HIMAGELIST mImages; //image list. //Cookie used to hook up the solution events. - VSCOOKIE mIVsSolutionEventsCookie; + VSCOOKIE mIVsSolutionEventsCookie; //Array of Projects LibraryItem[] mLibraryItems; - + BrowseCounter mCounterLibList; // Find References result string[] mLastFindReferencesResult; - + override HRESULT QueryInterface(in IID* riid, void** pvObject) { if(*riid == IVsLibrary2Ex.iid) // keep out of log file @@ -162,7 +162,7 @@ class Library : DComObject, mixin(LogCallMix2); mCheckState = LCS_CHECKED; - + if(auto solution = queryService!IVsSolution()) { scope(exit) release(solution); @@ -171,7 +171,7 @@ class Library : DComObject, } return S_OK; } - + HRESULT Close() { mixin(LogCallMix2); @@ -182,9 +182,9 @@ class Library : DComObject, scope(exit) release(solution); if(HRESULT hr = solution.UnadviseSolutionEvents(mIVsSolutionEventsCookie)) return hr; - mIVsSolutionEventsCookie = 0; + mIVsSolutionEventsCookie = 0; } - + foreach(lib; mLibraryItems) { lib.Close(); @@ -225,7 +225,7 @@ class Library : DComObject, return uIndex < mLibraryItems.length; } - HRESULT CountChecks(/* [out] */ ULONG* pcChecked, /* [out] */ ULONG* pcUnchecked) + HRESULT CountChecks(/* [out] */ ULONG* pcChecked, /* [out] */ ULONG* pcUnchecked) { assert(pcChecked); assert(pcUnchecked); @@ -240,20 +240,20 @@ class Library : DComObject, (*pcChecked)++; else if (lcs == LCS_UNCHECKED) (*pcUnchecked)++; - else + else assert(false); // check state is not correct } - return S_OK; + return S_OK; } // IVsSimpleLibrary2 //////////////////////////////////////////////////////// //Return E_FAIL if category not supported. - override HRESULT GetSupportedCategoryFields2(in LIB_CATEGORY2 eCategory, + override HRESULT GetSupportedCategoryFields2(in LIB_CATEGORY2 eCategory, /+[out, retval]+/ DWORD *pCatField) { mixin(LogCallMix2); - + assert(pCatField); switch(eCategory) @@ -317,9 +317,9 @@ class Library : DComObject, break; case LC_LISTTYPE: - // LLT_CLASSES = 0x000001, - // LLT_MEMBERS = 0x000002, - // LLT_PHYSICALCONTAINERS = 0x000004, + // LLT_CLASSES = 0x000001, + // LLT_MEMBERS = 0x000002, + // LLT_PHYSICALCONTAINERS = 0x000004, // LLT_PACKAGE = 0x000004, same as above (old name) // LLT_NAMESPACES = 0x000008, // LLT_CONTAINMENT = 0x000010, @@ -331,7 +331,7 @@ class Library : DComObject, // LLT_INTERFACEUSEDBYCLASSES = 0x000400, // LLT_DEFINITIONS = 0x000800, // LLT_REFERENCES = 0x001000, - // LLT_HIERARCHY = 0x002000, + // LLT_HIERARCHY = 0x002000, *pCatField = LLT_NAMESPACES | LLT_PACKAGE | LLT_CLASSES | LLT_MEMBERS; break; @@ -353,11 +353,11 @@ class Library : DComObject, case LC_HIERARCHYTYPE: *pCatField = LCHT_BASESANDINTERFACES; break; - + case LC_NODETYPE: case LC_MEMBERINHERITANCE: case LC_SEARCHMATCHTYPE: - + default: *pCatField = 0; return E_FAIL; @@ -367,7 +367,7 @@ class Library : DComObject, } //Retrieve a IVsObjectList interface of LISTTYPE - override HRESULT GetList2(in LIB_LISTTYPE2 eListType, in LIB_LISTFLAGS eFlags, in VSOBSEARCHCRITERIA2 *pobSrch, + override HRESULT GetList2(in LIB_LISTTYPE2 eListType, in LIB_LISTFLAGS eFlags, in VSOBSEARCHCRITERIA2 *pobSrch, /+[out, retval]+/ IVsSimpleObjectList2 *ppList) { mixin(LogCallMix2); @@ -395,7 +395,7 @@ class Library : DComObject, { mixin(LogCallMix2); assert(pfFlags); - + *pfFlags = LF_PROJECT | LF_EXPANDABLE; return S_OK; } @@ -420,7 +420,7 @@ class Library : DComObject, return S_OK; } - // Returns the separator string used to separate namespaces, classes and members + // Returns the separator string used to separate namespaces, classes and members // eg. "::" for VC and "." for VB override HRESULT GetSeparatorStringWithOwnership(BSTR *pszSeparator) { @@ -429,24 +429,24 @@ class Library : DComObject, return S_OK; } - //Retrieve the persisted state of this library from the passed stream + //Retrieve the persisted state of this library from the passed stream //(essentially information for each browse container being browsed). Only //implement for GLOBAL browse containers override HRESULT LoadState(/+[in]+/ IStream pIStream, in LIB_PERSISTTYPE lptType) { mixin(LogCallMix2); // we do not save/load persisted state - return E_NOTIMPL; + return E_NOTIMPL; } - //Save the current state of this library to the passed stream + //Save the current state of this library to the passed stream //(essentially information for each browse container being browsed). Only //implement for GLOBAL browse containers override HRESULT SaveState(/+[in]+/ IStream pIStream, in LIB_PERSISTTYPE lptType) { mixin(LogCallMix2); // we do not save/load persisted state - return E_NOTIMPL; + return E_NOTIMPL; } // Used to obtain a list of browse containers corresponding to the given @@ -474,7 +474,7 @@ class Library : DComObject, return hr; } if (pcActual) - *pcActual = 1;// We always only have one library. + *pcActual = 1;// We always only have one library. break; } } @@ -482,32 +482,32 @@ class Library : DComObject, } // Start browsing the component specified in PVSCOMPONENTSELECTORDATA (name is equivalent to that - // returned thru the liblist's GetText method for this browse container). - // Only meaningful for registered libraries for a given type of GLOBAL browse container - override HRESULT AddBrowseContainer(in PVSCOMPONENTSELECTORDATA pcdComponent, - /+[in, out]+/ LIB_ADDREMOVEOPTIONS *pgrfOptions, + // returned thru the liblist's GetText method for this browse container). + // Only meaningful for registered libraries for a given type of GLOBAL browse container + override HRESULT AddBrowseContainer(in PVSCOMPONENTSELECTORDATA pcdComponent, + /+[in, out]+/ LIB_ADDREMOVEOPTIONS *pgrfOptions, /+[out]+/ BSTR *pbstrComponentAdded) { mixin(LogCallMix2); // we do not support GLOBAL browse containers - return E_NOTIMPL; + return E_NOTIMPL; } // Stop browsing the component identified by name (name is equivalent to that - // returned thru the liblist's GetText method for this browse container - // Only meaningful for registered libraries for a given type of GLOBAL browse container + // returned thru the liblist's GetText method for this browse container + // Only meaningful for registered libraries for a given type of GLOBAL browse container override HRESULT RemoveBrowseContainer(in DWORD dwReserved, in LPCWSTR pszLibName) { mixin(LogCallMix2); // we do not support GLOBAL browse containers - return E_NOTIMPL; + return E_NOTIMPL; } - - override HRESULT CreateNavInfo(/+[ size_is (ulcNodes)]+/ in SYMBOL_DESCRIPTION_NODE *rgSymbolNodes, in ULONG ulcNodes, + + override HRESULT CreateNavInfo(/+[ size_is (ulcNodes)]+/ in SYMBOL_DESCRIPTION_NODE *rgSymbolNodes, in ULONG ulcNodes, /+[out]+/ IVsNavInfo * ppNavInfo) { mixin(LogCallMix2); - return E_NOTIMPL; + return E_NOTIMPL; } // IVsLiteTreeList //////////////////////////////////////////////////////// @@ -518,10 +518,10 @@ class Library : DComObject, //State change and update only *pFlags = TF_NOEVERYTHING ^ (TF_NOSTATECHANGE | TF_NOUPDATES); - + return S_OK; } - + //Count of items in this list override HRESULT GetItemCount(/+[out]+/ ULONG* pCount) { @@ -531,10 +531,10 @@ class Library : DComObject, *pCount = mLibraryItems.length; return S_OK; } - + //An item has been expanded, get the next list - override HRESULT GetExpandedList(in ULONG Index, - /+[out]+/ BOOL *pfCanRecurse, + override HRESULT GetExpandedList(in ULONG Index, + /+[out]+/ BOOL *pfCanRecurse, /+[out]+/ IVsLiteTreeList *pptlNode) { mixin(LogCallMix2); @@ -542,14 +542,14 @@ class Library : DComObject, assert(_false); // TF_NOEXPANSION is set: this shouldn't be called return E_FAIL; } - + //Called during a ReAlign command if TF_CANTRELOCATE isn't set. Return //E_FAIL if the list can't be located, in which case the list will be discarded. - override HRESULT LocateExpandedList(/+[in]+/ IVsLiteTreeList ExpandedList, + override HRESULT LocateExpandedList(/+[in]+/ IVsLiteTreeList ExpandedList, /+[out]+/ ULONG *iIndex) { mixin(LogCallMix2); - + assert(_false); // TF_NOEXPANSION and TF_NORELOCATE is set: this shouldn't be called return E_FAIL; } @@ -557,7 +557,7 @@ class Library : DComObject, override HRESULT OnClose(/+[out]+/ VSTREECLOSEACTIONS *ptca) { mixin(LogCallMix2); - + assert(ptca); // Since handing the list back out is almost free and @@ -568,7 +568,7 @@ class Library : DComObject, } //Get a pointer to the main text for the list item. Caller will NOT free, implementor //can reuse buffer for each call to GetText except for TTO_SORTTEXT. See VSTREETEXTOPTIONS for tto details - override HRESULT GetText(in ULONG uIndex, in VSTREETEXTOPTIONS tto, + override HRESULT GetText(in ULONG uIndex, in VSTREETEXTOPTIONS tto, /+[out]+/ const( WCHAR)**ppszText) { // mixin(LogCallMix2); @@ -581,7 +581,7 @@ class Library : DComObject, //Get a pointer to the tip text for the list item. Like GetText, caller will NOT free, implementor //can reuse buffer for each call to GetTipText. If you want tiptext to be same as TTO_DISPLAYTEXT, you can //E_NOTIMPL this call. - override HRESULT GetTipText(in ULONG uIndex, in VSTREETOOLTIPTYPE eTipType, + override HRESULT GetTipText(in ULONG uIndex, in VSTREETOOLTIPTYPE eTipType, /+[out]+/ const( WCHAR)**ppszText) { mixin(LogCallMix2); @@ -592,13 +592,13 @@ class Library : DComObject, return mLibraryItems[uIndex].GetTipText(eTipType, ppszText); } - + //Is this item expandable? Not called if TF_NOEXPANSION is set - override HRESULT GetExpandable(in ULONG uIndex, + override HRESULT GetExpandable(in ULONG uIndex, /+[out]+/ BOOL *pfExpandable) { mixin(LogCallMix2); - + assert(pfExpandable); if (!IsValidIndex(uIndex)) return E_UNEXPECTED; @@ -606,9 +606,9 @@ class Library : DComObject, *pfExpandable = FALSE; return S_OK; } - + //Retrieve information to draw the item - /+[local]+/ override HRESULT GetDisplayData(in ULONG uIndex, + /+[local]+/ override HRESULT GetDisplayData(in ULONG uIndex, /+[out]+/ VSTREEDISPLAYDATA *pData) { //mixin(LogCallMix2); @@ -622,12 +622,12 @@ class Library : DComObject, BOOL fIsLibraryChecked = (mCheckState == LCS_UNCHECKED) ? FALSE : TRUE; return mLibraryItems[uIndex].GetDisplayData(fIsLibraryChecked, pData); } - + //Return latest update increment. True/False isn't sufficient here since //multiple trees may be using this list. Returning an update counter > than //the last one cached by a given tree will force calls to GetItemCount and //LocateExpandedList as needed. - override HRESULT UpdateCounter(/+[out]+/ ULONG *pCurUpdate, + override HRESULT UpdateCounter(/+[out]+/ ULONG *pCurUpdate, /+[out]+/ VSTREEITEMCHANGESMASK *pgrfChanges) { // mixin(LogCallMix2); @@ -638,7 +638,7 @@ class Library : DComObject, // If prgListChanges is NULL, should return the # of changes in pcChanges. Otherwise // *pcChanges will indicate the size of the array (so that caller can allocate the array) to fill // with the VSTREELISTITEMCHANGE records - override HRESULT GetListChanges(/+[in,out]+/ ULONG *pcChanges, + override HRESULT GetListChanges(/+[in,out]+/ ULONG *pcChanges, /+[ size_is (*pcChanges)]+/ in VSTREELISTITEMCHANGE *prgListChanges) { mixin(LogCallMix2); @@ -646,9 +646,9 @@ class Library : DComObject, // bad "in" in annotation of VSI SDK vsshell.h return mCounterLibList.GetListChanges(pcChanges, cast(VSTREELISTITEMCHANGE *)prgListChanges); } - + //Toggles the state of the given item (may be more than two states) - override HRESULT ToggleState(in ULONG uIndex, + override HRESULT ToggleState(in ULONG uIndex, /+[out]+/ VSTREESTATECHANGEREFRESH *ptscr) { mixin(LogCallMix2); @@ -711,7 +711,7 @@ version(todo) NotifyOnBrowseDataRemoved(LLT_PACKAGE, pBrowseNode); } } - return S_OK; + return S_OK; } // IVsSolutionEvents ////////////////////////////////////////////////////// @@ -748,21 +748,21 @@ version(todo) // update the liblist VSTREELISTITEMCHANGE listChanges; - listChanges.grfChange = TCT_ITEMADDED; + listChanges.grfChange = TCT_ITEMADDED; listChanges.Index = mLibraryItems.length - 1; return mCounterLibList.Increment(listChanges); } - + // fRemoving == TRUE means project being removed from solution before solution close. // fRemoving == FALSE means project being removed from solution during solution close. - override HRESULT OnQueryCloseProject(/+[in]+/ IVsHierarchy pHierarchy, in BOOL fRemoving, + override HRESULT OnQueryCloseProject(/+[in]+/ IVsHierarchy pHierarchy, in BOOL fRemoving, /+[in,out]+/ BOOL *pfCancel) { mixin(LogCallMix2); return S_OK; } - + // fRemoved == TRUE means project removed from solution before solution close. // fRemoved == FALSE means project removed from solution during solution close. override HRESULT OnBeforeCloseProject(/+[in]+/ IVsHierarchy pHierarchy, in BOOL fRemoved) @@ -792,7 +792,7 @@ version(todo) // update the liblist VSTREELISTITEMCHANGE listChanges; - listChanges.grfChange = TCT_ITEMDELETED; + listChanges.grfChange = TCT_ITEMDELETED; listChanges.Index = idx; HRESULT hr = mCounterLibList.Increment(listChanges); @@ -806,7 +806,7 @@ version(todo) mixin(LogCallMix2); return S_OK; } - override HRESULT OnQueryUnloadProject(/+[in]+/ IVsHierarchy pRealHierarchy, + override HRESULT OnQueryUnloadProject(/+[in]+/ IVsHierarchy pRealHierarchy, /+[in,out]+/ BOOL *pfCancel) { mixin(LogCallMix2); @@ -825,7 +825,7 @@ version(todo) mixin(LogCallMix2); return S_OK; } - override HRESULT OnQueryCloseSolution(/+[in]+/ IUnknown pUnkReserved, + override HRESULT OnQueryCloseSolution(/+[in]+/ IUnknown pUnkReserved, /+[in,out]+/ BOOL *pfCancel) { mixin(LogCallMix2); @@ -1004,7 +1004,7 @@ LIB_LISTTYPE2 GetListType(string kind) case "delegate": case "function decl": case "function": return LLT_MEMBERS; - + // not expected to show up in json file case "attribute": case "function alias": @@ -1031,13 +1031,13 @@ class ObjectList : DComObject, IVsSimpleObjectList2 LIB_LISTTYPE mListType; //type of the list LIB_LISTFLAGS mFlags; const(VSOBSEARCHCRITERIA2) *mObSrch; // assume valid through the lifetime of the list - + BrowseCounter mCounter; LibraryInfo mLibInfo; ObjectList mParent; InfoObject mObject; InfoObject[] mMembers; - + this(Library lib, in LIB_LISTTYPE2 eListType, in LIB_LISTFLAGS eFlags, in VSOBSEARCHCRITERIA2 *pobSrch) { mLibrary = lib; @@ -1053,14 +1053,14 @@ class ObjectList : DComObject, IVsSimpleObjectList2 mListType = eListType; mFlags = eFlags; mObSrch = pobSrch; - + mLibrary = lib; mLibInfo = libInfo; mParent = parent; mObject = object; initMembers(); } - + override HRESULT QueryInterface(in IID* riid, void** pvObject) { if(queryInterface!(IVsSimpleObjectList2) (this, riid, pvObject)) @@ -1081,14 +1081,14 @@ class ObjectList : DComObject, IVsSimpleObjectList2 else if(info.mModules.type == JSON_TYPE.ARRAY) arr ~= info.mModules.array; - + } else if(mObject) { arr = mObject.members; string base = mObject.GetBase(); string[] ifaces = mObject.GetInterfaces(); - + bool hasBase = base.length || ifaces.length; // do not show base class of enums in the tree if(mObject.kind == "enum") @@ -1132,7 +1132,7 @@ class ObjectList : DComObject, IVsSimpleObjectList2 if(!(mObSrch.grfOptions & VSOBSO_CASESENSITIVE)) searchName = toLower(searchName); } - + foreach(v; arr) { void addIfCorrectKind(InfoObject val) @@ -1148,7 +1148,7 @@ class ObjectList : DComObject, IVsSimpleObjectList2 string name = GetInfoName(val); if(!(mObSrch.grfOptions & VSOBSO_CASESENSITIVE)) name = toLower(name); - + bool rc; switch(mObSrch.eSrchType) { @@ -1177,12 +1177,12 @@ class ObjectList : DComObject, IVsSimpleObjectList2 addIfCorrectKind(v); } } - + int GetCount() { return mMembers.length; } - + bool IsValidIndex(/* [in] */ ULONG uIndex) { return uIndex < GetCount(); @@ -1194,7 +1194,7 @@ class ObjectList : DComObject, IVsSimpleObjectList2 return null; return mMembers[idx]; } - + string GetName(ULONG idx) { InfoObject v = GetObject(idx); @@ -1206,7 +1206,7 @@ class ObjectList : DComObject, IVsSimpleObjectList2 InfoObject v = GetObject(idx); return GetInfoKind(v); } - + InfoObject GetModule() { if(GetInfoKind(mObject) == "module") @@ -1222,7 +1222,7 @@ class ObjectList : DComObject, IVsSimpleObjectList2 return GetObject(idx); return GetModule(); } - + // IVsLiteTreeList /////////////////////////////////////////////////////// override HRESULT GetFlags(/+[out]+/ VSTREEFLAGS *pFlags) { @@ -1232,12 +1232,12 @@ class ObjectList : DComObject, IVsSimpleObjectList2 if (GetCount() > 0) // mListType & (LLT_PACKAGE | LLT_CLASSES)) { //State change and expansion - *pFlags = TF_NOEVERYTHING ^ (TF_NOSTATECHANGE | TF_NOUPDATES | TF_NOEXPANSION); + *pFlags = TF_NOEVERYTHING ^ (TF_NOSTATECHANGE | TF_NOUPDATES | TF_NOEXPANSION); } else { //State change only - *pFlags = TF_NOEVERYTHING ^ (TF_NOSTATECHANGE | TF_NOUPDATES); + *pFlags = TF_NOEVERYTHING ^ (TF_NOSTATECHANGE | TF_NOUPDATES); } return S_OK; } @@ -1246,27 +1246,27 @@ class ObjectList : DComObject, IVsSimpleObjectList2 { mixin(LogCallMix2); assert(pCount); - + *pCount = GetCount(); return S_OK; } - + //Called when a list is collapsed by the user. override HRESULT OnClose(/+[out]+/ VSTREECLOSEACTIONS *ptca) { mixin(LogCallMix2); - + assert(ptca); *ptca = TCA_NOTHING; - + return E_NOTIMPL; } - override HRESULT GetTextWithOwnership(in ULONG uIndex, in VSTREETEXTOPTIONS tto, + override HRESULT GetTextWithOwnership(in ULONG uIndex, in VSTREETEXTOPTIONS tto, /+[out]+/ BSTR *pbstrText) { //mixin(LogCallMix2); - + if (!IsValidIndex(uIndex)) return E_UNEXPECTED; @@ -1295,13 +1295,13 @@ class ObjectList : DComObject, IVsSimpleObjectList2 name ~= display; } name ~= ")"; - } + } *pbstrText = allocBSTR(name); return S_OK; } - + //If you want tiptext to be same as TTO_DISPLAYTEXT, you can E_NOTIMPL this call. - override HRESULT GetTipTextWithOwnership(in ULONG uIndex, in VSTREETOOLTIPTYPE eTipType, + override HRESULT GetTipTextWithOwnership(in ULONG uIndex, in VSTREETOOLTIPTYPE eTipType, /+[out]+/ BSTR *pbstrText) { mixin(LogCallMix2); @@ -1313,8 +1313,8 @@ class ObjectList : DComObject, IVsSimpleObjectList2 string name = GetName(uIndex); *pbstrText = allocBSTR(kind ~ " " ~ name); return S_OK; - } - + } + //Retrieve information to draw the item /+[local]+/ HRESULT GetDisplayData(in ULONG Index, /+[out]+/ VSTREEDISPLAYDATA *pData) { @@ -1343,7 +1343,7 @@ class ObjectList : DComObject, IVsSimpleObjectList2 case "template": pData.Image = CSIMG_TEMPLATE; break; case "alias": case "typedef": pData.Image = CSIMG_UNKNOWN7; break; - + // not expected to show up in json file case "attribute": case "function alias": @@ -1357,13 +1357,13 @@ class ObjectList : DComObject, IVsSimpleObjectList2 case "mixin": case "debug": case "version": - pData.Image = CSIMG_BLITZ; + pData.Image = CSIMG_BLITZ; break; default: pData.Image = CSIMG_STOP; } pData.SelectedImage = pData.Image; - + return S_OK; } //Return latest update increment. True/False isn't sufficient here since @@ -1384,7 +1384,7 @@ class ObjectList : DComObject, IVsSimpleObjectList2 return S_OK; } // Get a sublist - override HRESULT GetList2(in ULONG uIndex, in LIB_LISTTYPE2 ListType, in LIB_LISTFLAGS Flags, in VSOBSEARCHCRITERIA2 *pobSrch, + override HRESULT GetList2(in ULONG uIndex, in LIB_LISTTYPE2 ListType, in LIB_LISTFLAGS Flags, in VSOBSEARCHCRITERIA2 *pobSrch, /+[out]+/ IVsSimpleObjectList2 *ppList) { mixin(LogCallMix2); @@ -1395,8 +1395,8 @@ class ObjectList : DComObject, IVsSimpleObjectList2 auto list = newCom!ObjectList(mLibrary, mLibInfo, this, obj, ListType, Flags, pobSrch); return list.QueryInterface(&IVsSimpleObjectList2.iid, cast(void**) ppList); } - - override HRESULT GetCategoryField2(in ULONG uIndex, in LIB_CATEGORY2 Category, + + override HRESULT GetCategoryField2(in ULONG uIndex, in LIB_CATEGORY2 Category, /+[out,retval]+/ DWORD* pField) { mixin(LogCallMix2); @@ -1442,7 +1442,7 @@ class ObjectList : DComObject, IVsSimpleObjectList2 case LC_MEMBERTYPE: assert(uIndex != BrowseCounter.NULINDEX); return E_NOTIMPL; // m_rgpBrowseNode[uIndex]->GetCategoryField(eCategory, pField); - + case LC_HIERARCHYTYPE: switch (GetKind(uIndex)) { @@ -1455,11 +1455,11 @@ class ObjectList : DComObject, IVsSimpleObjectList2 return E_FAIL; } break; - + case LC_NODETYPE: case LC_MEMBERINHERITANCE: case LC_SEARCHMATCHTYPE: - + default: *pField = 0; return E_FAIL; @@ -1467,47 +1467,47 @@ class ObjectList : DComObject, IVsSimpleObjectList2 return S_OK; } - override HRESULT GetExpandable3(in ULONG Index, in LIB_LISTTYPE2 ListTypeExcluded, + override HRESULT GetExpandable3(in ULONG Index, in LIB_LISTTYPE2 ListTypeExcluded, /+[out]+/ BOOL *pfExpandable) { //mixin(LogCallMix2); assert(pfExpandable); - + InfoObject obj = GetObject(Index); if(GetInfoCount(obj) > 0) // mListType & (LLT_PACKAGE | LLT_CLASSES)) *pfExpandable = TRUE; else *pfExpandable = FALSE; - + return S_OK; } - + override HRESULT GetNavInfo(in ULONG uIndex, /+[out]+/ IVsNavInfo * ppNavInfo) { mixin(LogCallMix2); return E_NOTIMPL; } - override HRESULT GetNavInfoNode(in ULONG Index, + override HRESULT GetNavInfoNode(in ULONG Index, /+[out]+/ IVsNavInfoNode * ppNavInfoNode) { mixin(LogCallMix2); return E_NOTIMPL; } - - override HRESULT LocateNavInfoNode(/+[in]+/ IVsNavInfoNode pNavInfoNode, + + override HRESULT LocateNavInfoNode(/+[in]+/ IVsNavInfoNode pNavInfoNode, /+[out]+/ ULONG * pulIndex) { mixin(LogCallMix2); return E_NOTIMPL; } - - override HRESULT GetBrowseObject(in ULONG Index, + + override HRESULT GetBrowseObject(in ULONG Index, /+[out]+/ IDispatch *ppdispBrowseObj) { mixin(LogCallMix2); return E_NOTIMPL; } - override HRESULT GetUserContext(in ULONG Index, + override HRESULT GetUserContext(in ULONG Index, /+[out]+/ IUnknown *ppunkUserCtx) { mixin(LogCallMix2); @@ -1518,14 +1518,14 @@ class ObjectList : DComObject, IVsSimpleObjectList2 mixin(LogCallMix2); return E_NOTIMPL; } - override HRESULT GetSourceContextWithOwnership(in ULONG Index, - /+[out]+/ BSTR *pszFileName, + override HRESULT GetSourceContextWithOwnership(in ULONG Index, + /+[out]+/ BSTR *pszFileName, /+[out]+/ ULONG *pulLineNum) { mixin(LogCallMix2); return E_NOTIMPL; } - override HRESULT GetProperty(in ULONG Index, in VSOBJLISTELEMPROPID propid, + override HRESULT GetProperty(in ULONG Index, in VSOBJLISTELEMPROPID propid, /+[out]+/ VARIANT *pvar) { mixin(LogCallMix2); @@ -1537,17 +1537,17 @@ class ObjectList : DComObject, IVsSimpleObjectList2 // If there are >1 itemids, return VSITEMID_SELECTION and a subsequent call will be made // on GetMultipleSourceItems to get them. If there are no available source items, return // VSITEMID_ROOT to indicate the root of the hierarchy as a whole. - override HRESULT CountSourceItems(in ULONG Index, - /+[out]+/ IVsHierarchy *ppHier, - /+[out]+/ VSITEMID *pitemid, + override HRESULT CountSourceItems(in ULONG Index, + /+[out]+/ IVsHierarchy *ppHier, + /+[out]+/ VSITEMID *pitemid, /+[out, retval]+/ ULONG *pcItems) { mixin(LogCallMix2); return E_NOTIMPL; } - // Used if CountSourceItems returns > 1. Details for filling up these out params are same + // Used if CountSourceItems returns > 1. Details for filling up these out params are same // as IVsMultiItemSelect::GetSelectedItems - override HRESULT GetMultipleSourceItems(in ULONG Index, in VSGSIFLAGS grfGSI, in ULONG cItems, + override HRESULT GetMultipleSourceItems(in ULONG Index, in VSGSIFLAGS grfGSI, in ULONG cItems, /+[out, size_is(cItems)]+/ VSITEMSELECTION *rgItemSel) { mixin(LogCallMix2); @@ -1555,7 +1555,7 @@ class ObjectList : DComObject, IVsSimpleObjectList2 } // Return TRUE if navigation to source of the specified type (definition or declaration), // is possible, FALSE otherwise - override HRESULT CanGoToSource(in ULONG Index, in VSOBJGOTOSRCTYPE SrcType, + override HRESULT CanGoToSource(in ULONG Index, in VSOBJGOTOSRCTYPE SrcType, /+[out]+/ BOOL *pfOK) { mixin(LogCallMix2); @@ -1578,7 +1578,7 @@ class ObjectList : DComObject, IVsSimpleObjectList2 override HRESULT GoToSource(in ULONG Index, in VSOBJGOTOSRCTYPE SrcType) { mixin(LogCallMix2); - + string file, modname; auto mod = GetModule(Index); @@ -1594,22 +1594,22 @@ class ObjectList : DComObject, IVsSimpleObjectList2 return OpenFileInSolution(file, line, 0, modname, true); } - - override HRESULT GetContextMenu(in ULONG Index, - /+[out]+/ CLSID *pclsidActive, - /+[out]+/ LONG *pnMenuId, + + override HRESULT GetContextMenu(in ULONG Index, + /+[out]+/ CLSID *pclsidActive, + /+[out]+/ LONG *pnMenuId, /+[out]+/ IOleCommandTarget *ppCmdTrgtActive) { // mixin(LogCallMix2); return E_NOTIMPL; - } - override HRESULT QueryDragDrop(in ULONG Index, /+[in]+/ IDataObject pDataObject, in DWORD grfKeyState, + } + override HRESULT QueryDragDrop(in ULONG Index, /+[in]+/ IDataObject pDataObject, in DWORD grfKeyState, /+[in, out]+/DWORD * pdwEffect) { mixin(LogCallMix2); return E_NOTIMPL; } - override HRESULT DoDragDrop(in ULONG Index, /+[in]+/ IDataObject pDataObject, in DWORD grfKeyState, + override HRESULT DoDragDrop(in ULONG Index, /+[in]+/ IDataObject pDataObject, in DWORD grfKeyState, /+[in, out]+/DWORD * pdwEffect) { mixin(LogCallMix2); @@ -1620,8 +1620,8 @@ class ObjectList : DComObject, IVsSimpleObjectList2 // (return TRUE or FALSE). If pszNewName is non-NULL, do validation of the new name // and return TRUE if successful rename with that new name is possible or an an error hr (along with FALSE) // if the name is somehow invalid (and set the rich error info to indicate to the user - // what was wrong) - override HRESULT CanRename(in ULONG Index, in LPCOLESTR pszNewName, + // what was wrong) + override HRESULT CanRename(in ULONG Index, in LPCOLESTR pszNewName, /+[out]+/ BOOL *pfOK) { mixin(LogCallMix2); @@ -1637,7 +1637,7 @@ class ObjectList : DComObject, IVsSimpleObjectList2 return E_NOTIMPL; } // Says whether the item Index can be deleted or not. Return TRUE if it can, FALSE if not. - override HRESULT CanDelete(in ULONG Index, + override HRESULT CanDelete(in ULONG Index, /+[out]+/ BOOL *pfOK) { mixin(LogCallMix2); @@ -1657,14 +1657,14 @@ class ObjectList : DComObject, IVsSimpleObjectList2 override HRESULT FillDescription2(in ULONG Index, in VSOBJDESCOPTIONS grfOptions, /+[in]+/ IVsObjectBrowserDescription3 pobDesc) { mixin(LogCallMix2); - + auto val = GetObject(Index); Definition def; if(val) def.setFromBrowseNode(val); if(!val || def.line < -1) return S_OK; // no description for auto generated nodes - + if(HasFunctionPrototype(def.kind)) { string ret = def.GetReturnType(); @@ -1729,27 +1729,27 @@ class ObjectList : DComObject, IVsSimpleObjectList2 } return S_OK; } - - // These three methods give the list a chance to provide clipboard formats for a drag-drop or + + // These three methods give the list a chance to provide clipboard formats for a drag-drop or // copy/paste operation. // Caller first calls EnumClipboardFormats(index, flags, 0, NULL, &cExpected) to get the count // of clipboard formats the list is interested in providing, allocates an array of that size, // and then calls EnumClipboardFormats(index, flags, cExpected, prgCFs, &cActual) - // Flags indicate whether this is part of a multiple selction of items. In the + // Flags indicate whether this is part of a multiple selction of items. In the // returned array, the list can indicate which formats it supports, on what STGMEDIUM and // whether the format is a composite one (caller does the actual rendering after calling // GetExtendedClipboardVariant) vs one that the list itself will render thru GetClipboardFormat // In the case of a multi-select, typically the list would only support composite formats - // enabling the caller to write the format in the form: + // enabling the caller to write the format in the form: // .. // (Note that only certain persistable VARIANT types are supported (as per CComVariant::WriteToStream). // In the single select case, the list is free to provide both traditional and composite formats // and will be called respectively on GetClipboardFormat or GetExtendedClipboardVariant for each. // Note that CV/OB will automatically provide a CF_NAVINFO and a CF_TEXT/CF_UNICODETEXT format, so // EnumClipboardFormats should NOT return these values. - override HRESULT EnumClipboardFormats(in ULONG Index, + override HRESULT EnumClipboardFormats(in ULONG Index, in VSOBJCFFLAGS grfFlags, - in ULONG celt, + in ULONG celt, /+[in, out, size_is(celt)]+/ VSOBJCLIPFORMAT *rgcfFormats, /+[out, optional]+/ ULONG *pcActual) { @@ -1826,42 +1826,42 @@ class FindReferencesList : DComObject, IVsSimpleObjectList2 } /////////////////////////////////////////////////////////////////// - HRESULT GetFlags(/+[out]+/ VSTREEFLAGS *pFlags) + HRESULT GetFlags(/+[out]+/ VSTREEFLAGS *pFlags) { mixin(LogCallMix2); return E_NOTIMPL; } - HRESULT GetCapabilities2(/+[out]+/ LIB_LISTCAPABILITIES2 *pgrfCapabilities) + HRESULT GetCapabilities2(/+[out]+/ LIB_LISTCAPABILITIES2 *pgrfCapabilities) { mixin(LogCallMix2); return E_NOTIMPL; } - HRESULT UpdateCounter(/+[out]+/ ULONG *pCurUpdate) + HRESULT UpdateCounter(/+[out]+/ ULONG *pCurUpdate) { mixin(LogCallMix2); return E_NOTIMPL; } - HRESULT GetItemCount(/+[out]+/ ULONG* pCount) + HRESULT GetItemCount(/+[out]+/ ULONG* pCount) { mixin(LogCallMix2); *pCount = mReferences.length; return S_OK; } - /+[local]+/ HRESULT GetDisplayData(in ULONG Index, - /+[out]+/ VSTREEDISPLAYDATA *pData) + /+[local]+/ HRESULT GetDisplayData(in ULONG Index, + /+[out]+/ VSTREEDISPLAYDATA *pData) { mixin(LogCallMix2); if (!IsValidIndex(Index)) return E_UNEXPECTED; pData.Mask = TDM_IMAGE | TDM_SELECTEDIMAGE; - pData.Image = CSIMG_BLITZ; + pData.Image = CSIMG_BLITZ; pData.SelectedImage = pData.Image; return S_OK; } - HRESULT GetTextWithOwnership(in ULONG Index, in VSTREETEXTOPTIONS tto, - /+[out]+/ BSTR *pbstrText) + HRESULT GetTextWithOwnership(in ULONG Index, in VSTREETEXTOPTIONS tto, + /+[out]+/ BSTR *pbstrText) { mixin(LogCallMix2); switch(tto) @@ -1879,8 +1879,8 @@ class FindReferencesList : DComObject, IVsSimpleObjectList2 } return E_FAIL; } - HRESULT GetTipTextWithOwnership(in ULONG Index, in VSTREETOOLTIPTYPE eTipType, - /+[out]+/ BSTR *pbstrText) + HRESULT GetTipTextWithOwnership(in ULONG Index, in VSTREETOOLTIPTYPE eTipType, + /+[out]+/ BSTR *pbstrText) { mixin(LogCallMix2); if (!IsValidIndex(Index)) @@ -1889,32 +1889,32 @@ class FindReferencesList : DComObject, IVsSimpleObjectList2 *pbstrText = allocBSTR(mReferences[Index]); return S_OK; } - HRESULT GetCategoryField2(in ULONG Index, in LIB_CATEGORY2 Category, - /+[out,retval]+/ DWORD *pfCatField) + HRESULT GetCategoryField2(in ULONG Index, in LIB_CATEGORY2 Category, + /+[out,retval]+/ DWORD *pfCatField) { mixin(LogCallMix2); return E_NOTIMPL; } - HRESULT GetBrowseObject(in ULONG Index, - /+[out]+/ IDispatch *ppdispBrowseObj) + HRESULT GetBrowseObject(in ULONG Index, + /+[out]+/ IDispatch *ppdispBrowseObj) { mixin(LogCallMix2); return E_NOTIMPL; } - HRESULT GetUserContext(in ULONG Index, - /+[out]+/ IUnknown *ppunkUserCtx) + HRESULT GetUserContext(in ULONG Index, + /+[out]+/ IUnknown *ppunkUserCtx) { mixin(LogCallMix2); return E_NOTIMPL; } - HRESULT ShowHelp(in ULONG Index) + HRESULT ShowHelp(in ULONG Index) { mixin(LogCallMix2); return E_NOTIMPL; } - HRESULT GetSourceContextWithOwnership(in ULONG Index, - /+[out]+/ BSTR *pbstrFileName, - /+[out]+/ ULONG *pulLineNum) + HRESULT GetSourceContextWithOwnership(in ULONG Index, + /+[out]+/ BSTR *pbstrFileName, + /+[out]+/ ULONG *pulLineNum) { mixin(LogCallMix2); version(none) @@ -1931,31 +1931,31 @@ class FindReferencesList : DComObject, IVsSimpleObjectList2 else return E_NOTIMPL; } - HRESULT CountSourceItems(in ULONG Index, - /+[out]+/ IVsHierarchy *ppHier, - /+[out]+/ VSITEMID *pitemid, - /+[out, retval]+/ ULONG *pcItems) + HRESULT CountSourceItems(in ULONG Index, + /+[out]+/ IVsHierarchy *ppHier, + /+[out]+/ VSITEMID *pitemid, + /+[out, retval]+/ ULONG *pcItems) { mixin(LogCallMix2); return E_NOTIMPL; } - HRESULT GetMultipleSourceItems(in ULONG Index, in VSGSIFLAGS grfGSI, in ULONG cItems, - /+[out, size_is(cItems)]+/ VSITEMSELECTION *rgItemSel) + HRESULT GetMultipleSourceItems(in ULONG Index, in VSGSIFLAGS grfGSI, in ULONG cItems, + /+[out, size_is(cItems)]+/ VSITEMSELECTION *rgItemSel) { mixin(LogCallMix2); return E_NOTIMPL; } - HRESULT CanGoToSource(in ULONG Index, in VSOBJGOTOSRCTYPE SrcType, - /+[out]+/ BOOL *pfOK) + HRESULT CanGoToSource(in ULONG Index, in VSOBJGOTOSRCTYPE SrcType, + /+[out]+/ BOOL *pfOK) { mixin(LogCallMix2); if (!IsValidIndex(Index) || !pfOK) return E_UNEXPECTED; - + *pfOK = (SrcType == GS_ANY || SrcType == GS_REFERENCE); return S_OK; } - HRESULT GoToSource(in ULONG Index, in VSOBJGOTOSRCTYPE SrcType) + HRESULT GoToSource(in ULONG Index, in VSOBJGOTOSRCTYPE SrcType) { mixin(LogCallMix2); @@ -1967,113 +1967,113 @@ class FindReferencesList : DComObject, IVsSimpleObjectList2 return E_FAIL; return OpenFileInSolution(file, line, col, modname, true); } - HRESULT GetContextMenu(in ULONG Index, - /+[out]+/ CLSID *pclsidActive, - /+[out]+/ LONG *pnMenuId, - /+[out]+/ IOleCommandTarget *ppCmdTrgtActive) + HRESULT GetContextMenu(in ULONG Index, + /+[out]+/ CLSID *pclsidActive, + /+[out]+/ LONG *pnMenuId, + /+[out]+/ IOleCommandTarget *ppCmdTrgtActive) { mixin(LogCallMix2); return E_NOTIMPL; } - HRESULT QueryDragDrop(in ULONG Index, /+[in]+/ IDataObject pDataObject, in DWORD grfKeyState, - /+[in, out]+/DWORD * pdwEffect) + HRESULT QueryDragDrop(in ULONG Index, /+[in]+/ IDataObject pDataObject, in DWORD grfKeyState, + /+[in, out]+/DWORD * pdwEffect) { mixin(LogCallMix2); return E_NOTIMPL; } - HRESULT DoDragDrop(in ULONG Index, /+[in]+/ IDataObject pDataObject, in DWORD grfKeyState, - /+[in, out]+/DWORD * pdwEffect) + HRESULT DoDragDrop(in ULONG Index, /+[in]+/ IDataObject pDataObject, in DWORD grfKeyState, + /+[in, out]+/DWORD * pdwEffect) { mixin(LogCallMix2); return E_NOTIMPL; } - HRESULT CanRename(in ULONG Index, in LPCOLESTR pszNewName, - /+[out]+/ BOOL *pfOK) + HRESULT CanRename(in ULONG Index, in LPCOLESTR pszNewName, + /+[out]+/ BOOL *pfOK) { mixin(LogCallMix2); return E_NOTIMPL; } - HRESULT DoRename(in ULONG Index, in LPCOLESTR pszNewName, in VSOBJOPFLAGS grfFlags) + HRESULT DoRename(in ULONG Index, in LPCOLESTR pszNewName, in VSOBJOPFLAGS grfFlags) { mixin(LogCallMix2); return E_NOTIMPL; } - HRESULT CanDelete(in ULONG Index, - /+[out]+/ BOOL *pfOK) + HRESULT CanDelete(in ULONG Index, + /+[out]+/ BOOL *pfOK) { mixin(LogCallMix2); return E_NOTIMPL; } - HRESULT DoDelete(in ULONG Index, in VSOBJOPFLAGS grfFlags) + HRESULT DoDelete(in ULONG Index, in VSOBJOPFLAGS grfFlags) { mixin(LogCallMix2); return E_NOTIMPL; } - HRESULT FillDescription2(in ULONG Index, in VSOBJDESCOPTIONS grfOptions, /+[in]+/ IVsObjectBrowserDescription3 pobDesc) + HRESULT FillDescription2(in ULONG Index, in VSOBJDESCOPTIONS grfOptions, /+[in]+/ IVsObjectBrowserDescription3 pobDesc) { mixin(LogCallMix2); return E_NOTIMPL; } - HRESULT EnumClipboardFormats(in ULONG Index, in VSOBJCFFLAGS grfFlags, in ULONG celt, - /+[in, out, size_is(celt)]+/ VSOBJCLIPFORMAT *rgcfFormats, - /+[out, optional]+/ ULONG *pcActual) + HRESULT EnumClipboardFormats(in ULONG Index, in VSOBJCFFLAGS grfFlags, in ULONG celt, + /+[in, out, size_is(celt)]+/ VSOBJCLIPFORMAT *rgcfFormats, + /+[out, optional]+/ ULONG *pcActual) { mixin(LogCallMix2); return E_NOTIMPL; } - HRESULT GetClipboardFormat(in ULONG Index, in VSOBJCFFLAGS grfFlags, in FORMATETC *pFormatetc, in STGMEDIUM *pMedium) + HRESULT GetClipboardFormat(in ULONG Index, in VSOBJCFFLAGS grfFlags, in FORMATETC *pFormatetc, in STGMEDIUM *pMedium) { mixin(LogCallMix2); return E_NOTIMPL; } - HRESULT GetExtendedClipboardVariant(in ULONG Index, in VSOBJCFFLAGS grfFlags, in const( VSOBJCLIPFORMAT)*pcfFormat, - /+[out]+/ VARIANT *pvarFormat) + HRESULT GetExtendedClipboardVariant(in ULONG Index, in VSOBJCFFLAGS grfFlags, in const( VSOBJCLIPFORMAT)*pcfFormat, + /+[out]+/ VARIANT *pvarFormat) { mixin(LogCallMix2); return E_NOTIMPL; } - HRESULT GetProperty(in ULONG Index, in VSOBJLISTELEMPROPID propid, - /+[out]+/ VARIANT *pvar) + HRESULT GetProperty(in ULONG Index, in VSOBJLISTELEMPROPID propid, + /+[out]+/ VARIANT *pvar) { mixin(LogCallMix2); return E_NOTIMPL; } - HRESULT GetNavInfo(in ULONG Index, - /+[out]+/ IVsNavInfo * ppNavInfo) + HRESULT GetNavInfo(in ULONG Index, + /+[out]+/ IVsNavInfo * ppNavInfo) { mixin(LogCallMix2); return E_NOTIMPL; } - HRESULT GetNavInfoNode(in ULONG Index, - /+[out]+/ IVsNavInfoNode * ppNavInfoNode) + HRESULT GetNavInfoNode(in ULONG Index, + /+[out]+/ IVsNavInfoNode * ppNavInfoNode) { mixin(LogCallMix2); return E_NOTIMPL; } - HRESULT LocateNavInfoNode(/+[in]+/ IVsNavInfoNode pNavInfoNode, - /+[out]+/ ULONG * pulIndex) + HRESULT LocateNavInfoNode(/+[in]+/ IVsNavInfoNode pNavInfoNode, + /+[out]+/ ULONG * pulIndex) { mixin(LogCallMix2); return E_NOTIMPL; } - HRESULT GetExpandable3(in ULONG Index, in LIB_LISTTYPE2 ListTypeExcluded, - /+[out]+/ BOOL *pfExpandable) + HRESULT GetExpandable3(in ULONG Index, in LIB_LISTTYPE2 ListTypeExcluded, + /+[out]+/ BOOL *pfExpandable) { mixin(LogCallMix2); return E_NOTIMPL; } - HRESULT GetList2(in ULONG Index, in LIB_LISTTYPE2 ListType, in LIB_LISTFLAGS Flags, in VSOBSEARCHCRITERIA2 *pobSrch, - /+[out, retval]+/ IVsSimpleObjectList2 *ppIVsSimpleObjectList2) + HRESULT GetList2(in ULONG Index, in LIB_LISTTYPE2 ListType, in LIB_LISTFLAGS Flags, in VSOBSEARCHCRITERIA2 *pobSrch, + /+[out, retval]+/ IVsSimpleObjectList2 *ppIVsSimpleObjectList2) { mixin(LogCallMix2); return E_NOTIMPL; } - HRESULT OnClose(/+[out]+/ VSTREECLOSEACTIONS *ptca) + HRESULT OnClose(/+[out]+/ VSTREECLOSEACTIONS *ptca) { mixin(LogCallMix2); return E_NOTIMPL; } -}; +}; class LibraryItem { @@ -2082,9 +2082,9 @@ class LibraryItem mLibrary = lib; mHierarchy = addref(pIVsHierarchy); } - + IVsHierarchy GetHierarchy() { return mHierarchy; } - + void Close() { mHierarchy = release(mHierarchy); @@ -2116,7 +2116,7 @@ class LibraryItem return S_OK; } - HRESULT GetDisplayData(/* [in] */ BOOL fIsLibraryChecked, + HRESULT GetDisplayData(/* [in] */ BOOL fIsLibraryChecked, /* [out] */ VSTREEDISPLAYDATA * pData) { assert(pData); @@ -2151,7 +2151,7 @@ struct BrowseCounter } else { - m_listChanges = listChanges; + m_listChanges = listChanges; } m_fIsCounterDirty = TRUE; @@ -2172,13 +2172,13 @@ struct BrowseCounter return S_OK; } - HRESULT GetListChanges(/*[in,out] */ ULONG * pcChanges, + HRESULT GetListChanges(/*[in,out] */ ULONG * pcChanges, /*[in, size_is(*pcChanges)]*/ VSTREELISTITEMCHANGE * prgListChanges) { assert(pcChanges); assert(m_cChanges == 1); assert(m_fIsCounterDirty); - assert((m_listChanges.Index != NULINDEX) || + assert((m_listChanges.Index != NULINDEX) || (m_listChanges.grfChange == TCT_TOOMANYCHANGES) ); assert(m_listChanges.grfChange != TCT_NOCHANGE); @@ -2243,7 +2243,7 @@ Definition[] GetObjectLibraryDefinitions(wstring word) for(ULONG it = 0; it < items; it++) if(reslist.CanGoToSource(it, GS_DEFINITION, &ok) == S_OK && ok) { - + } } } diff --git a/visuald/logutil.d b/visuald/logutil.d index 206c2b85..8c4022d6 100644 --- a/visuald/logutil.d +++ b/visuald/logutil.d @@ -352,16 +352,11 @@ version(none) return toUTF8(GUID2wstring(guid)); } -string tryformat(...) +string tryformat(T...)(string fmt, T args) { string s; - void putc(dchar c) - { - s ~= c; - } - try { - std.format.doFormat(&putc, _arguments, _argptr); + s = std.format.format(fmt, args); } catch(Exception e) { @@ -509,16 +504,9 @@ extern(C) void log_flush() version(test) { - void logCall(...) + void logCall(T...)(string fmt, T args) { - string s; - - void putc(dchar c) - { - s ~= c; - } - - std.format.doFormat(&putc, _arguments, _argptr); + string s = std.format.format(fmt, args); s ~= "\n"; std.stdio.fputs(toStringz(s), stdout.getFP); @@ -528,7 +516,7 @@ version(test) { class logSync {} - void logCall(...) + void logCall(T...)(string fmt, T args) { auto buffer = new char[32]; SysTime now = Clock.currTime(); @@ -538,13 +526,8 @@ version(test) { string s = to!string(buffer[0..len]); s ~= replicate(" ", gLogIndent); - void putc(dchar c) - { - s ~= c; - } - try { - std.format.doFormat(&putc, _arguments, _argptr); + s ~= std.format.format(fmt, args); } catch(Exception e) { diff --git a/visuald/pkgutil.d b/visuald/pkgutil.d index 21843f27..9e52198d 100644 --- a/visuald/pkgutil.d +++ b/visuald/pkgutil.d @@ -167,13 +167,13 @@ string browseFile(HWND parentHwnd, string title, string filter, string initdir = wchar[260] fileName; fileName[0] = 0; VSOPENFILENAMEW ofn; - ofn.lStructSize = ofn.sizeof; - ofn.hwndOwner = parentHwnd; - ofn.pwzDlgTitle = toUTF16z(title); - ofn.pwzFileName = fileName.ptr; - ofn.nMaxFileName = fileName.length; - ofn.pwzInitialDir = toUTF16z(initdir); - ofn.pwzFilter = toUTF16z(filter); + ofn.lStructSize = ofn.sizeof; + ofn.hwndOwner = parentHwnd; + ofn.pwzDlgTitle = toUTF16z(title); + ofn.pwzFileName = fileName.ptr; + ofn.nMaxFileName = fileName.length; + ofn.pwzInitialDir = toUTF16z(initdir); + ofn.pwzFilter = toUTF16z(filter); if (pIVsUIShell.GetOpenFileNameViaDlg(&ofn) == S_OK) return to!string(fileName); } diff --git a/visuald/propertypage.d b/visuald/propertypage.d index 9449288c..75b4c167 100644 --- a/visuald/propertypage.d +++ b/visuald/propertypage.d @@ -1072,7 +1072,8 @@ class DmdDebugPropertyPage : ProjectPropertyPage "Default (enable asserts, invariants and constraints)" ], false)); AddControl("Debug Info", mDebugInfo = new ComboBox(mCanvas, dbgInfoOpt, false)); AddHorizontalLine(); - AddControl("", mRunCv2pdb = new CheckBox(mCanvas, "Run cv2pdb to Convert Debug Info")); + string[] cv2pdbOpt = [ "Never", "If recommended for selected debug engine", "Always" ]; + AddControl("Run cv2pdb", mRunCv2pdb = new ComboBox(mCanvas, cv2pdbOpt, false)); auto btn = new Button(mCanvas, "...", ID_BROWSECV2PDB); AddControl("Path to cv2pdb", mPathCv2pdb = new Text(mCanvas), btn); AddControl("", mCv2pdbPre2043 = new CheckBox(mCanvas, "Assume old associative array implementation (before dmd 2.043)")); @@ -1090,7 +1091,7 @@ class DmdDebugPropertyPage : ProjectPropertyPage void EnableControls() { mRunCv2pdb.setEnabled(mCanRunCv2PDB); - bool runcv2pdb = mCanRunCv2PDB && mRunCv2pdb.isChecked(); + bool runcv2pdb = mCanRunCv2PDB && mRunCv2pdb.getSelection() > 0; mPathCv2pdb.setEnabled(runcv2pdb); mCv2pdbOptions.setEnabled(runcv2pdb); @@ -1103,7 +1104,7 @@ class DmdDebugPropertyPage : ProjectPropertyPage { mDebugMode.setSelection(options.release); mDebugInfo.setSelection(options.symdebug); - mRunCv2pdb.setChecked(options.runCv2pdb); + mRunCv2pdb.setSelection(options.runCv2pdb); mPathCv2pdb.setText(options.pathCv2pdb); mCv2pdbOptions.setText(options.cv2pdbOptions); mCv2pdbPre2043.setChecked(options.cv2pdbPre2043); @@ -1119,7 +1120,7 @@ class DmdDebugPropertyPage : ProjectPropertyPage int changes = 0; changes += changeOption(cast(ubyte) mDebugMode.getSelection(), options.release, refoptions.release); changes += changeOption(cast(ubyte) mDebugInfo.getSelection(), options.symdebug, refoptions.symdebug); - changes += changeOption(mRunCv2pdb.isChecked(), options.runCv2pdb, refoptions.runCv2pdb); + changes += changeOption(cast(ubyte) mRunCv2pdb.getSelection(), options.runCv2pdb, refoptions.runCv2pdb); changes += changeOption(mPathCv2pdb.getText(), options.pathCv2pdb, refoptions.pathCv2pdb); changes += changeOption(mCv2pdbOptions.getText(), options.cv2pdbOptions, refoptions.cv2pdbOptions); changes += changeOption(mCv2pdbPre2043.isChecked(), options.cv2pdbPre2043, refoptions.cv2pdbPre2043); @@ -1131,7 +1132,7 @@ class DmdDebugPropertyPage : ProjectPropertyPage bool mCanRunCv2PDB; ComboBox mDebugMode; ComboBox mDebugInfo; - CheckBox mRunCv2pdb; + ComboBox mRunCv2pdb; Text mPathCv2pdb; CheckBox mCv2pdbPre2043; CheckBox mCv2pdbNoDemangle; diff --git a/visuald/register.d b/visuald/register.d index 0742c85b..c87060fe 100644 --- a/visuald/register.d +++ b/visuald/register.d @@ -310,6 +310,8 @@ static const wstring regPathMetricsEE = "\\AD7Metrics\\ExpressionEvaluator" static const wstring vendorMicrosoftGuid = "{994B45C4-E6E9-11D2-903F-00C04FA302A1}"w; static const wstring guidCOMPlusNativeEng = "{92EF0900-2251-11D2-B72E-0000F87572EF}"w; +static const GUID GUID_MaGoDebugger = uuid("{97348AC0-2B6B-4B99-A245-4C7E2C09D403}"); + /////////////////////////////////////////////////////////////////////// // Registration /////////////////////////////////////////////////////////////////////// @@ -351,6 +353,10 @@ void updateConfigurationChanged(HKEY keyRoot, wstring registrationRoot) { scope RegKey keyRegRoot = new RegKey(keyRoot, registrationRoot, true, false); + // avoid: Function type does not match previously declared function with the same mangled name + // which is an ambiguity between sdk.win32 and core.sys.windows + version(LDC) + import core.sys.windows.winbase : FILETIME, GetSystemTimeAsFileTime; FILETIME fileTime; GetSystemTimeAsFileTime(&fileTime); ULARGE_INTEGER ul; @@ -415,12 +421,14 @@ HRESULT VSDllUnregisterServerInternal(in wchar* pszRegRoot, in bool useRanu) wstring languageGuid = GUID2wstring(g_languageCLSID); wstring wizardGuid = GUID2wstring(g_ProjectItemWizardCLSID); wstring vdhelperGuid = GUID2wstring(g_VisualDHelperCLSID); + wstring vchelperGuid = GUID2wstring(g_VisualCHelperCLSID); HRESULT hr = S_OK; hr |= RegDeleteRecursive(keyRoot, registrationRoot ~ "\\Packages\\"w ~ packageGuid); hr |= RegDeleteRecursive(keyRoot, registrationRoot ~ "\\CLSID\\"w ~ languageGuid); hr |= RegDeleteRecursive(keyRoot, registrationRoot ~ "\\CLSID\\"w ~ wizardGuid); hr |= RegDeleteRecursive(keyRoot, registrationRoot ~ "\\CLSID\\"w ~ vdhelperGuid); + hr |= RegDeleteRecursive(keyRoot, registrationRoot ~ "\\CLSID\\"w ~ vchelperGuid); foreach (wstring fileExt; g_languageFileExtensions) hr |= RegDeleteRecursive(keyRoot, registrationRoot ~ regPathFileExts ~ "\\"w ~ fileExt); @@ -459,6 +467,13 @@ HRESULT VSDllRegisterServerInternal(in wchar* pszRegRoot, in bool useRanu) wstring templatePath = GetTemplatePath(dllPath); wstring vdextPath = dirName(dllPath) ~ "\\vdextensions.dll"w; + float ver = guessVSVersion(registrationRoot); + wstring dbuildPath; + if (ver == 12) + dbuildPath = dirName(dllPath) ~ "\\msbuild\\dbuild.12.0.dll"w; + else if (ver == 14) + dbuildPath = dirName(dllPath) ~ "\\msbuild\\dbuild.14.0.dll"w; + try { wstring packageGuid = GUID2wstring(g_packageCLSID); @@ -467,6 +482,7 @@ HRESULT VSDllRegisterServerInternal(in wchar* pszRegRoot, in bool useRanu) wstring exprEvalGuid = GUID2wstring(g_expressionEvaluator); wstring wizardGuid = GUID2wstring(g_ProjectItemWizardCLSID); wstring vdhelperGuid = GUID2wstring(g_VisualDHelperCLSID); + wstring vchelperGuid = GUID2wstring(g_VisualCHelperCLSID); // package scope RegKey keyPackage = new RegKey(keyRoot, registrationRoot ~ "\\Packages\\"w ~ packageGuid); @@ -475,7 +491,7 @@ HRESULT VSDllRegisterServerInternal(in wchar* pszRegRoot, in bool useRanu) keyPackage.Set("About"w, g_packageName); keyPackage.Set("CompanyName"w, g_packageCompany); keyPackage.Set("ProductName"w, g_packageName); - keyPackage.Set("ProductVersion"w, toUTF16(g_packageVersion)); + keyPackage.Set("ProductVersion"w, toUTF16(ver < 10 ? plk_version : g_packageVersion)); keyPackage.Set("MinEdition"w, "Standard"); keyPackage.Set("ID"w, 1); @@ -494,12 +510,26 @@ HRESULT VSDllRegisterServerInternal(in wchar* pszRegRoot, in bool useRanu) keyWizardCLSID.Set("ThreadingModel"w, "Appartment"w); // VDExtensions - scope RegKey keyHelperCLSID = new RegKey(keyRoot, registrationRoot ~ "\\CLSID\\"w ~ vdhelperGuid); - keyHelperCLSID.Set("InprocServer32"w, "mscoree.dll"); - keyHelperCLSID.Set("ThreadingModel"w, "Both"w); - keyHelperCLSID.Set(null, "vdextensions.VisualDHelper"w); - keyHelperCLSID.Set("Class"w, "vdextensions.VisualDHelper"w); - keyHelperCLSID.Set("CodeBase"w, vdextPath); + if (vdextPath) + { + scope RegKey keyHelperCLSID = new RegKey(keyRoot, registrationRoot ~ "\\CLSID\\"w ~ vdhelperGuid); + keyHelperCLSID.Set("InprocServer32"w, "mscoree.dll"); + keyHelperCLSID.Set("ThreadingModel"w, "Both"w); + keyHelperCLSID.Set(null, "vdextensions.VisualDHelper"w); + keyHelperCLSID.Set("Class"w, "vdextensions.VisualDHelper"w); + keyHelperCLSID.Set("CodeBase"w, vdextPath); + } + + // dbuild extension + if (dbuildPath) + { + scope RegKey keyHelperCLSID = new RegKey(keyRoot, registrationRoot ~ "\\CLSID\\"w ~ vchelperGuid); + keyHelperCLSID.Set("InprocServer32"w, "mscoree.dll"); + keyHelperCLSID.Set("ThreadingModel"w, "Both"w); + keyHelperCLSID.Set(null, "vdextensions.VisualCHelper"w); + keyHelperCLSID.Set("Class"w, "vdextensions.VisualCHelper"w); + keyHelperCLSID.Set("CodeBase"w, dbuildPath); + } // file extensions wstring fileExtensions; @@ -664,6 +694,8 @@ version(none){ fixVS2012Shellx64Debugger(keyRoot, registrationRoot); + registerMago(pszRegRoot, useRanu); + updateConfigurationChanged(keyRoot, registrationRoot); } catch(RegistryException e) @@ -673,6 +705,44 @@ version(none){ return S_OK; } +HRESULT registerMago(in wchar* pszRegRoot, in bool useRanu) +{ + HKEY keyRoot = useRanu ? HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE; + wstring registrationRoot = GetRegistrationRoot(pszRegRoot, useRanu); + + // package + scope RegKey keyProduct = new RegKey(keyRoot, registrationRoot ~ "\\InstalledProducts\\Mago"w); + keyProduct.Set(null, "Mago Native Debug Engine"w); + keyProduct.Set("PID"w, "1.0.0"); + keyProduct.Set("ProductDetails"w, "A debug engine dedicated to debugging applications written in the D programming language." + ~ " See the project website at http://www.dsource.org/projects/mago_debugger for more information." + ~ " Copyright (c) 2010-2014 Aldo J. Nunez"w); + + wstring magoGuid = GUID2wstring(GUID_MaGoDebugger); + scope RegKey keyAD7 = new RegKey(keyRoot, registrationRoot ~ "\\AD7Metrics\\Engine\\"w ~ magoGuid); + keyAD7.Set("CLSID"w, magoGuid); + keyAD7.Set("Name"w, "Mago Native"); + keyAD7.Set("ENC"w, 0); + keyAD7.Set("Disassembly"w, 1); + keyAD7.Set("Exceptions"w, 1); + keyAD7.Set("AlwaysLoadLocal"w, 1); + + // TODO: register exceptions + + wstring languageGuid = GUID2wstring(g_languageCLSID); + wstring vendorGuid = GUID2wstring(g_vendorCLSID); + + scope RegKey keyEE = new RegKey(keyRoot, registrationRoot ~ "\\AD7Metrics\\ExpressionEvaluator\\"w ~ languageGuid ~ "\\"w ~ vendorGuid); + keyEE.Set("Language"w, "D"w); + keyEE.Set("Name"w, "D"w); + + scope RegKey keyCV = new RegKey(keyRoot, registrationRoot ~ "\\Debugger\\CodeView Compilers\\68:*"w); + keyEE.Set("LanguageID"w, languageGuid); + keyEE.Set("VendorID"w, vendorGuid); + + return S_OK; +} + wstring GetDLLName(HINSTANCE inst) { //get dll path diff --git a/visuald/stringutil.d b/visuald/stringutil.d index d66cce01..ada21c43 100644 --- a/visuald/stringutil.d +++ b/visuald/stringutil.d @@ -160,23 +160,23 @@ S createPasteString(S)(S s) // special version of std.string.indexOf that considers '.', '/' and '\\' the same // character for case insensitive searches -ptrdiff_t indexOfPath(Char1, Char2)(const(Char1)[] s, const(Char2)[] sub, - std.string.CaseSensitive cs = std.string.CaseSensitive.yes) -{ - const(Char1)[] balance; - if (cs == std.string.CaseSensitive.yes) - { - balance = std.algorithm.find(s, sub); - } - else - { - static bool isSame(Char1, Char2)(Char1 c1, Char2 c2) - { - if (c1 == '.' || c1 == '/' || c1 == '\\') - return c2 == '.' || c2 == '/' || c2 == '\\'; - return std.uni.toLower(c1) == std.uni.toLower(c2); - } - balance = std.algorithm.find!((a, b) => isSame(a, b))(s, sub); - } - return balance.empty ? -1 : balance.ptr - s.ptr; -} +ptrdiff_t indexOfPath(Char1, Char2)(const(Char1)[] s, const(Char2)[] sub, + std.string.CaseSensitive cs = std.string.CaseSensitive.yes) +{ + const(Char1)[] balance; + if (cs == std.string.CaseSensitive.yes) + { + balance = std.algorithm.find(s, sub); + } + else + { + static bool isSame(Char1, Char2)(Char1 c1, Char2 c2) + { + if (c1 == '.' || c1 == '/' || c1 == '\\') + return c2 == '.' || c2 == '/' || c2 == '\\'; + return std.uni.toLower(c1) == std.uni.toLower(c2); + } + balance = std.algorithm.find!((a, b) => isSame(a, b))(s, sub); + } + return balance.empty ? -1 : balance.ptr - s.ptr; +} diff --git a/visuald/tokenreplace.d b/visuald/tokenreplace.d index 57b5c38a..8e703b13 100644 --- a/visuald/tokenreplace.d +++ b/visuald/tokenreplace.d @@ -14,7 +14,7 @@ // $_identNAME - any identifier (no keywords) // $_dotidentNAME - any identifier.identifier pair // $_exprNAME - any sequence of brace matched tokens terminated by closing bracket or ";" -// $_notNAME - any token not matching the following token +// $_notNAME - any token not matching the following token // $_optNAME - the following token or nothing // $NAME - any sequence of tokens greedily stopped by the following token // token$NAME - any token starting with "token" @@ -60,12 +60,12 @@ class Token enum BraceR = TOK_rcurly; enum BracketL = TOK_lbracket; enum BracketR = TOK_rbracket; - + static bool isPPToken(int) { return false; } bool isOpeningBracket() { return type == ParenL || type == BraceL || type == BracketL; } bool isClosingBracket() { return type == ParenR || type == BraceR || type == BracketR; } - + int type; bool replaced; int lineno, column; // token pos and end can be calculated from pretext/text @@ -373,7 +373,7 @@ static void scanAny(TL)(ref TL tokenList, _string text, int lineno = 1, int colu int state = 0; int prelineno = lineno; int precolumn = column; - + void appendToken(Token tok) { static if(is(TL == Token[])) @@ -383,7 +383,7 @@ static void scanAny(TL)(ref TL tokenList, _string text, int lineno = 1, int colu else tokenList.append(tok); } - + for(uint pos = 0; pos < text.length; ) { int tokid; @@ -391,7 +391,7 @@ static void scanAny(TL)(ref TL tokenList, _string text, int lineno = 1, int colu trLex.scan(state, text, pos, tokid); _string txt = text[prevpos .. pos]; - advanceTextPos(txt, lineno, column); + advanceTextPos(txt, lineno, column); if(tokid != TOK_Space && tokid != TOK_Comment) { @@ -445,7 +445,7 @@ int findSubmatch(ref SubMatch[] submatch, _string ident) } /////////////////////////////////////////////////////////////////////// -bool findTokenSequence(TokenIterator it, _string[] search, +bool findTokenSequence(TokenIterator it, _string[] search, bool checkBracketsSearch, bool checkBracketsMatch, bool caseSensitive, _string stopText, ref TokenRange match, ref SubMatch[] submatch) { @@ -471,7 +471,7 @@ bool findTokenSequence(TokenIterator it, _string[] search, return s1 == s2; return icmp(s1, s2) == 0; } - + bool compareTokens(TokenIterator start, TokenIterator end, ref TokenIterator it) { for(TokenIterator sit = start; !sit.atEnd() && sit != end; ++sit) @@ -503,7 +503,7 @@ bool findTokenSequence(TokenIterator it, _string[] search, int prevsubmatchLength = submatch.length; - while(!it.atEnd() && (stopText.length == 0 || !strEqual(it.text, stopText) + while(!it.atEnd() && (stopText.length == 0 || !strEqual(it.text, stopText) || strEqual(search[p], stopText))) { bool dollar = indexOf(search[p], '$') >= 0; @@ -548,7 +548,7 @@ bool findTokenSequence(TokenIterator it, _string[] search, break; TokenIterator start = mit; - while(!(mit + 1).atEnd() && !(mit + 2).atEnd() && + while(!(mit + 1).atEnd() && !(mit + 2).atEnd() && mit[1].type == Token.Dot && mit[2].type == Token.Identifier) { mit.advance(); @@ -599,7 +599,7 @@ bool findTokenSequence(TokenIterator it, _string[] search, else { TokenRange tailmatch; - if (!findTokenSequence(mit, search[i+1 .. $], + if (!findTokenSequence(mit, search[i+1 .. $], checkBracketsMatch, checkBracketsMatch, caseSensitive, stopText, tailmatch, submatch)) break; @@ -655,7 +655,7 @@ bool findTokenSequence(TokenIterator it, _string[] search, advanceToClosingBracket(it); else if(checkBracketsSearch && it.isClosingBracket()) break; - else + else it.advance(); } return false; @@ -709,7 +709,7 @@ TokenList createReplacementTokenList(RTYPE) (RTYPE[] replace, TokenRange match, } -int _replaceTokenSequence(RTYPE)(TokenList srctoken, _string[] search, RTYPE[] replace, +int _replaceTokenSequence(RTYPE)(TokenList srctoken, _string[] search, RTYPE[] replace, ref const ReplaceOptions opt, ReplaceRange[]* ranges) { if(search.length == 0) // do not replace an empty token list (everything?) @@ -755,13 +755,13 @@ int _replaceTokenSequence(RTYPE)(TokenList srctoken, _string[] search, RTYPE[] r TokenList tokenList = createReplacementTokenList(replace, match, submatch); markReplaceTokenList(tokenList); - + if(ranges) { rng.startlineno = match.start.lineno; rng.startcolumn = match.start.column; rng.replacementText = tokenListToString(tokenList); - + *ranges ~= rng; } @@ -790,7 +790,7 @@ int _replaceTokenSequence(RTYPE)(TokenList srctoken, _string[] search, RTYPE[] r return cntReplacements; } -int replaceTokenSequence(TokenList srctoken, _string[] search, _string[] replace, +int replaceTokenSequence(TokenList srctoken, _string[] search, _string[] replace, ref const ReplaceOptions opt, ReplaceRange[]* ranges) { return _replaceTokenSequence(srctoken, search, replace, opt, ranges); @@ -807,11 +807,11 @@ int replaceTokenSequence(TokenList srctoken, _string search, _string replace, return _replaceTokenSequence(srctoken, searchTokens, replaceTokens, opt, ranges); } -_string replaceTokenSequence(_string srctext, int srclineno, int srccolumn, _string search, _string replace, +_string replaceTokenSequence(_string srctext, int srclineno, int srccolumn, _string search, _string replace, ref const ReplaceOptions opt, ReplaceRange[]* ranges) { TokenList tokens = scanText(srctext, srclineno, srccolumn); - + int cnt = replaceTokenSequence(tokens, search, replace, opt, ranges); if(cnt == 0) return srctext; @@ -821,37 +821,37 @@ _string replaceTokenSequence(_string srctext, int srclineno, int srccolumn, _str unittest { - _string txt = - "unittest {\n" - " if (list_freelist) {\n" - " list--;\n" - " }\n" - "}\n" + _string txt = + "unittest {\n" + ~ " if (list_freelist) {\n" + ~ " list--;\n" + ~ " }\n" + ~ "}\n" ; - + ReplaceOptions opt; ReplaceRange[] rng1; _string res1 = replaceTokenSequence(txt, 1, 0, "if($1) { $2 }", "$2", opt, &rng1); - _string exp1 = - "unittest {\n" - " \n" - " list--;\n" - "}\n" + _string exp1 = + "unittest {\n" + ~ " \n" + ~ " list--;\n" + ~ "}\n" ; assert(res1 == exp1); assert(rng1.length == 1); assert(rng1[0].startlineno == 2 && rng1[0].startcolumn == 2); assert(rng1[0].endlineno == 4 && rng1[0].endcolumn == 3); - + opt.includePretext = true; ReplaceRange[] rng2; _string res2 = replaceTokenSequence(txt, 1, 0, "if($1) { $2 }", "$2", opt, &rng2); - _string exp2 = - "unittest {\n" - " list--;\n" - "}\n" + _string exp2 = + "unittest {\n" + ~ " list--;\n" + ~ "}\n" ; assert(res2 == exp2); assert(rng2.length == 1); diff --git a/visuald/vdextensions.d b/visuald/vdextensions.d index 859979cc..a7d19aad 100644 --- a/visuald/vdextensions.d +++ b/visuald/vdextensions.d @@ -1,36 +1,126 @@ -module visuald.vdextensions; - -import sdk.port.base; -import sdk.win32.oaidl; -import sdk.win32.objbase; -import sdk.win32.oleauto; -import sdk.win32.wtypes; - -import sdk.vsi.textmgr; -import sdk.vsi.vsshell; - -import visuald.hierutil; -import visuald.dpackage; - -__gshared IVisualDHelper vdhelper; - -interface IVisualDHelper : IUnknown -{ - static const GUID iid = uuid("002a2de9-8bb6-484d-9910-7e4ad4084715"); - - int GetTextOptions(IVsTextView view, int* flags, int* tabsize, int* indentsize); -} - -IVisualDHelper createHelper() -{ - if (!vdhelper) - vdhelper = VsLocalCreateInstance!IVisualDHelper (&g_VisualDHelperCLSID, CLSCTX_INPROC_SERVER); - return vdhelper; -} - -int vdhelper_GetTextOptions(IVsTextView view, int* flags, int* tabsize, int* indentsize) -{ - if (!createHelper()) - return S_FALSE; - return vdhelper.GetTextOptions(view, flags, tabsize, indentsize); -} +module visuald.vdextensions; + +import sdk.port.base; +import sdk.win32.oaidl; +import sdk.win32.objbase; +import sdk.win32.oleauto; +import sdk.win32.wtypes; + +import sdk.vsi.textmgr; +import sdk.vsi.vsshell; + +import stdext.com; + +import visuald.hierutil; +import visuald.dpackage; +import visuald.config; + +__gshared IVisualDHelper vdhelper; +__gshared IVisualCHelper vchelper; + +interface IVisualDHelper : IUnknown +{ + static const GUID iid = uuid("002a2de9-8bb6-484d-9910-7e4ad4084715"); + + int GetTextOptions(IVsTextView view, int* flags, int* tabsize, int* indentsize); +} + +IVisualDHelper createDHelper() +{ + if (!vdhelper) + vdhelper = VsLocalCreateInstance!IVisualDHelper (&g_VisualDHelperCLSID, CLSCTX_INPROC_SERVER); + return vdhelper; +} + +interface IVisualCHelper : IUnknown +{ + static const GUID iid = uuid("002a2de9-8bb6-484d-9911-7e4ad4084715"); + + int GetDCompileOptions(IVsHierarchy proj, VSITEMID itemid, BSTR* impPath, BSTR* stringImpPath, + BSTR* versionids, BSTR* debugids, ref uint flags); + int GetDCommandLine(IVsHierarchy proj, uint itemid, BSTR* cmdline); +} + +IVisualCHelper createCHelper() +{ + if (!vchelper) + vchelper = VsLocalCreateInstance!IVisualCHelper (&g_VisualCHelperCLSID, CLSCTX_INPROC_SERVER); + return vchelper; +} + +int vdhelper_GetTextOptions(IVsTextView view, int* flags, int* tabsize, int* indentsize) +{ + try + { + if (!createDHelper()) + return S_FALSE; + return vdhelper.GetTextOptions(view, flags, tabsize, indentsize); + } + catch(Throwable) + { + return E_FAIL; + } +} + +int vdhelper_GetDCompileOptions(IVsHierarchy proj, VSITEMID itemid, ProjectOptions opt) +{ + try + { + if (!createCHelper()) + return S_FALSE; + + BSTR versionids; + BSTR debugids; + BSTR impPath; + BSTR stringImpPath; + uint flags; // see ConfigureFlags!() + + int rc = vchelper.GetDCompileOptions(proj, itemid, &impPath, &stringImpPath, &versionids, &debugids, flags); + if (rc != S_OK) + return rc; + + opt.versionids = detachBSTR(versionids); + opt.debugids = detachBSTR(debugids); + opt.imppath = detachBSTR(impPath); + opt.fileImppath = detachBSTR(stringImpPath); + + opt.useUnitTests = (flags & 1) != 0; + opt.release = (flags & 2) == 0; + opt.isX86_64 = (flags & 4) != 0; + opt.cov = (flags & 8) != 0; + opt.doDocComments = (flags & 16) != 0; + opt.noboundscheck = (flags & 32) != 0; + opt.errDeprecated = (flags & 128) != 0; + opt.compiler = (flags & 0x4_00_00_00) != 0 ? Compiler.LDC : (flags & 64) != 0 ? Compiler.GDC : Compiler.DMD; + opt.versionlevel = (flags >> 8) & 0xff; + opt.debuglevel = (flags >> 16) & 0xff; + opt.mscoff = true; + + return S_OK; + } + catch(Throwable) + { + return E_FAIL; + } +} + +int vdhelper_GetDCommandLine(IVsHierarchy proj, VSITEMID itemid, out string cmd) +{ + try + { + if (!createCHelper()) + return S_FALSE; + + BSTR cmdline; + int rc = vchelper.GetDCommandLine(proj, itemid, &cmdline); + if (rc != S_OK) + return rc; + + cmd = detachBSTR(cmdline); + return S_OK; + } + catch(Throwable) + { + return E_FAIL; + } +} diff --git a/visuald/vdserverclient.d b/visuald/vdserverclient.d index 413262b4..9f33cda8 100644 --- a/visuald/vdserverclient.d +++ b/visuald/vdserverclient.d @@ -27,6 +27,7 @@ import stdext.container; import stdext.string; import std.concurrency; +import std.datetime; import std.string; import std.conv; import std.path; @@ -49,18 +50,18 @@ import std.datetime; import core.stdc.stdio : fprintf, fopen, fflush, fputc, FILE; __gshared FILE* dbgfh; -private void dbglog(string s) +private void dbglog(string s) { debug { - version(all) - logCall("VDClient: ", s); + version(all) + logCall("VDClient: %s", s); else OutputDebugStringA(toMBSz("VDClient: " ~ s ~ "\n")); } else { - if(!dbgfh) + if(!dbgfh) dbgfh = fopen("c:/tmp/vdclient.log", "w"); SysTime now = Clock.currTime(); uint tid = sdk.win32.winbase.GetCurrentThreadId(); @@ -94,7 +95,7 @@ bool startVDServer() CoInitialize(null); - version(InProc) + version(InProc) gVDServer = addref(newCom!VDServer); else { @@ -230,7 +231,7 @@ class FileCommand : Command class ConfigureProjectCommand : FileCommand { - this(string filename, immutable(string[]) imp, immutable(string[]) stringImp, + this(string filename, immutable(string[]) imp, immutable(string[]) stringImp, immutable(string[]) versionids, immutable(string[]) debugids, uint flags) { super("ConfigureProject", filename); @@ -264,7 +265,7 @@ class ConfigureProjectCommand : FileCommand freeBSTR(bstringImp); freeBSTR(bversionids); freeBSTR(bdebugids); - + return hr; } @@ -284,7 +285,7 @@ class GetTipCommand : FileCommand this(string filename, sdk.vsi.sdk_shared.TextSpan span, GetTipCallBack cb) { super("GetTip", filename); - version(DebugCmd) mCommand ~= " {" ~ to!string(span.iStartLine) ~ "," ~ to!string(span.iStartIndex) + version(DebugCmd) mCommand ~= " {" ~ to!string(span.iStartLine) ~ "," ~ to!string(span.iStartIndex) ~ " - " ~ to!string(span.iEndLine) ~ "," ~ to!string(span.iEndIndex) ~ "}"; mSpan = span; mCallback = cb; @@ -319,6 +320,11 @@ class GetTipCommand : FileCommand mType = detachBSTR(btype); mSpan = sdk.vsi.sdk_shared.TextSpan(iStartIndex, iStartLine - 1, iEndIndex, iEndLine - 1); + if (mType == "__pending__") + return E_PENDING; + if (mType == "__cancelled__") + return ERROR_CANCELLED; + send(gUITid); return S_OK; } @@ -344,7 +350,7 @@ class GetDefinitionCommand : FileCommand this(string filename, sdk.vsi.sdk_shared.TextSpan span, GetDefinitionCallBack cb) { super("GetDefinition", filename); - version(DebugCmd) mCommand ~= " {" ~ to!string(span.iStartLine) ~ "," ~ to!string(span.iStartIndex) + version(DebugCmd) mCommand ~= " {" ~ to!string(span.iStartLine) ~ "," ~ to!string(span.iStartIndex) ~ " - " ~ to!string(span.iEndLine) ~ "," ~ to!string(span.iEndIndex) ~ "}"; mSpan = span; mCallback = cb; @@ -379,6 +385,11 @@ class GetDefinitionCommand : FileCommand mDefFile = detachBSTR(fname); mSpan = sdk.vsi.sdk_shared.TextSpan(iStartIndex, iStartLine - 1, iEndIndex, iEndLine - 1); + if (mDefFile == "__pending__") + return E_PENDING; + if (mDefFile == "__cancelled__") + return ERROR_CANCELLED; + send(gUITid); return S_OK; } @@ -445,7 +456,7 @@ class UpdateModuleCommand : FileCommand LONG lbound, ubound; SafeArrayGetLBound(sa, 1, &lbound); SafeArrayGetUBound(sa, 1, &ubound); - + size_t cnt = (ubound - lbound + 1) / 2; mBinaryIsIn.length = cnt; for(size_t i = 0; i < cnt; i++) @@ -520,6 +531,12 @@ class GetExpansionsCommand : FileCommand return rc; string slist = detachBSTR(stringList); + if (slist == "__pending__") + return E_PENDING; + if (slist == "__cancelled__") + return ERROR_CANCELLED; + + mExpansions = /*cast(shared(string[]))*/ splitLines(slist); send(gUITid); return S_OK; @@ -578,6 +595,11 @@ class GetReferencesCommand : FileCommand return rc; string slist = detachBSTR(stringList); + if (slist == "__pending__") + return E_PENDING; + if (slist == "__cancelled__") + return ERROR_CANCELLED; + mReferences = /*cast(shared(string[]))*/ splitLines(slist); send(gUITid); return S_OK; @@ -627,7 +649,7 @@ class VDServerClient this() { } - + ~this() { shutDown(); @@ -653,7 +675,7 @@ class VDServerClient } ////////////////////////////////////// - uint ConfigureSemanticProject(string filename, immutable(string[]) imp, immutable(string[]) stringImp, + uint ConfigureSemanticProject(string filename, immutable(string[]) imp, immutable(string[]) stringImp, immutable(string[]) versionids, immutable(string[]) debugids, uint flags) { auto cmd = new _shared!(ConfigureProjectCommand)(filename, imp, stringImp, versionids, debugids, flags); @@ -747,6 +769,9 @@ class VDServerClient try { + SysTime lastAnswerTime = Clock.currTime(); + bool pendingMessageSent = false; + Queue!(_shared!(Command)) toAnswer; while(gVDServer) { @@ -774,11 +799,14 @@ class VDServerClient { auto cmd = toAnswer[i]; HRESULT hr = cmd.answer(); - if(hr == S_OK) + if(hr == S_OK || hr == ERROR_CANCELLED) { toAnswer.remove(i); changed = true; + lastAnswerTime = Clock.currTime(); } + else if (hr == E_PENDING) + break; else if((hr & 0xffff) == RPC_S_SERVER_UNAVAILABLE) restartServer = true; else @@ -793,7 +821,21 @@ class VDServerClient { string m = detachBSTR(msg); if(m != "__no_message__") + { (new _shared!(GetMessageCommand)(m)).send(gUITid); + pendingMessageSent = false; + } + else if (toAnswer.length > 0 && lastAnswerTime + 2.seconds < Clock.currTime()) + { + (new _shared!(GetMessageCommand)("Pending semantic analysis request...")).send(gUITid); + lastAnswerTime = Clock.currTime(); + pendingMessageSent = true; + } + else if (toAnswer.length == 0 && pendingMessageSent) + { + (new _shared!(GetMessageCommand)("")).send(gUITid); + pendingMessageSent = false; + } } else if((hr & 0xffff) == RPC_S_SERVER_UNAVAILABLE) restartServer = true; @@ -831,7 +873,7 @@ class VDServerClient (size_t icmd) { auto cmd = cast(Command) cast(void*) icmd; - version(DebugCmd) + version(DebugCmd) if(cmd.mCommand != "GetMessage") dbglog(to!string(cmd.mRequest) ~ " " ~ "idleLoop: " ~ cmd.mCommand); cmd.forward(); diff --git a/visuald/viewfilter.d b/visuald/viewfilter.d index 2fbf006c..80553659 100644 --- a/visuald/viewfilter.d +++ b/visuald/viewfilter.d @@ -39,6 +39,7 @@ import vdc.lexer; import sdk.port.vsi; import sdk.vsi.textmgr; import sdk.vsi.textmgr2; +import sdk.vsi.textmgr120; import sdk.vsi.stdidcmd; import sdk.vsi.vsshell; import sdk.vsi.vsshell80; @@ -46,7 +47,7 @@ import sdk.vsi.vsshell90; import sdk.vsi.vsdbgcmd; import sdk.vsi.vsdebugguids; import sdk.vsi.msdbg; -import sdk.win32.wtypes; +import sdk.win32.wtypes; import stdext.array; import stdext.path; @@ -84,6 +85,8 @@ class ViewFilter : DisposingComObject, IVsTextViewFilter, IOleCommandTarget, int mLastHighlightBracesLine; ViewCol mLastHighlightBracesCol; + static const GUID iid = { 0xd143496a, 0xc795, 0x428d, [ 0x8c, 0xfe, 0x96, 0x88, 0xcf, 0x19, 0x5e, 0x3f ] }; + version(tip) TextTipData mTextTipData; @@ -172,6 +175,8 @@ version(tip) override HRESULT QueryInterface(in IID* riid, void** pvObject) { + if(queryInterface!(ViewFilter) (this, riid, pvObject)) + return S_OK; if(queryInterface!(IVsTextViewFilter) (this, riid, pvObject)) return S_OK; if(queryInterface!(IVsTextViewEvents) (this, riid, pvObject)) @@ -432,7 +437,10 @@ version(tip) { case ECMD_RETURN: if(!wasCompletorActive) + { + HandleBraceCompletion('\n'); HandleSmartIndent('\n'); + } break; case ECMD_LEFT: @@ -466,6 +474,10 @@ version(tip) stopCompletions(); } + if(ch == '{' || ch == '}' || ch == '[' || ch == ']' || ch == '(' || ch == ')' || + ch == '"' || ch == '`' || ch == '\'') + HandleBraceCompletion(ch); + if(ch == '{' || ch == '}' || ch == '[' || ch == ']' || ch == 'n' || ch == 't' || ch == 'y') // last characters of "in", "out" and "body" HandleSmartIndent(ch); @@ -477,7 +489,7 @@ version(tip) } else if(ch == '(') { - LANGPREFERENCES langPrefs; + LANGPREFERENCES3 langPrefs; if(GetUserPreferences(&langPrefs, null) == S_OK && langPrefs.fAutoListParams) _HandleMethodTip(false); } @@ -506,51 +518,37 @@ version(tip) wchar* wfname = _toUTF16z(fname); string addopt; - Config cfg; - CFileNode pFile; - - IVsUIHierarchy pUIH; - uint itemid; - IServiceProvider pSP; - VSDOCINPROJECT docInProj; - if(pIVsUIShellOpenDocument.IsDocumentInAProject(wfname, &pUIH, &itemid, &pSP, &docInProj) != S_OK) - return S_OK; - - scope(exit) release(pSP); - scope(exit) release(pUIH); - - if(!pUIH) - return returnError(E_FAIL); - Project proj = qi_cast!Project(pUIH); - scope(exit) release(proj); + Config cfg = getProjectConfig(fname, true); + scope(exit) release(cfg); // must not dispose because we need the builder + CFileNode pFile; BSTR bstrSelText; string selText; if(mView.GetSelectedText(&bstrSelText) == S_OK && !disasm) selText = detachBSTR(bstrSelText); - if(!proj) + if(cfg) + { + string docName = toLower(fname); + CHierNode node = searchNode(cfg.GetProject().GetRootNode(), delegate (CHierNode n) { return n.GetCanonicalName() == docName; }); + pFile = cast(CFileNode) node; + assert(pFile); + } + else { // not in Visual D project, but in workspace project - ProjectFactory factory = newCom!ProjectFactory(Package.s_instance); + string platform, config = GetActiveSolutionConfig(&platform); + if (config.empty) + platform = "Win32", config = "Debug"; + string filename = normalizeDir(tempDir()) ~ "__compile__.vdproj"; + cfg = newCom!VCConfig(filename, "__compile__", platform, config).addref(); + cfg.GetProjectOptions().outdir = normalizeDir(tempDir()) ~ "__vdcompile"; + cfg.GetProjectOptions().release = false; - proj = newCom!Project(factory, "__compile__", filename, "Debug", "Win32").addref(); + Project prj = newCom!Project(Package.GetProjectFactory(), "__compile__", filename, platform, config); pFile = newCom!CFileNode(fname); - proj.GetProjectNode().Add(pFile); - - IVsCfgProvider pCfgProvider; - IVsCfg icfg; - scope(exit) release(pCfgProvider); - scope(exit) release(icfg); - if(proj.GetCfgProvider(&pCfgProvider) == S_OK) - if(pCfgProvider.GetCfgs(1, &icfg, null, null) == S_OK) - cfg = qi_cast!Config(icfg); - if(cfg) - { - cfg.GetProjectOptions().outdir = normalizeDir(tempDir()) ~ "__vdcompile"; - cfg.GetProjectOptions().release = false; - } + prj.GetRootNode().AddTail(pFile); string modname = getModuleDeclarationName(fname); if(modname.length) @@ -563,42 +561,19 @@ version(tip) addopt ~= " -I" ~ normalizeDir(dirName(fname)) ~ ipath[1..$]; } } - else - { - CHierNode pNode = proj.VSITEMID2Node(itemid); - if(!pNode) - return returnError(E_INVALIDARG); - pFile = cast(CFileNode) pNode; - if(!pFile) - return S_OK; - auto solutionBuildManager = queryService!(IVsSolutionBuildManager)(); - scope(exit) release(solutionBuildManager); - IVsProjectCfg activeCfg; - scope(exit) release(activeCfg); - - if(solutionBuildManager) - if(solutionBuildManager.FindActiveProjectCfg(null, null, proj, &activeCfg) == S_OK) - cfg = qi_cast!Config(activeCfg); - } - if(!cfg || !pFile) - return S_OK; - - if(pFile.SaveDoc(SLNSAVEOPT_SaveIfDirty) != S_OK) + if(!pFile || saveTextBuffer(fname) != S_OK) return returnError(E_FAIL); mCodeWinMgr.mSource.OnBufferSave(null); // save current modification position auto symdebug = cfg.GetProjectOptions().symdebug; - scope(exit) - { - cfg.GetProjectOptions().symdebug = symdebug; - release(cfg); - } + scope(exit) cfg.GetProjectOptions().symdebug = symdebug; + if (disasm && symdebug == 0) // ensure debug info is enabled cfg.GetProjectOptions().symdebug = 3; - string stool = cfg.GetStaticCompileTool(pFile, cfg.getCfgName()); + string stool = pFile ? cfg.GetStaticCompileTool(pFile, cfg.getCfgName()) : "DMDsingle"; if(stool == "DMD") stool = "DMDsingle"; if(stool == "DMDsingle" && rdmd) @@ -654,7 +629,10 @@ version(tip) clearOutputPane(); if(pane) pane.Activate(); - HRESULT hr = RunCustomBuildBatchFile(outfile, cmdfile, cmd, pane, cfg.getBuilder()); + + auto builder = new CBuilderThread(cfg); + HRESULT hr = RunCustomBuildBatchFile(outfile, cmdfile, cmd, pane, builder); + builder.Dispose(); if(run) Package.GetGlobalOptions().addExecutionPath(workdir, null); @@ -1110,7 +1088,7 @@ version(tip) ////////////////////////////////////////////////////////////// int HandleSmartIndent(dchar ch) { - LANGPREFERENCES langPrefs; + LANGPREFERENCES3 langPrefs; if(int rc = GetUserPreferences(&langPrefs, mView)) return rc; if(langPrefs.IndentStyle != vsIndentStyleSmart) @@ -1180,6 +1158,30 @@ version(tip) return S_OK; } + ////////////////////////////////////////////////////////////// + int HandleBraceCompletion(dchar ch) + { + // character ch already inserted, caret placed right after it + LANGPREFERENCES3 langPrefs; + if(int rc = GetUserPreferences(&langPrefs, mView)) + return rc; + if(!langPrefs.fBraceCompletion) + return S_FALSE; + + int line, idx; + if(int rc = mView.GetCaretPos(&line, &idx)) + return rc; + + if(int rc = mCodeWinMgr.mSource.AutoCompleteBrace(line, idx, ch, langPrefs)) + return rc; + + // restore caret position, it has been moved by the insertion + if(int rc = mView.SetCaretPos(line, idx)) + return rc; + + return S_OK; + } + ////////////////////////////////////////////////////////////// int CommentLines(int commentMode) { diff --git a/visuald/visuald.rc b/visuald/visuald.rc index 34e99d34..40850808 100644 --- a/visuald/visuald.rc +++ b/visuald/visuald.rc @@ -99,7 +99,7 @@ BMP_COMPLETION BITMAP "resources/completionset.bmp" #define VER_FILEVERSION_STR _str(VERSION_MAJOR.VERSION_MINOR.VERSION_REVISION) VERSION_POSTFIX #define VER_PRODUCTVERSION VER_FILEVERSION #define VER_PRODUCTVERSION_STR VER_FILEVERSION_STR -#define VER_LEGALCOPYRIGHT_STR "(c) 2010-2012 Rainer Schuetze" +#define VER_LEGALCOPYRIGHT_STR "(c) 2010-2017 Rainer Schuetze" #define VER_FILEDESCRIPTION_STR "Visual D Package\0" #define VER_PRODUCTNAME_STR "Visual D\0" diff --git a/visuald/visuald.visualdproj b/visuald/visuald.visualdproj index ddbe88d6..a6819296 100644 --- a/visuald/visuald.visualdproj +++ b/visuald/visuald.visualdproj @@ -183,7 +183,7 @@ 0 - 1 + 2 $(VisualDInstallDir)\cv2pdb\cv2pdb.exe 0 0 @@ -403,7 +403,7 @@ 1 1 0 - -L/DLL -L/DEF:visuald.def -L"$(OutDir)\visuald.res" + *.obj @@ -411,12 +411,12 @@ 0 0 - 0 + 2 0 0 0 0 - 0 + 1 0 0 0 @@ -482,7 +482,7 @@ 0 0 - 3 + 0 0 @@ -498,14 +498,14 @@ uuid.lib advapi32.lib comdlg32.lib ole32.lib oleaut32.lib comctl32.lib shell32.lib gdi32.lib winmm.lib - ..\sdk\lib + - $(OutDir)\..\Debug\$(ProjectName).dll + $(OutDir)\$(ProjectName).dll 1 1 0 - -debuglib=phobos_d,druntime_d -m32ms -L/DLL -L/FORCE:UNRESOLVED + *.obj @@ -584,7 +584,7 @@ 0 0 - 0 + 3 0 @@ -607,7 +607,109 @@ 1 2 0 - -L/DLL -L/DEF:visuald.def -L"$(OutDir)\visuald.res" + + + + *.obj + + + 0 + 0 + 2 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 2 + 0 + 0 + 0 + 0 + 0 + $(CC) -c + 1 + m:\s\d\rainers\windows\bin\dmd_msc.exe + .. + ..;resources + ..\bin\$(ConfigurationName) + $(OutDir)\obj + + + 1 + $(IntDir)\doc + + + + 0 + + + 1 + $(IntDir)\$(ProjectName).json + 0 + + 0 + + 0 + 3 + 0 + + + + 0 + + 0 + $(VisualDInstallDir)\cv2pdb\cv2pdb.exe + 0 + 0 + 0 + + + + uuid.lib advapi32.lib comdlg32.lib ole32.lib oleaut32.lib comctl32.lib shell32.lib gdi32.lib winmm.lib + + + + $(OutDir)\$(ProjectName).dll + 1 + 1 + 0 + -L/OPT:ICF -L/OPT:REF *.obj @@ -643,11 +745,13 @@ + + - +:reportError" tool="Custom" outfile="$(InputDir)\$(InputName).cto" /> @@ -669,9 +773,9 @@ echo It is part of the VS2010-VS2013 SDK and is needed to compile $(InputPath) - +rc /fo"$(OutDir)\visuald.res" $(InputPath)" tool="Custom" dependencies="resources\pkgcmd.cto;resources\daboutlogo.ico;..\version;resources\dimagelist.bmp" linkoutput="true" outfile="$(OutDir)\visuald.res" /> @@ -689,36 +793,36 @@ rc /fo"$(OutDir)\visuald.res" $(InputPath)" outfile="$(OutDir)\visuald - - + + - + - + - - + + - + - + diff --git a/visuald/windows.d b/visuald/windows.d index d2c95e30..9bfd8bf3 100644 --- a/visuald/windows.d +++ b/visuald/windows.d @@ -10,6 +10,9 @@ module visuald.windows; import sdk.win32.commctrl; +pragma(lib,"ole32.lib"); +pragma(lib,"comctl32.lib"); + HRESULT HResultFromLastError() { return HRESULT_FROM_WIN32(GetLastError()); diff --git a/visuald/wmmsg.d b/visuald/wmmsg.d index fd1e0d47..50fd5313 100644 --- a/visuald/wmmsg.d +++ b/visuald/wmmsg.d @@ -249,9 +249,12 @@ string msg_toString(uint msg) void logMessage(string prefix, HWND hWnd, uint uMsg, WPARAM wParam, LPARAM lParam) { - string msg = msg_toString(uMsg); - if(msg.length == 0) - msg = tryformat("%x", uMsg); - - logCall("%s(hwnd=%x, msg=%s, wp=%x, lp=%x)", prefix, hWnd, msg, wParam, lParam); + debug + { + string msg = msg_toString(uMsg); + if(msg.length == 0) + msg = tryformat("%x", uMsg); + + logCall("%s(hwnd=%x, msg=%s, wp=%x, lp=%x)", prefix, hWnd, msg, wParam, lParam); + } } diff --git a/visuald_vs10.sln b/visuald_vs10.sln index c99bb276..9c1a0793 100644 --- a/visuald_vs10.sln +++ b/visuald_vs10.sln @@ -5,6 +5,7 @@ VisualStudioVersion = 12.0.31101.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{2BD51E62-6604-48AE-9E01-C940C0CA1C68}" ProjectSection(SolutionItems) = preProject + appveyor.yml = appveyor.yml CHANGES = CHANGES LICENSE_1_0.txt = LICENSE_1_0.txt Makefile = Makefile @@ -122,14 +123,25 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Default", "Default", "{AB49 msbuild\ImportBefore\Default\d.props = msbuild\ImportBefore\Default\d.props EndProjectSection EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Extensions", "Extensions", "{7F391DE3-9620-4A98-B05D-4181924A9D15}" + ProjectSection(SolutionItems) = preProject + nsis\Extensions\extension.vsixmanifest = nsis\Extensions\extension.vsixmanifest + nsis\Extensions\vdlogo.ico = nsis\Extensions\vdlogo.ico + nsis\Extensions\visuald.pkgdef = nsis\Extensions\visuald.pkgdef + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug COFF32|Win32 = Debug COFF32|Win32 + Debug COFF32|x64 = Debug COFF32|x64 Debug GDC|Win32 = Debug GDC|Win32 Debug GDC|x64 = Debug GDC|x64 Debug LDC|Win32 = Debug LDC|Win32 Debug LDC|x64 = Debug LDC|x64 Debug|Win32 = Debug|Win32 Debug|x64 = Debug|x64 + Release COFF32|Win32 = Release COFF32|Win32 + Release COFF32|x64 = Release COFF32|x64 Release LDC|Win32 = Release LDC|Win32 Release LDC|x64 = Release LDC|x64 Release|Win32 = Release|Win32 @@ -140,6 +152,9 @@ Global TestDebug|x64 = TestDebug|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution + {7610F45A-69D9-4B68-BE63-0E055B51D447}.Debug COFF32|Win32.ActiveCfg = Debug COFF32|Win32 + {7610F45A-69D9-4B68-BE63-0E055B51D447}.Debug COFF32|Win32.Build.0 = Debug COFF32|Win32 + {7610F45A-69D9-4B68-BE63-0E055B51D447}.Debug COFF32|x64.ActiveCfg = Debug|Win32 {7610F45A-69D9-4B68-BE63-0E055B51D447}.Debug GDC|Win32.ActiveCfg = Debug|Win32 {7610F45A-69D9-4B68-BE63-0E055B51D447}.Debug GDC|Win32.Build.0 = Debug|Win32 {7610F45A-69D9-4B68-BE63-0E055B51D447}.Debug GDC|x64.ActiveCfg = Debug|Win32 @@ -149,6 +164,9 @@ Global {7610F45A-69D9-4B68-BE63-0E055B51D447}.Debug|Win32.ActiveCfg = Debug|Win32 {7610F45A-69D9-4B68-BE63-0E055B51D447}.Debug|Win32.Build.0 = Debug|Win32 {7610F45A-69D9-4B68-BE63-0E055B51D447}.Debug|x64.ActiveCfg = Debug|Win32 + {7610F45A-69D9-4B68-BE63-0E055B51D447}.Release COFF32|Win32.ActiveCfg = Release COFF32|Win32 + {7610F45A-69D9-4B68-BE63-0E055B51D447}.Release COFF32|Win32.Build.0 = Release COFF32|Win32 + {7610F45A-69D9-4B68-BE63-0E055B51D447}.Release COFF32|x64.ActiveCfg = Release COFF32|Win32 {7610F45A-69D9-4B68-BE63-0E055B51D447}.Release LDC|Win32.ActiveCfg = Release LDC|Win32 {7610F45A-69D9-4B68-BE63-0E055B51D447}.Release LDC|Win32.Build.0 = Release LDC|Win32 {7610F45A-69D9-4B68-BE63-0E055B51D447}.Release LDC|x64.ActiveCfg = Release LDC|Win32 @@ -159,6 +177,10 @@ Global {7610F45A-69D9-4B68-BE63-0E055B51D447}.Test|x64.ActiveCfg = Release|Win32 {7610F45A-69D9-4B68-BE63-0E055B51D447}.TestDebug|Win32.ActiveCfg = Debug|Win32 {7610F45A-69D9-4B68-BE63-0E055B51D447}.TestDebug|x64.ActiveCfg = Debug|Win32 + {32872753-4812-40DA-9B24-1C2114621E78}.Debug COFF32|Win32.ActiveCfg = Debug COFF32|Win32 + {32872753-4812-40DA-9B24-1C2114621E78}.Debug COFF32|Win32.Build.0 = Debug COFF32|Win32 + {32872753-4812-40DA-9B24-1C2114621E78}.Debug COFF32|x64.ActiveCfg = Debug|x64 + {32872753-4812-40DA-9B24-1C2114621E78}.Debug COFF32|x64.Build.0 = Debug|x64 {32872753-4812-40DA-9B24-1C2114621E78}.Debug GDC|Win32.ActiveCfg = Debug GDC|Win32 {32872753-4812-40DA-9B24-1C2114621E78}.Debug GDC|Win32.Build.0 = Debug GDC|Win32 {32872753-4812-40DA-9B24-1C2114621E78}.Debug GDC|x64.ActiveCfg = Debug GDC|x64 @@ -171,6 +193,10 @@ Global {32872753-4812-40DA-9B24-1C2114621E78}.Debug|Win32.Build.0 = Debug|Win32 {32872753-4812-40DA-9B24-1C2114621E78}.Debug|x64.ActiveCfg = Debug|x64 {32872753-4812-40DA-9B24-1C2114621E78}.Debug|x64.Build.0 = Debug|x64 + {32872753-4812-40DA-9B24-1C2114621E78}.Release COFF32|Win32.ActiveCfg = Release COFF32|Win32 + {32872753-4812-40DA-9B24-1C2114621E78}.Release COFF32|Win32.Build.0 = Release COFF32|Win32 + {32872753-4812-40DA-9B24-1C2114621E78}.Release COFF32|x64.ActiveCfg = Release COFF32|x64 + {32872753-4812-40DA-9B24-1C2114621E78}.Release COFF32|x64.Build.0 = Release COFF32|x64 {32872753-4812-40DA-9B24-1C2114621E78}.Release LDC|Win32.ActiveCfg = Release LDC|Win32 {32872753-4812-40DA-9B24-1C2114621E78}.Release LDC|Win32.Build.0 = Release LDC|Win32 {32872753-4812-40DA-9B24-1C2114621E78}.Release LDC|x64.ActiveCfg = Release LDC|x64 @@ -187,6 +213,10 @@ Global {32872753-4812-40DA-9B24-1C2114621E78}.TestDebug|Win32.Build.0 = Debug|Win32 {32872753-4812-40DA-9B24-1C2114621E78}.TestDebug|x64.ActiveCfg = Debug|x64 {32872753-4812-40DA-9B24-1C2114621E78}.TestDebug|x64.Build.0 = Debug|x64 + {8760F45A-69D9-4B68-BE63-0E055B51D447}.Debug COFF32|Win32.ActiveCfg = Debug COFF32|Win32 + {8760F45A-69D9-4B68-BE63-0E055B51D447}.Debug COFF32|Win32.Build.0 = Debug COFF32|Win32 + {8760F45A-69D9-4B68-BE63-0E055B51D447}.Debug COFF32|x64.ActiveCfg = Debug|x64 + {8760F45A-69D9-4B68-BE63-0E055B51D447}.Debug COFF32|x64.Build.0 = Debug|x64 {8760F45A-69D9-4B68-BE63-0E055B51D447}.Debug GDC|Win32.ActiveCfg = Debug GDC|Win32 {8760F45A-69D9-4B68-BE63-0E055B51D447}.Debug GDC|Win32.Build.0 = Debug GDC|Win32 {8760F45A-69D9-4B68-BE63-0E055B51D447}.Debug GDC|x64.ActiveCfg = Debug GDC|x64 @@ -199,6 +229,10 @@ Global {8760F45A-69D9-4B68-BE63-0E055B51D447}.Debug|Win32.Build.0 = Debug|Win32 {8760F45A-69D9-4B68-BE63-0E055B51D447}.Debug|x64.ActiveCfg = Debug|x64 {8760F45A-69D9-4B68-BE63-0E055B51D447}.Debug|x64.Build.0 = Debug|x64 + {8760F45A-69D9-4B68-BE63-0E055B51D447}.Release COFF32|Win32.ActiveCfg = Release COFF32|Win32 + {8760F45A-69D9-4B68-BE63-0E055B51D447}.Release COFF32|Win32.Build.0 = Release COFF32|Win32 + {8760F45A-69D9-4B68-BE63-0E055B51D447}.Release COFF32|x64.ActiveCfg = Release COFF32|x64 + {8760F45A-69D9-4B68-BE63-0E055B51D447}.Release COFF32|x64.Build.0 = Release COFF32|x64 {8760F45A-69D9-4B68-BE63-0E055B51D447}.Release LDC|Win32.ActiveCfg = Release LDC|Win32 {8760F45A-69D9-4B68-BE63-0E055B51D447}.Release LDC|Win32.Build.0 = Release LDC|Win32 {8760F45A-69D9-4B68-BE63-0E055B51D447}.Release LDC|x64.ActiveCfg = Release LDC|x64 @@ -213,6 +247,10 @@ Global {8760F45A-69D9-4B68-BE63-0E055B51D447}.TestDebug|Win32.ActiveCfg = Debug|Win32 {8760F45A-69D9-4B68-BE63-0E055B51D447}.TestDebug|x64.ActiveCfg = Debug|x64 {8760F45A-69D9-4B68-BE63-0E055B51D447}.TestDebug|x64.Build.0 = Debug|x64 + {FE3A959D-6CFA-43BF-8637-62125B571770}.Debug COFF32|Win32.ActiveCfg = Debug COFF32|Win32 + {FE3A959D-6CFA-43BF-8637-62125B571770}.Debug COFF32|Win32.Build.0 = Debug COFF32|Win32 + {FE3A959D-6CFA-43BF-8637-62125B571770}.Debug COFF32|x64.ActiveCfg = Debug|x64 + {FE3A959D-6CFA-43BF-8637-62125B571770}.Debug COFF32|x64.Build.0 = Debug|x64 {FE3A959D-6CFA-43BF-8637-62125B571770}.Debug GDC|Win32.ActiveCfg = Debug GDC|Win32 {FE3A959D-6CFA-43BF-8637-62125B571770}.Debug GDC|Win32.Build.0 = Debug GDC|Win32 {FE3A959D-6CFA-43BF-8637-62125B571770}.Debug GDC|x64.ActiveCfg = Debug GDC|x64 @@ -225,6 +263,10 @@ Global {FE3A959D-6CFA-43BF-8637-62125B571770}.Debug|Win32.Build.0 = Debug|Win32 {FE3A959D-6CFA-43BF-8637-62125B571770}.Debug|x64.ActiveCfg = Debug|x64 {FE3A959D-6CFA-43BF-8637-62125B571770}.Debug|x64.Build.0 = Debug|x64 + {FE3A959D-6CFA-43BF-8637-62125B571770}.Release COFF32|Win32.ActiveCfg = Release COFF32|Win32 + {FE3A959D-6CFA-43BF-8637-62125B571770}.Release COFF32|Win32.Build.0 = Release COFF32|Win32 + {FE3A959D-6CFA-43BF-8637-62125B571770}.Release COFF32|x64.ActiveCfg = Release COFF32|x64 + {FE3A959D-6CFA-43BF-8637-62125B571770}.Release COFF32|x64.Build.0 = Release COFF32|x64 {FE3A959D-6CFA-43BF-8637-62125B571770}.Release LDC|Win32.ActiveCfg = Release LDC|Win32 {FE3A959D-6CFA-43BF-8637-62125B571770}.Release LDC|Win32.Build.0 = Release LDC|Win32 {FE3A959D-6CFA-43BF-8637-62125B571770}.Release LDC|x64.ActiveCfg = Release LDC|x64 @@ -241,6 +283,10 @@ Global {FE3A959D-6CFA-43BF-8637-62125B571770}.TestDebug|Win32.Build.0 = TestDebug|Win32 {FE3A959D-6CFA-43BF-8637-62125B571770}.TestDebug|x64.ActiveCfg = TestDebug|x64 {FE3A959D-6CFA-43BF-8637-62125B571770}.TestDebug|x64.Build.0 = TestDebug|x64 + {2070DF9A-6D80-4E3C-950A-C1BBA1B20F4D}.Debug COFF32|Win32.ActiveCfg = Debug COFF32|Win32 + {2070DF9A-6D80-4E3C-950A-C1BBA1B20F4D}.Debug COFF32|Win32.Build.0 = Debug COFF32|Win32 + {2070DF9A-6D80-4E3C-950A-C1BBA1B20F4D}.Debug COFF32|x64.ActiveCfg = Debug|x64 + {2070DF9A-6D80-4E3C-950A-C1BBA1B20F4D}.Debug COFF32|x64.Build.0 = Debug|x64 {2070DF9A-6D80-4E3C-950A-C1BBA1B20F4D}.Debug GDC|Win32.ActiveCfg = Debug GDC|Win32 {2070DF9A-6D80-4E3C-950A-C1BBA1B20F4D}.Debug GDC|Win32.Build.0 = Debug GDC|Win32 {2070DF9A-6D80-4E3C-950A-C1BBA1B20F4D}.Debug GDC|x64.ActiveCfg = Debug GDC|x64 @@ -253,6 +299,10 @@ Global {2070DF9A-6D80-4E3C-950A-C1BBA1B20F4D}.Debug|Win32.Build.0 = Debug|Win32 {2070DF9A-6D80-4E3C-950A-C1BBA1B20F4D}.Debug|x64.ActiveCfg = Debug|x64 {2070DF9A-6D80-4E3C-950A-C1BBA1B20F4D}.Debug|x64.Build.0 = Debug|x64 + {2070DF9A-6D80-4E3C-950A-C1BBA1B20F4D}.Release COFF32|Win32.ActiveCfg = Release COFF32|Win32 + {2070DF9A-6D80-4E3C-950A-C1BBA1B20F4D}.Release COFF32|Win32.Build.0 = Release COFF32|Win32 + {2070DF9A-6D80-4E3C-950A-C1BBA1B20F4D}.Release COFF32|x64.ActiveCfg = Release COFF32|x64 + {2070DF9A-6D80-4E3C-950A-C1BBA1B20F4D}.Release COFF32|x64.Build.0 = Release COFF32|x64 {2070DF9A-6D80-4E3C-950A-C1BBA1B20F4D}.Release LDC|Win32.ActiveCfg = Release LDC|Win32 {2070DF9A-6D80-4E3C-950A-C1BBA1B20F4D}.Release LDC|Win32.Build.0 = Release LDC|Win32 {2070DF9A-6D80-4E3C-950A-C1BBA1B20F4D}.Release LDC|x64.ActiveCfg = Release LDC|x64 @@ -269,6 +319,10 @@ Global {2070DF9A-6D80-4E3C-950A-C1BBA1B20F4D}.TestDebug|Win32.Build.0 = Debug|Win32 {2070DF9A-6D80-4E3C-950A-C1BBA1B20F4D}.TestDebug|x64.ActiveCfg = Debug|x64 {2070DF9A-6D80-4E3C-950A-C1BBA1B20F4D}.TestDebug|x64.Build.0 = Debug|x64 + {E2073B79-635A-48FA-A5A3-6E760D3A5DD8}.Debug COFF32|Win32.ActiveCfg = Debug COFF32|Win32 + {E2073B79-635A-48FA-A5A3-6E760D3A5DD8}.Debug COFF32|Win32.Build.0 = Debug COFF32|Win32 + {E2073B79-635A-48FA-A5A3-6E760D3A5DD8}.Debug COFF32|x64.ActiveCfg = Debug|x64 + {E2073B79-635A-48FA-A5A3-6E760D3A5DD8}.Debug COFF32|x64.Build.0 = Debug|x64 {E2073B79-635A-48FA-A5A3-6E760D3A5DD8}.Debug GDC|Win32.ActiveCfg = Debug GDC|Win32 {E2073B79-635A-48FA-A5A3-6E760D3A5DD8}.Debug GDC|Win32.Build.0 = Debug GDC|Win32 {E2073B79-635A-48FA-A5A3-6E760D3A5DD8}.Debug GDC|x64.ActiveCfg = Debug GDC|x64 @@ -281,6 +335,10 @@ Global {E2073B79-635A-48FA-A5A3-6E760D3A5DD8}.Debug|Win32.Build.0 = Debug|Win32 {E2073B79-635A-48FA-A5A3-6E760D3A5DD8}.Debug|x64.ActiveCfg = Debug|x64 {E2073B79-635A-48FA-A5A3-6E760D3A5DD8}.Debug|x64.Build.0 = Debug|x64 + {E2073B79-635A-48FA-A5A3-6E760D3A5DD8}.Release COFF32|Win32.ActiveCfg = Release COFF32|Win32 + {E2073B79-635A-48FA-A5A3-6E760D3A5DD8}.Release COFF32|Win32.Build.0 = Release COFF32|Win32 + {E2073B79-635A-48FA-A5A3-6E760D3A5DD8}.Release COFF32|x64.ActiveCfg = Release COFF32|x64 + {E2073B79-635A-48FA-A5A3-6E760D3A5DD8}.Release COFF32|x64.Build.0 = Release COFF32|x64 {E2073B79-635A-48FA-A5A3-6E760D3A5DD8}.Release LDC|Win32.ActiveCfg = Release LDC|Win32 {E2073B79-635A-48FA-A5A3-6E760D3A5DD8}.Release LDC|Win32.Build.0 = Release LDC|Win32 {E2073B79-635A-48FA-A5A3-6E760D3A5DD8}.Release LDC|x64.ActiveCfg = Release LDC|x64 @@ -293,6 +351,10 @@ Global {E2073B79-635A-48FA-A5A3-6E760D3A5DD8}.Test|x64.Build.0 = TestDebug|x64 {E2073B79-635A-48FA-A5A3-6E760D3A5DD8}.TestDebug|Win32.ActiveCfg = Debug|Win32 {E2073B79-635A-48FA-A5A3-6E760D3A5DD8}.TestDebug|x64.ActiveCfg = Debug|Win32 + {E2073B79-635A-48FA-A5A3-6E500D3A5DD8}.Debug COFF32|Win32.ActiveCfg = Debug COFF32|Win32 + {E2073B79-635A-48FA-A5A3-6E500D3A5DD8}.Debug COFF32|Win32.Build.0 = Debug COFF32|Win32 + {E2073B79-635A-48FA-A5A3-6E500D3A5DD8}.Debug COFF32|x64.ActiveCfg = Debug|x64 + {E2073B79-635A-48FA-A5A3-6E500D3A5DD8}.Debug COFF32|x64.Build.0 = Debug|x64 {E2073B79-635A-48FA-A5A3-6E500D3A5DD8}.Debug GDC|Win32.ActiveCfg = Debug GDC|Win32 {E2073B79-635A-48FA-A5A3-6E500D3A5DD8}.Debug GDC|Win32.Build.0 = Debug GDC|Win32 {E2073B79-635A-48FA-A5A3-6E500D3A5DD8}.Debug GDC|x64.ActiveCfg = Debug GDC|x64 @@ -305,6 +367,10 @@ Global {E2073B79-635A-48FA-A5A3-6E500D3A5DD8}.Debug|Win32.Build.0 = Debug|Win32 {E2073B79-635A-48FA-A5A3-6E500D3A5DD8}.Debug|x64.ActiveCfg = Debug|x64 {E2073B79-635A-48FA-A5A3-6E500D3A5DD8}.Debug|x64.Build.0 = Debug|x64 + {E2073B79-635A-48FA-A5A3-6E500D3A5DD8}.Release COFF32|Win32.ActiveCfg = Release COFF32|Win32 + {E2073B79-635A-48FA-A5A3-6E500D3A5DD8}.Release COFF32|Win32.Build.0 = Release COFF32|Win32 + {E2073B79-635A-48FA-A5A3-6E500D3A5DD8}.Release COFF32|x64.ActiveCfg = Release COFF32|x64 + {E2073B79-635A-48FA-A5A3-6E500D3A5DD8}.Release COFF32|x64.Build.0 = Release COFF32|x64 {E2073B79-635A-48FA-A5A3-6E500D3A5DD8}.Release LDC|Win32.ActiveCfg = Release LDC|Win32 {E2073B79-635A-48FA-A5A3-6E500D3A5DD8}.Release LDC|Win32.Build.0 = Release LDC|Win32 {E2073B79-635A-48FA-A5A3-6E500D3A5DD8}.Release LDC|x64.ActiveCfg = Release LDC|x64 @@ -316,6 +382,10 @@ Global {E2073B79-635A-48FA-A5A3-6E500D3A5DD8}.Test|x64.ActiveCfg = Debug GDC|Win32 {E2073B79-635A-48FA-A5A3-6E500D3A5DD8}.TestDebug|Win32.ActiveCfg = Debug|Win32 {E2073B79-635A-48FA-A5A3-6E500D3A5DD8}.TestDebug|x64.ActiveCfg = Debug|Win32 + {2F75431E-B8DB-4231-AAC1-EA68D06A22E6}.Debug COFF32|Win32.ActiveCfg = Debug COFF32|Win32 + {2F75431E-B8DB-4231-AAC1-EA68D06A22E6}.Debug COFF32|Win32.Build.0 = Debug COFF32|Win32 + {2F75431E-B8DB-4231-AAC1-EA68D06A22E6}.Debug COFF32|x64.ActiveCfg = Debug|x64 + {2F75431E-B8DB-4231-AAC1-EA68D06A22E6}.Debug COFF32|x64.Build.0 = Debug|x64 {2F75431E-B8DB-4231-AAC1-EA68D06A22E6}.Debug GDC|Win32.ActiveCfg = Debug GDC|Win32 {2F75431E-B8DB-4231-AAC1-EA68D06A22E6}.Debug GDC|Win32.Build.0 = Debug GDC|Win32 {2F75431E-B8DB-4231-AAC1-EA68D06A22E6}.Debug GDC|x64.ActiveCfg = Debug GDC|x64 @@ -328,6 +398,10 @@ Global {2F75431E-B8DB-4231-AAC1-EA68D06A22E6}.Debug|Win32.Build.0 = Debug|Win32 {2F75431E-B8DB-4231-AAC1-EA68D06A22E6}.Debug|x64.ActiveCfg = Debug|x64 {2F75431E-B8DB-4231-AAC1-EA68D06A22E6}.Debug|x64.Build.0 = Debug|x64 + {2F75431E-B8DB-4231-AAC1-EA68D06A22E6}.Release COFF32|Win32.ActiveCfg = Release COFF32|Win32 + {2F75431E-B8DB-4231-AAC1-EA68D06A22E6}.Release COFF32|Win32.Build.0 = Release COFF32|Win32 + {2F75431E-B8DB-4231-AAC1-EA68D06A22E6}.Release COFF32|x64.ActiveCfg = Release COFF32|x64 + {2F75431E-B8DB-4231-AAC1-EA68D06A22E6}.Release COFF32|x64.Build.0 = Release COFF32|x64 {2F75431E-B8DB-4231-AAC1-EA68D06A22E6}.Release LDC|Win32.ActiveCfg = Release LDC|Win32 {2F75431E-B8DB-4231-AAC1-EA68D06A22E6}.Release LDC|Win32.Build.0 = Release LDC|Win32 {2F75431E-B8DB-4231-AAC1-EA68D06A22E6}.Release LDC|x64.ActiveCfg = Release LDC|x64 @@ -342,6 +416,9 @@ Global {2F75431E-B8DB-4231-AAC1-EA68D06A22E6}.TestDebug|Win32.ActiveCfg = Debug|Win32 {2F75431E-B8DB-4231-AAC1-EA68D06A22E6}.TestDebug|x64.ActiveCfg = Debug|x64 {2F75431E-B8DB-4231-AAC1-EA68D06A22E6}.TestDebug|x64.Build.0 = Debug|x64 + {CD26A145-F663-473D-8908-0254FE377D48}.Debug COFF32|Win32.ActiveCfg = Debug|Win32 + {CD26A145-F663-473D-8908-0254FE377D48}.Debug COFF32|Win32.Build.0 = Debug|Win32 + {CD26A145-F663-473D-8908-0254FE377D48}.Debug COFF32|x64.ActiveCfg = Debug|Win32 {CD26A145-F663-473D-8908-0254FE377D48}.Debug GDC|Win32.ActiveCfg = Debug|Win32 {CD26A145-F663-473D-8908-0254FE377D48}.Debug GDC|Win32.Build.0 = Debug|Win32 {CD26A145-F663-473D-8908-0254FE377D48}.Debug GDC|x64.ActiveCfg = Debug|Win32 @@ -351,6 +428,9 @@ Global {CD26A145-F663-473D-8908-0254FE377D48}.Debug|Win32.ActiveCfg = Debug|Win32 {CD26A145-F663-473D-8908-0254FE377D48}.Debug|Win32.Build.0 = Debug|Win32 {CD26A145-F663-473D-8908-0254FE377D48}.Debug|x64.ActiveCfg = Debug|Win32 + {CD26A145-F663-473D-8908-0254FE377D48}.Release COFF32|Win32.ActiveCfg = Release|Win32 + {CD26A145-F663-473D-8908-0254FE377D48}.Release COFF32|Win32.Build.0 = Release|Win32 + {CD26A145-F663-473D-8908-0254FE377D48}.Release COFF32|x64.ActiveCfg = Release|Win32 {CD26A145-F663-473D-8908-0254FE377D48}.Release LDC|Win32.ActiveCfg = Release|Win32 {CD26A145-F663-473D-8908-0254FE377D48}.Release LDC|Win32.Build.0 = Release|Win32 {CD26A145-F663-473D-8908-0254FE377D48}.Release LDC|x64.ActiveCfg = Release|Win32 @@ -375,5 +455,6 @@ Global {B7673E1D-73AC-458B-BC59-0EBDBFCBF7AA} = {38FEE953-9826-4DDB-8BE3-6DAB8E71AC66} {6C5387E8-CF11-443A-88BD-CA6DCA80E755} = {38FEE953-9826-4DDB-8BE3-6DAB8E71AC66} {AB498803-493D-4FB4-9FB1-9CEF0E628CE9} = {6C5387E8-CF11-443A-88BD-CA6DCA80E755} + {7F391DE3-9620-4A98-B05D-4181924A9D15} = {342DCC0D-9F76-4AFE-B2BF-4FEFEB438D17} EndGlobalSection EndGlobal