diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2018-12-21 11:00:28 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-12-21 11:00:28 -0500 |
| commit | efa2c8f41aa5cd2c27990fd9b57ea0eff06976e7 (patch) | |
| tree | 4c1a4d8e6e71e81c42cfbf315610e380d75527bf /source/core/slang-app-context.cpp | |
| parent | b5bda9b3d155234be079debe6997cbc900773cf2 (diff) | |
Feature/remove app context (#765)
* Remove AppContext. Use StdChannels to hold writers, and TestToolUtil to hold test tool specific functionality.
* StdChannels -> StdWriters
* getStdOut -> getOut, getStdError -> getError
Diffstat (limited to 'source/core/slang-app-context.cpp')
| -rw-r--r-- | source/core/slang-app-context.cpp | 67 |
1 files changed, 0 insertions, 67 deletions
diff --git a/source/core/slang-app-context.cpp b/source/core/slang-app-context.cpp deleted file mode 100644 index 2b3f32cbc..000000000 --- a/source/core/slang-app-context.cpp +++ /dev/null @@ -1,67 +0,0 @@ - -#include "slang-app-context.h" - -#include "slang-writer.h" - -namespace Slang -{ - -/* static */AppContext* AppContext::s_singleton = nullptr; - - -/* static */AppContext* AppContext::getDefault() -{ - static AppContext* s_context = nullptr; - - if (!s_context) - { - static FileWriter s_stdError(stderr, WriterFlag::IsStatic | WriterFlag::IsUnowned | WriterFlag::AutoFlush); - static FileWriter s_stdOut(stdout, WriterFlag::IsStatic | WriterFlag::IsUnowned | WriterFlag::AutoFlush); - - static AppContext s_contextVar; - s_context = &s_contextVar; - - s_context->setWriter(SLANG_WRITER_CHANNEL_STD_ERROR, &s_stdError); - s_context->setWriter(SLANG_WRITER_CHANNEL_STD_OUTPUT, &s_stdOut); - } - return s_context; -} - -/* static */AppContext* AppContext::initDefault() -{ - AppContext* context = getDefault(); - setSingleton(context); - return context; -} - -/* static */int AppContext::getReturnCode(SlangResult res) -{ - if (SLANG_SUCCEEDED(res)) - { - return 0; - } - else if (res == SLANG_E_INTERNAL_FAIL) - { - return -1; - } - return 1; -} - -void AppContext::setRequestWriters(SlangCompileRequest* request) -{ - for (int i = 0; i < SLANG_WRITER_CHANNEL_COUNT_OF; ++i) - { - if (m_replaceWriterFlags & (1 << i)) - { - spSetWriter(request, SlangWriterChannel(i), m_writers[i]); - } - } -} - -void AppContext::configureRequest(SlangCompileRequest* request) -{ - setRequestWriters(request); -} - -} - |
