Process class fix a dead-lock.

Compile with C++20 (compilation might fail on some systems, let's see the CI).
Fixed V1 syntax highlighting.
This commit is contained in:
Martín Lucas Golini
2025-03-31 18:52:42 -03:00
parent 70861e98b9
commit 67a86c3c05
20 changed files with 174 additions and 156 deletions

View File

@@ -74,9 +74,9 @@ jobs:
sudo apt-get update
- name: Install dependencies
run: |
sudo apt-get install -y gcc-11 g++-11
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 10
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-11 10
sudo apt-get install -y gcc-13 g++-13
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 10
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-13 10
sudo update-alternatives --install /usr/bin/cc cc /usr/bin/gcc 30
sudo update-alternatives --set cc /usr/bin/gcc
sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 30

View File

@@ -7,6 +7,7 @@
#include <cstring>
#include <functional>
#include <string>
#include <uchar.h>
#include <vector>
namespace EE {
@@ -319,7 +320,7 @@ class EE_API String {
static bool icontains( const String& haystack, const String& needle );
static int fuzzyMatchSimple( const std::string& pattern, const std::string& string,
bool allowUneven = false, bool permissive = false );
bool allowUneven = false, bool permissive = false );
static int fuzzyMatch( const std::string& pattern, const std::string& string );
@@ -409,18 +410,33 @@ class EE_API String {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wformat-security"
#elif defined( __GNUC__ )
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-security"
#endif
int size =
int reqSize =
std::snprintf( nullptr, 0, format.data(),
FormatArg<std::decay_t<Args>>::get( std::forward<Args>( args ) )... ) +
1;
std::string result( size, 0 );
if ( size > 0 ) {
std::snprintf( &result[0], size, format.data(),
FormatArg<std::decay_t<Args>>::get( std::forward<Args>( args ) )... );
result.resize( size - 1 );
if ( reqSize < 0 )
return "";
std::size_t bufSize = static_cast<std::size_t>( reqSize ) + 1;
std::string result( bufSize, '\0' );
int writtenChars =
std::snprintf( &result[0], bufSize, format.data(),
FormatArg<std::decay_t<Args>>::get( std::forward<Args>( args ) )... );
if ( writtenChars < 0 )
return "";
if ( static_cast<std::size_t>( writtenChars ) < bufSize ) {
result.resize( static_cast<std::size_t>( writtenChars ) );
} else {
result.resize( bufSize - 1 );
}
#ifdef __clang__
#pragma clang diagnostic pop
#elif defined( __GNUC__ )
@@ -510,6 +526,11 @@ class EE_API String {
**/
String( const std::string& utf8String );
/** @brief Construct from an UTF-8 string to UTF-32 according
** @param utf8String UTF-8 string to convert
**/
String( const std::basic_string<char8_t>& utf8String );
/** @brief Construct from an UTF-8 string to UTF-32 according
** @param utf8String UTF-8 string to convert
**/

View File

@@ -22,14 +22,14 @@ struct EE_API Glyph {
enum class FontType { TTF, BMF, Sprite };
enum FontHorizontalAlign {
enum FontHorizontalAlign : Uint32 {
TEXT_ALIGN_LEFT = ( 0 << 0 ),
TEXT_ALIGN_RIGHT = ( 1 << 0 ),
TEXT_ALIGN_CENTER = ( 2 << 0 ),
TEXT_HALIGN_MASK = ( 3 << 0 )
};
enum FontVerticalAlign {
enum FontVerticalAlign : Uint32 {
TEXT_ALIGN_TOP = ( 0 << 2 ),
TEXT_ALIGN_BOTTOM = ( 1 << 2 ),
TEXT_ALIGN_MIDDLE = ( 2 << 2 ),

View File

@@ -8,12 +8,11 @@ using namespace EE::Graphics;
namespace EE { namespace UI {
#define UI_HALIGN_LEFT TEXT_ALIGN_LEFT
#define UI_HALIGN_MASK TEXT_HALIGN_MASK
#define UI_VALIGN_TOP TEXT_ALIGN_TOP
#define UI_VALIGN_MASK TEXT_VALIGN_MASK
enum UIFlag {
enum UIFlag : Uint32 {
UI_HALIGN_LEFT = TEXT_ALIGN_LEFT,
UI_VALIGN_TOP = TEXT_ALIGN_TOP,
UI_HALIGN_MASK = TEXT_HALIGN_MASK,
UI_VALIGN_MASK = TEXT_VALIGN_MASK,
UI_HALIGN_RIGHT = TEXT_ALIGN_RIGHT,
UI_HALIGN_CENTER = TEXT_ALIGN_CENTER,
UI_VALIGN_BOTTOM = TEXT_ALIGN_BOTTOM,
@@ -133,10 +132,7 @@ static const Uint32 UI_NODE_DEFAULT_FLAGS =
static const Uint32 UI_NODE_DEFAULT_FLAGS_CENTERED =
UI_ANCHOR_LEFT | UI_ANCHOR_TOP | UI_HALIGN_CENTER | UI_VALIGN_CENTER;
enum class HintDisplay {
Always,
Focus
};
enum class HintDisplay { Always, Focus };
}} // namespace EE::UI

View File

@@ -406,9 +406,9 @@ function build_base_cpp_configuration( package_name )
end
if not is_vs() then
buildoptions{ "-std=c++17" }
buildoptions{ "-std=c++20" }
else
buildoptions{ "/std:c++17", "/utf-8" }
buildoptions{ "/std:c++20", "/utf-8" }
end
set_ios_config()
@@ -510,9 +510,9 @@ function build_link_configuration( package_name, use_ee_icon )
end
if not is_vs() then
buildoptions{ "-std=c++17" }
buildoptions{ "-std=c++20" }
else
buildoptions{ "/std:c++17", "/utf-8", "/bigobj" }
buildoptions{ "/std:c++20", "/utf-8", "/bigobj" }
end
if package_name ~= "eepp" and package_name ~= "eepp-static" then
@@ -976,9 +976,9 @@ function build_eepp( build_name )
end
if not is_vs() then
buildoptions{ "-std=c++17" }
buildoptions{ "-std=c++20" }
else
buildoptions{ "/std:c++17", "/utf-8", "/bigobj" }
buildoptions{ "/std:c++20", "/utf-8", "/bigobj" }
end
if os.is_real("mingw32") or os.is_real("mingw64") or os.is_real("windows") then
@@ -1235,9 +1235,9 @@ solution "eepp"
set_targetdir("libs/" .. os.get_real() .. "/thirdparty/")
includedirs { "src/thirdparty/efsw/include", "src/thirdparty/efsw/src" }
if not is_vs() then
buildoptions{ "-std=c++17" }
buildoptions{ "-std=c++20" }
else
buildoptions{ "/std:c++17" }
buildoptions{ "/std:c++20" }
end
if os.is("windows") then
@@ -1297,9 +1297,9 @@ solution "eepp"
defines { "EE_STATIC" }
end
if not is_vs() then
buildoptions{ "-std=c++17" }
buildoptions{ "-std=c++20" }
else
buildoptions{ "/std:c++17" }
buildoptions{ "/std:c++20" }
end
build_base_cpp_configuration( "eepp-maps-static" )
@@ -1315,9 +1315,9 @@ solution "eepp"
defines { "EE_STATIC" }
end
if not is_vs() then
buildoptions{ "-std=c++17" }
buildoptions{ "-std=c++20" }
else
buildoptions{ "/std:c++17" }
buildoptions{ "/std:c++20" }
end
build_base_cpp_configuration( "eepp-maps" )
postsymlinklib("../libs/" .. os.get_real() .. "/", "../../bin/", "eepp-maps" )
@@ -1330,9 +1330,9 @@ solution "eepp"
files { "src/modules/physics/src/**.cpp", "src/eepp/physics/constraints/*.cpp" }
defines { "EE_PHYSICS_STATIC" }
if not is_vs() then
buildoptions{ "-std=c++17" }
buildoptions{ "-std=c++20" }
else
buildoptions{ "/std:c++17" }
buildoptions{ "/std:c++20" }
end
build_base_cpp_configuration( "eepp-physics-static" )
@@ -1345,9 +1345,9 @@ solution "eepp"
links { "chipmunk-static", "eepp-shared" }
defines { "EE_PHYSICS_EXPORTS" }
if not is_vs() then
buildoptions{ "-std=c++17" }
buildoptions{ "-std=c++20" }
else
buildoptions{ "/std:c++17" }
buildoptions{ "/std:c++20" }
end
build_base_cpp_configuration( "eepp-physics" )
postsymlinklib("../libs/" .. os.get_real() .. "/", "../../bin/", "eepp-physics" )
@@ -1365,9 +1365,9 @@ solution "eepp"
defines { "WINVER=0x0602" }
end
if not is_vs() then
buildoptions{ "-std=c++17" }
buildoptions{ "-std=c++20" }
else
buildoptions{ "/std:c++17" }
buildoptions{ "/std:c++20" }
end
build_base_cpp_configuration( "eterm" )
@@ -1381,9 +1381,9 @@ solution "eepp"
defines { "EE_STATIC" }
end
if not is_vs() then
buildoptions{ "-std=c++17" }
buildoptions{ "-std=c++20" }
else
buildoptions{ "/std:c++17" }
buildoptions{ "/std:c++20" }
end
build_base_cpp_configuration( "languages-syntax-highlighting" )

View File

@@ -144,7 +144,7 @@ function set_kind()
else
kind("WindowedApp")
end
cppdialect "C++17"
cppdialect "C++20"
end
link_list = { }
@@ -290,10 +290,10 @@ function build_base_cpp_configuration( package_name )
end
filter "action:vs*"
buildoptions{ "/std:c++17", "/utf-8" }
buildoptions{ "/std:c++20", "/utf-8" }
filter "action:not vs*"
cppdialect "C++17"
cppdialect "C++20"
buildoptions { "-Wall" }
filter "configurations:debug*"
@@ -380,7 +380,7 @@ function build_link_configuration( package_name, use_ee_icon )
defines { "EE_TEXT_SHAPER_ENABLED" }
end
cppdialect "C++17"
cppdialect "C++20"
set_ios_config()
set_apple_config()
build_arch_configuration()
@@ -412,7 +412,7 @@ function build_link_configuration( package_name, use_ee_icon )
end
filter "action:vs*"
buildoptions{ "/std:c++17", "/utf-8", "/bigobj" }
buildoptions{ "/std:c++20", "/utf-8", "/bigobj" }
filter "action:not vs*"
buildoptions { "-Wall" }
@@ -475,7 +475,7 @@ function build_link_configuration( package_name, use_ee_icon )
end
filter { "action:export-compile-commands", "system:macosx" }
buildoptions { "-std=c++17" }
buildoptions { "-std=c++20" }
filter {}
end
@@ -793,7 +793,7 @@ function build_eepp( build_name )
table.insert( link_list, get_backend_link_name( "freetype" ) )
end
cppdialect "C++17"
cppdialect "C++20"
filter "options:use-frameworks"
defines { "EE_USE_FRAMEWORKS" }
@@ -833,10 +833,10 @@ function build_eepp( build_name )
filter "action:vs*"
incdirs { "src/thirdparty/libzip/vs" }
buildoptions{ "/std:c++17", "/utf-8", "/bigobj" }
buildoptions{ "/std:c++20", "/utf-8", "/bigobj" }
filter { "action:export-compile-commands", "system:macosx" }
buildoptions { "-std=c++17" }
buildoptions { "-std=c++20" }
filter {}
end
@@ -1107,7 +1107,7 @@ workspace "eepp"
project "efsw-static"
kind "StaticLib"
language "C++"
cppdialect "C++17"
cppdialect "C++20"
incdirs { "src/thirdparty/efsw/include", "src/thirdparty/efsw/src" }
files { "src/thirdparty/efsw/src/efsw/*.cpp" }
build_base_cpp_configuration( "efsw" )
@@ -1153,7 +1153,7 @@ workspace "eepp"
project "eepp-maps-static"
kind "StaticLib"
language "C++"
cppdialect "C++17"
cppdialect "C++20"
incdirs { "include", "src/modules/maps/include/","src/modules/maps/src/" }
files { "src/modules/maps/src/**.cpp" }
defines { "EE_MAPS_STATIC" }
@@ -1168,7 +1168,7 @@ workspace "eepp"
project "eepp-maps"
kind "SharedLib"
language "C++"
cppdialect "C++17"
cppdialect "C++20"
incdirs { "include", "src/modules/maps/include/","src/modules/maps/src/" }
files { "src/modules/maps/src/**.cpp" }
links { "eepp-shared" }
@@ -1182,7 +1182,7 @@ workspace "eepp"
project "eepp-physics-static"
kind "StaticLib"
language "C++"
cppdialect "C++17"
cppdialect "C++20"
incdirs { "include", "src/modules/physics/include/","src/modules/physics/src/" }
files { "src/modules/physics/src/**.cpp", "src/eepp/physics/constraints/*.cpp" }
defines { "EE_PHYSICS_STATIC" }
@@ -1197,7 +1197,7 @@ workspace "eepp"
project "eepp-physics"
kind "SharedLib"
language "C++"
cppdialect "C++17"
cppdialect "C++20"
incdirs { "include", "src/modules/physics/include/","src/modules/physics/src/" }
files { "src/modules/physics/src/**.cpp", "src/eepp/physics/constraints/*.cpp" }
links { "chipmunk-static", "eepp-shared" }
@@ -1211,7 +1211,7 @@ workspace "eepp"
project "eterm-static"
kind "StaticLib"
language "C++"
cppdialect "C++17"
cppdialect "C++20"
incdirs { "include", "src/modules/eterm/include/","src/modules/eterm/src/" }
files { "src/modules/eterm/src/**.cpp" }
if _OPTIONS["with-static-eepp"] then
@@ -1225,12 +1225,12 @@ workspace "eepp"
filter "action:not vs*"
buildoptions { "-Wall" }
filter { "action:export-compile-commands", "system:macosx" }
buildoptions { "-std=c++17" }
buildoptions { "-std=c++20" }
project "languages-syntax-highlighting-static"
kind "StaticLib"
language "C++"
cppdialect "C++17"
cppdialect "C++20"
incdirs { "include", "src/modules/languages-syntax-highlighting/src" }
files { "src/modules/languages-syntax-highlighting/src/**.cpp" }
if _OPTIONS["with-static-eepp"] then
@@ -1241,7 +1241,7 @@ workspace "eepp"
filter "action:not vs*"
buildoptions { "-Wall" }
filter { "action:export-compile-commands", "system:macosx" }
buildoptions { "-std=c++17" }
buildoptions { "-std=c++20" }
-- Library
if not _OPTIONS["disable-static-build"] then

View File

@@ -1484,6 +1484,19 @@ String::String( const std::string& utf8String ) {
Utf8::toUtf32( utf8String.begin() + skip, utf8String.end(), std::back_inserter( mString ) );
}
String::String( const std::basic_string<char8_t>& utf8String ) {
mString.reserve( utf8String.length() + 1 );
int skip = 0;
// Skip BOM
if ( utf8String.size() >= 3 && (char8_t)0xef == utf8String[0] &&
(char8_t)0xbb == utf8String[1] && (char8_t)0xbf == utf8String[2] ) {
skip = 3;
}
Utf8::toUtf32( utf8String.begin() + skip, utf8String.end(), std::back_inserter( mString ) );
}
String::String( const std::string_view& utf8String ) {
mString.reserve( utf8String.length() + 1 );

View File

@@ -147,9 +147,13 @@ void TextureAtlasLoader::loadFromStream( IOStream& IOS ) {
if ( !mSkipResourceLoad && NULL == tTex ) {
if ( NULL != mPack ) {
mRL.add( [=] { TextureFactory::instance()->loadFromPack( mPack, path ); } );
mRL.add( [this, path = std::move( path )] {
TextureFactory::instance()->loadFromPack( mPack, path );
} );
} else {
mRL.add( [=] { TextureFactory::instance()->loadFromFile( path ); } );
mRL.add( [path = std::move( path )] {
TextureFactory::instance()->loadFromFile( path );
} );
}
}

View File

@@ -329,7 +329,7 @@ size_t Process::readAll( std::string& buffer, bool readErr, Time timeout ) {
int res = poll( &pollfd, static_cast<nfds_t>( 1 ), 100 );
if ( res <= 0 ) {
if ( ( timeout != Time::Zero && clock.getElapsedTime() >= timeout ) ||
( res < 0 && errno != EINTR ) )
( res < 0 && errno != EINTR ) || !isAlive() )
break;
continue;
}

View File

@@ -1,3 +1,4 @@
#include <eepp/system/log.hpp>
#include <eepp/system/regex.hpp>
#include <pcre2.h>
@@ -54,9 +55,9 @@ RegEx::RegEx( const std::string_view& pattern, Options options, bool useCache )
PCRE2_UCHAR buffer[256];
pcre2_get_error_message( errornumber, buffer, sizeof( buffer ) );
mValid = false;
// throw std::runtime_error( "PCRE2 compilation failed at offset " +
// std::to_string( erroroffset ) + ": " +
// reinterpret_cast<const char*>( buffer ) );
Log::debug( "PCRE2 compilation failed at offset " + std::to_string( erroroffset ) + ": " +
reinterpret_cast<const char*>( buffer ) );
return;
}
#if EE_PLATFORM != EE_PLATFORM_EMSCRIPTEN
@@ -66,8 +67,7 @@ RegEx::RegEx( const std::string_view& pattern, Options options, bool useCache )
int rc = pcre2_pattern_info( reinterpret_cast<pcre2_code*>( mCompiledPattern ),
PCRE2_INFO_CAPTURECOUNT, &mCaptureCount );
if ( rc != 0 ) {
// throw std::runtime_error( "PCRE2 pattern info failed with error code " +
// std::to_string( rc ) );
Log::debug( "PCRE2 pattern info failed with error code " + std::to_string( rc ) );
mValid = false;
} else if ( useCache && RegExCache::instance()->isEnabled() ) {
RegExCache::instance()->insert( pattern, options, mCompiledPattern );

View File

@@ -94,6 +94,7 @@ void addCPP() {
{ "bitor", "keyword" }, { "thread_local", "keyword" },
{ "uint64_t", "keyword2" }, { "char32_t", "keyword2" },
{ "alignas", "keyword" }, { "export", "keyword" },
{ "ssize_t", "keyword2" },
{ "#if", "keyword" }, { "#ifdef", "keyword" },
{ "#ifndef", "keyword" }, { "#else", "keyword" },

View File

@@ -626,7 +626,8 @@ bool TextDocument::loadAsyncFromURL( const std::string& url,
mLoadingAsync = true;
Http::getAsync(
[=]( const Http&, Http::Request&, Http::Response& response ) {
[this, onLoaded = std::move( onLoaded ),
uri = std::move( uri )]( const Http&, Http::Request&, Http::Response& response ) {
if ( response.getStatus() <= Http::Response::Ok ) {
std::string path( getTempPathFromURI( uri ) );
FileSystem::fileWrite( path, (const Uint8*)response.getBody().c_str(),
@@ -2959,7 +2960,7 @@ TextDocument::SearchResults TextDocument::findAll( const String& text, bool case
do {
found = find( text, from, caseSensitive, wholeWord, type, restrictRange );
if ( found.isValid() ) {
if ( !all.empty() && all.back() == found )
if ( !all.empty() && all.back().operator==(found) )
break;
from = found.result.end();
all.push_back( found );

View File

@@ -202,7 +202,7 @@ bool FileSystemModel::Node::refresh( const FileSystemModel& model ) {
auto files = FileSystem::filesInfoGetInPath(
mInfo.getFilepath(), false, displayCfg.sortByName, displayCfg.foldersFirst,
displayCfg.ignoreHidden,
[&model] { return model.mShutingDown.load( std::memory_order::memory_order_relaxed ); } );
[&model] { return model.mShutingDown.load( std::memory_order_relaxed ); } );
std::vector<Node*> newChildren;
Node* node = nullptr;
@@ -263,7 +263,7 @@ bool FileSystemModel::Node::traverseIfNeeded( const FileSystemModel& model ) {
auto files = FileSystem::filesInfoGetInPath(
mInfo.getFilepath(), false, displayCfg.sortByName, displayCfg.foldersFirst,
displayCfg.ignoreHidden,
[&model] { return model.mShutingDown.load( std::memory_order::memory_order_relaxed ); } );
[&model] { return model.mShutingDown.load( std::memory_order_relaxed ); } );
const auto& patterns = displayCfg.acceptedExtensions;
bool accepted;

View File

@@ -899,12 +899,13 @@ void UITextView::updateTextOverflow() {
}
UITextView* UITextView::setTextOverflow( const std::string_view& textOverflow ) {
static String EllipsisChar( u8""s ); // U+2026
if ( textOverflow == mTextOverflow ||
( mTextOverflow == u8"" && textOverflow == "ellipsis"sv ) )
( mTextOverflow == EllipsisChar && textOverflow == "ellipsis"sv ) )
return this;
if ( "ellipsis"sv == textOverflow ) {
mTextOverflow = u8""; // U+2026
mTextOverflow = EllipsisChar;
} else {
mTextOverflow = textOverflow;
}

View File

@@ -5,39 +5,41 @@ namespace EE { namespace UI { namespace Doc { namespace Language {
void addV1() {
auto& sd = SyntaxDefinitionManager::instance()
->add( { "V1",
{ "%.v1$" },
{
{ { "<%s*[sS][cC][rR][iI][pP][tT]%s+[tT][yY][pP][eE]%s*=%s*['\"]%a+/"
"[jJ][aA][vV][aA][sS][cC][rR][iI][pP][tT]['\"]%s*>",
"<%s*/[sS][cC][rR][iI][pP][tT]>" },
"function",
"JavaScript" },
{ { "<%s*[sS][cC][rR][iI][pP][tT]%s*>", "<%s*/%s*[sS][cC][rR][iI][pP][tT]>" },
"function",
"JavaScript" },
{ { "<%s*[sS][tT][yY][lL][eE][^>]*>", "<%s*/%s*[sS][tT][yY][lL][eE]%s*>" },
"function",
"CSS" },
{ { "<%?v?1?", "%?>" }, "function", "V1Core" },
{ { "<!%-%-", "%-%->" }, "comment" },
{ { "%f[^>][^<]", "%f[<]" }, "normal" },
{ { "\"", "\"", "\\" }, "string" },
{ { "'", "'", "\\" }, "string" },
{ { "0x[%da-fA-F]+" }, "number" },
{ { "-?%d+[%d%.]*f?" }, "number" },
{ { "-?%.?%d+f?" }, "number" },
{ { "%f[^<]![%a_][%w%_%-]*" }, "keyword2" },
{ { "%f[^<][%a_][%w%_%-]*" }, "function" },
{ { "%f[^<]/[%a_][%w%_%-]*" }, "function" },
{ { "[%a_][%w_]*" }, "keyword" },
{ { "[/<>=]" }, "operator" },
},
{},
"",
{ "^#!.*[ /]v1" } } )
.setAutoCloseXMLTags( true );
auto& sd =
SyntaxDefinitionManager::instance()
->add(
{ "V1",
{ "%.v1$" },
{
{ { "<%s*[sS][cC][rR][iI][pP][tT]%s+[tT][yY][pP][eE]%s*=%s*['\"]%a+/"
"[jJ][aA][vV][aA][sS][cC][rR][iI][pP][tT]['\"]%s*>",
"<%s*/[sS][cC][rR][iI][pP][tT]>" },
"function",
"JavaScript" },
{ { "<%s*[sS][cC][rR][iI][pP][tT]%s*>", "<%s*/%s*[sS][cC][rR][iI][pP][tT]>" },
"function",
"JavaScript" },
{ { "<%s*[sS][tT][yY][lL][eE][^>]*>", "<%s*/%s*[sS][tT][yY][lL][eE]%s*>" },
"function",
"CSS" },
{ { "<%?v?1?", "%?>" }, "function", "V1Core" },
{ { "<!%-%-", "%-%->" }, "comment" },
{ { "%f[^>][^<]", "%f[<]" }, "normal" },
{ { "\"", "\"", "\\" }, "string" },
{ { "'", "'", "\\" }, "string" },
{ { "0x[%da-fA-F]+" }, "number" },
{ { "-?%d+[%d%.]*f?" }, "number" },
{ { "-?%.?%d+f?" }, "number" },
{ { "%f[^<]![%a_][%w%_%-]*" }, "keyword2" },
{ { "%f[^<][%a_][%w%_%-]*" }, "function" },
{ { "%f[^<]/[%a_][%w%_%-]*" }, "function" },
{ { "[%a_][%w_]*" }, "keyword" },
{ { "[/<>=]" }, "operator" },
},
{},
"",
{ "^#!.*[ /]v1" } } )
.setAutoCloseXMLTags( true );
SyntaxDefinitionManager::instance()
->add( { "V1Core",
@@ -54,50 +56,24 @@ void addV1() {
{ { "-?%d+[%d%.eE]*" }, "number" },
{ { "-?%.?%d+" }, "number" },
{ { "[%.%+%-=/%*%^%%<>!~|&]" }, "operator" },
{ { "[%a_][%w_]*%f[(]" }, "function" },
{ { "(if|for|while|foreach|switch)\\s*(?=\\()" },
{ "normal", "keyword", "keyword" },
"",
SyntaxPatternMatchType::RegEx },
{ { "[%a_][%w_]*%s*%f[(]" }, "function" },
{ { "[%a_][%w_]*" }, "symbol" },
},
{ { "return", "keyword" }, { "if", "keyword" },
{ "else", "keyword" }, { "elseif", "keyword" },
{ "endif", "keyword" }, { "declare", "keyword" },
{ "enddeclare", "keyword" }, { "switch", "keyword" },
{ "endswitch", "keyword" }, { "as", "keyword" },
{ "do", "keyword" }, { "for", "keyword" },
{ "endfor", "keyword" }, { "foreach", "keyword" },
{ "endforeach", "keyword" }, { "while", "keyword" },
{ "endwhile", "keyword" }, { "switch", "keyword" },
{ "case", "keyword" }, { "continue", "keyword" },
{ "default", "keyword" }, { "break", "keyword" },
{ "exit", "keyword" }, { "goto", "keyword" },
{
{ "catch", "keyword" }, { "throw", "keyword" },
{ "try", "keyword" }, { "finally", "keyword" },
{ "return", "keyword" }, { "if", "keyword" }, { "else", "keyword" },
{ "as", "keyword" }, { "do", "keyword" }, { "for", "keyword" },
{ "foreach", "keyword" }, { "while", "keyword" }, { "switch", "keyword" },
{ "case", "keyword" }, { "continue", "keyword" }, { "default", "keyword" },
{ "break", "keyword" }, { "exit", "keyword" }, { "function", "keyword" },
{ "global", "keyword" }, { "const", "keyword" }, { "true", "literal" },
{ "false", "literal" }, { "null", "literal" },
{ "class", "keyword" }, { "trait", "keyword" },
{ "interface", "keyword" }, { "public", "keyword" },
{ "static", "keyword" }, { "protected", "keyword" },
{ "private", "keyword" }, { "abstract", "keyword" },
{ "final", "keyword" },
{ "function", "keyword2" }, { "global", "keyword2" },
{ "var", "keyword2" }, { "const", "keyword2" },
{ "bool", "keyword2" }, { "boolean", "keyword2" },
{ "int", "keyword2" }, { "integer", "keyword2" },
{ "real", "keyword2" }, { "double", "keyword2" },
{ "float", "keyword2" }, { "string", "keyword2" },
{ "array", "keyword2" }, { "object", "keyword2" },
{ "callable", "keyword2" }, { "iterable", "keyword2" },
{ "namespace", "keyword2" }, { "extends", "keyword2" },
{ "implements", "keyword2" }, { "instanceof", "keyword2" },
{ "require", "keyword2" }, { "require_once", "keyword2" },
{ "include", "keyword2" }, { "include_once", "keyword2" },
{ "use", "keyword2" }, { "new", "keyword2" },
{ "clone", "keyword2" },
{ "true", "literal" }, { "false", "literal" },
{ "NULL", "literal" }, { "parent", "literal" },
{ "self", "literal" }, { "echo", "function" } },
},
"//",
{},
"v1" } )

View File

@@ -1375,7 +1375,9 @@ void EETest::loadTextures() {
std::string name( files[i] );
if ( "jpg" == FileSystem::fileExtension( name ) ) {
mResLoad.add( [=] { TextureFactory::instance()->loadFromPack( PakTest, name ); } );
mResLoad.add( [this, name = std::move( name )] {
TextureFactory::instance()->loadFromPack( PakTest, name );
} );
}
}
#endif

View File

@@ -1669,7 +1669,7 @@ static int nsvg__parseRotate(float* xform, const char* str)
static void nsvg__parseTransform(float* xform, const char* str)
{
float t[6];
float t[6] = { 0, 0, 0, 0, 0, 0 };
int len;
nsvg__xformIdentity(xform);
while (*str)

View File

@@ -3549,7 +3549,7 @@ void App::init( const LogLevel& logLevel, std::string file, const Float& pidelDe
mThreadPool->run( [this] {
// Load language definitions
Clock defClock;
SyntaxDefinitionManager::createSingleton( 118 );
SyntaxDefinitionManager::createSingleton( 119 );
Language::LanguagesSyntaxHighlighting::load();
SyntaxDefinitionManager::instance()->setLanguageExtensionsPriority(
mConfig.languagesExtensions.priorities );

View File

@@ -2090,7 +2090,8 @@ void DebuggerPlugin::run( const std::string& debugger, ProtocolSettings&& protoc
std::function<void( int )> doneFn ) {
if ( !FileSystem::fileExists( cmd ) )
cmd = FileSystem::fileNameFromPath( cmd );
getUISceneNode()->runOnMainThread( [=] {
getUISceneNode()->runOnMainThread( [this, isIntegrated, cmd = std::move( cmd ), cwd, args,
doneFn = std::move( doneFn )] {
if ( isIntegrated ) {
UITerminal* term =
getPluginContext()->getTerminalManager()->createTerminalInSplitter(

View File

@@ -2,6 +2,8 @@
#include "ecode.hpp"
#include "version.hpp"
using namespace std::string_literals;
namespace ecode {
void SettingsActions::checkForUpdatesResponse( Http::Response response, bool fromStartup ) {
@@ -206,11 +208,11 @@ void SettingsActions::setIndentTabCharacter() {
UIComboBox* comboBox = msgBox->getComboBox();
UIListBox* listBox = msgBox->getComboBox()->getDropDownList()->getListBox();
listBox->addClass( "indent_tab_listbox_item" );
listBox->addListBoxItems( { u8"»", u8"", u8"", u8"", u8"", u8"" } );
listBox->addListBoxItems( { u8"»"s, u8""s, u8""s, u8""s, u8""s, u8""s } );
msgBox->getComboBox()->setText(
String::fromUtf8( mApp->getConfig().editor.tabIndentCharacter.empty()
? u8"»"
: mApp->getConfig().editor.tabIndentCharacter ) );
mApp->getConfig().editor.tabIndentCharacter.empty()
? String( u8"»"s )
: String::fromUtf8( mApp->getConfig().editor.tabIndentCharacter ) );
msgBox->showWhenReady();
comboBox->on( Event::OnValueChange, [this, comboBox]( const Event* ) {
if ( comboBox->getText().size() != 1 )