diff options
| author | Tim Foley <tfoley@nvidia.com> | 2017-06-15 13:24:25 -0700 |
|---|---|---|
| committer | Tim Foley <tfoley@nvidia.com> | 2017-06-15 13:24:25 -0700 |
| commit | 205187b561c3b31fa931e73e8f7263f0c4b1de41 (patch) | |
| tree | 7bd2cd5ae3c14416b71ef8319ff02ace429d1132 /tools | |
| parent | 517513645afb8eaf4841e7b7035f1ba3a9c7cd57 (diff) | |
Rename `CoreLib::*` to `Slang`
Getting rid of more namespace complexity and stripping things down to the basics.
This also gets rid of some dead code in the "core" library.
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/slang-test/main.cpp | 31 | ||||
| -rw-r--r-- | tools/slang-test/os.cpp | 18 | ||||
| -rw-r--r-- | tools/slang-test/os.h | 38 |
3 files changed, 43 insertions, 44 deletions
diff --git a/tools/slang-test/main.cpp b/tools/slang-test/main.cpp index 4940228fe..3d193dad4 100644 --- a/tools/slang-test/main.cpp +++ b/tools/slang-test/main.cpp @@ -2,8 +2,7 @@ #include "../../source/core/slang-io.h" -using namespace CoreLib::Basic; -using namespace CoreLib::IO; +using namespace Slang; #include "os.h" @@ -509,9 +508,9 @@ TestResult gatherTestsForFile( String fileContents; try { - fileContents = CoreLib::IO::File::ReadAllText(filePath); + fileContents = Slang::File::ReadAllText(filePath); } - catch (CoreLib::IO::IOException) + catch (Slang::IOException) { return kTestResult_Fail; } @@ -629,9 +628,9 @@ TestResult runSimpleTest(TestInput& input) String expectedOutput; try { - expectedOutput = CoreLib::IO::File::ReadAllText(expectedOutputPath); + expectedOutput = Slang::File::ReadAllText(expectedOutputPath); } - catch (CoreLib::IO::IOException) + catch (Slang::IOException) { } @@ -656,7 +655,7 @@ TestResult runSimpleTest(TestInput& input) if (result == kTestResult_Fail) { String actualOutputPath = outputStem + ".actual"; - CoreLib::IO::File::WriteAllText(actualOutputPath, actualOutput); + Slang::File::WriteAllText(actualOutputPath, actualOutput); } return result; @@ -691,9 +690,9 @@ TestResult generateHLSLBaseline(TestInput& input) String expectedOutputPath = outputStem + ".expected"; try { - CoreLib::IO::File::WriteAllText(expectedOutputPath, expectedOutput); + Slang::File::WriteAllText(expectedOutputPath, expectedOutput); } - catch (CoreLib::IO::IOException) + catch (Slang::IOException) { return kTestResult_Fail; } @@ -758,9 +757,9 @@ TestResult runHLSLComparisonTest(TestInput& input) String expectedOutput; try { - expectedOutput = CoreLib::IO::File::ReadAllText(expectedOutputPath); + expectedOutput = Slang::File::ReadAllText(expectedOutputPath); } - catch (CoreLib::IO::IOException) + catch (Slang::IOException) { } @@ -786,7 +785,7 @@ TestResult runHLSLComparisonTest(TestInput& input) if (result == kTestResult_Fail) { String actualOutputPath = outputStem + ".actual"; - CoreLib::IO::File::WriteAllText(actualOutputPath, actualOutput); + Slang::File::WriteAllText(actualOutputPath, actualOutput); } return result; @@ -869,8 +868,8 @@ TestResult runGLSLComparisonTest(TestInput& input) TestResult hlslResult = doGLSLComparisonTestRun(input, "__GLSL__", "glslang", ".expected", &expectedOutput); TestResult slangResult = doGLSLComparisonTestRun(input, "__SLANG__", nullptr, ".actual", &actualOutput); - CoreLib::IO::File::WriteAllText(outputStem + ".expected", expectedOutput); - CoreLib::IO::File::WriteAllText(outputStem + ".actual", actualOutput); + Slang::File::WriteAllText(outputStem + ".expected", expectedOutput); + Slang::File::WriteAllText(outputStem + ".actual", actualOutput); if( hlslResult == kTestResult_Fail ) return kTestResult_Fail; if( slangResult == kTestResult_Fail ) return kTestResult_Fail; @@ -1014,8 +1013,8 @@ TestResult runHLSLRenderComparisonTestImpl( TestResult hlslResult = doRenderComparisonTestRun(input, expectedArg, ".expected", &expectedOutput); TestResult slangResult = doRenderComparisonTestRun(input, actualArg, ".actual", &actualOutput); - CoreLib::IO::File::WriteAllText(outputStem + ".expected", expectedOutput); - CoreLib::IO::File::WriteAllText(outputStem + ".actual", actualOutput); + Slang::File::WriteAllText(outputStem + ".expected", expectedOutput); + Slang::File::WriteAllText(outputStem + ".actual", actualOutput); if( hlslResult == kTestResult_Fail ) return kTestResult_Fail; if( slangResult == kTestResult_Fail ) return kTestResult_Fail; diff --git a/tools/slang-test/os.cpp b/tools/slang-test/os.cpp index 4bc3d8e6d..63db4f9ad 100644 --- a/tools/slang-test/os.cpp +++ b/tools/slang-test/os.cpp @@ -5,7 +5,7 @@ #include <stdio.h> #include <stdlib.h> -using namespace CoreLib::Basic; +using namespace Slang; // Platform-specific code follows @@ -54,8 +54,8 @@ bool OSFindFilesResult::findNextFile() } OSFindFilesResult osFindFilesInDirectoryMatchingPattern( - CoreLib::Basic::String directoryPath, - CoreLib::Basic::String pattern) + Slang::String directoryPath, + Slang::String pattern) { // TODO: add separator to end of directory path if needed @@ -87,13 +87,13 @@ OSFindFilesResult osFindFilesInDirectoryMatchingPattern( } OSFindFilesResult osFindFilesInDirectory( - CoreLib::Basic::String directoryPath) + Slang::String directoryPath) { return osFindFilesInDirectoryMatchingPattern(directoryPath, "*"); } OSFindFilesResult osFindChildDirectories( - CoreLib::Basic::String directoryPath) + Slang::String directoryPath) { // TODO: add separator to end of directory path if needed @@ -189,7 +189,7 @@ static DWORD WINAPI osReaderThreadProc(LPVOID threadParam) } bytesRead = (DWORD)(writeCursor - buffer); - // Note: Current Slang CoreLib gives no way to know + // Note: Current "core" implementation gives no way to know // the length of the buffer, so we ultimately have // to just assume null termination... outputBuilder.Append(buffer, bytesRead); @@ -201,7 +201,7 @@ static DWORD WINAPI osReaderThreadProc(LPVOID threadParam) } void OSProcessSpawner::pushExecutableName( - CoreLib::Basic::String executableName) + Slang::String executableName) { executableName_ = executableName; commandLine_.Append(executableName); @@ -209,7 +209,7 @@ void OSProcessSpawner::pushExecutableName( } void OSProcessSpawner::pushExecutablePath( - CoreLib::Basic::String executablePath) + Slang::String executablePath) { executableName_ = executablePath; commandLine_.Append(executablePath); @@ -217,7 +217,7 @@ void OSProcessSpawner::pushExecutablePath( } void OSProcessSpawner::pushArgument( - CoreLib::Basic::String argument) + Slang::String argument) { // TODO(tfoley): handle cases where arguments need some escaping commandLine_.Append(" "); diff --git a/tools/slang-test/os.h b/tools/slang-test/os.h index 5471e7e1a..c6eb8f410 100644 --- a/tools/slang-test/os.h +++ b/tools/slang-test/os.h @@ -32,8 +32,8 @@ enum OSError // A helper type used during enumeration of files in a directory. struct OSFindFilesResult { - CoreLib::Basic::String directoryPath_; - CoreLib::Basic::String filePath_; + Slang::String directoryPath_; + Slang::String filePath_; #ifdef WIN32 HANDLE findHandle_; WIN32_FIND_DATAW fileData_; @@ -57,7 +57,7 @@ struct OSFindFilesResult context_ = NULL; } } - CoreLib::Basic::String const& operator*() const + Slang::String const& operator*() const { return context_->filePath_; } @@ -86,10 +86,10 @@ struct OSFindFilesResult // for( auto subdir : osFindChildDirectories(dir)) // { ... } // -// Each element in the range is a `CoreLib::Basic::String` representing the +// Each element in the range is a `Slang::String` representing the // path to a subdirecotry of the directory. OSFindFilesResult osFindChildDirectories( - CoreLib::Basic::String directoryPath); + Slang::String directoryPath); // Enumerate files in the given `directoryPath` that match the provided // `pattern` as a simplified regex for files to return (e.g., "*.txt") @@ -99,11 +99,11 @@ OSFindFilesResult osFindChildDirectories( // for( auto file : osFindFilesInDirectoryMatchingPattern(dir, "*.txt")) // { ... } // -// Each element in the range is a `CoreLib::Basic::String` representing the +// Each element in the range is a `Slang::String` representing the // path to a file in the directory. OSFindFilesResult osFindFilesInDirectoryMatchingPattern( - CoreLib::Basic::String directoryPath, - CoreLib::Basic::String pattern); + Slang::String directoryPath, + Slang::String pattern); // Enumerate files in the given `directoryPath` and return a logical // collection of the results that can be iterated with a range-based @@ -112,10 +112,10 @@ OSFindFilesResult osFindFilesInDirectoryMatchingPattern( // for( auto file : osFindFilesInDirectory(dir)) // { ... } // -// Each element in the range is a `CoreLib::Basic::String` representing the +// Each element in the range is a `Slang::String` representing the // path to a file in the directory. OSFindFilesResult osFindFilesInDirectory( - CoreLib::Basic::String directoryPath); + Slang::String directoryPath); // An `OSProcessSpawner` can be used to launch a process, and handles @@ -127,16 +127,16 @@ struct OSProcessSpawner // Set the executable name for the process to be spawned. // Note: this call must be made before any arguments are pushed. void pushExecutableName( - CoreLib::Basic::String executableName); + Slang::String executableName); // Set the executable name for the process to be spawned. // Note: this call must be made before any arguments are pushed. void pushExecutablePath( - CoreLib::Basic::String executablePath); + Slang::String executablePath); // Append an argument for the process to be spawned. void pushArgument( - CoreLib::Basic::String argument); + Slang::String argument); // Attempt to spawn the process, and wait for it to complete. // Returns an error if the attempt to spawn and/or wait fails, @@ -150,16 +150,16 @@ struct OSProcessSpawner // on exit, along with the output it wrote to stdout and stderr. typedef int ResultCode; ResultCode getResultCode() { return resultCode_; } - CoreLib::Basic::String const& getStandardOutput() { return standardOutput_; } - CoreLib::Basic::String const& getStandardError() { return standardError_; } + Slang::String const& getStandardOutput() { return standardOutput_; } + Slang::String const& getStandardError() { return standardError_; } // "private" data follows - CoreLib::Basic::String standardOutput_; - CoreLib::Basic::String standardError_; + Slang::String standardOutput_; + Slang::String standardError_; ResultCode resultCode_; #ifdef WIN32 - CoreLib::Basic::String executableName_; - CoreLib::Basic::StringBuilder commandLine_; + Slang::String executableName_; + Slang::StringBuilder commandLine_; // Is the executable specified by path, rather than just by name? bool isExecutablePath_; |
