mirror of
https://github.com/Ed94/metadesk.git
synced 2026-08-06 23:58:48 +00:00
give cl the attention it needs so it will work with us on C++ language version detection
This commit is contained in:
@@ -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
@@ -132,18 +132,52 @@
|
|||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
# define MD_LANG_CPP 1
|
# define MD_LANG_CPP 1
|
||||||
|
|
||||||
# if __cplusplus <= 199711L
|
// We can't get this 100% correct thanks to Microsoft's compiler.
|
||||||
# define MD_CPP_VERSION 98
|
// So this check lets us pre-define MD_CPP_VERSION if we have to.
|
||||||
# elif __cplusplus <= 201103L
|
# if !defined(MD_CPP_VERSION)
|
||||||
# define MD_CPP_VERSION 11
|
# if defined(MD_COMPILER_CL)
|
||||||
# elif __cplusplus <= 201402L
|
// CL is annoying and didn't update __cplusplus over time
|
||||||
# define MD_CPP_VERSION 14
|
// If it is available _MSVC_LANG serves the same role
|
||||||
# elif __cplusplus <= 201703L
|
# if defined(_MSVC_LANG)
|
||||||
# define MD_CPP_VERSION 17
|
# if _MSVC_LANG <= 199711L
|
||||||
# elif __cplusplus <= 202002L
|
# define MD_CPP_VERSION 98
|
||||||
# define MD_CPP_VERSION 20
|
# elif _MSVC_LANG <= 201103L
|
||||||
# else
|
# define MD_CPP_VERSION 11
|
||||||
# define MD_CPP_VERSION 23
|
# 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
|
# endif
|
||||||
|
|
||||||
#else
|
#else
|
||||||
@@ -194,6 +228,9 @@
|
|||||||
#if !defined(MD_LANG_CPP)
|
#if !defined(MD_LANG_CPP)
|
||||||
# define MD_LANG_CPP 0
|
# define MD_LANG_CPP 0
|
||||||
#endif
|
#endif
|
||||||
|
#if !defined(MD_CPP_VERSION)
|
||||||
|
# define MD_CPP_VERSION 0
|
||||||
|
#endif
|
||||||
|
|
||||||
#if MD_LANG_CPP
|
#if MD_LANG_CPP
|
||||||
# define MD_ZERO_STRUCT {}
|
# define MD_ZERO_STRUCT {}
|
||||||
|
|||||||
Reference in New Issue
Block a user