function mexShortName = getMexShortNameForHostToolchain(hosttc)
%GETMEXSHORTNAMEFORHOSTTOOLCHAIN Returns the associated mex compiler for
%the host toolchain

%   Copyright 2020 The MathWorks, Inc.

mexShortName = '';

if isa(hosttc, 'coder.make.ToolchainInfo')
    hosttc = hosttc.Name;
end

compilerMap = ...
    { ...
    {'Microsoft Visual C++ 2015',           'msvc140'}, ...
    {'Microsoft Visual C++ 2017',           'msvc150'}, ...
    {'Microsoft Visual C++ 2019',           'msvc160'}, ...
    {'GNU',                                 'gcc'} ...
    {'Clang',                               'clang'} ...
    {'Lcc-win64',                           'lcc64'} ...
    {'MinGW64',                             'mingw64'}...
    {'Intel Parallel Studio XE 2018 (w/Microsoft Visual Studio 2015)', 'intelc18msvs2015'},...
    {'Intel Parallel Studio XE 2018 (w/Microsoft Visual Studio 2017)', 'intelc18msvs2017'},...
    {'Intel Parallel Studio XE 2019 (w/Microsoft Visual Studio 2015)', 'intelc19msvs2015'},...
    {'Intel Parallel Studio XE 2019 (w/Microsoft Visual Studio 2017)', 'intelc19msvs2017'},...
    {'Intel Parallel Studio XE 2019 (w/Microsoft Visual Studio 2019)', 'intelc19msvs2019'},...
    {'Intel Parallel Studio XE 2020 (w/Microsoft Visual Studio 2017)', 'intelc20msvs2017'},...
    {'Intel Parallel Studio XE 2020 (w/Microsoft Visual Studio 2019)', 'intelc20msvs2019'},...
    };

for i = 1:numel(compilerMap)
    thisCompiler = compilerMap{i};
    thisCompilerName = thisCompiler{1};
    if strncmpi(hosttc, thisCompilerName, length(thisCompilerName))
        mexShortName = thisCompiler{2};
        break;
    end
end
end

