diff options
author | The Android Open Source Project <initial-contribution@android.com> | 2009-03-03 19:30:52 -0800 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2009-03-03 19:30:52 -0800 |
commit | 8e35f3cfc7fba1d1c829dc557ebad6409cbe16a2 (patch) | |
tree | 11425ea0b299d6fb89c6d3618a22d97d5bf68d0f /WebKitTools/MIDLWrapper | |
parent | 648161bb0edfc3d43db63caed5cc5213bc6cb78f (diff) | |
download | external_webkit-8e35f3cfc7fba1d1c829dc557ebad6409cbe16a2.zip external_webkit-8e35f3cfc7fba1d1c829dc557ebad6409cbe16a2.tar.gz external_webkit-8e35f3cfc7fba1d1c829dc557ebad6409cbe16a2.tar.bz2 |
auto import from //depot/cupcake/@135843
Diffstat (limited to 'WebKitTools/MIDLWrapper')
-rw-r--r-- | WebKitTools/MIDLWrapper/MIDLWrapper.cpp | 86 | ||||
-rw-r--r-- | WebKitTools/MIDLWrapper/MIDLWrapper.sln | 20 | ||||
-rw-r--r-- | WebKitTools/MIDLWrapper/MIDLWrapper.vcproj | 199 |
3 files changed, 305 insertions, 0 deletions
diff --git a/WebKitTools/MIDLWrapper/MIDLWrapper.cpp b/WebKitTools/MIDLWrapper/MIDLWrapper.cpp new file mode 100644 index 0000000..2132af8 --- /dev/null +++ b/WebKitTools/MIDLWrapper/MIDLWrapper.cpp @@ -0,0 +1,86 @@ +// MIDLWrapper.cpp : Just calls the built-in midl.exe with the given arguments. + +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +#include <process.h> +#include <stdio.h> +#include <string> +#include <windows.h> + +using namespace std; + +int wmain(int argc, wchar_t* argv[], wchar_t* envp[]) +{ +#ifndef NDEBUG + fwprintf(stderr, L"######### im in ur IDE, compiling ur c0des ########\n"); +#endif + + int pathIndex = -1; + for (int i = 0; envp[i]; ++i) + if (!wcsncmp(envp[i], L"PATH=", 5)) { + pathIndex = i; + break; + } + + if (pathIndex == -1) { + fwprintf(stderr, L"Couldn't find PATH environment variable!\n"); + return -1; + } + + wchar_t* vcbin = wcsstr(envp[pathIndex], L"WebKitTools\\vcbin"); + if (!vcbin) { + fwprintf(stderr, L"Couldn't find WebKitTools\\vcbin in PATH!\n"); + return -1; + } + + wchar_t saved = *vcbin; + *vcbin = 0; + + wchar_t* afterLeadingSemiColon = wcsrchr(envp[pathIndex], ';'); + if (!afterLeadingSemiColon) + afterLeadingSemiColon = envp[pathIndex] + 5; // +5 for the length of "PATH=" + else + afterLeadingSemiColon++; + + *vcbin = saved; + + size_t pathLength = wcslen(envp[pathIndex]); + + wchar_t* trailingSemiColon = wcschr(vcbin, ';'); + if (!trailingSemiColon) + trailingSemiColon = envp[pathIndex] + pathLength; + + int vcbinLength = trailingSemiColon - afterLeadingSemiColon; + + size_t newPathLength = pathLength - vcbinLength; + + wchar_t* newPath = new wchar_t[newPathLength + 1]; + + // Copy everything before the vcbin path... + wchar_t* d = newPath; + wchar_t* s = envp[pathIndex]; + while (s < afterLeadingSemiColon) + *d++ = *s++; + + // Copy everything after the vcbin path... + s = trailingSemiColon; + while (*d++ = *s++); + + envp[pathIndex] = newPath; + +#ifndef NDEBUG + fwprintf(stderr, L"New path: %s\n", envp[pathIndex]); +#endif + + wchar_t** newArgv = new wchar_t*[argc + 1]; + for (int i = 0; i < argc; ++i) { + size_t length = wcslen(argv[i]); + newArgv[i] = new wchar_t[length + 3]; + *newArgv[i] = '\"'; + wcscpy_s(newArgv[i] + 1, length + 2, argv[i]); + *(newArgv[i] + 1 + length) = '\"'; + *(newArgv[i] + 2 + length) = 0; + } + newArgv[argc] = 0; + + return _wspawnvpe(_P_WAIT, L"midl", newArgv, envp); +} diff --git a/WebKitTools/MIDLWrapper/MIDLWrapper.sln b/WebKitTools/MIDLWrapper/MIDLWrapper.sln new file mode 100644 index 0000000..b066df5 --- /dev/null +++ b/WebKitTools/MIDLWrapper/MIDLWrapper.sln @@ -0,0 +1,20 @@ +
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual Studio 2005
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MIDLWrapper", "MIDLWrapper.vcproj", "{CBE6BA0B-1A76-4936-BF54-7EB84E1B0F21}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {CBE6BA0B-1A76-4936-BF54-7EB84E1B0F21}.Debug|Win32.ActiveCfg = Debug|Win32
+ {CBE6BA0B-1A76-4936-BF54-7EB84E1B0F21}.Debug|Win32.Build.0 = Debug|Win32
+ {CBE6BA0B-1A76-4936-BF54-7EB84E1B0F21}.Release|Win32.ActiveCfg = Release|Win32
+ {CBE6BA0B-1A76-4936-BF54-7EB84E1B0F21}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/WebKitTools/MIDLWrapper/MIDLWrapper.vcproj b/WebKitTools/MIDLWrapper/MIDLWrapper.vcproj new file mode 100644 index 0000000..471813d --- /dev/null +++ b/WebKitTools/MIDLWrapper/MIDLWrapper.vcproj @@ -0,0 +1,199 @@ +<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="MIDLWrapper"
+ ProjectGUID="{CBE6BA0B-1A76-4936-BF54-7EB84E1B0F21}"
+ RootNamespace="MIDLWrapper"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="..\vcbin"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ OutputFile="$(OutDir)\midl.exe"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="..\vcbin"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ RuntimeLibrary="2"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ OutputFile="$(OutDir)\midl.exe"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+ >
+ <File
+ RelativePath=".\MIDLWrapper.cpp"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+ >
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+ >
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
|