give cl the attention it needs so it will work with us on C++ language version detection

This commit is contained in:
Allen Webster
2021-07-03 11:14:20 -04:00
parent fb865cea4b
commit 0f53a4379f
2 changed files with 110 additions and 12 deletions
@@ -0,0 +1,61 @@
function StringFitsFilter(str, filter)
{
let match = true;
let filter_upper = filter.toUpperCase();
let filter_substrings = filter_upper.split(/[ _*]+/);
let str_upper = str.toUpperCase();
let minimum_index = 0;
for(let i = 0; i < filter_substrings.length; ++i)
{
if(filter_substrings[i].length > 0)
{
let index_of_substring = str_upper.indexOf(filter_substrings[i], minimum_index);
if(index_of_substring < 0 || index_of_substring < minimum_index)
{
match = false;
break;
}
minimum_index = index_of_substring + filter_substrings[i].length - 1;
}
}
return match;
}
function UpdateListByFilter(menu_id, filter_id)
{
let ul = document.getElementById(menu_id);
let li = ul.getElementsByTagName("li");
let input = document.getElementById(filter_id);
let filter = input.value.toUpperCase();
for(let i = 0; i < li.length; i++)
{
if(filter.length > 0)
{
let a = li[i].getElementsByTagName("a")[0];
if(StringFitsFilter(a.innerHTML, filter))
{
li[i].style.display = "";
}
else
{
li[i].style.display = "none";
}
}
else
{
li[i].style.display = "";
}
}
}
function SearchInput(event, lister_idx)
{
UpdateListByFilter("lister_"+lister_idx, "lister_search_"+lister_idx);
}
function SearchKeyDown(event, lister_idx)
{
UpdateListByFilter("lister_"+lister_idx, "lister_search_"+lister_idx);
}
+49 -12
View File
@@ -132,18 +132,52 @@
#if defined(__cplusplus)
# define MD_LANG_CPP 1
# if __cplusplus <= 199711L
# define MD_CPP_VERSION 98
# elif __cplusplus <= 201103L
# define MD_CPP_VERSION 11
# elif __cplusplus <= 201402L
# define MD_CPP_VERSION 14
# elif __cplusplus <= 201703L
# define MD_CPP_VERSION 17
# elif __cplusplus <= 202002L
# define MD_CPP_VERSION 20
# else
# define MD_CPP_VERSION 23
// We can't get this 100% correct thanks to Microsoft's compiler.
// So this check lets us pre-define MD_CPP_VERSION if we have to.
# if !defined(MD_CPP_VERSION)
# if defined(MD_COMPILER_CL)
// CL is annoying and didn't update __cplusplus over time
// If it is available _MSVC_LANG serves the same role
# if defined(_MSVC_LANG)
# if _MSVC_LANG <= 199711L
# define MD_CPP_VERSION 98
# elif _MSVC_LANG <= 201103L
# define MD_CPP_VERSION 11
# elif _MSVC_LANG <= 201402L
# define MD_CPP_VERSION 14
# elif _MSVC_LANG <= 201703L
# define MD_CPP_VERSION 17
# elif _MSVC_LANG <= 202002L
# define MD_CPP_VERSION 20
# else
# define MD_CPP_VERSION 23
# endif
// If we don't have _MSVC_LANG we can guess from the compiler version
# else
# if MD_COMPILER_CL_YEAR <= 2010
# define MD_CPP_VERSION 98
# elif MD_COMPILER_CL_YEAR <= 2015
# define MD_CPP_VERSION 11
# else
# define MD_CPP_VERSION 17
# endif
# endif
# else
// Other compilers use __cplusplus correctly
# if __cplusplus <= 199711L
# define MD_CPP_VERSION 98
# elif __cplusplus <= 201103L
# define MD_CPP_VERSION 11
# elif __cplusplus <= 201402L
# define MD_CPP_VERSION 14
# elif __cplusplus <= 201703L
# define MD_CPP_VERSION 17
# elif __cplusplus <= 202002L
# define MD_CPP_VERSION 20
# else
# define MD_CPP_VERSION 23
# endif
# endif
# endif
#else
@@ -194,6 +228,9 @@
#if !defined(MD_LANG_CPP)
# define MD_LANG_CPP 0
#endif
#if !defined(MD_CPP_VERSION)
# define MD_CPP_VERSION 0
#endif
#if MD_LANG_CPP
# define MD_ZERO_STRUCT {}