mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-13 00:04:19 +00:00
Resave all projects
This commit is contained in:
parent
4e2a8cc6c4
commit
8efadd14bb
42 changed files with 1035 additions and 99 deletions
|
|
@ -8542,11 +8542,11 @@ static const unsigned char temp_binary_data_66[] =
|
|||
"\r\n"
|
||||
"#include <dlfcn.h>\r\n"
|
||||
"\r\n"
|
||||
"int main (int argc, const char** argv)\r\n"
|
||||
"int main (int argc, const char* const* argv)\r\n"
|
||||
"{\r\n"
|
||||
" if (argc >= 3)\r\n"
|
||||
" if (auto* handle = dlopen (argv[1], RTLD_LAZY))\r\n"
|
||||
" if (auto* function = reinterpret_cast<int (*) (int, const char**)> (dlsym (handle, argv[2])))\r\n"
|
||||
" if (auto* function = reinterpret_cast<int (*) (int, const char* const*)> (dlsym (handle, argv[2])))\r\n"
|
||||
" return function (argc - 3, argv + 3);\r\n"
|
||||
"\r\n"
|
||||
" return 1;\r\n"
|
||||
|
|
@ -8581,64 +8581,150 @@ static const unsigned char temp_binary_data_67[] =
|
|||
" ==============================================================================\r\n"
|
||||
"*/\r\n"
|
||||
"\r\n"
|
||||
"#include <sys/stat.h>\r\n"
|
||||
"#include <unistd.h>\r\n"
|
||||
"\r\n"
|
||||
"#include <algorithm>\r\n"
|
||||
"#include <cstdint>\r\n"
|
||||
"#include <filesystem>\r\n"
|
||||
"#include <fstream>\r\n"
|
||||
"#include <iomanip>\r\n"
|
||||
"#include <iostream>\r\n"
|
||||
"#include <optional>\r\n"
|
||||
"#include <vector>\r\n"
|
||||
"\r\n"
|
||||
"namespace fs = std::filesystem;\r\n"
|
||||
"//==============================================================================\r\n"
|
||||
"struct FileHelpers\r\n"
|
||||
"{\r\n"
|
||||
" static std::string getCurrentWorkingDirectory()\r\n"
|
||||
" {\r\n"
|
||||
" std::vector<char> buffer (1024);\r\n"
|
||||
"\r\n"
|
||||
" while (getcwd (buffer.data(), buffer.size() - 1) == nullptr && errno == ERANGE)\r\n"
|
||||
" buffer.resize (buffer.size() * 2 / 3);\r\n"
|
||||
"\r\n"
|
||||
" return { buffer.data() };\r\n"
|
||||
" }\r\n"
|
||||
"\r\n"
|
||||
" static bool endsWith (const std::string& s, char c)\r\n"
|
||||
" {\r\n"
|
||||
" if (s.length() == 0)\r\n"
|
||||
" return false;\r\n"
|
||||
"\r\n"
|
||||
" return *s.rbegin() == c;\r\n"
|
||||
" };\r\n"
|
||||
"\r\n"
|
||||
" static std::string appendedPaths (const std::string& first, const std::string& second)\r\n"
|
||||
" {\r\n"
|
||||
" return endsWith (first, '/') ? first + second : first + \"/\" + second;\r\n"
|
||||
" }\r\n"
|
||||
"\r\n"
|
||||
" static bool exists (const std::string& path)\r\n"
|
||||
" {\r\n"
|
||||
" return ! path.empty() && access (path.c_str(), F_OK) == 0;\r\n"
|
||||
" }\r\n"
|
||||
"\r\n"
|
||||
" static bool deleteFile (const std::string& path)\r\n"
|
||||
" {\r\n"
|
||||
" if (! exists (path))\r\n"
|
||||
" return true;\r\n"
|
||||
"\r\n"
|
||||
" return remove (path.c_str()) == 0;\r\n"
|
||||
" }\r\n"
|
||||
"\r\n"
|
||||
" static std::string getFilename (const std::string& path)\r\n"
|
||||
" {\r\n"
|
||||
" return { std::find_if (path.rbegin(), path.rend(), [] (auto c) { return c == '/'; }).base(),\r\n"
|
||||
" path.end() };\r\n"
|
||||
" }\r\n"
|
||||
"\r\n"
|
||||
" static bool isDirectory (const std::string& path)\r\n"
|
||||
" {\r\n"
|
||||
" struct stat64 info;\r\n"
|
||||
"\r\n"
|
||||
" return ! path.empty()\r\n"
|
||||
" && stat64 (path.c_str(), &info) == 0\r\n"
|
||||
" && ((info.st_mode & S_IFDIR) != 0);\r\n"
|
||||
" }\r\n"
|
||||
"\r\n"
|
||||
" static std::string getParentDirectory (const std::string& path)\r\n"
|
||||
" {\r\n"
|
||||
" std::string p { path.begin(),\r\n"
|
||||
" std::find_if (path.rbegin(),\r\n"
|
||||
" path.rend(),\r\n"
|
||||
" [] (auto c) { return c == '/'; }).base() };\r\n"
|
||||
"\r\n"
|
||||
" // Trim the ending slash, but only if not root\r\n"
|
||||
" if (endsWith (p, '/') && p.length() > 1)\r\n"
|
||||
" return { p.begin(), p.end() - 1 };\r\n"
|
||||
"\r\n"
|
||||
" return p;\r\n"
|
||||
" }\r\n"
|
||||
"\r\n"
|
||||
" static bool createDirectory (const std::string& path)\r\n"
|
||||
" {\r\n"
|
||||
" if (isDirectory (path))\r\n"
|
||||
" return true;\r\n"
|
||||
"\r\n"
|
||||
" const auto parentDir = getParentDirectory (path);\r\n"
|
||||
"\r\n"
|
||||
" if (path == parentDir)\r\n"
|
||||
" return false;\r\n"
|
||||
"\r\n"
|
||||
" if (createDirectory (parentDir))\r\n"
|
||||
" return mkdir (path.c_str(), 0777) != -1;\r\n"
|
||||
"\r\n"
|
||||
" return false;\r\n"
|
||||
" }\r\n"
|
||||
"};\r\n"
|
||||
"\r\n"
|
||||
"//==============================================================================\r\n"
|
||||
"namespace StringHelpers\r\n"
|
||||
"struct StringHelpers\r\n"
|
||||
"{\r\n"
|
||||
" static bool isQuoteCharacter (char c)\r\n"
|
||||
" {\r\n"
|
||||
" return c == '\"' || c == '\\'';\r\n"
|
||||
" }\r\n"
|
||||
"\r\n"
|
||||
"static bool isQuoteCharacter (char c)\r\n"
|
||||
"{\r\n"
|
||||
" return c == '\"' || c == '\\'';\r\n"
|
||||
"}\r\n"
|
||||
" static std::string unquoted (const std::string& str)\r\n"
|
||||
" {\r\n"
|
||||
" if (str.length() == 0 || (! isQuoteCharacter (str[0])))\r\n"
|
||||
" return str;\r\n"
|
||||
"\r\n"
|
||||
"static std::string unquoted (const std::string& str)\r\n"
|
||||
"{\r\n"
|
||||
" if (str.length() == 0 || (! isQuoteCharacter (str[0])))\r\n"
|
||||
" return str;\r\n"
|
||||
" return str.substr (1, str.length() - (isQuoteCharacter (str[str.length() - 1]) ? 1 : 0));\r\n"
|
||||
" }\r\n"
|
||||
"\r\n"
|
||||
" return str.substr (1, str.length() - (isQuoteCharacter (str[str.length() - 1]) ? 1 : 0));\r\n"
|
||||
"}\r\n"
|
||||
" static void ltrim (std::string& s)\r\n"
|
||||
" {\r\n"
|
||||
" s.erase (s.begin(), std::find_if (s.begin(), s.end(), [] (int c) { return ! std::isspace (c); }));\r\n"
|
||||
" }\r\n"
|
||||
"\r\n"
|
||||
"static void ltrim (std::string& s)\r\n"
|
||||
"{\r\n"
|
||||
" s.erase (s.begin(), std::find_if (s.begin(), s.end(), [] (int c) { return ! std::isspace (c); }));\r\n"
|
||||
"}\r\n"
|
||||
" static void rtrim (std::string& s)\r\n"
|
||||
" {\r\n"
|
||||
" s.erase (std::find_if (s.rbegin(), s.rend(), [] (int c) { return ! std::isspace (c); }).base(), s.end());\r\n"
|
||||
" }\r\n"
|
||||
"\r\n"
|
||||
"static void rtrim (std::string& s)\r\n"
|
||||
"{\r\n"
|
||||
" s.erase (std::find_if (s.rbegin(), s.rend(), [] (int c) { return ! std::isspace (c); }).base(), s.end());\r\n"
|
||||
"}\r\n"
|
||||
" static std::string trimmed (const std::string& str)\r\n"
|
||||
" {\r\n"
|
||||
" auto result = str;\r\n"
|
||||
" ltrim (result);\r\n"
|
||||
" rtrim (result);\r\n"
|
||||
" return result;\r\n"
|
||||
" }\r\n"
|
||||
"\r\n"
|
||||
"static std::string trimmed (const std::string& str)\r\n"
|
||||
"{\r\n"
|
||||
" auto result = str;\r\n"
|
||||
" ltrim (result);\r\n"
|
||||
" rtrim (result);\r\n"
|
||||
" return result;\r\n"
|
||||
"}\r\n"
|
||||
"\r\n"
|
||||
"static std::string replaced (const std::string& str, char charToReplace, char replaceWith)\r\n"
|
||||
"{\r\n"
|
||||
" auto result = str;\r\n"
|
||||
" std::replace( result.begin(), result.end(), charToReplace, replaceWith);\r\n"
|
||||
" return result;\r\n"
|
||||
"}\r\n"
|
||||
"\r\n"
|
||||
"}\r\n"
|
||||
" static std::string replaced (const std::string& str, char charToReplace, char replaceWith)\r\n"
|
||||
" {\r\n"
|
||||
" auto result = str;\r\n"
|
||||
" std::replace (result.begin(), result.end(), charToReplace, replaceWith);\r\n"
|
||||
" return result;\r\n"
|
||||
" }\r\n"
|
||||
"};\r\n"
|
||||
"\r\n"
|
||||
"//==============================================================================\r\n"
|
||||
"static bool addFile (const fs::path& filePath,\r\n"
|
||||
"static bool addFile (const std::string& filePath,\r\n"
|
||||
" const std::string& binaryNamespace,\r\n"
|
||||
" std::ofstream& headerStream,\r\n"
|
||||
" std::ofstream& cppStream)\r\n"
|
||||
" std::ofstream& cppStream,\r\n"
|
||||
" bool verbose)\r\n"
|
||||
"{\r\n"
|
||||
" std::ifstream fileStream (filePath, std::ios::in | std::ios::binary | std::ios::ate);\r\n"
|
||||
"\r\n"
|
||||
|
|
@ -8652,17 +8738,20 @@ static const unsigned char temp_binary_data_67[] =
|
|||
" fileStream.seekg (0);\r\n"
|
||||
" fileStream.read (buffer.data(), static_cast<std::streamsize> (buffer.size()));\r\n"
|
||||
"\r\n"
|
||||
" const auto variableName = StringHelpers::replaced (StringHelpers::replaced (filePath.filename().string(),\r\n"
|
||||
" const auto variableName = StringHelpers::replaced (StringHelpers::replaced (FileHelpers::getFilename (filePath),\r\n"
|
||||
" ' ',\r\n"
|
||||
" '_'),\r\n"
|
||||
" '.',\r\n"
|
||||
" '_');\r\n"
|
||||
"\r\n"
|
||||
" std::cout << \"Adding \" << variableName << \": \"\r\n"
|
||||
" << buffer.size() << \" bytes\" << std::endl;\r\n"
|
||||
" if (verbose)\r\n"
|
||||
" {\r\n"
|
||||
" std::cout << \"Adding \" << variableName << \": \"\r\n"
|
||||
" << buffer.size() << \" bytes\" << std::endl;\r\n"
|
||||
" }\r\n"
|
||||
"\r\n"
|
||||
" headerStream << \" extern const char* \" << variableName << \";\\r\\n\"\r\n"
|
||||
" \" const int \" << variableName << \"Size = \"\r\n"
|
||||
" headerStream << \" extern const char* \" << variableName << \";\" << std::endl\r\n"
|
||||
" << \" const int \" << variableName << \"Size = \"\r\n"
|
||||
" << buffer.size() << \";\" << std::endl;\r\n"
|
||||
"\r\n"
|
||||
" cppStream << \"static const unsigned char temp0[] = {\";\r\n"
|
||||
|
|
@ -8671,10 +8760,10 @@ static const unsigned char temp_binary_data_67[] =
|
|||
"\r\n"
|
||||
" for (size_t i = 0; i < buffer.size() - 1; ++i)\r\n"
|
||||
" {\r\n"
|
||||
" if ((i % 40) != 39)\r\n"
|
||||
" cppStream << (int) data[i] << \",\";\r\n"
|
||||
" else\r\n"
|
||||
" cppStream << (int) data[i] << \",\" << std::endl << \" \";\r\n"
|
||||
" cppStream << (int) data[i] << \",\";\r\n"
|
||||
"\r\n"
|
||||
" if ((i % 40) == 39)\r\n"
|
||||
" cppStream << std::endl << \" \";\r\n"
|
||||
" }\r\n"
|
||||
"\r\n"
|
||||
" cppStream << (int) data[buffer.size() - 1] << \",0,0};\" << std::endl;\r\n"
|
||||
|
|
@ -8685,23 +8774,84 @@ static const unsigned char temp_binary_data_67[] =
|
|||
"}\r\n"
|
||||
"\r\n"
|
||||
"//==============================================================================\r\n"
|
||||
"class Arguments\r\n"
|
||||
"{\r\n"
|
||||
"public:\r\n"
|
||||
" enum class PositionalArguments\r\n"
|
||||
" {\r\n"
|
||||
" sourceFile = 0,\r\n"
|
||||
" targetDirectory,\r\n"
|
||||
" targetFilename,\r\n"
|
||||
" binaryNamespace\r\n"
|
||||
" };\r\n"
|
||||
"\r\n"
|
||||
" static std::optional<Arguments> create (int argc, char* argv[])\r\n"
|
||||
" {\r\n"
|
||||
" std::vector<std::string> arguments;\r\n"
|
||||
" bool verbose = false;\r\n"
|
||||
"\r\n"
|
||||
" for (int i = 1; i < argc; ++i)\r\n"
|
||||
" {\r\n"
|
||||
" std::string arg { argv[i] };\r\n"
|
||||
"\r\n"
|
||||
" if (arg == \"-v\" || arg == \"--verbose\")\r\n"
|
||||
" verbose = true;\r\n"
|
||||
" else\r\n"
|
||||
" arguments.emplace_back (std::move (arg));\r\n"
|
||||
" }\r\n"
|
||||
"\r\n"
|
||||
" if (arguments.size() != static_cast<size_t> (PositionalArguments::binaryNamespace) + 1)\r\n"
|
||||
" return std::nullopt;\r\n"
|
||||
"\r\n"
|
||||
" return Arguments { std::move (arguments), verbose };\r\n"
|
||||
" }\r\n"
|
||||
"\r\n"
|
||||
" std::string get (PositionalArguments argument) const\r\n"
|
||||
" {\r\n"
|
||||
" return arguments[static_cast<size_t> (argument)];\r\n"
|
||||
" }\r\n"
|
||||
"\r\n"
|
||||
" bool isVerbose() const\r\n"
|
||||
" {\r\n"
|
||||
" return verbose;\r\n"
|
||||
" }\r\n"
|
||||
"\r\n"
|
||||
"private:\r\n"
|
||||
" Arguments (std::vector<std::string> args, bool verboseIn)\r\n"
|
||||
" : arguments (std::move (args)), verbose (verboseIn)\r\n"
|
||||
" {\r\n"
|
||||
" }\r\n"
|
||||
"\r\n"
|
||||
" std::vector<std::string> arguments;\r\n"
|
||||
" bool verbose = false;\r\n"
|
||||
"};\r\n"
|
||||
"\r\n"
|
||||
"//==============================================================================\r\n"
|
||||
"int main (int argc, char* argv[])\r\n"
|
||||
"{\r\n"
|
||||
" if (argc != 5)\r\n"
|
||||
" const auto arguments = Arguments::create (argc, argv);\r\n"
|
||||
"\r\n"
|
||||
" if (! arguments.has_value())\r\n"
|
||||
" {\r\n"
|
||||
" std::cout << \" Usage: SimpleBinaryBuilder sourcefile targetdirectory targetfilename namespace\\n\\n\"\r\n"
|
||||
" \" SimpleBinaryBuilder will encode the provided source file into\\n\"\r\n"
|
||||
" \" two files called (targetfilename).cpp and (targetfilename).h,\\n\"\r\n"
|
||||
" \" which it will write into the specified target directory.\\n\"\r\n"
|
||||
" \" The target directory will be automatically created if necessary. The binary\"\r\n"
|
||||
" \" resource will be available in the given namespace.\\n\\n\";\r\n"
|
||||
" std::cout << \" Usage: SimpleBinaryBuilder [-v | --verbose] sourcefile targetdirectory targetfilename namespace\"\r\n"
|
||||
" << std::endl << std::endl\r\n"
|
||||
" << \" SimpleBinaryBuilder will encode the provided source file into\" << std::endl\r\n"
|
||||
" << \" two files called (targetfilename).cpp and (targetfilename).h,\" << std::endl\r\n"
|
||||
" << \" which it will write into the specified target directory.\" << std::endl\r\n"
|
||||
" << \" The target directory will be automatically created if necessary. The binary\" << std::endl\r\n"
|
||||
" << \" resource will be available in the given namespace.\" << std::endl << std::endl;\r\n"
|
||||
"\r\n"
|
||||
" return 0;\r\n"
|
||||
" }\r\n"
|
||||
"\r\n"
|
||||
" const auto sourceFile = fs::current_path() / StringHelpers::unquoted (std::string (argv[1]));\r\n"
|
||||
" const auto currentWorkingDirectory = FileHelpers::getCurrentWorkingDirectory();\r\n"
|
||||
"\r\n"
|
||||
" if (! fs::exists (sourceFile))\r\n"
|
||||
" using ArgType = Arguments::PositionalArguments;\r\n"
|
||||
"\r\n"
|
||||
" const auto sourceFile = FileHelpers::appendedPaths (currentWorkingDirectory,\r\n"
|
||||
" StringHelpers::unquoted (arguments->get (ArgType::sourceFile)));\r\n"
|
||||
"\r\n"
|
||||
" if (! FileHelpers::exists (sourceFile))\r\n"
|
||||
" {\r\n"
|
||||
" std::cerr << \"Source file doesn't exist: \"\r\n"
|
||||
" << sourceFile\r\n"
|
||||
|
|
@ -8710,37 +8860,43 @@ static const unsigned char temp_binary_data_67[] =
|
|||
" return 1;\r\n"
|
||||
" }\r\n"
|
||||
"\r\n"
|
||||
" const auto targetDirectory = fs::current_path() / StringHelpers::unquoted (std::string (argv[2]));\r\n"
|
||||
" const auto targetDirectory = FileHelpers::appendedPaths (currentWorkingDirectory,\r\n"
|
||||
" StringHelpers::unquoted (arguments->get (ArgType::targetDirectory)));\r\n"
|
||||
"\r\n"
|
||||
" if (! fs::exists (targetDirectory))\r\n"
|
||||
" if (! FileHelpers::exists (targetDirectory))\r\n"
|
||||
" {\r\n"
|
||||
" try\r\n"
|
||||
" if (! FileHelpers::createDirectory (targetDirectory))\r\n"
|
||||
" {\r\n"
|
||||
" fs::create_directories (targetDirectory);\r\n"
|
||||
" }\r\n"
|
||||
" catch (const fs::filesystem_error&)\r\n"
|
||||
" {\r\n"
|
||||
" std::cerr << \"Failed to create target directory: \"\r\n"
|
||||
" << targetDirectory\r\n"
|
||||
" << std::endl << std::endl;\r\n"
|
||||
"\r\n"
|
||||
" std::cerr << \"Failed to create target directory: \" << targetDirectory << std::endl;\r\n"
|
||||
" return 1;\r\n"
|
||||
" }\r\n"
|
||||
" }\r\n"
|
||||
"\r\n"
|
||||
" const auto className = StringHelpers::trimmed (argv[3]);\r\n"
|
||||
" const auto binaryNamespace = StringHelpers::trimmed (argv[4]);\r\n"
|
||||
" const auto className = StringHelpers::trimmed (arguments->get (ArgType::targetFilename));\r\n"
|
||||
" const auto binaryNamespace = StringHelpers::trimmed (arguments->get (ArgType::binaryNamespace));\r\n"
|
||||
"\r\n"
|
||||
" const auto headerFilePath = targetDirectory / (className + \".h\");\r\n"
|
||||
" const auto cppFilePath = targetDirectory / (className + \".cpp\");\r\n"
|
||||
" const auto headerFilePath = FileHelpers::appendedPaths (targetDirectory, className + \".h\");\r\n"
|
||||
" const auto cppFilePath = FileHelpers::appendedPaths (targetDirectory, className + \".cpp\");\r\n"
|
||||
"\r\n"
|
||||
" std::cout << \"Creating \" << headerFilePath\r\n"
|
||||
" << \" and \" << cppFilePath\r\n"
|
||||
" << \" from file \" << sourceFile\r\n"
|
||||
" << \"...\" << std::endl << std::endl;\r\n"
|
||||
" if (arguments->isVerbose())\r\n"
|
||||
" {\r\n"
|
||||
" std::cout << \"Creating \" << headerFilePath\r\n"
|
||||
" << \" and \" << cppFilePath\r\n"
|
||||
" << \" from file \" << sourceFile\r\n"
|
||||
" << \"...\" << std::endl << std::endl;\r\n"
|
||||
" }\r\n"
|
||||
"\r\n"
|
||||
" fs::remove (headerFilePath);\r\n"
|
||||
" fs::remove (cppFilePath);\r\n"
|
||||
" if (! FileHelpers::deleteFile (headerFilePath))\r\n"
|
||||
" {\r\n"
|
||||
" std::cerr << \"Failed to remove old header file: \" << headerFilePath << std::endl;\r\n"
|
||||
" return 1;\r\n"
|
||||
" }\r\n"
|
||||
"\r\n"
|
||||
" if (! FileHelpers::deleteFile (cppFilePath))\r\n"
|
||||
" {\r\n"
|
||||
" std::cerr << \"Failed to remove old source file: \" << cppFilePath << std::endl;\r\n"
|
||||
" return 1;\r\n"
|
||||
" }\r\n"
|
||||
"\r\n"
|
||||
" std::ofstream header (headerFilePath);\r\n"
|
||||
"\r\n"
|
||||
|
|
@ -8768,7 +8924,7 @@ static const unsigned char temp_binary_data_67[] =
|
|||
" cpp << \"/* (Auto-generated binary data file). */\" << std::endl << std::endl\r\n"
|
||||
" << \"#include \" << std::quoted (className + \".h\") << std::endl << std::endl;\r\n"
|
||||
"\r\n"
|
||||
" if (! addFile (sourceFile, binaryNamespace, header, cpp))\r\n"
|
||||
" if (! addFile (sourceFile, binaryNamespace, header, cpp, arguments->isVerbose()))\r\n"
|
||||
" return 1;\r\n"
|
||||
"\r\n"
|
||||
" header << \"}\" << std::endl << std::endl;\r\n"
|
||||
|
|
@ -8856,8 +9012,8 @@ const char* getNamedResource (const char* resourceNameUTF8, int& numBytes)
|
|||
case 0x763d39dc: numBytes = 1050; return colourscheme_dark_xml;
|
||||
case 0xe8b08520: numBytes = 1050; return colourscheme_light_xml;
|
||||
case 0x7c03d519: numBytes = 3005; return juce_runtime_arch_detection_cpp;
|
||||
case 0x295b6f43: numBytes = 1200; return juce_LinuxSubprocessHelper_cpp;
|
||||
case 0xef269d3a: numBytes = 7162; return juce_SimpleBinaryBuilder_cpp;
|
||||
case 0x295b6f43: numBytes = 1212; return juce_LinuxSubprocessHelper_cpp;
|
||||
case 0xef269d3a: numBytes = 12183; return juce_SimpleBinaryBuilder_cpp;
|
||||
default: break;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue