yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
1e86f5657
master
1// slang-fiddle-options.h 2#pragma once 3 4#include "slang-fiddle-diagnostics.h" 5 6namespace fiddle 7{ 8using namespace Slang ; 9 10// 11 12struct Options 13{ 14public : 15static const char * expectArg (char const * const *& cursor ,char const * const * end ) 16 { 17if (cursor != end ) 18return * cursor ++ ; 19return nullptr ; 20 } 21 22void parse (DiagnosticSink & sink ,int argc ,char const * const * argv ) 23 { 24 autoargCursor = argv ++ ; 25auto argEnd = argCursor + argc; 26 27if (argCursor != argEnd) 28{ 29appName = * argCursor ++ ; 30} 31 32while (argCursor != argEnd) 33{ 34UnownedTerminatedStringSlice arg = * argCursor ++ ; 35if (arg[ 0 ] != '-' ) 36{ 37inputPaths. add ( String (arg)); 38continue ; 39} 40 41if (arg == UnownedTerminatedStringSlice ( "-i" )) 42{ 43inputPathPrefix = expectArg (argCursor, argEnd); 44} 45else if (arg == UnownedTerminatedStringSlice ( "-o" )) 46{ 47outputPathPrefix = expectArg (argCursor, argEnd); 48} 49else 50{ 51sink. diagnose ( SourceLoc (), Diagnostics::unknownOption, arg); 52} 53} 54} 55 56String appName = "slang-fiddle" ; 57String inputPathPrefix = "" ; 58String outputPathPrefix = "" ; 59List < String > inputPaths; 60}; 61} // namespace fiddle