From ad6f3070251f25cf022c231b8567d78e98061127 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Thu, 29 Apr 2021 15:45:25 -0400 Subject: Simplify CommandLine by removing Escaping (#1825) * #include an absolute path didn't work - because paths were taken to always be relative. * Split out StringEscapeUtil. * Added StringEscapeUtil. * Fix typo in unix quoting type. * Small comment improvements. * Try to fix linux linking issue. * Fix typo. * Attempt to fix linux link issue. * Update VS proj even though nothing really changed. * Fix another typo issue. * Fix for windows issue. Fixed bug. * Make separate Utils for escaping. * Fix typo. * Split out into StringEscapeHandler. * Windows shell does handle removing quotes (so remove code to remove them). * Handle unescaping if not initiating using the shell. * Slight improvement around shell like decoding. * Simplify command extraction. * Add shared-library category type. * Fix bug in command extraction. * Typo in transcendental category. * Enable unit-test on in smoke test category. * Make parsing failing output as a failing test. * Fixes for transcendental tests. Disable tests that do not work. * Changed category parsing. * Removed the TestResult parameter from _gatherTestsForFile. Made testsList only output. * Remove testing if all tests were disabled. * Make args of CommandLine always unescaped. * Add category. * Don't need escaping on unix/linux. * Remove some no longer used functions. --- source/core/slang-string-escape-util.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'source/core/slang-string-escape-util.cpp') diff --git a/source/core/slang-string-escape-util.cpp b/source/core/slang-string-escape-util.cpp index 13fce6dc7..5e4db269c 100644 --- a/source/core/slang-string-escape-util.cpp +++ b/source/core/slang-string-escape-util.cpp @@ -2,6 +2,7 @@ #include "slang-char-util.h" #include "slang-text-io.h" +#include "slang-memory-arena.h" #include "../../slang-com-helper.h" @@ -459,12 +460,13 @@ StringEscapeUtil::Handler* StringEscapeUtil::getHandler(Style style) } } -/* static */void StringEscapeUtil::appendQuoted(Handler* handler, const UnownedStringSlice& slice, StringBuilder& out) +/* static */SlangResult StringEscapeUtil::appendQuoted(Handler* handler, const UnownedStringSlice& slice, StringBuilder& out) { const char quoteChar = handler->getQuoteChar(); out.appendChar(quoteChar); - handler->appendEscaped(slice, out); + SlangResult res = handler->appendEscaped(slice, out); out.appendChar(quoteChar); + return res; } /* static */SlangResult StringEscapeUtil::appendUnquoted(Handler* handler, const UnownedStringSlice& slice, StringBuilder& out) @@ -480,15 +482,16 @@ StringEscapeUtil::Handler* StringEscapeUtil::getHandler(Style style) return handler->appendUnescaped(slice.subString(1, len - 2), out); } -/* static */void StringEscapeUtil::appendMaybeQuoted(Handler* handler, const UnownedStringSlice& slice, StringBuilder& out) +/* static */SlangResult StringEscapeUtil::appendMaybeQuoted(Handler* handler, const UnownedStringSlice& slice, StringBuilder& out) { if (handler->isQuotingNeeded(slice)) { - appendQuoted(handler, slice, out); + return appendQuoted(handler, slice, out); } else { out.append(slice); + return SLANG_OK; } } -- cgit v1.2.3