commit 9a250a816c6f0b94aaab96b2af9ee99caf291833 Author: Lenheart <947330670@qq.com> Date: Sat May 4 18:30:32 2024 +0800 初次转移 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..88dbff1 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.vs/ diff --git a/BaseRead.cpp b/BaseRead.cpp new file mode 100644 index 0000000..9c8c51a --- /dev/null +++ b/BaseRead.cpp @@ -0,0 +1 @@ +#include "BaseRead.h" diff --git a/BaseRead.h b/BaseRead.h new file mode 100644 index 0000000..1f61517 --- /dev/null +++ b/BaseRead.h @@ -0,0 +1,93 @@ +#pragma once +#include +#include +#include +class BaseRead :public std::fstream +{ +private: + + const BYTE Key[256] = { 112,117,99,104,105,107,111,110,64,110,101,111,112,108,101,32,100,117,110,103,101,111,110,32,97,110,100,32,102,105,103,104,116,101,114,32,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,0 }; + + +public: + //char* ת + int CharToInt(char* Str) + { + return *(int*)Str; + } + + //char* תLong + long CharToLong(char* Str) + { + return *(long long*)Str; + } + + + // + int ReadInt() + { + char* CountBuffer = new char[4]; + for (int i = 0; i < 4; i++) + { + this->get(CountBuffer[i]); + } + int Count = CharToInt(CountBuffer); + delete[]CountBuffer; + return Count; + } + + //ַ + std::string ReadString() + { + char* CharBuffer = new char[1024]; + this->get(CharBuffer, 1024, '\0'); + std::string Str = CharBuffer; + delete[]CharBuffer; + this->seekg(1, std::ios::cur); + return Str; + } + + //ȡNPKϢ + std::string ReadInfo() + { + char* CharBuffer = new char[256]; + char var; + int i = 0; + while (i < 256) + { + this->get(var); + CharBuffer[i] = var ^ Key[i]; + ++i; + } + std::string Str = CharBuffer; + delete[] CharBuffer; + return Str; + } + + //LONG + int ReadLong() + { + char* CountBuffer = new char[8]; + for (int i = 0; i < 8; i++) + { + this->get(CountBuffer[i]); + } + long Count = CharToLong(CountBuffer); + delete[]CountBuffer; + return Count; + } + + //ָ + BYTE* ReadCustomSize(int Size) + { + BYTE* CharBuffer = new BYTE[Size]; + for (int j = 0; j < Size; j++) + { + char var; + this->get(var); + CharBuffer[j] = var; + } + return CharBuffer; + } +}; + diff --git a/ButtonActorRegister.h b/ButtonActorRegister.h new file mode 100644 index 0000000..0f15265 --- /dev/null +++ b/ButtonActorRegister.h @@ -0,0 +1,159 @@ +#pragma once + +//ť +static SQInteger Create_Button(HSQUIRRELVM v) +{ + SQInteger Top = sq_gettop(v); + if (Top <= 0) + { + sq_throwerror(v, _SST("Incorrect function argument")); + return 0; + } + + SquirrelButtonPtr Button = new SquirrelButton(); + + //ȡΨһID + uint64_t UUID = Button->GetObjectID(); + + //ťMap + ActorPtrMapObject[UUID] = Button; + + sq_pushinteger(v, UUID); + + return 1; +} + +//ðť״̬ +static SQInteger Button_Load_Texture(HSQUIRRELVM v) +{ + SQInteger Top = sq_gettop(v); + if (Top <= 0) + { + sq_throwerror(v, _SST("Incorrect function argument")); + return 0; + } + + SQInteger ActorUUID; + sq_getinteger(v, 2, &ActorUUID); + + const SQChar* Path; + sq_getstring(v, 3, &Path); + + SQInteger Frame; + sq_getinteger(v, 4, &Frame); + + if (ActorPtrMapObject.count(ActorUUID)) { + SquirrelButtonPtr Button = dynamic_cast(ActorPtrMapObject[ActorUUID].Get()); + + TexturePtr t = SquirrelClassEx::GetTexturePtrByImg((char*)Path, Frame); + Button->SetFrame(t); + sq_pushbool(v, true); + } + else { + sq_pushbool(v, false); + } + + return 1; +} + +//ʼť +static SQInteger Button_Init(HSQUIRRELVM v) +{ + SQInteger Top = sq_gettop(v); + if (Top <= 0) + { + sq_throwerror(v, _SST("Incorrect function argument")); + return 0; + } + + SQInteger ActorUUID; + sq_getinteger(v, 2, &ActorUUID); + + if (ActorPtrMapObject.count(ActorUUID)) { + SquirrelButtonPtr Button = dynamic_cast(ActorPtrMapObject[ActorUUID].Get()); + Button->Init(); + sq_pushbool(v, true); + } + else { + sq_pushbool(v, false); + } + + return 1; +} + + +//жϰťǷ񱻵 +static SQInteger Button_IsPress(HSQUIRRELVM v) +{ + SQInteger Top = sq_gettop(v); + if (Top <= 0) + { + sq_throwerror(v, _SST("Incorrect function argument")); + return 0; + } + + SQInteger ActorUUID; + sq_getinteger(v, 2, &ActorUUID); + + SQInteger Type; + sq_getinteger(v, 3, &Type); + + if (ActorPtrMapObject.count(ActorUUID)) { + SquirrelButtonPtr Button = dynamic_cast(ActorPtrMapObject[ActorUUID].Get()); + sq_pushbool(v, Button->IsPress(Type)); + } + else { + sq_pushnull(v); + } + + return 1; +} + +//жϰťǷͣ +static SQInteger Button_IsHover(HSQUIRRELVM v) +{ + SQInteger Top = sq_gettop(v); + if (Top <= 0) + { + sq_throwerror(v, _SST("Incorrect function argument")); + return 0; + } + + SQInteger ActorUUID; + sq_getinteger(v, 2, &ActorUUID); + + if (ActorPtrMapObject.count(ActorUUID)) { + SquirrelButtonPtr Button = dynamic_cast(ActorPtrMapObject[ActorUUID].Get()); + sq_pushbool(v, Button->IsHover()); + } + else { + sq_pushnull(v); + } + + return 1; +} + +//ƳԼZ +static SQInteger Button_RemoveZorder(HSQUIRRELVM v) +{ + SQInteger Top = sq_gettop(v); + if (Top <= 0) + { + sq_throwerror(v, _SST("Incorrect function argument")); + return 0; + } + + SQInteger ActorUUID; + sq_getinteger(v, 2, &ActorUUID); + + if (ActorPtrMapObject.count(ActorUUID)) { + SquirrelButtonPtr Button = dynamic_cast(ActorPtrMapObject[ActorUUID].Get()); + Button->RemoveZorder(); + sq_pushbool(v, true); + } + else { + sq_pushnull(v); + } + + return 1; +} \ No newline at end of file diff --git a/CanvasActorRegister.h b/CanvasActorRegister.h new file mode 100644 index 0000000..abfa16e --- /dev/null +++ b/CanvasActorRegister.h @@ -0,0 +1,218 @@ +#pragma once +//ԱָMap +extern std::mapActorPtrMapObject; + +// +static SQInteger Create_Canvas(HSQUIRRELVM v) +{ + SQInteger Top = sq_gettop(v); + if (Top <= 0) + { + sq_throwerror(v, _SST("Incorrect function argument")); + return 0; + } + + SQFloat X; + sq_getfloat(v, 2, &X); + SQFloat Y; + sq_getfloat(v, 3, &Y); + + CanvasPtr _Canvas = new Canvas(PixelSize(X, Y)); + //ȡΨһID + uint64_t UUID = _Canvas->GetObjectID(); + + //Map + ActorPtrMapObject[UUID] = _Canvas; + + sq_pushinteger(v, UUID); + + return 1; +} + +//ʼȾ +static SQInteger Canvas_BeginDraw(HSQUIRRELVM v) +{ + SQInteger Top = sq_gettop(v); + if (Top <= 0) + { + sq_throwerror(v, _SST("Incorrect function argument")); + return 0; + } + + SQInteger ActorUUID; + sq_getinteger(v, 2, &ActorUUID); + + if (ActorPtrMapObject.count(ActorUUID)) { + CanvasPtr _Canvas = dynamic_cast(ActorPtrMapObject[ActorUUID].Get()); + CanvasRenderContextPtr _CanvasRenderContextPtr = _Canvas->GetContext2D(); + _CanvasRenderContextPtr->SetTextAntialiasMode(TextAntialiasMode::None); + _CanvasRenderContextPtr->BeginDraw(); + sq_pushbool(v, true); + } + else { + sq_pushbool(v, false); + } + + return 1; +} + +//Ⱦ +static SQInteger Canvas_EndDraw(HSQUIRRELVM v) +{ + SQInteger Top = sq_gettop(v); + if (Top <= 0) + { + sq_throwerror(v, _SST("Incorrect function argument")); + return 0; + } + + SQInteger ActorUUID; + sq_getinteger(v, 2, &ActorUUID); + + if (ActorPtrMapObject.count(ActorUUID)) { + CanvasPtr _Canvas = dynamic_cast(ActorPtrMapObject[ActorUUID].Get()); + CanvasRenderContextPtr _CanvasRenderContextPtr = _Canvas->GetContext2D(); + _CanvasRenderContextPtr->EndDraw(); + sq_pushbool(v, true); + } + else { + sq_pushbool(v, false); + } + + return 1; +} + +// +static SQInteger Canvas_DrawTexture(HSQUIRRELVM v) +{ + SQInteger Top = sq_gettop(v); + if (Top <= 0) + { + sq_throwerror(v, _SST("Incorrect function argument")); + return 0; + } + + SQInteger ActorUUID; + sq_getinteger(v, 2, &ActorUUID); + + const SQChar* OutPutBuffer; + sq_getstring(v, 3, &OutPutBuffer); + + SQInteger gFrame; + sq_getinteger(v, 4, &gFrame); + + SQFloat X; + sq_getfloat(v, 5, &X); + SQFloat Y; + sq_getfloat(v, 6, &Y); + + if (ActorPtrMapObject.count(ActorUUID)) { + CanvasPtr _Canvas = dynamic_cast(ActorPtrMapObject[ActorUUID].Get()); + + CanvasRenderContextPtr _CanvasRenderContextPtr = _Canvas->GetContext2D(); + + //ֻ + if (Top == 6) { + Vec2 POS = Vec2(X, Y); + + TexturePtr t = SquirrelClassEx::GetTexturePtrByImg((char*)OutPutBuffer, gFrame); + _CanvasRenderContextPtr->DrawTexture(t, POS); + } + else if (Top == 8) { + SQFloat XSize; + sq_getfloat(v, 7, &XSize); + SQFloat YSize; + sq_getfloat(v, 8, &YSize); + + Vec2 POS = Vec2(X, Y); + Vec2 Size = Vec2(X + XSize, Y + YSize); + + TexturePtr t = SquirrelClassEx::GetTexturePtrByImg((char*)OutPutBuffer, gFrame); + _CanvasRenderContextPtr->DrawTexture(t, POS, Size); + } + sq_pushbool(v, true); + } + else { + sq_pushbool(v, false); + } + return 1; +} + + + +// +static SQInteger Canvas_DrawText(HSQUIRRELVM v) +{ + SQInteger Top = sq_gettop(v); + if (Top <= 0) + { + sq_throwerror(v, _SST("Incorrect function argument")); + return 0; + } + + SQInteger ActorUUID; + sq_getinteger(v, 2, &ActorUUID); + + //õSquirrelַ ·Key + const SQChar* OutPutBuffer; + sq_getstring(v, 3, &OutPutBuffer); + + + //˲NewһַҪֶ + char* OutPutTextbuf = SquirrelClassEx::SquirrelU2W((char*)OutPutBuffer); + std::string OutPutText = OutPutTextbuf; + //Newַ + delete[]OutPutTextbuf; + + //ͨ崴ıʽ + if (Top == 7) { + //õSquirrelַ + const SQChar* TextStringBuffer; + sq_getstring(v, 4, &TextStringBuffer); + //˲NewһַҪֶ + char* TextStringbuf = SquirrelClassEx::SquirrelU2W((char*)TextStringBuffer); + //ҪƵ + std::string TextString = TextStringbuf; + //Newַ + delete[]TextStringbuf; + + SQInteger FontColor; + sq_getinteger(v, 5, &FontColor); + + SQFloat Xpos; + sq_getfloat(v, 6, &Xpos); + + SQFloat Ypos; + sq_getfloat(v, 7, &Ypos); + + + //ȫMapлȡ + if (ActorPtrMapObject.count(ActorUUID)) { + CanvasPtr _Canvas = dynamic_cast(ActorPtrMapObject[ActorUUID].Get()); + CanvasRenderContextPtr _CanvasRenderContextPtr = _Canvas->GetContext2D(); + TextStyle TsP = TextStyle(FontRecObject[OutPutText]); + TsP.alignment = TextAlign::Center; + /* + // Խʽ + LinearGradientStyle fill_style = LinearGradientStyle( + Point(_Canvas->GetWidth() / 3, 0.0f), // ʽ + Point(_Canvas->GetWidth() * 2 / 3, _Canvas->GetHeight()), // ʽյ + { GradientStop(0.0f, Color::Yellow), GradientStop(1.0f, Color::Green) } + ); + */ + + + BrushPtr fill_brush = new Brush(FontColor); + _CanvasRenderContextPtr->SetFillBrush(fill_brush); + _CanvasRenderContextPtr->DrawTextLayout(TextString, TsP, Point(Xpos, Ypos)); + + sq_pushbool(v, true); + } + } + else { + sq_pushbool(v, false); + } + + + return 1; +} diff --git a/Cursor.cpp b/Cursor.cpp new file mode 100644 index 0000000..2e53b27 --- /dev/null +++ b/Cursor.cpp @@ -0,0 +1,55 @@ +#include "Cursor.h" +#include "SquirrelClassEx.h" + +//߼ +void SetCursorGameLogic() { + WindowPtr window = Application::GetInstance().GetWindow(); + int X = window->GetPosX(); + int MaxX = window->GetWidth() + X; + + int Y = window->GetPosY(); + int MaxY = window->GetHeight() + Y; + + + POINT pt = { 0, 0 }; + GetCursorPos(&pt); + + if (pt.x >= X && pt.x <= MaxX && pt.y >= Y && pt.y <= MaxY /*&& GetForegroundWindow() == window->GetHandle()*/) { + ShowCursor(FALSE); + } +} + +Cursor::Cursor() +{ + this->SetName("GameCursorObject"); + this->Retain(); + + +} + +void Cursor::OnUpdate(Duration dt) +{ + static bool Init = false; + if (!Init) { + TexturePtr ImageBuf = SquirrelClassEx::GetTexturePtrByImg("sprite/interface/cursor.img",0); + this->SetFrame(ImageBuf); + Init = true; + } + + ////ȡ + Input& input = Input::GetInstance(); + + ////"" + this->SetPosition(input.GetMousePos()); + + //std::cout << (int)GetCursor() << std::endl; + //ʧ߼ + if ((int)GetCursor() == 65541) { + SetCursorGameLogic(); + this->SetVisible(true); + } + else { + this->SetVisible(false); + } +} + diff --git a/Cursor.h b/Cursor.h new file mode 100644 index 0000000..78cd691 --- /dev/null +++ b/Cursor.h @@ -0,0 +1,12 @@ +#pragma once + +#include +using namespace kiwano; + +class Cursor :public Sprite +{ +public: + Cursor(); + void OnUpdate(Duration dt) override; +}; + diff --git a/GameState.cpp b/GameState.cpp new file mode 100644 index 0000000..2bcf124 --- /dev/null +++ b/GameState.cpp @@ -0,0 +1,191 @@ +#include "GameState.h" +#include "SquirrelActor.h" + +extern SquirrelClassEx* TObject; +extern NPK_M* npk; +std::mapSoundRecObject; +std::unordered_map>ImageRecObject; +std::mapFontRecObject; +WThreadPool threadPool; +Cursor* Mouse_Object = new Cursor(); + +void InitSound(const TCHAR* directory) +{ + WIN32_FIND_DATA fileInfo; + TCHAR buffer[MAX_PATH]; + + // · + _tcscpy_s(buffer, directory); + _tcscat_s(buffer, _T("\\*.*")); + + // ҵһļ/Ŀ¼ + HANDLE hFind = FindFirstFile(buffer, &fileInfo); + if (hFind != INVALID_HANDLE_VALUE) + { + do + { + // ų "." ".." + if (_tcscmp(fileInfo.cFileName, _T(".")) != 0 && _tcscmp(fileInfo.cFileName, _T("..")) != 0) + { + // Ŀ¼ݹĿ¼ + if (fileInfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) + { + _tcscpy_s(buffer, directory); + _tcscat_s(buffer, _T("\\")); + _tcscat_s(buffer, fileInfo.cFileName); + InitSound(buffer); + } + else { + // ļ + //_tprintf(_T("%s\\%s\n"), directory, fileInfo.cFileName); + + char output[1024]; + sprintf(output, "%ws\\%ws", directory,fileInfo.cFileName); + std::string path = output; + std::replace(path.begin(), path.end(), '\\', '/'); + + Sound* sou = new Sound(path); + //sou->Preload(path); + SoundRecObject[path] = sou; + //std::cout << "ƵԴ___" << path << "____Ѽ" << std::endl; + } + } + } while (FindNextFile(hFind, &fileInfo)); + + FindClose(hFind); + } +} + +void InitFont(const TCHAR* directory) +{ + WIN32_FIND_DATA fileInfo; + TCHAR buffer[MAX_PATH]; + + // · + _tcscpy_s(buffer, directory); + _tcscat_s(buffer, _T("\\*.*")); + + // ҵһļ/Ŀ¼ + HANDLE hFind = FindFirstFile(buffer, &fileInfo); + if (hFind != INVALID_HANDLE_VALUE) + { + do + { + // ų "." ".." + if (_tcscmp(fileInfo.cFileName, _T(".")) != 0 && _tcscmp(fileInfo.cFileName, _T("..")) != 0) + { + // Ŀ¼ݹĿ¼ + if (fileInfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) + { + _tcscpy_s(buffer, directory); + _tcscat_s(buffer, _T("\\")); + _tcscat_s(buffer, fileInfo.cFileName); + InitFont(buffer); + } + else { + // ļ + //_tprintf(_T("%s\\%s\n"), directory, fileInfo.cFileName); + + char output[1024]; + sprintf(output, "%ws\\%ws", directory, fileInfo.cFileName); + std::string path = output; + std::replace(path.begin(), path.end(), '\\', '/'); + + FontPtr FontBuf = new Font(); + FontBuf->Preload(path); + FontRecObject[path] = FontBuf; + } + } + } while (FindNextFile(hFind, &fileInfo)); + + FindClose(hFind); + } +} + +void LoadingScene_Success() +{ + KGE_DEBUG_LOG("Դ"); + Stage* P_Stage = Director::GetInstance().GetCurrentStage().Get(); + SquirrelStage* Push_Stage = (SquirrelStage*)P_Stage; + TObject->RunSceneScript("LoadingGame_Stage_Func", Push_Stage); +} + +void InitGameRecFunc() { + + //List + SquirrelClassEx::LoadingListScript(); + //Sleep(4000); + //ƵԴ + InitSound(L"SoundPacks2/music"); + //Դ + InitFont(L"Font"); + + //ԤһѡɫǸȻе㿨 + for (size_t i = 0; i < 17; i++) + { + SquirrelClassEx::GetTexturePtrByImg("sprite/selectcharacter/background.img", i); + } + IMG* img = npk->ReadNpkTable("sprite/selectcharacter/background.img"); + npk->ReleaseNpkTable(img); + + Application::GetInstance().PerformInMainThread(LoadingScene_Success); + + +} + + + +//#include +//KGE_DECLARE_SMART_PTR(ISound); +void Setup() +{ + //̳߳سʼ + threadPool.setMaxThreadNum(10); + + //뷨 + WindowPtr window = Application::GetInstance().GetWindow(); + window->SetImmEnabled(true); + + //Newһ߳ȥϷԴ + threadPool.concurrentRun(InitGameRecFunc); + + //Ⱦģʽ + Director::GetInstance().SetRenderBorderEnabled(true); + + //irrklang::ISoundEngine* engine = irrklang::createIrrKlangDevice(); + + + + + + + /*SoundPtr SP = new Sound(); + SP*/ + /*loader.Load(fileData.get(), "ogg", memory.buffer);*/ + + //Renderer::GetInstance().GetContext().SetTextAntialiasMode(TextAntialiasMode::None); +} + + +void GameState::Run() +{ + // Ϸ + Settings s; + s.window.title = "Yosin - DOF"; // ڱ + s.window.width = 1600; // ڿ + s.window.height = 900; // ڸ߶ + // ȡֱͬ + s.vsync_enabled = false; + // ֡ʱ + s.frame_interval = 1_sec / 10000; + s.debug_mode = true; + + // ־ϵͳ + //Logger::GetInstance().Enable(); + + //Application::GetInstance().Use(ImGuiModule::GetInstance()); + Application::GetInstance().Use(AudioModule::GetInstance()); + // Ӧ + Application::GetInstance().Run(s, Setup); + +} diff --git a/GameState.h b/GameState.h new file mode 100644 index 0000000..9816d49 --- /dev/null +++ b/GameState.h @@ -0,0 +1,12 @@ +#pragma once +#include "SquirrelClassEx.h" +#include + + + +class GameState +{ +public: + void Run(); +}; + diff --git a/ImguiLayerActorRegister.h b/ImguiLayerActorRegister.h new file mode 100644 index 0000000..f5de844 --- /dev/null +++ b/ImguiLayerActorRegister.h @@ -0,0 +1,194 @@ +//#pragma once +////ԱָMap +//extern std::mapActorPtrMapObject; +// +//std::string UTF8toString(const std::string& strSrc) +//{ +// int nwLen = MultiByteToWideChar(CP_UTF8, 0, strSrc.c_str(), -1, NULL, 0); +// +// wchar_t* pwBuf = new wchar_t[nwLen + 1];//һҪ1Ȼβ +// memset(pwBuf, 0, nwLen * 2 + 2); +// +// MultiByteToWideChar(CP_UTF8, 0, strSrc.c_str(), strSrc.length(), pwBuf, nwLen); +// +// int nLen = WideCharToMultiByte(CP_ACP, 0, pwBuf, -1, NULL, NULL, NULL, NULL); +// +// char* pBuf = new char[nLen + 1]; +// memset(pBuf, 0, nLen + 1); +// +// WideCharToMultiByte(CP_ACP, 0, pwBuf, nwLen, pBuf, nLen, NULL, NULL); +// +// std::string retStr = pBuf; +// +// delete[]pBuf; +// delete[]pwBuf; +// +// pBuf = NULL; +// pwBuf = NULL; +// +// return retStr; +// +//} +// +//std::string string_To_UTF8(const std::string& strSrc) +//{ +// int nwLen = ::MultiByteToWideChar(CP_ACP, 0, strSrc.c_str(), -1, NULL, 0); +// +// wchar_t* pwBuf = new wchar_t[nwLen + 1];//һҪ1Ȼβ +// ZeroMemory(pwBuf, nwLen * 2 + 2); +// +// ::MultiByteToWideChar(CP_ACP, 0, strSrc.c_str(), strSrc.length(), pwBuf, nwLen); +// +// int nLen = ::WideCharToMultiByte(CP_UTF8, 0, pwBuf, -1, NULL, NULL, NULL, NULL); +// +// char* pBuf = new char[nLen + 1]; +// ZeroMemory(pBuf, nLen + 1); +// +// ::WideCharToMultiByte(CP_UTF8, 0, pwBuf, nwLen, pBuf, nLen, NULL, NULL); +// +// std::string retStr(pBuf); +// +// delete[]pwBuf; +// delete[]pBuf; +// +// pwBuf = NULL; +// pBuf = NULL; +// +// return retStr; +//} +// +//void ControlPanel(const SQChar* Name) +//{ +// ImGui::Begin(u8"Դ", 0, ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoBackground | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove); +// +// sq_pushroottable(v); +// sq_pushstring(v, Name, -1); +// sq_get(v, -2); +// sq_pushroottable(v); +// sq_pushstring(v, _SST("Lenheart"), -1); +// sq_call(v, 2, 0, 1); +// sq_pop(v, 2); +// +// +// ImGui::End(); +//} +// +// +// +////Imguiͼ +//static SQInteger Create_ImguiLayer(HSQUIRRELVM v) +//{ +// SQInteger Top = sq_gettop(v); +// if (Top <= 0) +// { +// sq_throwerror(v, _SST("Incorrect function argument")); +// return 0; +// } +// +// const SQChar* ImguiName; +// sq_getstring(v, 2, &ImguiName); +// +// +// auto f1 = std::bind(&ControlPanel, ImguiName); +// +// // ImGui ͼ +// ImGuiLayerPtr layer = new ImGuiLayer((char*)ImguiName, f1); +// +// //ȡΨһID +// uint64_t UUID = layer->GetObjectID(); +// +// //Map +// ActorPtrMapObject[UUID] = layer; +// +// sq_pushinteger(v, UUID); +// +// return 1; +//} +// +// +////Imgui +//static SQInteger Imgui_Text(HSQUIRRELVM v) +//{ +// SQInteger Top = sq_gettop(v); +// if (Top <= 0) +// { +// sq_throwerror(v, _SST("Incorrect function argument")); +// return 0; +// } +// +// const SQChar* ImguiName; +// sq_getstring(v, 2, &ImguiName); +// +// ImGui::Text((char*)ImguiName); +// +// return 0; +//} +// +////ôڴС +//static SQInteger Imgui_SetWindowSize(HSQUIRRELVM v) +//{ +// SQInteger Top = sq_gettop(v); +// if (Top <= 0) +// { +// sq_throwerror(v, _SST("Incorrect function argument")); +// return 0; +// } +// +// SQInteger X; +// SQInteger Y; +// sq_getinteger(v, 2, &X); +// sq_getinteger(v, 3, &Y); +// +// ImGui::SetWindowSize(ImVec2(X, Y)); +// return 0; +//} +// +////ô +//static SQInteger Imgui_SetWindowPos(HSQUIRRELVM v) +//{ +// SQInteger Top = sq_gettop(v); +// if (Top <= 0) +// { +// sq_throwerror(v, _SST("Incorrect function argument")); +// return 0; +// } +// +// SQInteger X; +// SQInteger Y; +// sq_getinteger(v, 2, &X); +// sq_getinteger(v, 3, &Y); +// +// ImGui::SetWindowPos(ImVec2(X, Y)); +// return 0; +//} +// +// +////Imgui +//static SQInteger Imgui_InputText(HSQUIRRELVM v) +//{ +// SQInteger Top = sq_gettop(v); +// if (Top <= 0) +// { +// sq_throwerror(v, _SST("Incorrect function argument")); +// return 0; +// } +// +// const SQChar* InPutName; +// sq_getstring(v, 2, &InPutName); +// +// ImGui::PushStyleColor(ImGuiCol_FrameBg, IM_COL32(0, 0, 0, 255)); +// static char buf[25] = u8""; +// ImGui::InputText("##", buf, IM_ARRAYSIZE(buf)); +// ImGui::PopStyleColor(); +// +// +// +// sq_pushroottable(v); +// sq_pushstring(v, InPutName, -1); +// sq_get(v, -2); +// sq_pushroottable(v); +// sq_pushstring(v, _SST(buf), -1); +// sq_call(v, 2, 0, 1); +// sq_pop(v, 2); +// return 0; +//} diff --git a/LockQueue.hpp b/LockQueue.hpp new file mode 100644 index 0000000..80fa9d2 --- /dev/null +++ b/LockQueue.hpp @@ -0,0 +1,90 @@ +#pragma once + +#include +#include + +template +class LockQueue +{ +public: + LockQueue() + { + QueueNode *node = new QueueNode(); + node->next = nullptr; + // head->next is the first node, _tail point to last node, not _tail->next + _head = node; + _tail = _head; + }; + virtual ~LockQueue() + { + clear(); + delete _head; + _head = nullptr; + _tail = nullptr; + }; + + struct QueueNode + { + T value; + QueueNode *next; + }; + + bool enQueue(T data) + { + QueueNode *node = new (std::nothrow) QueueNode(); + if (!node) + { + return false; + } + node->value = data; + node->next = nullptr; + + std::unique_lock locker(_mutex); + _tail->next = node; + _tail = node; + _queueSize++; + return true; + } + + bool deQueue(T &data) + { + std::unique_lock locker(_mutex); + QueueNode *currentFirstNode = _head->next; + if (!currentFirstNode) + { + return false; + } + + _head->next = currentFirstNode->next; + data = currentFirstNode->value; + delete currentFirstNode; + _queueSize--; + if (_queueSize == 0) + { + _tail = _head; + } + return true; + } + + int64_t size() + { + return _queueSize; + } + + void clear() + { + T data; + while(deQueue(data)); + } + + bool empty() + { + return (_queueSize <= 0); + } +private: + QueueNode *_head; + QueueNode *_tail; + int64_t _queueSize = 0; + std::mutex _mutex; +}; + diff --git a/Npk.cpp b/Npk.cpp new file mode 100644 index 0000000..c8f6bb0 --- /dev/null +++ b/Npk.cpp @@ -0,0 +1,394 @@ +#include "Npk.h" +#include +#include +std::mutex Npk_ImgMutex; +std::mutex Npk_PngMutex; + +class ReadNpk :public std::ifstream +{ + const BYTE Key[256] = { 112,117,99,104,105,107,111,110,64,110,101,111,112,108,101,32,100,117,110,103,101,111,110,32,97,110,100,32,102,105,103,104,116,101,114,32,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,0 }; + +public: + //char* ת + int CharToInt(char* Str) + { + return *(int*)Str; + } + + //char* תLong + long CharToLong(char* Str) + { + return *(long long*)Str; + } + + // + int ReadInt() + { + char* CountBuffer = new char[4]; + for (int i = 0; i < 4; i++) + { + this->get(CountBuffer[i]); + } + int Count = CharToInt(CountBuffer); + delete[]CountBuffer; + return Count; + } + + //ַ + std::string ReadString() + { + char* CharBuffer = new char[1024]; + this->get(CharBuffer, 1024, '\0'); + std::string Str = CharBuffer; + delete[]CharBuffer; + this->seekg(1, std::ios::cur); + return Str; + } + + //ȡϢ + std::string ReadInfo() + { + char* CharBuffer = new char[256]; + char var; + int i = 0; + while (i < 256) + { + this->get(var); + CharBuffer[i] = var ^ Key[i]; + ++i; + } + std::string Str = CharBuffer; + delete[] CharBuffer; + return Str; + } + + //LONG + int ReadLong() + { + char* CountBuffer = new char[8]; + for (int i = 0; i < 8; i++) + { + this->get(CountBuffer[i]); + } + long Count = CharToLong(CountBuffer); + delete[]CountBuffer; + return Count; + } + + //ָ + BYTE* ReadCustomSize(int Size) + { + BYTE* CharBuffer = new BYTE[Size]; + for (int j = 0; j < Size; j++) + { + char var; + this->get(var); + CharBuffer[j] = var; + } + return CharBuffer; + } + +}; + +void ReadColor(BYTE* Tab, int Type, BYTE* SaveByte, int Offset) +{ + BYTE a = 0; + BYTE r = 0; + BYTE g = 0; + BYTE b = 0; + switch (Type) + { + case 0x0e: + a = (byte)(Tab[1] >> 7); + r = (byte)((Tab[1] >> 2) & 0x1f); + g = (byte)((Tab[0] >> 5) | ((Tab[1] & 3) << 3)); + b = (byte)(Tab[0] & 0x1f); + a = (byte)(a * 0xff); + r = (byte)((r << 3) | (r >> 2)); + g = (byte)((g << 3) | (g >> 2)); + b = (byte)((b << 3) | (b >> 2)); + break; + case 0x0f: + a = (byte)(Tab[1] & 0xf0); + r = (byte)((Tab[1] & 0xf) << 4); + g = (byte)(Tab[0] & 0xf0); + b = (byte)((Tab[0] & 0xf) << 4); + break; + } + SaveByte[Offset + 0] = b; + SaveByte[Offset + 1] = g; + SaveByte[Offset + 2] = r; + SaveByte[Offset + 3] = a; +} + +NPK_M::NPK_M() +{ +} + +void NPK_M::init() +{ + WIN32_FIND_DATAA lpdata; + DWORD read; + + HANDLE hFindFile = FindFirstFileA("ImagePacks2\\*.npk", &lpdata); + do { + //ƴ· + char cat[256] = "ImagePacks2\\"; + strcat(cat, lpdata.cFileName); + + ReadNpk Fs; + Fs.open(cat, std::ios::in | std::ios::binary); + + if (Fs) + { + std::string Header = Fs.ReadString(); + //NPK + if (Header._Equal("NeoplePack_Bill")) + { + //ȡimg + int ImageCount = Fs.ReadInt(); + //ȡͷ + NpkInfo* ImgList = new NpkInfo[ImageCount]; + for (size_t i = 0; i < ImageCount; i++) + { + ImgList[i].Offset = Fs.ReadInt(); + ImgList[i].Length = Fs.ReadInt(); + ImgList[i].Path = Fs.ReadInfo(); + } + for (int i = 0; i < ImageCount; i++) + { + IMG img; + + img.imgOffset = ImgList[i].Offset; + img.imgSize = ImgList[i].Length; + img.img_index = i; + img.lpBelongsFile = lpdata.cFileName; + img.lpImgName = ImgList[i].Path; + img.lp_lplist = NULL; + img.png_sum = 0; + + map_npk.insert(make_pair(img.lpImgName, img)); + } + // + delete[]ImgList; + } + } + Fs.close(); + } while (FindNextFileA(hFindFile, &lpdata)); + FindClose(hFindFile); + + + + ReadNpkTable("sprite/interface2/event/chn_event_2016/160927_joustmatches/knight0.img"); + return; +} + +LPDWORD NPK_M::LoadImgToMem(IMG* p) +{ + //ƴNPK + char dirname[256] = "ImagePacks2\\"; + strcat(dirname, p->lpBelongsFile.c_str()); + + ReadNpk Fs; + Fs.open(dirname, std::ios::in | std::ios::binary); + + if (Fs) + { + Fs.seekg(p->imgOffset); + std::string Flag = Fs.ReadString(); + if (Flag._Equal("Neople Img File")) + { + //С + long TableLength = Fs.ReadLong(); + //img 汾 4ֽ + int ver = Fs.ReadInt(); + //img ֡ + int IndexCount = Fs.ReadInt(); + Npk_PngMutex.lock(); + //ͼƬֵ + p->png_sum = IndexCount; + Npk_PngMutex.unlock(); + + //new Png ṹ + ImgInfo* PngList = new ImgInfo[IndexCount]; + + for (size_t i = 0; i < IndexCount; i++) + { + PngList[i].Type = Fs.ReadInt(); + if (PngList[i].Type == 17) + { + //ͼ + int frbuf = Fs.ReadInt(); + + continue; + } + //ѹ + PngList[i].CmpType = Fs.ReadInt(); + // + PngList[i].Width = Fs.ReadInt(); + //߶ + PngList[i].Height = Fs.ReadInt(); + //С + PngList[i].Size = Fs.ReadInt(); + //Xpos + PngList[i].Xpos = Fs.ReadInt(); + //Ypos + PngList[i].Ypos = Fs.ReadInt(); + //֡X + PngList[i].FrameXpos = Fs.ReadInt(); + //֡Y + PngList[i].FrameYpos = Fs.ReadInt(); + //ƫ + if (i == 0)PngList[i].Offset = 0 + p->imgOffset + TableLength + 32; + else PngList[i].Offset = PngList[i - 1].Offset + PngList[i - 1].Size; + + } + + for (size_t i = 0; i < IndexCount; i++) + { + Fs.seekg(PngList[i].Offset); + BYTE* PngData = Fs.ReadCustomSize(PngList[i].Size); + int DeSize = PngList[i].Width * PngList[i].Height * 4; + BYTE* bByte = new BYTE[DeSize]; + ULONG RealSize = DeSize; + int a = uncompress(bByte, &RealSize, PngData, (ULONG)PngList[i].Size); + delete[]PngData; + + + if (PngList[i].Type != 16) + { + int PngByteSize = DeSize * 2; + PngList[i].PNGdata = new BYTE[PngByteSize]; + + for (int e = 0; e < PngByteSize; e += 4) + { + BYTE NeedData[2]; + memset(NeedData, 0, 2); + memcpy(NeedData, bByte + (e / 4) * 2, 2); + ReadColor(NeedData, PngList[i].Type, PngList[i].PNGdata, e); + } + + delete[]bByte; + } + else { + PngList[i].PNGdata = bByte; + } + } + + Npk_PngMutex.lock(); + p->lp_lplist = PngList; + Npk_PngMutex.unlock(); + } + } + Fs.close(); + + return 0; +} + +IMG* NPK_M::ReadNpkTable(const std::string imgpath) +{ + std::cout << imgpath << std::endl; + IMG* img = NULL; + + Npk_ImgMutex.lock(); + std::map::iterator itr; + itr = map_npk.find(imgpath); + if (itr == map_npk.end()) { + std::string mes = "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!˲ڵImg : " + imgpath; + //MessageBoxA(0, mes.c_str(), 0, 0); + img = &map_npk["sprite/interface/base.img"]; + } + else { + img = &itr->second; + } + Npk_ImgMutex.unlock(); + + //ͼƬ鲻 ͼƬݲڶҪض + if (!img->lp_lplist || !img->lp_lplist->PNGdata) { + LoadImgToMem(img); + } + return img; +} + +void NPK_M::ReleaseNpkTable(IMG* p) +{ + for (int i = 0; i < p->png_sum; i++) { + if (p->lp_lplist[i].PNGdata) { + delete p->lp_lplist[i].PNGdata; + p->lp_lplist[i].PNGdata = 0; + } + else { + int a = 0; + } + } + //delete[] p->lp_lplist; + + //p->lp_lplist = NULL; +} + +int Translate24Bto32B_cpp(char* des, char* src, int num) +{ + for (int i = 0; i < (num / 4); i++) { + unsigned short aword = *(unsigned short*)src; + unsigned short A = aword >> 12; + unsigned short R = 15 & aword >> 8; + unsigned short G = 15 & aword >> 4; + unsigned short B = 15 & aword >> 0; + + A = (A * 255) / 15; + B = (B * 255) / 15; + G = (G * 255) / 15; + R = (R * 255) / 15; + + unsigned int aDword = 0; + aDword |= A; + aDword <<= 8; + aDword |= R; + aDword <<= 8; + aDword |= G; + aDword <<= 8; + aDword |= B; + + *(unsigned int*)des = aDword; + + src += 2; + des += 4; + } + return 0; +} + +int Translate16Bto32B_cpp(char* des, char* src, int num) +{ + for (int i = 0; i < (num / 4); i++) { + unsigned short aword = *(unsigned short*)src; + unsigned short A = aword >> 15; + unsigned short R = 31 & aword >> 10; + unsigned short G = 31 & aword >> 5; + unsigned short B = 31 & aword >> 0; + + A = A * 255; + B = (B * 255) / 31; + G = (G * 255) / 31; + R = (R * 255) / 31; + + unsigned int aDword = 0; + aDword |= A; + aDword <<= 8; + aDword |= R; + aDword <<= 8; + aDword |= G; + aDword <<= 8; + aDword |= B; + + *(unsigned int*)des = aDword; + + src += 2; + des += 4; + } + return 0; +} + +NPK_M::~NPK_M() +{ + map_npk.clear(); +} \ No newline at end of file diff --git a/Npk.h b/Npk.h new file mode 100644 index 0000000..dd22c45 --- /dev/null +++ b/Npk.h @@ -0,0 +1,65 @@ +#pragma once +#include +#include +#include +#include +#include + +#define NPK_R_FLAG(b){if(!b)continue;} + +//PNGṹ +struct ImgInfo +{ + //ͼƬʽ + int Type; + //ѹ + int CmpType; + // + int Width; + //߶ + int Height; + //С + int Size; + //Xpos + int Xpos; + //Ypos + int Ypos; + //֡X + int FrameXpos; + //֡Y + int FrameYpos; + //ƫ + int Offset; + //Pngλͼ + BYTE* PNGdata; +}; + +struct NpkInfo +{ + int Offset; + int Length; + std::string Path; +}; + +struct IMG //npkimgĽṹ +{ + std::string lpImgName; //imgļ· + int img_index; //imgļnpkļ + unsigned imgOffset; + unsigned imgSize; + std::string lpBelongsFile; //imgĸnpkļ + int png_sum; //imgļжٸ ͼƬ + ImgInfo* lp_lplist; //ͼƬ.. +}; + +class NPK_M { +private: + std::map map_npk; +public: + NPK_M(); + void init(); + LPDWORD LoadImgToMem(IMG* p); + IMG* ReadNpkTable(const std::string imgname); + void ReleaseNpkTable(IMG* p); + ~NPK_M(); +}; diff --git a/SoundActorRegister.h b/SoundActorRegister.h new file mode 100644 index 0000000..b25c8b8 --- /dev/null +++ b/SoundActorRegister.h @@ -0,0 +1,207 @@ +#pragma once +#include "SoundManager.h" + +//ƵָMap +extern std::mapSoundActorPtrMapObject; +//ƵԴMap +extern std::mapSoundRecObject; +//Ƶ +static SoundManagerPtr SoundEffectObject = new SoundManager(); + + +//Sound Ƶ +static SQInteger Create_Sound(HSQUIRRELVM v) +{ + SQInteger Top = sq_gettop(v); + if (Top <= 0) + { + sq_throwerror(v, _SST("Incorrect function argument")); + return 0; + } + + + const SQChar* OutPutBuffer; + sq_getstring(v, 2, &OutPutBuffer); + + size_t Id = SoundEffectObject->Save_Load((char*)OutPutBuffer); + + sq_pushinteger(v, Id); + //if (SoundRecObject.count((char*)OutPutBuffer)) { + // sq_pushuserpointer(v, SoundRecObject[(char*)OutPutBuffer]); + //} + //else { + // Sound* Sound_Obj = new Sound(); + // Sound_Obj->Load((char*)OutPutBuffer); + + // sq_pushuserpointer(v, Sound_Obj); + //} + + return 1; +} + +//Sound Ƶ +static SQInteger Set_Sound_Task(HSQUIRRELVM v) +{ + SQInteger Top = sq_gettop(v); + if (Top <= 0) + { + sq_throwerror(v, _SST("Incorrect function argument")); + return 0; + } + + SQInteger SoundId; + sq_getinteger(v, 2, &SoundId); + + + SQInteger Type; + sq_getinteger(v, 3, &Type); + + // + if (Type == 0) { + //ȡŴ -1 Ϊѭ + SQInteger Count; + sq_getinteger(v, 4, &Count); + + SoundPtr Sound_Obj = SoundEffectObject->GetSaveSound(SoundId); + Sound_Obj->Play(Count); + } + //ͣ + else if (Type == 1) { + SoundPtr Sound_Obj = SoundEffectObject->GetSaveSound(SoundId); + Sound_Obj->Pause(); + } + // + else if (Type == 2) { + SoundPtr Sound_Obj = SoundEffectObject->GetSaveSound(SoundId); + Sound_Obj->Resume(); + } + //ر + else if (Type == 3) { + SoundEffectObject->ReleaseSaveSoundByIndex(SoundId); + //SoundPtr Sound_Obj = SoundEffectObject->GetSaveSound(SoundId); + //Sound_Obj->Close(); + } + + return 0; +} + +//Sound ȡƵ +static SQInteger Get_Sound_Volume(HSQUIRRELVM v) +{ + SQInteger Top = sq_gettop(v); + if (Top <= 0) + { + sq_throwerror(v, _SST("Incorrect function argument")); + return 0; + } + + SQInteger SoundId; + sq_getinteger(v, 2, &SoundId); + + SoundPtr Sound_Obj = SoundEffectObject->GetSaveSound(SoundId); + + sq_pushfloat(v, Sound_Obj->GetVolume()); + + return 1; +} + +//Sound Ƶ +static SQInteger Set_Sound_Volume(HSQUIRRELVM v) +{ + SQInteger Top = sq_gettop(v); + if (Top <= 0) + { + sq_throwerror(v, _SST("Incorrect function argument")); + return 0; + } + + SQInteger SoundId; + sq_getinteger(v, 2, &SoundId); + + SoundPtr Sound_Obj = SoundEffectObject->GetSaveSound(SoundId); + + SQFloat VolumeCalue; + sq_getfloat(v, 3, &VolumeCalue); + + Sound_Obj->SetVolume(VolumeCalue); + return 0; +} + + + + +//Sound ʱЧ +static SQInteger Squirrel_PlaySoundEffect(HSQUIRRELVM v) +{ + SQInteger Top = sq_gettop(v); + if (Top <= 0) + { + sq_throwerror(v, _SST("Incorrect function argument")); + return 0; + } + + const SQChar* Name; + sq_getstring(v, 2, &Name); + + //˲NewһַҪֶ + char* Namebuf = SquirrelClassEx::SquirrelU2W((char*)Name); + //ҪƵ + std::string SoundName = Namebuf; + //Newַ + delete[]Namebuf; + + if (SoundName.find(".ogg") != std::string::npos || SoundName.find(".mp3") != std::string::npos) { + size_t Id = SoundEffectObject->Load(SoundName); + SoundEffectObject->Play(Id, 0); + } + else { + if (GameAudioList.count(SoundName)) { + size_t Id = SoundEffectObject->Load(GameAudioList[SoundName]); + SoundEffectObject->Play(Id, 0); + } + } + + /* + SoundPtr Sound_Obj = new Sound(); + Sound_Obj->Load(SoundName); + + if (Top == 3) { + SQFloat Volume; + sq_getfloat(v, 3, &Volume); + Sound_Obj->SetVolume(Volume); + } + + Sound_Obj->Play(); + + SoundEffectMap[Sound_Obj->GetObjectID()] = Sound_Obj; + */ + + return 0; +} + +//Sound ͷʱЧ +static SQInteger Squirrel_ReleseSoundEffect(HSQUIRRELVM v) +{ + SQInteger Top = sq_gettop(v); + if (Top <= 0) + { + sq_throwerror(v, _SST("Incorrect function argument")); + return 0; + } + + //¼ܹԶ + //Map S_M = SoundEffectObject->GetAllSound(); + + + //for (auto it = SoundEffectVector.begin(); it != SoundEffectVector.end(); ++it) { + // size_t id = *it; + // if (!SoundEffectObject->IsPlaying(id)) { + // //SoundPtr Sound_Obj = SoundEffectObject->GetSound(id); + // //Sound_Obj->Close(); + // } + //} + //SoundEffectObject->ClearCache(); + + + return 0; +} \ No newline at end of file diff --git a/SoundManager.cpp b/SoundManager.cpp new file mode 100644 index 0000000..ac28d2b --- /dev/null +++ b/SoundManager.cpp @@ -0,0 +1,210 @@ +#include "SoundManager.h" +// Copyright (c) 2016-2018 Kiwano - Nomango +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +namespace kiwano +{ + namespace audio + { + + SoundManager::SoundManager() + : volume_rate(1.f) + { + } + + SoundManager::~SoundManager() + { + ClearCache(); + } + + size_t SoundManager::GetId(const String& file_path) const + { + return std::hash()(file_path); + } + + size_t SoundManager::GetId(const Resource& res) const + { + return static_cast(res.GetId()); + } + + size_t SoundManager::Load(const String& file_path) + { + size_t id = GetId(file_path); + if (sound_cache_.end() != sound_cache_.find(id)) + return id; + + SoundPtr sound = MakePtr(file_path); + if (sound) + { + sound->SetVolume(volume_rate * 1.0); + sound_cache_.insert(std::make_pair(id, sound)); + return id; + } + return 0; + } + + size_t SoundManager::Save_Load(const String& file_path) + { + size_t id = GetId(file_path); + if (sound_save_.end() != sound_save_.find(id)) + return id; + + SoundPtr sound = MakePtr(file_path); + if (sound) + { + sound->SetVolume(volume_rate * 1.0); + sound_save_.insert(std::make_pair(id, sound)); + return id; + } + return 0; + } + + size_t SoundManager::Load(const Resource& res) + { + size_t id = GetId(res); + if (sound_cache_.end() != sound_cache_.find(id)) + return id; + + SoundPtr sound = MakePtr(res); + + if (sound) + { + sound->SetVolume(volume_rate * 1.0); + sound_cache_.insert(std::make_pair(id, sound)); + return id; + } + return 0; + } + + void SoundManager::Play(size_t id, int loop_count) + { + if (auto sound = GetSound(id)) + sound->Play(loop_count); + } + + void SoundManager::Pause(size_t id) + { + if (auto sound = GetSound(id)) + sound->Pause(); + } + + void SoundManager::Resume(size_t id) + { + if (auto sound = GetSound(id)) + sound->Resume(); + } + + void SoundManager::Stop(size_t id) + { + if (auto sound = GetSound(id)) + sound->Stop(); + } + + bool SoundManager::IsPlaying(size_t id) + { + if (auto sound = GetSound(id)) + return sound->IsPlaying(); + return false; + } + + float SoundManager::GetVolumeRate() const + { + return volume_rate; + } + + void SoundManager::SetVolumeRate(float volume) + { + volume_rate = std::min(std::max(volume, -224.f), 224.f); + for (auto& pair : sound_cache_) + { + pair.second->SetVolume(volume_rate); + } + } + + SoundPtr SoundManager::GetSound(size_t id) const + { + auto iter = sound_cache_.find(id); + if (iter != sound_cache_.end()) + return iter->second; + return SoundPtr(); + } + + SoundPtr SoundManager::GetSaveSound(size_t id) const + { + auto iter = sound_save_.find(id); + if (iter != sound_save_.end()) + return iter->second; + return SoundPtr(); + } + + void SoundManager::PauseAll() + { + for (auto& pair : sound_cache_) + { + pair.second->Pause(); + } + } + + void SoundManager::ResumeAll() + { + for (auto& pair : sound_cache_) + { + pair.second->Resume(); + } + } + + void SoundManager::StopAll() + { + for (auto& pair : sound_cache_) + { + pair.second->Stop(); + } + } + + void SoundManager::ClearCache() + { + sound_cache_.clear(); + } + + void SoundManager::ReleaseSoundByIndex(const size_t Id) + { + auto iter = sound_cache_.find(Id); + if (iter != sound_cache_.end()) { + iter->second->Close(); + sound_cache_.erase(Id); + } + } + + void SoundManager::ReleaseSaveSoundByIndex(const size_t Id) + { + auto iter = sound_save_.find(Id); + if (iter != sound_save_.end()) { + iter->second->Close(); + sound_save_.erase(Id); + } + } + + Map SoundManager::GetAllSound() + { + Map Buf; + Buf.insert(sound_cache_.begin(), sound_cache_.end()); + return Buf; + } + } // namespace audio +} // namespace kiwano diff --git a/SoundManager.h b/SoundManager.h new file mode 100644 index 0000000..9070e04 --- /dev/null +++ b/SoundManager.h @@ -0,0 +1,162 @@ +// Copyright (c) 2016-2018 Kiwano - Nomango +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#pragma once +#include +#include + +namespace kiwano +{ + namespace audio + { + KGE_DECLARE_SMART_PTR(SoundManager); + + /** + * \addtogroup Audio + * @{ + */ + + /** + * \~chinese + * @brief Ƶ + */ + class KGE_API SoundManager : public ObjectBase + { + public: + SoundManager(); + + ~SoundManager(); + + /// \~chinese + /// @brief رƵļ + /// @param file_path Ƶļ· + /// @return Ƶʶ + size_t Load(const String& file_path); + + /// \~chinese + /// @brief رƵļ + /// @param file_path Ƶļ· + /// @return Ƶʶ + size_t Save_Load(const String& file_path); + + /// \~chinese + /// @brief ƵԴ + /// @param res ƵԴ + /// @return Ƶʶ + size_t Load(const Resource& res); + + /// \~chinese + /// @brief Ƶ + /// @param id Ƶʶ + /// @param loop_count ѭ -1 Ϊѭ + void Play(size_t id, int loop_count = 0); + + /// \~chinese + /// @brief ͣƵ + /// @param id Ƶʶ + void Pause(size_t id); + + /// \~chinese + /// @brief Ƶ + /// @param id Ƶʶ + void Resume(size_t id); + + /// \~chinese + /// @brief ֹͣƵ + /// @param id Ƶʶ + void Stop(size_t id); + + /// \~chinese + /// @brief ȡƵ״̬ + /// @param id Ƶʶ + bool IsPlaying(size_t id); + + /// \~chinese + /// @brief ȡ + float GetVolumeRate() const; + + /// \~chinese + /// @brief + /// @param volume С1.0 Ϊԭʼ, 1 ΪŴ, 0 ΪС + void SetVolumeRate(float volume); + + /// \~chinese + /// @brief ȡƵļid + /// @param file_path Ƶļ· + /// @return Ƶʶ + size_t GetId(const String& file_path) const; + + /// \~chinese + /// @brief ȡƵԴid + /// @param res ƵԴ + /// @return Ƶʶ + size_t GetId(const Resource& res) const; + + /// \~chinese + /// @brief ȡֶ + /// @param id Ƶʶ + SoundPtr GetSound(size_t id) const; + + /// \~chinese + /// @brief ȡֶ + /// @param id Ƶʶ + SoundPtr GetSaveSound(size_t id) const; + + /// \~chinese + /// @brief ͣƵ + void PauseAll(); + + /// \~chinese + /// @brief Ƶ + void ResumeAll(); + + /// \~chinese + /// @brief ֹͣƵ + void StopAll(); + + /// \~chinese + /// @brief + void ClearCache(); + + /// \~chinese + /// @brief ͷֶ + /// @param id Ƶʶ + void ReleaseSoundByIndex(const size_t Id); + + /// \~chinese + /// @brief ͷֶ + /// @param id Ƶʶ + void ReleaseSaveSoundByIndex(const size_t Id); + + /// \~chinese + /// @brief ȡֶ + Map GetAllSound(); + + private: + float volume_rate; + + using SoundMap = Map; + SoundMap sound_cache_; + SoundMap sound_save_; + }; + + /** @} */ + } // namespace audio +} // namespace kiwano diff --git a/SpriteActorRegister.h b/SpriteActorRegister.h new file mode 100644 index 0000000..1aa821b --- /dev/null +++ b/SpriteActorRegister.h @@ -0,0 +1,373 @@ +#pragma once +//ԱָMap +extern std::mapActorPtrMapObject; + +extern NPK_M* npk; +//ͼ +static SQInteger Create_Image(HSQUIRRELVM v) +{ + SQInteger Top = sq_gettop(v); + if (Top <= 0) + { + sq_throwerror(v, _SST("Incorrect function argument")); + return 0; + } + + + const SQChar* gOutPutBuffer; + sq_getstring(v, 2, &gOutPutBuffer); + + SQInteger gFrame; + sq_getinteger(v, 3, &gFrame); + + //תimg + std::string TextureName = (char*)gOutPutBuffer; + + // + TexturePtr t = SquirrelClassEx::GetTexturePtrByImg(TextureName, gFrame); + + // + SpritePtr Png = new Sprite(t); + + //ȡΨһID + uint64_t UUID = Png->GetObjectID(); + + //Map + ActorPtrMapObject[UUID] = Png; + + sq_pushinteger(v, UUID); + + return 1; +} + +//߼ͼ +static SQInteger Create_ImageEx(HSQUIRRELVM v) +{ + SQInteger Top = sq_gettop(v); + if (Top <= 0) + { + sq_throwerror(v, _SST("Incorrect function argument")); + return 0; + } + + + //˳ʼ + if (Top == 3) { + const SQChar* gOutPutBuffer; + sq_getstring(v, 2, &gOutPutBuffer); + + SQInteger gFrame; + sq_getinteger(v, 3, &gFrame); + + std::string TextureName = (char*)gOutPutBuffer; + + SpriteExPtr Png = new SpriteEx(); + + TexturePtr t = SquirrelClassEx::GetTexturePtrByImg(TextureName, gFrame); + + Png->SetFrame(t); + + //ȡΨһID + uint64_t UUID = Png->GetObjectID(); + + //߼Map + ActorPtrMapObject[UUID] = Png; + + sq_pushinteger(v, UUID); + + } + // + else if (Top == 1) { + + SpriteExPtr Png = new SpriteEx(); + + //ȡΨһID + uint64_t UUID = Png->GetObjectID(); + + //߼Map + ActorPtrMapObject[UUID] = Png; + + sq_pushinteger(v, UUID); + + } + + return 1; +} + + +//ø߼ͼģʽ +static SQInteger Set_ImageEx_Mode(HSQUIRRELVM v) +{ + SQInteger Top = sq_gettop(v); + if (Top <= 0) + { + sq_throwerror(v, _SST("Incorrect function argument")); + return 0; + } + + SQInteger ActorUUID; + sq_getinteger(v, 2, &ActorUUID); + + SQInteger gType; + sq_getinteger(v, 3, &gType); + + //ȫMapлȡ߼ɫ + if (ActorPtrMapObject.count(ActorUUID)) { + SpriteExPtr Png = dynamic_cast(ActorPtrMapObject[ActorUUID].Get()); + Png->SetMode(gType); + sq_pushbool(v, true); + } + else { + sq_pushbool(v, false); + } + + return 1; +} + +//ø߼ͼ֡ +static SQInteger Set_ImageEx_Frame(HSQUIRRELVM v) +{ + SQInteger Top = sq_gettop(v); + if (Top <= 0) + { + sq_throwerror(v, _SST("Incorrect function argument")); + return 0; + } + + + SQInteger ActorUUID; + sq_getinteger(v, 2, &ActorUUID); + + const SQChar* gOutPutBuffer; + sq_getstring(v, 3, &gOutPutBuffer); + + SQInteger gFrame; + sq_getinteger(v, 4, &gFrame); + + std::string TextureName = (char*)gOutPutBuffer; + + //ȫMapлȡ߼ɫ + if (ActorPtrMapObject.count(ActorUUID)) { + SpriteExPtr Png = dynamic_cast(ActorPtrMapObject[ActorUUID].Get()); + + TexturePtr t = SquirrelClassEx::GetTexturePtrByImg(TextureName, gFrame); + + Png->SetFrame(t); + + sq_pushbool(v, true); + } + else { + sq_pushbool(v, false); + } + + return 1; +} + + +//ø߼ͼ͸ +static SQInteger Set_ImageEx_Alpha(HSQUIRRELVM v) +{ + SQInteger Top = sq_gettop(v); + if (Top <= 0) + { + sq_throwerror(v, _SST("Incorrect function argument")); + return 0; + } + + + SQInteger ActorUUID; + sq_getinteger(v, 2, &ActorUUID); + + SQFloat Alpha; + sq_getfloat(v, 3, &Alpha); + + + //ȫMapлȡ߼ɫ + if (ActorPtrMapObject.count(ActorUUID)) { + SpriteExPtr Png = dynamic_cast(ActorPtrMapObject[ActorUUID].Get()); + Png->SetOpacity(Alpha); + sq_pushbool(v, true); + } + else { + sq_pushbool(v, false); + } + + return 1; +} + + + +//ø߼ͼ֡Ϣ +static SQInteger Set_ImageEx_FrameInfo(HSQUIRRELVM v) +{ + SQInteger Top = sq_gettop(v); + if (Top <= 0) + { + sq_throwerror(v, _SST("Incorrect function argument")); + return 0; + } + + + SQInteger ActorUUID; + sq_getinteger(v, 2, &ActorUUID); + + std::vector FrameDelay; + sq_pushnull(v); // null iterator + while (SQ_SUCCEEDED(sq_next(v, 3))) + { + SQInteger gDelay; + sq_getinteger(v, -1, &gDelay); + FrameDelay.push_back(gDelay); + //-1ֵ-2Ǽ + sq_pop(v, 2); //һε֮ǰֵ + } + sq_pop(v, 1); + + SQInteger Loop; + sq_getinteger(v, 4, &Loop); + + //ȫMapлȡ߼ɫ + if (ActorPtrMapObject.count(ActorUUID)) { + SpriteExPtr Png = dynamic_cast(ActorPtrMapObject[ActorUUID].Get()); + Png->SetFrameInfo(FrameDelay, Loop); + sq_pushbool(v, true); + } + else { + sq_pushbool(v, false); + } + + return 1; +} + +//ø߼ͼ񲥷Ŷ +static SQInteger Set_ImageEx_PlayAnimotion(HSQUIRRELVM v) +{ + SQInteger Top = sq_gettop(v); + if (Top <= 0) + { + sq_throwerror(v, _SST("Incorrect function argument")); + return 0; + } + + + SQInteger ActorUUID; + sq_getinteger(v, 2, &ActorUUID); + + SQBool Type; + sq_getbool(v, 3, &Type); + + //ȫMapлȡ߼ɫ + if (ActorPtrMapObject.count(ActorUUID)) { + SpriteExPtr Png = dynamic_cast(ActorPtrMapObject[ActorUUID].Get()); + Png->SetAnimotionPlay(Type); + sq_pushbool(v, true); + } + else { + sq_pushbool(v, false); + } + + return 1; +} + + +//ø߼Ani֡ +static SQInteger Set_ImageEx_Animotion_Frame(HSQUIRRELVM v) +{ + SQInteger Top = sq_gettop(v); + if (Top <= 0) + { + sq_throwerror(v, _SST("Incorrect function argument")); + return 0; + } + + + SQInteger ActorUUID; + sq_getinteger(v, 2, &ActorUUID); + + SQInteger Frame; + sq_getinteger(v, 3, &Frame); + + //ȫMapлȡ߼ɫ + if (ActorPtrMapObject.count(ActorUUID)) { + SpriteExPtr Png = dynamic_cast(ActorPtrMapObject[ActorUUID].Get()); + Png->SetAnimotionFrame(Frame); + sq_pushbool(v, true); + } + else { + sq_pushbool(v, false); + } + + return 1; +} + + + +//ø߼Ӱ +static SQInteger Set_ImageEx_Shadow(HSQUIRRELVM v) +{ + SQInteger Top = sq_gettop(v); + if (Top <= 0) + { + sq_throwerror(v, _SST("Incorrect function argument")); + return 0; + } + + + SQInteger ActorUUID; + sq_getinteger(v, 2, &ActorUUID); + + //SQInteger Frame; + //sq_getinteger(v, 3, &Frame); + + //ȫMapлȡ߼ɫ + if (ActorPtrMapObject.count(ActorUUID)) { + SpriteExPtr Png = dynamic_cast(ActorPtrMapObject[ActorUUID].Get()); + Png->SetShadow(); + sq_pushbool(v, true); + } + else { + sq_pushbool(v, false); + } + + return 1; +} + +//òо +static SQInteger Set_Image_CropRect(HSQUIRRELVM v) +{ + SQInteger Top = sq_gettop(v); + if (Top <= 0) + { + sq_throwerror(v, _SST("Incorrect function argument")); + return 0; + } + + + SQInteger ActorUUID; + sq_getinteger(v, 2, &ActorUUID); + + SQFloat L; + sq_getfloat(v, 3, &L); + + SQFloat U; + sq_getfloat(v, 4, &U); + + SQFloat R; + sq_getfloat(v, 5, &R); + + SQFloat D; + sq_getfloat(v, 6, &D); + + //ȫMapлȡ߼ɫ + if (ActorPtrMapObject.count(ActorUUID)) { + SpritePtr Png = dynamic_cast(ActorPtrMapObject[ActorUUID].Get()); + + Png->SetCropRect(Rect(Point(L,U), Point(R, D))); + sq_pushbool(v, true); + } + else { + sq_pushbool(v, false); + } + + return 1; +} \ No newline at end of file diff --git a/SpriteEx.cpp b/SpriteEx.cpp new file mode 100644 index 0000000..6381977 --- /dev/null +++ b/SpriteEx.cpp @@ -0,0 +1,187 @@ +#include "SpriteEx.h" +#include "SquirrelClassEx.h" +//#include "kiwano/render/DirectX/D3DDeviceResources.h" +//#include "kiwano/render/DirectX/NativePtr.h" +//#include "d2d1effects_2.h" + +std::unordered_mapImageRecShadowObject; + +#pragma comment(lib, "d2d1.lib") +#pragma comment(lib, "dxguid.lib") + +extern NPK_M* npk; + +SpriteEx::SpriteEx(const std::string imgpath, const int frame) +{ + SetFrame(SquirrelClassEx::GetTexturePtrByImg(imgpath, frame)); +} + +void SpriteEx::SetPosition(const Point& point) +{ + TexturePtr t = GetTexture(); + ImgInfo Img = *(ImgInfo*)t->GetUserData(); + Actor::SetPosition(Point((point.x + Img.Xpos), (point.y + Img.Ypos) * GetScale().y)); + + +} + + + + +void SpriteEx::SetScale(const Point& point) +{ + //if (ShadowObject) { + // ShadowObject->GetTransform().skew = Vec2((-20.0) * (GetParent()->GetScale().x), 0.0); + + //} + Sprite::SetScale(point); +} + +void SpriteEx::OnRender(RenderContext& ctx) +{ + + //if (INTERPOLATION_MODE != D2D1_INTERPOLATION_MODE_FORCE_DWORD && COMPOSITE_MODE != D2D1_COMPOSITE_MODE_FORCE_DWORD) + //{ + // auto bitmap = NativePtr::Get(GetFrame().GetTexture()); + + // auto d2d_res = graphics::directx::GetD2DDeviceResources(); + + // d2d_res->GetDeviceContext()->DrawImage( + // bitmap.Get(), + // INTERPOLATION_MODE, + // COMPOSITE_MODE + // ); + + // //auto bitmap = NativePtr::Get(GetFrame().GetTexture()); + // //auto m_d2dContext = graphics::directx::GetD2DDeviceResources()->GetDeviceContext(); + // //ComPtr chromakeyEffect; + // //m_d2dContext->CreateEffect(CLSID_D2D1Emboss, &chromakeyEffect); + + // // + // //chromakeyEffect->SetInput(0, bitmap.Get()); + // ////chromakeyEffect->SetValue(D2D1_CHROMAKEY_PROP_COLOR, Color{ 1.0f, 1.0f, 1.0f, 1.0f }); + // ////chromakeyEffect->SetValue(D2D1_CHROMAKEY_PROP_TOLERANCE, 0.2f); + // ////chromakeyEffect->SetValue(D2D1_CHROMAKEY_PROP_INVERT_ALPHA, true); + // //chromakeyEffect->SetValue(D2D1_EMBOSS_PROP_HEIGHT, 1.0f); + // //chromakeyEffect->SetValue(D2D1_EMBOSS_PROP_DIRECTION, 0.0f); + + // //m_d2dContext->DrawImage(chromakeyEffect.Get()); + //} + //else { + // this->Sprite::OnRender(ctx); + //} + + + switch (MyModel) + { + case -1: //-1ԭʼģʽ + ctx.SetBlendMode(BlendMode::SourceOver); + break; + case 0: //0Լ + ctx.SetBlendMode(BlendMode::Add); + break; + default: + ctx.SetBlendMode(BlendMode::SourceOver); + break; + } + + this->Sprite::OnRender(ctx); + +} + +//void SpriteEx::OnUpdate(Duration dt) { +// //ڲ״̬ +// if (is_Animotion_Play) { +// //ǰ֡С֡ʱִ߼ +// if (NowFrameIndex < MaxFrameCount) { +// if (OffsetTime == 0)OffsetTime = clock(); +// if ((clock() - OffsetTime) >= MyDelay[NowFrameIndex]) { +// OffsetTime = clock(); +// NowFrameIndex++; +// SquirrelClassEx::RunUpdateScript("AnimotionUpdateCallBack", this->GetObjectID(), NowFrameIndex); +// } +// } +// //ʱ õǰ֡ +// else { +// OffsetTime = 0; +// NowFrameIndex = 0; +// MyLoop--; +// if (MyLoop != 0) { +// SquirrelClassEx::RunUpdateScript("AnimotionUpdateCallBack", this->GetObjectID(), NowFrameIndex); +// } +// else { +// is_Animotion_Play = false; +// } +// } +// } +//} + +void SpriteEx::SetFrameInfo(std::vector FrameDaley , const int Loop) +{ + MyDelay = FrameDaley; + MaxFrameCount = FrameDaley.size(); + MyLoop = Loop; +} + +void SpriteEx::SetAnimotionPlay(bool Type) +{ + is_Animotion_Play = Type; + //ʼԺ һȴ0֡ + SquirrelClassEx::RunUpdateScript("AnimotionUpdateCallBack", this->GetObjectID(), NowFrameIndex); +} + +void SpriteEx::SetAnimotionFrame(const int gFrame) +{ + this->NowFrameIndex = gFrame; +} + +void SpriteEx::SetShadow() +{ + + TexturePtr t; + ImgInfo Img = *(ImgInfo*)GetTexture()->GetUserData(); + + if (ImageRecShadowObject.count(GetTexture()->GetObjectID())) { + t = ImageRecShadowObject[GetTexture()->GetObjectID()]; + } + else { + + BYTE* Data = Img.PNGdata; + BYTE* NewData = new BYTE[Img.Height * Img.Width * 4]; + + for (size_t i = 0; i < Img.Height * Img.Width * 4; i++) + { + if ((i + 1) % 4 == 0) + NewData[i] = Data[i]; + else + NewData[i] = 0; + } + + BinaryData data = { ((void*)NewData) ,(uint32_t)(Img.Height * Img.Width * 4) }; + t = new Texture(); + t->Load(PixelSize(Img.Width, Img.Height), data, PixelFormat::Bpp32BGRA); + t->SetUserData(&Img); + ImageRecShadowObject[GetTexture()->GetObjectID()] = t; + + } + + if (ShadowObject) { + ShadowObject->SetFrame(t); + } + else { + ShadowObject = new SpriteEx(t); + ShadowObject->SetAnchor(1, 1); + ShadowObject->SetOpacity(0.4); + ShadowObject->SetZOrder(-1); + AddChild(ShadowObject); + //GetParent()->GetParent()->AddChild(ShadowObject); + } + + Transform B; + B.scale = Vec2(1.0, 0.29); + B.position = Point(GetWidth(), GetHeight() - 5); + B.skew = Vec2((-20.0) * (GetParent()->GetScale().x), 0.0); + ShadowObject->SetTransform(B); + +} + diff --git a/SpriteEx.h b/SpriteEx.h new file mode 100644 index 0000000..b21947c --- /dev/null +++ b/SpriteEx.h @@ -0,0 +1,72 @@ +#pragma once +#include +using namespace kiwano; +//#include "kiwano/render/DirectX/NativePtr.h" + +KGE_DECLARE_SMART_PTR(SpriteEx); + +class SpriteEx : public Sprite +{ +private: + //D2D1_INTERPOLATION_MODE INTERPOLATION_MODE = D2D1_INTERPOLATION_MODE_FORCE_DWORD; + //D2D1_COMPOSITE_MODE COMPOSITE_MODE = D2D1_COMPOSITE_MODE_FORCE_DWORD; + int MyModel = -1; + std::string TexturePtrName; + //Ӱ + SpriteExPtr ShadowObject = nullptr; + + //Ŷʱ + int OffsetTime = 0; + //ӳټ + std::vector MyDelay; + //ǷDzŶ + bool is_Animotion_Play = false; + //ǰ֡ + int NowFrameIndex = 0; + //֡ + int MaxFrameCount = 0; + //Ƿѭ + int MyLoop = -1; + + +public: + SpriteEx() + { + + } + + SpriteEx(TexturePtr texture) + { + SetFrame(SpriteFrame(texture)); + } + + SpriteEx(const std::string Path) + { + Load(Path); + } + + SpriteEx(const std::string imgpath, const int frame); + + //NPK仯 + void SetPosition(const Point& point)override; + + //ҪıӰ + void SetScale(const Point& point)override; + + void OnRender(RenderContext& ctx) override; + + void SetMode(int Type) { + MyModel = Type; + } + + //void OnUpdate(Duration dt) override; + + void SetFrameInfo(std::vector FrameDaley,const int Loop); + + void SetAnimotionPlay(bool Type); + + void SetAnimotionFrame(const int gFrame); + + void SetShadow(); +}; + diff --git a/SquirrelActor.cpp b/SquirrelActor.cpp new file mode 100644 index 0000000..b6307b6 --- /dev/null +++ b/SquirrelActor.cpp @@ -0,0 +1,14 @@ +#include "SquirrelActor.h" + +extern SquirrelClassEx* TObject; + +SquirrelActor::SquirrelActor(std::string gActorName) +{ + ActorName = gActorName; +} + + +void SquirrelActor::OnUpdate(Duration dt) +{ + +} diff --git a/SquirrelActor.h b/SquirrelActor.h new file mode 100644 index 0000000..b6079e5 --- /dev/null +++ b/SquirrelActor.h @@ -0,0 +1,16 @@ +#pragma once +#include +#include "SquirrelClassEx.h" +#include +using namespace kiwano; +class SquirrelActor :public Actor +{ +private: + std::string ActorName; + bool OnStartFrame = false; +public: + + SquirrelActor(std::string gActorName); + void OnUpdate(Duration dt) override; +}; + diff --git a/SquirrelButton.cpp b/SquirrelButton.cpp new file mode 100644 index 0000000..bcd1f60 --- /dev/null +++ b/SquirrelButton.cpp @@ -0,0 +1,120 @@ +#include "SquirrelButton.h" +#include "SquirrelClassEx.h" + + +void SquirrelButton::OnClick(Event* evt) { + //ǰ̬еж ʵж̬ͣ + if (this->MyState != 3)return; + auto mouse_evt = dynamic_cast(evt); + if (mouse_evt->button == MouseButton::Left) + { + SquirrelClassEx::RunUpdateScript("ButtonUpdateCallBack", this->GetObjectID(), 10); + } + else if (mouse_evt->button == MouseButton::Right) + { + SquirrelClassEx::RunUpdateScript("ButtonUpdateCallBack", this->GetObjectID(), 11); + } + else if (mouse_evt->button == MouseButton::Middle) + { + SquirrelClassEx::RunUpdateScript("ButtonUpdateCallBack", this->GetObjectID(), 12); + } +} + +void SquirrelButton::OnHover() { + //봦̬ͨʱŻ̬ͣ + if (this->MyState == 0) { + SetState(2); + //this->_is_Hover = true; + } +} + +void SquirrelButton::OnOut() { + if (this->MyState == 1)return; + //Ƴʱڰ̬ ôҲҪڵһOnUp + if (this->MyState == 3) { + SetState(2); + this->SetPositionY(this->GetPositionY() - 1); + } + SetState(0); + //this->_is_Hover = false; +} + +void SquirrelButton::OnDown(Event* evt) { + if (this->MyState == 1)return; + if (this->MyState == 2) { + SetState(3); + this->SetPositionY(this->GetPositionY() + 1); + } +} + +void SquirrelButton::OnUp(Event* evt) { + if (this->MyState == 1)return; + if (this->MyState == 3) { + SetState(2); + this->SetPositionY(this->GetPositionY() - 1); + } +} + +bool SquirrelButton::IsPress(const int Type) +{ + switch (Type) + { + case 0: { + if (this->_is_Left_Press) { + this->_is_Left_Press = false; + return true; + } + else { + return false; + } + } + break; + case 1: { + if (this->_is_Right_Press) { + this->_is_Right_Press = false; + return true; + } + else { + return false; + } + } + break; + case 2: { + if (this->_is_Middle_Press) { + this->_is_Middle_Press = false; + return true; + } + else { + return false; + } + } + break; + } +} + +bool SquirrelButton::IsHover() +{ + return this->_is_Hover; +} + +void SquirrelButton::SetState(const int state) +{ + this->MyState = state; + SquirrelClassEx::RunUpdateScript("ButtonUpdateCallBack", this->GetObjectID(), state); +} + +void SquirrelButton::Init() +{ + //ȵøInit ʼſԳɹעUI + this->UiFrameWork::Init(); + + //ڸInitѾװ ֻҪźŵĴ߼ + AddListener(Closure(this, &SquirrelButton::OnClick)); + AddListener(Closure(this, &SquirrelButton::OnDown)); + AddListener(Closure(this, &SquirrelButton::OnUp)); + +} + +void SquirrelButton::OnUpdate(Duration dt) { + //SquirrelClassEx::RunUpdateScript("ButtonUpdateCallBack", this->GetObjectID(), this->MyState); +} \ No newline at end of file diff --git a/SquirrelButton.h b/SquirrelButton.h new file mode 100644 index 0000000..ff30600 --- /dev/null +++ b/SquirrelButton.h @@ -0,0 +1,49 @@ +#pragma once + +#include "UiFrameWork.h" + +KGE_DECLARE_SMART_PTR(SquirrelButton); + +class SquirrelButton : public UiFrameWork +{ +private: + //̬ + std::string NORMAL = "ImagePacks2/Error/base.png"; + //̬ + std::string DISABLE = "ImagePacks2/Error/base.png"; + //̬ͣ + std::string HOVER = "ImagePacks2/Error/base.png"; + //̬ + std::string PRESS = "ImagePacks2/Error/base.png"; + + //״̬ + int MyState = 0; + + //Ƿ + bool _is_Left_Press = false; + //ǷҼ + bool _is_Right_Press = false; + //Ƿм + bool _is_Middle_Press = false; + //Ƿͣ + bool _is_Hover = false; + +public: + SquirrelButton() { + Init(); + } + + void Init() override; + void OnClick(Event* evt); + void OnHover()override; + void OnOut()override; + void OnDown(Event* evt); + void OnUp(Event* evt); + bool IsPress(const int Type); + bool IsHover(); + + void SetState(const int state); + + void OnUpdate(Duration dt) override; +}; + diff --git a/SquirrelCamera.cpp b/SquirrelCamera.cpp new file mode 100644 index 0000000..5837e9f --- /dev/null +++ b/SquirrelCamera.cpp @@ -0,0 +1,7 @@ +#include "SquirrelCamera.h" +#include "SquirrelClassEx.h" + +void SquirrelCamera::OnUpdate(Duration dt) +{ + SquirrelClassEx::RunUpdateScript("CameraUpdateCallBack", this->GetObjectID(),dt.GetMilliseconds()); +} diff --git a/SquirrelCamera.h b/SquirrelCamera.h new file mode 100644 index 0000000..31a78d9 --- /dev/null +++ b/SquirrelCamera.h @@ -0,0 +1,14 @@ +#pragma once +#include +using namespace kiwano; + +KGE_DECLARE_SMART_PTR(SquirrelCamera); + + +class SquirrelCamera : + public Actor +{ +public: + void OnUpdate(Duration dt) override; +}; + diff --git a/SquirrelClassEx.cpp b/SquirrelClassEx.cpp new file mode 100644 index 0000000..fcc8198 --- /dev/null +++ b/SquirrelClassEx.cpp @@ -0,0 +1,2116 @@ +#include +#include "SquirrelClassEx.h" + +//ԱָMap +static std::mapActorPtrMapObject; +//ƵָMap +static std::mapSoundActorPtrMapObject; +extern std::unordered_map>ImageRecObject; + +//ʱװList Map +std::mapGameAvatarList; +//װList Map +std::mapGameEquipmentList; +//ͼList Map +std::mapGameMapList; +//List Map +std::mapGameMonsterList; +//List Map +std::mapGamePassobjectList; +//Ƶ Map +std::mapGameAudioList; + +//עắ +#include "TextActorRegister.h" +//עắ +#include "SpriteActorRegister.h" +//Ƶעắ +#include "SoundActorRegister.h" +//עắ +#include "StageActorRegister.h" +//עắ +#include "CanvasActorRegister.h" +//ťעắ +#include "ButtonActorRegister.h" +//IMGUIעắ +#include "ImguiLayerActorRegister.h" +//߳עắ +#include "ThreadRegister.h" + + +wchar_t* char2wchar(const char* cchar) +{ + wchar_t* m_wchar; + int len = MultiByteToWideChar(CP_ACP, 0, cchar, strlen(cchar), NULL, 0); + m_wchar = new wchar_t[len + 1]; + MultiByteToWideChar(CP_ACP, 0, cchar, strlen(cchar), m_wchar, len); + m_wchar[len] = '\0'; + return m_wchar; +} + +wchar_t* SquirrelW2W(const wchar_t* Str) +{ + size_t len = 0; + char* wbuffer = (char*)(Str); + while (true) + { + if (wbuffer[len] == 0 && wbuffer[len - 1] == 0)break; + ++len; + } + char* cbuffer = new char[len / 2 + 1]; + int k = 0; + for (size_t i = 0; i < len; i++) + { + if (i % 2 == 0) + { + cbuffer[k] = wbuffer[i]; + ++k; + } + } + cbuffer[len / 2] = '\0'; + wchar_t* str = char2wchar(cbuffer); + delete[]cbuffer; + return str; +} + +//ԭ +void printfunc(HSQUIRRELVM SQ_UNUSED_ARG(v), const SQChar* s, ...) +{ + va_list vl; + va_start(vl, s); + vfprintf(stdout, (char*)s, vl); + va_end(vl); + std::cout << std::endl; +} + +void errorfunc(HSQUIRRELVM SQ_UNUSED_ARG(v), const SQChar* s, ...) +{ + va_list vl; + va_start(vl, s); + vfprintf(stderr, (char*)s, vl); + va_end(vl); +} + + + + +//캯 +SquirrelClassEx::SquirrelClassEx() +{ + +} + +void SquirrelClassEx::LoadingListScript() +{ + //ȡʱװList + std::ifstream AvatarStream("Script/Avatar/Avatar.ylst"); + nlohmann::json AvatarList = nlohmann::json::parse(AvatarStream); + AvatarStream.close(); + for (nlohmann::json::iterator it = AvatarList.begin(); it != AvatarList.end(); ++it) { + std::string Path = it.value().dump(); + Path = Path.substr(1, Path.size() - 2); + GameAvatarList[std::atoi(it.key().c_str())] = Path; + } + + //ȡװList + std::ifstream EquipmentStream("Script/Equipment/Equipment.ylst"); + nlohmann::json EquipmentList = nlohmann::json::parse(EquipmentStream); + EquipmentStream.close(); + for (nlohmann::json::iterator it = EquipmentList.begin(); it != EquipmentList.end(); ++it) { + std::string Path = it.value().dump(); + Path = Path.substr(1, Path.size() - 2); + GameEquipmentList[std::atoi(it.key().c_str())] = Path; + } + + //ȡͼList + std::ifstream MapStream("Script/Map/Map.ylst"); + nlohmann::json MapList = nlohmann::json::parse(MapStream); + MapStream.close(); + for (nlohmann::json::iterator it = MapList.begin(); it != MapList.end(); ++it) { + std::string Path = it.value().dump(); + Path = Path.substr(1, Path.size() - 2); + GameMapList[std::atoi(it.key().c_str())] = Path; + } + + //ȡList + std::ifstream MonsterStream("Script/Monster/Monster.ylst"); + nlohmann::json MonsterList = nlohmann::json::parse(MonsterStream); + MonsterStream.close(); + for (nlohmann::json::iterator it = MonsterList.begin(); it != MonsterList.end(); ++it) { + std::string Path = it.value().dump(); + Path = Path.substr(1, Path.size() - 2); + GameMonsterList[std::atoi(it.key().c_str())] = Path; + } + + //ȡList + std::ifstream PassobjectStream("Script/PassObject/PassObject.ylst"); + nlohmann::json PassobjectList = nlohmann::json::parse(PassobjectStream); + PassobjectStream.close(); + for (nlohmann::json::iterator it = PassobjectList.begin(); it != PassobjectList.end(); ++it) { + std::string Path = it.value().dump(); + Path = Path.substr(1, Path.size() - 2); + GamePassobjectList[std::atoi(it.key().c_str())] = Path; + } + + //ȡƵList + std::ifstream AudioStream("Script/Audio/Audio.ylst"); + nlohmann::json AudioList = nlohmann::json::parse(AudioStream); + AudioStream.close(); + for (nlohmann::json::iterator it = AudioList.begin(); it != AudioList.end(); ++it) { + std::string Path = it.value().dump(); + Path = Path.substr(1, Path.size() - 2); + GameAudioList[it.key().c_str()] = Path; + } +} + +//ʼ +void SquirrelClassEx::Init() +{ + //ʼNPK + npk = new NPK_M(); + npk->init(); + + v = sq_open(4096); //ջijʼСΪ1024 + sq_setprintfunc(v, printfunc, errorfunc); + + sq_pushroottable(v); + + sqstd_register_bloblib(v); + sqstd_register_iolib(v); + sqstd_register_systemlib(v); + sqstd_register_mathlib(v); + sqstd_register_stringlib(v); + sqstd_seterrorhandlers(v); + + R_Register_Nut(v); + + //汾Ϣ + scfprintf(stdout, _SC("%s %s (%d bits)\n"), SQUIRREL_VERSION, SQUIRREL_COPYRIGHT, (int)sizeof(SQInteger) * 8); + + sqstd_dofile(v, _SST("Sqr/BaseTool/BaseTool.nut"), false, true); + + //һμؽű + ReloadingScript(); + + sqstd_dofile(v, _SST("Sqr/Run.nut"), false, true); +} + +int SquirrelClassEx::Sout(HSQUIRRELVM v) +{ + SQInteger Top = sq_gettop(v); + if (Top <= 0) + { + sq_throwerror(v, _SST("Incorrect function argument")); + return 0; + } + + const SQChar* OutPutBuffer; + sq_getstring(v, 2, &OutPutBuffer); + + char* OutPutText = SquirrelU2W((char*)OutPutBuffer); + + std::vector Data; + Split(OutPutText, Data, "%L"); + delete[]OutPutText; + + if (Top != Data.size() + 1) + { + sq_throwerror(v, _SST("Incorrect function argument")); + return 0; + } + + size_t Fnum = Data.size(); + if (Fnum > 1)Fnum -= 1; + std::string Text = ""; + for (size_t i = 0; i < Fnum; i++) + { + std::string Parameter; + //ȡֵ + int ValueType = sq_gettype(v, 3 + i); + //жֵ + switch (ValueType) + { + case OT_INTEGER://int + { + SQInteger Value; + sq_getinteger(v, 3 + i, &Value); + Parameter = std::to_string(Value); + break; + } + case OT_FLOAT://float + { + FLOAT Value; + sq_getfloat(v, 3 + i, &Value); + std::ostringstream oss; + oss << Value; + std::string str(oss.str()); + Parameter = str; + break; + } + case OT_BOOL://bool + { + SQBool Value; + sq_getbool(v, 3 + i, &Value); + switch (Value) + { + case true: + Parameter = "true"; + break; + case false: + Parameter = "false"; + break; + } + //Parameter = std::to_string(Value); + break; + } + case OT_STRING://string + { + const SQChar* Value; + sq_getstring(v, 3 + i, &Value); + char* str = SquirrelU2W((char*)Value); + Parameter = str; + delete[]str; + break; + } + default: + Parameter = " "; + break; + } + Text += Data[i]; + Text += Parameter; + } + std::cout << Text << std::endl; + return 0; +} + +int SquirrelClassEx::Error(HSQUIRRELVM v) +{ + SQInteger Top = sq_gettop(v); + if (Top <= 0) + { + sq_throwerror(v, _SST("Incorrect function argument")); + return 0; + } + + const SQChar* OutPutBuffer; + sq_getstring(v, 2, &OutPutBuffer); + + char* OutPutText = SquirrelU2W((char*)OutPutBuffer); + + std::vector Data; + Split(OutPutText, Data, "%L"); + delete[]OutPutText; + + if (Top != Data.size() + 1) + { + sq_throwerror(v, _SST("Incorrect function argument")); + return 0; + } + + size_t Fnum = Data.size(); + if (Fnum > 1)Fnum -= 1; + std::string Text = ""; + for (size_t i = 0; i < Fnum; i++) + { + std::string Parameter; + //ȡֵ + int ValueType = sq_gettype(v, 3 + i); + //жֵ + switch (ValueType) + { + case OT_INTEGER://int + { + SQInteger Value; + sq_getinteger(v, 3 + i, &Value); + Parameter = std::to_string(Value); + break; + } + case OT_FLOAT://float + { + FLOAT Value; + sq_getfloat(v, 3 + i, &Value); + std::ostringstream oss; + oss << Value; + std::string str(oss.str()); + Parameter = str; + break; + } + case OT_BOOL://bool + { + SQBool Value; + sq_getbool(v, 3 + i, &Value); + switch (Value) + { + case true: + Parameter = "true"; + break; + case false: + Parameter = "false"; + break; + } + //Parameter = std::to_string(Value); + break; + } + case OT_STRING://string + { + const SQChar* Value; + sq_getstring(v, 3 + i, &Value); + char* str = SquirrelU2W((char*)Value); + Parameter = str; + delete[]str; + break; + } + default: + Parameter = " "; + break; + } + Text += Data[i]; + Text += Parameter; + } + HANDLE hCon = GetStdHandle(STD_OUTPUT_HANDLE); //ȡ + SetConsoleTextAttribute(hCon, FOREGROUND_RED); //ıɫ + std::cout << "[Squirrel Error] : " << Text << std::endl; + return 0; +} + +char* SquirrelClassEx::U8ToUnicode(const char* szU8) +{ + //UTF8 to Unicode + //ԤתõռĴС + int wcsLen = ::MultiByteToWideChar(CP_UTF8, NULL, szU8, strlen(szU8), NULL, 0); + //ռҪ'\0'ռ䣬MultiByteToWideChar'\0'ռ + wchar_t* wszString = new wchar_t[wcsLen + 1]; + //ת + ::MultiByteToWideChar(CP_UTF8, NULL, szU8, strlen(szU8), wszString, wcsLen); + //'\0' + wszString[wcsLen] = '\0'; + + char* m_char; + int len = WideCharToMultiByte(CP_ACP, 0, wszString, wcslen(wszString), NULL, 0, NULL, NULL); + m_char = new char[len + 1]; + WideCharToMultiByte(CP_ACP, 0, wszString, wcslen(wszString), m_char, len, NULL, NULL); + delete[]wszString; + m_char[len] = '\0'; + return m_char; +} + +char* SquirrelClassEx::SquirrelU2W(const char* Str) +{ + size_t len = 0; + char* wbuffer = (char*)(Str); + while (true) + { + if (wbuffer[len] == 0 && wbuffer[len - 1] == 0)break; + ++len; + } + char* cbuffer = new char[len + 1]; + + for (size_t i = 0; i < len; i++) + { + cbuffer[i] = wbuffer[i]; + //std::cout << std::hex << (int)cbuffer[i] << std::endl; + } + cbuffer[len] = '\0'; + char* Text = U8ToUnicode(cbuffer); + //std::cout << Text << std::endl; + delete[]cbuffer; + return Text; +} + +void SquirrelClassEx::Split(const std::string& src, std::vector& dest, const std::string& separator) +{ + std::string str = src; + std::string substring; + std::string::size_type start = 0, index; + dest.clear(); + index = str.find_first_of(separator, start); + do + { + if (index != std::string::npos) + { + substring = str.substr(start, index - start); + dest.push_back(substring); + start = index + separator.size(); + index = str.find(separator, start); + if (start == std::string::npos) break; + } + } while (index != std::string::npos); + + //the last part + substring = str.substr(start); + dest.push_back(substring); +} + +void SquirrelClassEx::RegisterNutApi(const SQChar* funcName, void* funcAddr, HSQUIRRELVM v) +{ + sq_pushroottable(v); + sq_pushstring(v, funcName, -1); + sq_newclosure(v, (SQFUNCTION)funcAddr, 0); + sq_newslot(v, -3, false); + sq_poptop(v); +} + +TexturePtr SquirrelClassEx::GetTexturePtrByImg(const std::string ImgPath, const int Frame) { + + if (ImageRecObject.count(ImgPath) && ImageRecObject[ImgPath].count(Frame)) { + return ImageRecObject[ImgPath][Frame]; + } + else { + IMG* img = npk->ReadNpkTable(ImgPath); + DWORD Height = img->lp_lplist[Frame].Height; + DWORD Width = img->lp_lplist[Frame].Width; + BYTE* Data = img->lp_lplist[Frame].PNGdata; + + BinaryData data = { ((void*)Data) ,Height * Width * 4 }; + TexturePtr t = new Texture; + t->Load(PixelSize(Width, Height), data, PixelFormat::Bpp32BGRA); + + + t->SetUserData(&img->lp_lplist[Frame]); + ImageRecObject[ImgPath][Frame] = t; + return t; + } +} + +void SquirrelClassEx::ReleaseTextureByImg(const std::string ImgPath) +{ + IMG* img = npk->ReadNpkTable(ImgPath); + for (size_t i = 0; i < img->png_sum; i++) + { + std::string RealTextureName = ImgPath; + ImageRecObject.erase(RealTextureName); + } +} + +std::map FileFirst; +std::map FileLast; +void ReloadingSquirrelScript(const TCHAR* directory) +{ + WIN32_FIND_DATA fileInfo; + TCHAR buffer[MAX_PATH]; + + // · + _tcscpy_s(buffer, directory); + _tcscat_s(buffer, _T("\\*.*")); + + + // ҵһļ/Ŀ¼ + HANDLE hFind = FindFirstFile(buffer, &fileInfo); + if (hFind != INVALID_HANDLE_VALUE) + { + do + { + // ų "." ".." + if (_tcscmp(fileInfo.cFileName, _T(".")) != 0 && _tcscmp(fileInfo.cFileName, _T("..")) != 0) + { + // Ŀ¼ݹĿ¼ + if (fileInfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) + { + _tcscpy_s(buffer, directory); + _tcscat_s(buffer, _T("\\")); + _tcscat_s(buffer, fileInfo.cFileName); + ReloadingSquirrelScript(buffer); + } + else { + + char output[1024]; + sprintf(output, "%ws\\%ws", directory, fileInfo.cFileName); + std::string path = output; + if (path.find(".nut") != std::string::npos && path.find("Run.nut") == std::string::npos) { + std::replace(path.begin(), path.end(), '\\', '/'); + + std::fstream F; + F.open(path,std::ios::in); + std::stringstream ContentStringStream; + ContentStringStream << F.rdbuf(); + /*while (!F.eof()) + { + F >> ContentString; + }*/ + std::string ContentString(ContentStringStream.str()); + F.close(); + + if (ContentString.find("extends") != std::string::npos) { + FileLast[path] = ContentString; + } + else { + FileFirst[path] = ContentString; + } + + //sqstd_dofile(v, _SST(path.c_str()), false, true); + } + } + } + } while (FindNextFile(hFind, &fileInfo)); + + FindClose(hFind); + } + + + /* + sq_pushroottable(v); + sq_pushstring(v, _SST("PushReloadingNameToRootTab"), -1); + sq_get(v, -2); + sq_pushroottable(v); + sq_pushstring(v, _SST(path.c_str()), -1); + sq_call(v, 2, 0, 1); + sq_pop(v, 2); + */ +} +SQInteger SquirrelClassEx::ReloadingScript() +{ + ReloadingSquirrelScript(L"Sqr"); + + std::mapFailMap; + + for (auto it = FileFirst.begin(); it != FileFirst.end(); it++) { + std::string Sourcename = it->first; + std::string ContentString = it->second; + + if (SQ_SUCCEEDED(sq_compilebuffer(v, _SST(ContentString.c_str()), ContentString.length(), _SST(Sourcename.c_str()), true))) { + sq_pushroottable(v); + sq_call(v, 1, 1, 1); + sq_pop(v, 1); + }; + } + + for (auto it = FileLast.begin(); it != FileLast.end(); it++) { + std::string Sourcename = it->first; + std::string ContentString = it->second; + + if (SQ_SUCCEEDED(sq_compilebuffer(v, _SST(ContentString.c_str()), ContentString.length(), _SST(Sourcename.c_str()), true))) { + sq_pushroottable(v); + if (SQ_FAILED(sq_call(v, 1, 1, 0))) { + FailMap[Sourcename] = ContentString; + }; + sq_pop(v, 1); + }; + } + + while (FailMap.size() > 0) + { + std::mapFailMapBuffer; + for (auto it = FailMap.begin(); it != FailMap.end(); it++) { + std::string Sourcename = it->first; + std::string ContentString = it->second; + + if (SQ_SUCCEEDED(sq_compilebuffer(v, _SST(ContentString.c_str()), ContentString.length(), _SST(Sourcename.c_str()), true))) { + sq_pushroottable(v); + if (SQ_FAILED(sq_call(v, 1, 1, 1))) { + FailMapBuffer[Sourcename] = ContentString; + }; + sq_pop(v, 1); + }; + } + + FailMap.clear(); + if (FailMapBuffer.size() > 0) { + for (auto it = FailMapBuffer.begin(); it != FailMapBuffer.end(); it++) { + std::string Sourcename = it->first; + std::string ContentString = it->second; + FailMap[Sourcename] = ContentString; + } + } + } + return 0; +} +SQInteger SquirrelClassEx::Exit(HSQUIRRELVM v) +{ + Application::GetInstance().Quit(); + return 0; +} + +SQInteger SquirrelClassEx::Cmd(HSQUIRRELVM v) +{ + const SQChar* Command; + sq_getstring(v, 2, &Command); + + system((char*)Command); + + return 0; +} + +//滻ַ +static SQInteger String_Replace(HSQUIRRELVM v) +{ + const SQChar* F_String; + sq_getstring(v, 2, &F_String); + + const SQChar* B_String; + sq_getstring(v, 3, &B_String); + + const SQChar* R_String; + sq_getstring(v, 4, &R_String); + + std::string Fstring = (char*)F_String; + std::string Bstring = (char*)B_String; + std::string Rstring = (char*)R_String; + + Fstring.replace(Fstring.find(Bstring), Bstring.length(), Rstring); + + sq_pushstring(v, _SST(Fstring.c_str()), -1); + + return 1; +} + + +//NutհͷԴ +static SQInteger ReleaseTextureByImg_n(HSQUIRRELVM v) +{ + std::vector ImgList; + sq_pushnull(v); // null iterator + while (SQ_SUCCEEDED(sq_next(v, 2))) + { + const SQChar* path; + sq_getstring(v, -1, &path); + ImgList.push_back((char*)path); + //-1ֵ-2Ǽ + sq_pop(v, 2); //һε֮ǰֵ + } + sq_pop(v, 1); + + for (auto it = ImgList.begin(); it != ImgList.end(); ++it) { + std::string Iname = *it; + ImageRecObject.erase(Iname); + //SquirrelClassEx::ReleaseTextureByImg(Iname); + } + + return 0; +} + +//ȡʱװ·ByʱװID +static SQInteger GetAvatarPathByIndex() +{ + SQInteger Index; + sq_getinteger(v, 2, &Index); + + if (GameAvatarList.count(Index)) { + sq_pushstring(v, _SST(GameAvatarList[Index].c_str()), -1); + } + else { + sq_pushnull(v); + } + + return 1; +} + + +//ȡװ·ByװID +static SQInteger GetEquipmentPathByIndex() +{ + SQInteger Index; + sq_getinteger(v, 2, &Index); + + if (GameEquipmentList.count(Index)) { + sq_pushstring(v, _SST(GameEquipmentList[Index].c_str()), -1); + } + else { + sq_pushnull(v); + } + + return 1; +} + +//ȡͼ·ByͼID +static SQInteger GetMapPathByIndex() +{ + SQInteger Index; + sq_getinteger(v, 2, &Index); + + if (GameMapList.count(Index)) { + sq_pushstring(v, _SST(GameMapList[Index].c_str()), -1); + } + else { + sq_pushnull(v); + } + + return 1; +} + + +//ȡ·ByID +static SQInteger GetMonsterPathByIndex() +{ + SQInteger Index; + sq_getinteger(v, 2, &Index); + + if (GameMonsterList.count(Index)) { + sq_pushstring(v, _SST(GameMonsterList[Index].c_str()), -1); + } + else { + sq_pushnull(v); + } + + return 1; +} + +//ȡ·ByID +static SQInteger GetPassobjectPathByIndex() +{ + SQInteger Index; + sq_getinteger(v, 2, &Index); + + if (GamePassobjectList.count(Index)) { + sq_pushstring(v, _SST(GamePassobjectList[Index].c_str()), -1); + } + else { + sq_pushnull(v); + } + + return 1; +} + + + +//ȡƵ·ByƵID +static SQInteger GetAudioPathByIndex() +{ + const SQChar* Index; + sq_getstring(v, 2, &Index); + + if (GameAudioList.count((char*)Index)) { + sq_pushstring(v, _SST(GameAudioList[(char*)Index].c_str()), -1); + } + else { + sq_pushnull(v); + } + + return 1; +} + +//ѰַӴλ +static SQInteger String_Find_Last() +{ + const SQChar* F_String; + sq_getstring(v, 2, &F_String); + + const SQChar* R_String; + sq_getstring(v, 4, &R_String); + + std::string Fstring = (char*)F_String; + std::string Rstring = (char*)R_String; + + SQInteger Index = Fstring.find_last_of(Rstring); + + sq_pushinteger(v, Index); + return 1; +} +void SquirrelClassEx::RunSceneScript(std::string FuncName, SquirrelStagePtr scene) +{ + //std::cout << "ջռС: " << sq_gettop(v) << std::endl; + sq_pushroottable(v); + sq_pushstring(v, _SST(FuncName.c_str()), -1); + sq_get(v, -2); + sq_pushroottable(v); + sq_pushinteger(v, scene->GetObjectID()); + sq_call(v, 2, 0, 1); + sq_pop(v, 2); +} + +void SquirrelClassEx::RunSceneScript(std::string FuncName, SquirrelStagePtr scene,SQInteger dt) +{ + //std::cout << "ջռС: " << sq_gettop(v) << std::endl; + sq_pushroottable(v); + sq_pushstring(v, _SST(FuncName.c_str()), -1); + sq_get(v, -2); + sq_pushroottable(v); + sq_pushinteger(v, scene->GetObjectID()); + sq_pushinteger(v, dt); + sq_call(v, 3, 0, 1); + sq_pop(v, 2); +} + +void SquirrelClassEx::RunSceneScript(std::string FuncName, SquirrelStagePtr scene, SQFloat dt) +{ + sq_pushroottable(v); + sq_pushstring(v, _SST(FuncName.c_str()), -1); + sq_get(v, -2); + sq_pushroottable(v); + sq_pushinteger(v, scene->GetObjectID()); + sq_pushfloat(v, dt); + sq_call(v, 3, 0, 1); + sq_pop(v, 2); +} + +void SquirrelClassEx::RunSceneScript(std::string FuncName, SquirrelTownStagePtr scene) +{ + //std::cout << "ջռС: " << sq_gettop(v) << std::endl; + sq_pushroottable(v); + sq_pushstring(v, _SST(FuncName.c_str()), -1); + sq_get(v, -2); + sq_pushroottable(v); + sq_pushinteger(v, scene->GetObjectID()); + sq_call(v, 2, 0, 1); + sq_pop(v, 2); +} + +void SquirrelClassEx::RunUpdateScript(std::string FuncName, SQInteger ObjectIdx) +{ + //std::cout << "ջռС: " << sq_gettop(v) << std::endl; + sq_pushroottable(v); + sq_pushstring(v, _SST(FuncName.c_str()), -1); + sq_get(v, -2); + sq_pushroottable(v); + sq_pushinteger(v, ObjectIdx); + sq_call(v, 2, 0, 1); + sq_pop(v, 2); +} + +void SquirrelClassEx::RunUpdateScript(std::string FuncName, std::string string) +{ + sq_pushroottable(v); + sq_pushstring(v, _SST(FuncName.c_str()), -1); + sq_get(v, -2); + sq_pushroottable(v); + sq_pushstring(v, _SST(string.c_str()),-1); + sq_call(v, 2, 0, 1); + sq_pop(v, 2); +} + +void SquirrelClassEx::RunUpdateScript(std::string FuncName, SQInteger ObjectIdx,SQInteger Buf) +{ + //std::cout << "ջռС: " << sq_gettop(v) << std::endl; + sq_pushroottable(v); + sq_pushstring(v, _SST(FuncName.c_str()), -1); + sq_get(v, -2); + sq_pushroottable(v); + sq_pushinteger(v, ObjectIdx); + sq_pushinteger(v, Buf); + sq_call(v, 3, 0, 1); + sq_pop(v, 2); +} + +void SquirrelClassEx::RunUpdateScript(std::string FuncName, SQInteger ObjectIdx, SQInteger Buf, SQInteger Buf2) +{ + sq_pushroottable(v); + sq_pushstring(v, _SST(FuncName.c_str()), -1); + sq_get(v, -2); + sq_pushroottable(v); + sq_pushinteger(v, ObjectIdx); + sq_pushinteger(v, Buf); + sq_pushinteger(v, Buf2); + sq_call(v, 3, 0, 1); + sq_pop(v, 2); +} + +void SquirrelClassEx::RunUpdateScriptPlayer(std::string FuncName, SQInteger ObjectIdx, SQFloat Buf) +{ + sq_pushroottable(v); + sq_pushstring(v, _SST(FuncName.c_str()), -1); + sq_get(v, -2); + sq_pushroottable(v); + sq_pushinteger(v, ObjectIdx); + sq_pushfloat(v, Buf); + sq_call(v, 3, 0, 1); + sq_pop(v, 2); +} + +void SquirrelClassEx::PushLayerActorPtrToMap(LayerActorPtr Ptr) { + ActorPtrMapObject[Ptr->GetObjectID()] = Ptr; +} + +static SQInteger RGBA(HSQUIRRELVM v) +{ + SQInteger R; + sq_getinteger(v, 2, &R); + + SQInteger G; + sq_getinteger(v, 3, &G); + + SQInteger B; + sq_getinteger(v, 4, &B); + + SQInteger A; + sq_getinteger(v, 5, &A); + + SQInteger _Color = ((R & 0xff) << 24) + ((G & 0xff) << 16) + ((B & 0xff) << 8) + + (A & 0xff); + + sq_pushinteger(v, _Color); + return 1; +} + + + + + + +//ȡ +static ActorPtr GetActorObjectByMap(const size_t Hash_Name) { + //ָMap + if (ActorPtrMapObject.count(Hash_Name))return ActorPtrMapObject[Hash_Name]; + return nullptr; +} + +//ٶ +static SQInteger ReleaseActor(HSQUIRRELVM v) +{ + SQInteger Top = sq_gettop(v); + if (Top <= 0) + { + sq_throwerror(v, _SST("Incorrect function argument")); + return 0; + } + + SQInteger ActorUUID; + sq_getinteger(v, 2, &ActorUUID); + + //ָMap + if (ActorPtrMapObject.count(ActorUUID)) { + ActorPtrMapObject.erase(ActorUUID); + sq_pushbool(v, true); + } + else { + sq_pushbool(v, false); + } + return 1; +} + + +//ݰ +struct SquirrelClassObjectAbli +{ + int Id; +}; +static SQInteger _file_releasehook(SQUserPointer p, SQInteger SQ_UNUSED_ARG(size)) +{ + SquirrelClassObjectAbli* Abli = (SquirrelClassObjectAbli*)p; + std::cout << "C++: " << Abli->Id << std::endl; + std::cout << "ѱͷ" << std::endl; + delete Abli; + return 0; +} +//ע +static SQInteger Register_Destruction(HSQUIRRELVM v) +{ + // + SQInteger Idx; + sq_getinteger(v, 2, &Idx); + + SquirrelClassObjectAbli* Abli = new SquirrelClassObjectAbli(); + Abli->Id = Idx; + + sq_setinstanceup(v, 3, Abli); + sq_setreleasehook(v, 3, _file_releasehook); + return 0; +} + + +int TestCallC(HSQUIRRELVM v) +{ + + + + //sq_newarray(v, 0); + + //const wchar_t* str = _SST(""); + + //for (size_t i = 0; i < 5; i++) + //{ + // sq_pushstring(v, str, -1); + // sq_arrayappend(v, -2); + //} + /* + sq_pushnull(v); // null iterator + while (SQ_SUCCEEDED(sq_next(v, 2))) + { + const SQChar* path; + sq_getstring(v, -1, &path); + std::cout << (char*)path << std::endl; + //-1ֵ-2Ǽ + sq_pop(v, 2); //һε֮ǰֵ + } + sq_pop(v, 1); + + sq_pushnull(v); // null iterator + while (SQ_SUCCEEDED(sq_next(v, 3))) + { + SQInteger idx; + sq_getinteger(v, -1, &idx); + std::cout << idx << std::endl; + //-1ֵ-2Ǽ + sq_pop(v, 2); //һε֮ǰֵ + } + sq_pop(v, 1); + */ + + + //Application::GetInstance().Quit(); + return 0; +} + +// +static SQInteger Create_BaseAct(HSQUIRRELVM v) +{ + SQInteger Top = sq_gettop(v); + if (Top <= 0) + { + sq_throwerror(v, _SST("Incorrect function argument")); + return 0; + } + + + // һɫ + ActorPtr Act = new Actor(); + + //ȡUUID + uint64_t UUID = Act->GetObjectID(); + + //Map + ActorPtrMapObject[UUID] = Act; + + sq_pushinteger(v, UUID); + + return 1; +} + +// +static SQInteger Create_CameraObjectAct(HSQUIRRELVM v) +{ + SQInteger Top = sq_gettop(v); + if (Top <= 0) + { + sq_throwerror(v, _SST("Incorrect function argument")); + return 0; + } + + + // һɫ + SquirrelCameraPtr Act = new SquirrelCamera(); + + //ȡUUID + uint64_t UUID = Act->GetObjectID(); + + //Map + ActorPtrMapObject[UUID] = Act; + + sq_pushinteger(v, UUID); + + return 1; +} + +//RotateAnimotion ת +static SQInteger Set_RotateAnimotion(HSQUIRRELVM v) +{ + SQInteger Top = sq_gettop(v); + if (Top <= 0) + { + sq_throwerror(v, _SST("Incorrect function argument")); + return 0; + } + + SQInteger ActorUUID; + sq_getinteger(v, 2, &ActorUUID); + + SQInteger Duration; + sq_getinteger(v, 3, &Duration); + SQFloat Rotation; + sq_getfloat(v, 4, &Rotation); + + //ͨʱͽǶö + auto rotate_by = animation::RotateBy(Duration, Rotation); + //ѭ + rotate_by.Loops(-1); + + ActorPtr Act = GetActorObjectByMap(ActorUUID); + if (Act) { + Act->StartAnimation(rotate_by); + sq_pushbool(v,true); + } + else { + sq_pushbool(v, false); + } + return 1; +} + +//Actor ê +static SQInteger SetActorAnchor(HSQUIRRELVM v) +{ + SQInteger Top = sq_gettop(v); + if (Top <= 0) + { + sq_throwerror(v, _SST("Incorrect function argument")); + return 0; + } + + SQInteger ActorUUID; + sq_getinteger(v, 2, &ActorUUID); + SQFloat X_Anchor; + sq_getfloat(v, 3, &X_Anchor); + SQFloat Y_Anchor; + sq_getfloat(v, 4, &Y_Anchor); + + ActorPtr Act = GetActorObjectByMap(ActorUUID); + if (Act) { + Act->SetAnchor(X_Anchor, Y_Anchor); + sq_pushbool(v, true); + } + else { + sq_pushbool(v, false); + } + return 1; + +} + +//Actor X +static SQInteger SetActorXPos(HSQUIRRELVM v) +{ + SQInteger Top = sq_gettop(v); + if (Top <= 0) + { + sq_throwerror(v, _SST("Incorrect function argument")); + return 0; + } + + + SQInteger ActorUUID; + sq_getinteger(v, 2, &ActorUUID); + SQFloat Xpos; + sq_getfloat(v, 3, &Xpos); + + ActorPtr Act = GetActorObjectByMap(ActorUUID); + if (Act) { + Act->SetPositionX(Xpos); + sq_pushbool(v, true); + } + else { + sq_pushbool(v, false); + } + return 1; + +} + +//Actor Y +static SQInteger SetActorYPos(HSQUIRRELVM v) +{ + SQInteger Top = sq_gettop(v); + if (Top <= 0) + { + sq_throwerror(v, _SST("Incorrect function argument")); + return 0; + } + + + SQInteger ActorUUID; + sq_getinteger(v, 2, &ActorUUID); + SQFloat Ypos; + sq_getfloat(v, 3, &Ypos); + + ActorPtr Act = GetActorObjectByMap(ActorUUID); + if (Act) { + Act->SetPositionY(Ypos); + sq_pushbool(v, true); + } + else { + sq_pushbool(v, false); + } + return 1; +} + +//Actor ýɫȾ߿ +static SQInteger SetActorShowBorder(HSQUIRRELVM v) +{ + SQInteger Top = sq_gettop(v); + if (Top <= 0) + { + sq_throwerror(v, _SST("Incorrect function argument")); + return 0; + } + + + SQInteger ActorUUID; + sq_getinteger(v, 2, &ActorUUID); + SQBool Type; + sq_getbool(v, 3, &Type); + + ActorPtr Act = GetActorObjectByMap(ActorUUID); + if (Act) { + Act->ShowBorder(Type); + sq_pushbool(v, true); + } + else { + sq_pushbool(v, false); + } + return 1; +} + +//Actor ȡX +static SQInteger GetActorXPos(HSQUIRRELVM v) +{ + SQInteger Top = sq_gettop(v); + if (Top <= 0) + { + sq_throwerror(v, _SST("Incorrect function argument")); + return 0; + } + + SQInteger ActorUUID; + sq_getinteger(v, 2, &ActorUUID); + + ActorPtr Act = GetActorObjectByMap(ActorUUID); + if (Act) { + sq_pushfloat(v, Act->GetPositionX()); + } + else { + sq_pushbool(v, false); + } + return 1; +} + +//Actor ȡY +static SQInteger GetActorYPos(HSQUIRRELVM v) +{ + SQInteger Top = sq_gettop(v); + if (Top <= 0) + { + sq_throwerror(v, _SST("Incorrect function argument")); + return 0; + } + + + SQInteger ActorUUID; + sq_getinteger(v, 2, &ActorUUID); + + ActorPtr Act = GetActorObjectByMap(ActorUUID); + if (Act) { + sq_pushfloat(v, Act->GetPositionY()); + } + else { + sq_pushbool(v, false); + } + return 1; +} + +//Actor +static SQInteger SetActorPosition(HSQUIRRELVM v) +{ + SQInteger Top = sq_gettop(v); + if (Top <= 0) + { + sq_throwerror(v, _SST("Incorrect function argument")); + return 0; + } + + SQInteger ActorUUID; + sq_getinteger(v, 2, &ActorUUID); + SQFloat Xpos; + sq_getfloat(v, 3, &Xpos); + SQFloat Ypos; + sq_getfloat(v, 4, &Ypos); + + + ActorPtr Act = GetActorObjectByMap(ActorUUID); + if (Act) { + Act->SetPosition(Xpos, Ypos); + sq_pushbool(v, true); + } + else { + sq_pushbool(v, false); + } + return 1; +} + +//Actor ű +static SQInteger SetActorScale(HSQUIRRELVM v) +{ + SQInteger Top = sq_gettop(v); + if (Top <= 0) + { + sq_throwerror(v, _SST("Incorrect function argument")); + return 0; + } + + SQInteger ActorUUID; + sq_getinteger(v, 2, &ActorUUID); + SQFloat Xrate; + sq_getfloat(v, 3, &Xrate); + SQFloat Yrate; + sq_getfloat(v, 4, &Yrate); + + ActorPtr Act = GetActorObjectByMap(ActorUUID); + if (Act) { + Act->SetScale(Xrate, Yrate); + sq_pushbool(v, true); + } + else { + sq_pushbool(v, false); + } + return 1; +} + +//Actor Z㼶 +static SQInteger SetActorSetZOrder(HSQUIRRELVM v) +{ + SQInteger Top = sq_gettop(v); + if (Top <= 0) + { + sq_throwerror(v, _SST("Incorrect function argument")); + return 0; + } + + SQInteger ActorUUID; + sq_getinteger(v, 2, &ActorUUID); + SQInteger Z; + sq_getinteger(v, 3, &Z); + + ActorPtr Act = GetActorObjectByMap(ActorUUID); + if (Act) { + Act->SetZOrder(Z); + sq_pushbool(v, true); + } + else { + sq_pushbool(v, false); + } + return 1; +} + +//Actor ȡZ㼶 +static SQInteger GetActorSetZOrder(HSQUIRRELVM v) +{ + SQInteger Top = sq_gettop(v); + if (Top <= 0) + { + sq_throwerror(v, _SST("Incorrect function argument")); + return 0; + } + + SQInteger ActorUUID; + sq_getinteger(v, 2, &ActorUUID); + SQInteger Z; + sq_getinteger(v, 3, &Z); + + ActorPtr Act = GetActorObjectByMap(ActorUUID); + if (Act) { + Act->GetZOrder(); + sq_pushinteger(v, Act->GetZOrder()); + } + else { + sq_pushbool(v, false); + } + return 1; +} + +//Actor ȡ +static SQInteger GetActorWidth(HSQUIRRELVM v) +{ + SQInteger Top = sq_gettop(v); + if (Top <= 0) + { + sq_throwerror(v, _SST("Incorrect function argument")); + return 0; + } + + SQInteger ActorUUID; + sq_getinteger(v, 2, &ActorUUID); + + ActorPtr Act = GetActorObjectByMap(ActorUUID); + if (Act) { + SQFloat WidthValue = Act->GetWidth(); + + sq_pushfloat(v, WidthValue); + } + else { + sq_pushbool(v, false); + } + + return 1; +} + +//Actor ȡ߶ +static SQInteger GetActorHeight(HSQUIRRELVM v) +{ + SQInteger Top = sq_gettop(v); + if (Top <= 0) + { + sq_throwerror(v, _SST("Incorrect function argument")); + return 0; + } + + SQInteger ActorUUID; + sq_getinteger(v, 2, &ActorUUID); + + ActorPtr Act = GetActorObjectByMap(ActorUUID); + if (Act) { + SQFloat HeightValue = Act->GetHeight(); + sq_pushfloat(v, HeightValue); + } + else { + sq_pushbool(v, false); + } + + return 1; +} + +//Actor ȡ ȡ +static SQInteger GetActorName(HSQUIRRELVM v) +{ + SQInteger Top = sq_gettop(v); + if (Top <= 0) + { + sq_throwerror(v, _SST("Incorrect function argument")); + return 0; + } + + SQInteger ActorUUID; + sq_getinteger(v, 2, &ActorUUID); + + ActorPtr Act = GetActorObjectByMap(ActorUUID); + if (Act) { + std::string ActName = Act->GetName(); + sq_pushstring(v, (SQChar*)ActName.c_str(), -1); + } + else { + sq_pushbool(v, false); + } + + return 1; +} + +//Actor +static SQInteger SetActorName(HSQUIRRELVM v) +{ + SQInteger Top = sq_gettop(v); + if (Top <= 0) + { + sq_throwerror(v, _SST("Incorrect function argument")); + return 0; + } + + SQInteger ActorUUID; + sq_getinteger(v, 2, &ActorUUID); + + const SQChar* OutPutBuffer; + sq_getstring(v, 3, &OutPutBuffer); + + ActorPtr Act = GetActorObjectByMap(ActorUUID); + if (Act) { + Act->SetName((char*)OutPutBuffer); + sq_pushbool(v, true); + } + else { + sq_pushbool(v, false); + } + + return 1; +} + +//Actor ͸ +static SQInteger SetActorOpacity(HSQUIRRELVM v) +{ + SQInteger Top = sq_gettop(v); + if (Top <= 0) + { + sq_throwerror(v, _SST("Incorrect function argument")); + return 0; + } + + SQInteger ActorUUID; + sq_getinteger(v, 2, &ActorUUID); + + SQFloat Opacity; + sq_getfloat(v, 3, &Opacity); + + ActorPtr Act = GetActorObjectByMap(ActorUUID); + if (Act) { + Act->SetOpacity(Opacity); + sq_pushbool(v, true); + } + else { + sq_pushbool(v, false); + } + + return 1; +} + +//Actor Ӷ +static SQInteger SetActorChild(HSQUIRRELVM v) +{ + SQInteger Top = sq_gettop(v); + if (Top <= 0) + { + sq_throwerror(v, _SST("Incorrect function argument")); + return 0; + } + + SQInteger gFActor; + sq_getinteger(v, 2, &gFActor); + + SQInteger gCActor; + sq_getinteger(v, 3, &gCActor); + + ActorPtr FActor = GetActorObjectByMap(gFActor); + ActorPtr CActor = GetActorObjectByMap(gCActor); + + if (FActor && CActor) { + FActor->AddChild(CActor); + sq_pushbool(v, true); + } + else { + sq_pushbool(v, false); + } + + return 1; +} + +//Actor ȡӶByName +static SQInteger GetChildByName(HSQUIRRELVM v) +{ + SQInteger Top = sq_gettop(v); + if (Top <= 0) + { + sq_throwerror(v, _SST("Incorrect function argument")); + return 0; + } + + SQInteger gFActor; + sq_getinteger(v, 2, &gFActor); + ActorPtr FActor = GetActorObjectByMap(gFActor); + + const SQChar* OutPutBuffer; + sq_getstring(v, 3, &OutPutBuffer); + //˲NewһַҪֶ + char* OutPutText = SquirrelClassEx::SquirrelU2W((char*)OutPutBuffer); + + std::string Name = (char*)OutPutText; + + //Newַ + delete[]OutPutText; + + if (FActor) { + ActorPtr CAct = FActor->GetChild(Name); + if (CAct) { + sq_pushinteger(v, CAct->GetObjectID()); + } + else sq_pushnull(v); + } + else { + sq_pushbool(v, false); + } + + return 1; +} + +//Actor ƳӶ +static SQInteger RemoveActorChild(HSQUIRRELVM v) +{ + SQInteger Top = sq_gettop(v); + if (Top <= 0) + { + sq_throwerror(v, _SST("Incorrect function argument")); + return 0; + } + + SQInteger gFActor; + sq_getinteger(v, 2, &gFActor); + + SQInteger gCActor; + sq_getinteger(v, 3, &gCActor); + + ActorPtr FActor = GetActorObjectByMap(gFActor); + ActorPtr CActor = GetActorObjectByMap(gCActor); + + if (FActor && CActor) { + FActor->RemoveChild(CActor); + sq_pushbool(v, true); + } + else { + sq_pushbool(v, false); + } + + return 1; +} +//Actor ôС +static SQInteger SetSize(HSQUIRRELVM v) +{ + SQInteger Top = sq_gettop(v); + if (Top <= 0) + { + sq_throwerror(v, _SST("Incorrect function argument")); + return 0; + } + + SQInteger gActor; + sq_getinteger(v, 2, &gActor); + + + SQFloat gXsize; + sq_getfloat(v, 3, &gXsize); + + + SQFloat gYsize; + sq_getfloat(v, 4, &gYsize); + + ActorPtr Actor = GetActorObjectByMap(gActor); + + if (Actor) { + Actor->SetSize(gXsize, gYsize); + sq_pushbool(v, true); + } + else { + sq_pushbool(v, false); + } + + return 1; +} + +//Actor ת +static SQInteger SetRotate(HSQUIRRELVM v) +{ + SQInteger Top = sq_gettop(v); + if (Top <= 0) + { + sq_throwerror(v, _SST("Incorrect function argument")); + return 0; + } + + SQInteger gActor; + sq_getinteger(v, 2, &gActor); + + + SQFloat gRotation; + sq_getfloat(v, 3, &gRotation); + + + ActorPtr Actor = GetActorObjectByMap(gActor); + + if (Actor) { + Actor->SetRotation(gRotation); + sq_pushbool(v, true); + } + else { + sq_pushbool(v, false); + } + + return 1; +} + +//Actor Ƴ +static SQInteger RemoveActorParent(HSQUIRRELVM v) +{ + SQInteger Top = sq_gettop(v); + if (Top <= 0) + { + sq_throwerror(v, _SST("Incorrect function argument")); + return 0; + } + + + SQInteger gCActor; + sq_getinteger(v, 2, &gCActor); + + ActorPtr CActor = GetActorObjectByMap(gCActor); + + if ( CActor) { + CActor->RemoveFromParent(); + sq_pushbool(v, true); + } + else { + sq_pushbool(v, false); + } + + return 1; +} + + +//Actor ȡ +static SQInteger GetActorParent(HSQUIRRELVM v) +{ + SQInteger Top = sq_gettop(v); + if (Top <= 0) + { + sq_throwerror(v, _SST("Incorrect function argument")); + return 0; + } + + + SQInteger gCActor; + sq_getinteger(v, 2, &gCActor); + + ActorPtr CActor = GetActorObjectByMap(gCActor); + + if (CActor) { + SQInteger F = CActor->GetParent()->GetObjectID(); + sq_pushinteger(v, F); + } + else { + sq_pushbool(v, false); + } + + return 1; +} + +//жKey +static SQInteger Key_Pressed(HSQUIRRELVM v) +{ + SQInteger Top = sq_gettop(v); + if (Top <= 0) + { + sq_throwerror(v, _SST("Incorrect function argument")); + return 0; + } + + SQInteger Type; + sq_getinteger(v, 2, &Type); + + SQInteger Key; + sq_getinteger(v, 3, &Key); + + Input& input = Input::GetInstance(); + + //ж ģʽ ģʽ + bool KeyPressed; + switch (Type) + { + case 0: + KeyPressed = input.WasPressed((MouseButton)Key); + break; + case 1: + KeyPressed = input.WasPressed((KeyCode)Key); + break; + default: + break; + } + + sq_pushbool(v, KeyPressed); + return 1; +} + +//жKey +static SQInteger Key_Is_Down(HSQUIRRELVM v) +{ + SQInteger Top = sq_gettop(v); + if (Top <= 0) + { + sq_throwerror(v, _SST("Incorrect function argument")); + return 0; + } + + SQInteger Type; + sq_getinteger(v, 2, &Type); + + SQInteger Key; + sq_getinteger(v, 3, &Key); + + Input& input = Input::GetInstance(); + + //ж ģʽ ģʽ + bool KeyPressed; + switch (Type) + { + case 0: + KeyPressed = input.IsDown((MouseButton)Key); + break; + case 1: + KeyPressed = input.IsDown((KeyCode)Key); + break; + default: + break; + } + + sq_pushbool(v, KeyPressed); + return 1; +} + +//жKey̧ +static SQInteger Key_WasReleased(HSQUIRRELVM v) +{ + SQInteger Top = sq_gettop(v); + if (Top <= 0) + { + sq_throwerror(v, _SST("Incorrect function argument")); + return 0; + } + + SQInteger Type; + sq_getinteger(v, 2, &Type); + + SQInteger Key; + sq_getinteger(v, 3, &Key); + + Input& input = Input::GetInstance(); + + //ж ģʽ ģʽ + bool KeyPressed; + switch (Type) + { + case 0: + KeyPressed = input.WasReleased((MouseButton)Key); + break; + case 1: + KeyPressed = input.WasReleased((KeyCode)Key); + break; + default: + break; + } + + sq_pushbool(v, KeyPressed); + return 1; +} + +//ָͬ +static SQInteger Sync_CursorPos(HSQUIRRELVM v) +{ + SQInteger Top = sq_gettop(v); + if (Top <= 0) + { + sq_throwerror(v, _SST("Incorrect function argument")); + return 0; + } + + //ȡ"" + SQUserPointer gCursor; + sq_getuserpointer(v, 2, &gCursor); + //תActor + Actor* Cursor = (Actor*)gCursor; + //иʱͬ + if (Cursor->GetParent()) { + //ȡ + Input& input = Input::GetInstance(); + //"" + Cursor->SetPosition(input.GetMousePos()); + } + + + return 0; +} + +extern Cursor* Mouse_Object; +// +static SQInteger SetCursor_Task(HSQUIRRELVM v) +{ + SQInteger Top = sq_gettop(v); + if (Top <= 0) + { + sq_throwerror(v, _SST("Incorrect function argument")); + return 0; + } + + + const SQChar* Img; + sq_getstring(v, 2, &Img); + + SQInteger Frame; + sq_getinteger(v, 3, &Frame); + + TexturePtr T = SquirrelClassEx::GetTexturePtrByImg((char*)Img, Frame); + Mouse_Object->SetFrame(T); + + return 0; +} + +//ȡ +static SQInteger Get_Cursor(HSQUIRRELVM v) +{ + SQInteger Top = sq_gettop(v); + if (Top <= 0) + { + sq_throwerror(v, _SST("Incorrect function argument")); + return 0; + } + + uint32_t ObjectId = Mouse_Object->GetObjectID(); + //ȫֱû + if (!ActorPtrMapObject.count(ObjectId)) { + Mouse_Object->Retain(); + ActorPtrMapObject[ObjectId] = Mouse_Object; + } + sq_pushinteger(v, ObjectId); + return 1; +} + + +//ͼ +static SQInteger Create_Layer(HSQUIRRELVM v) +{ + SQInteger Top = sq_gettop(v); + if (Top <= 0) + { + sq_throwerror(v, _SST("Incorrect function argument")); + return 0; + } + + //const SQChar* gLayer; + //sq_getstring(v, 2, &gLayer); + + ////˲NewһַҪֶ + //char* gLayerbuf = SquirrelClassEx::SquirrelU2W((char*)gLayer); + + //std::string Layer = gLayerbuf; + + ////Newַ + //delete[]gLayerbuf; + + //ͼ + LayerActorPtr MouseUiLayer = new LayerActor(); + + + uint32_t ObjectId = MouseUiLayer->GetObjectID(); + + + ActorPtrMapObject[ObjectId] = MouseUiLayer; + + sq_pushinteger(v, ObjectId); + return 1; +} + + +void SquirrelClassEx::R_Register_Nut(HSQUIRRELVM v) +{ + RegisterNutApi(_SST("C_API"), TestCallC, v); + RegisterNutApi(_SST("Sout"), Sout, v); + RegisterNutApi(_SST("Error"), Error, v); + RegisterNutApi(_SST("Test"), TestCallC, v); + RegisterNutApi(_SST("sq_RGBA"), RGBA, v); + RegisterNutApi(_SST("sq_ReloadingScript"), ReloadingScript, v); + RegisterNutApi(_SST("sq_Exit"), Exit, v); + RegisterNutApi(_SST("sq_Cmd"), Cmd, v); + RegisterNutApi(_SST("sq_String_Replace"), String_Replace, v); + RegisterNutApi(_SST("sq_Register_Destruction"), Register_Destruction, v); + + //ʹ߳ԤNPK + RegisterNutApi(_SST("sq_ThreadPreloadImg"), ThreadPreloadImg, v); + + //Img·ͷԴ + RegisterNutApi(_SST("sq_ReleaseTextureByImg"), ReleaseTextureByImg_n, v); + + //ȡʱװ·By ʱװIndex + RegisterNutApi(_SST("sq_GetAvatarPathByIndex"), GetAvatarPathByIndex, v); + //ȡװ·By װIndex + RegisterNutApi(_SST("sq_GetEquipmentPathByIndex"), GetEquipmentPathByIndex, v); + //ȡͼ·By ͼIndex + RegisterNutApi(_SST("sq_GetMapPathByIndex"), GetMapPathByIndex, v); + //ȡ·By Index + RegisterNutApi(_SST("sq_GetMonsterPathByIndex"), GetMonsterPathByIndex, v); + //ȡ·By Index + RegisterNutApi(_SST("sq_GetPassobjectPathByIndex"), GetPassobjectPathByIndex, v); + //ȡƵ·By ƵIndex + RegisterNutApi(_SST("sq_GetAudioPathByIndex"), GetAudioPathByIndex, v); + + + + ////////////////Actor//////////////// + + RegisterNutApi(_SST("sq_Create_CameraObjectAct"), Create_CameraObjectAct, v);// + + + // + R_Register_Nut_Text(); + + //ͼ + RegisterNutApi(_SST("sq_Create_Layer"), Create_Layer, v);//ͼ + + RegisterNutApi(_SST("sq_Create_BaseAct"), Create_BaseAct, v);// + RegisterNutApi(_SST("sq_ReleaseActor"), ReleaseActor, v);//ٶ + RegisterNutApi(_SST("sq_Create_Image"), Create_Image, v);//Image + RegisterNutApi(_SST("sq_Set_Image_CropRect"), Set_Image_CropRect, v);//Image + RegisterNutApi(_SST("sq_Create_ImageEx"), Create_ImageEx, v);//ExImage + RegisterNutApi(_SST("sq_Set_ImageEx_Mode"), Set_ImageEx_Mode, v);//ExImageģʽ + RegisterNutApi(_SST("sq_Set_ImageEx_Frame"), Set_ImageEx_Frame, v);//ExImage֡ + RegisterNutApi(_SST("sq_Set_ImageEx_Alpha"), Set_ImageEx_Alpha, v);//ExImage͸ + RegisterNutApi(_SST("sq_Set_ImageEx_FrameInfo"), Set_ImageEx_FrameInfo, v);//ExImage֡Ϣ + RegisterNutApi(_SST("sq_Set_ImageEx_PlayAnimotion"), Set_ImageEx_PlayAnimotion, v);//ExImage Ŷ + RegisterNutApi(_SST("sq_Set_ImageEx_Animotion_Frame"), Set_ImageEx_Animotion_Frame, v);//ExImage Ani֡ + RegisterNutApi(_SST("sq_Set_ImageEx_Shadow"), Set_ImageEx_Shadow, v);//ExImage Ӱ + + + RegisterNutApi(_SST("sq_SetRotateAnimotion"), Set_RotateAnimotion, v);//ת + RegisterNutApi(_SST("sq_SetAnchor"), SetActorAnchor, v);//ê + RegisterNutApi(_SST("sq_SetXPos"), SetActorXPos, v);//X + RegisterNutApi(_SST("sq_SetYPos"), SetActorYPos, v);//Y + RegisterNutApi(_SST("sq_GetXPos"), GetActorXPos, v);//X + RegisterNutApi(_SST("sq_SetActorShowBorder"), SetActorShowBorder, v);//Ⱦ߿ + RegisterNutApi(_SST("sq_GetYPos"), GetActorYPos, v);//Y + RegisterNutApi(_SST("sq_SetPosition"), SetActorPosition, v);//X,Y + RegisterNutApi(_SST("sq_SetScale"), SetActorScale, v);//ű + RegisterNutApi(_SST("sq_SetZOrder"), SetActorSetZOrder, v);//Z㼶 + RegisterNutApi(_SST("sq_GetZOrder"), GetActorSetZOrder, v);//ȡZ㼶 + RegisterNutApi(_SST("sq_GetWidth"), GetActorWidth, v);//ȡ + RegisterNutApi(_SST("sq_GetHeight"), GetActorHeight, v);//ȡ߶ + RegisterNutApi(_SST("sq_GetName"), GetActorName, v);//ȡ + RegisterNutApi(_SST("sq_SetName"), SetActorName, v);// + RegisterNutApi(_SST("sq_SetActorOpacity"), SetActorOpacity, v);//͸ + RegisterNutApi(_SST("sq_SetChild"), SetActorChild, v);//Ӷ + RegisterNutApi(_SST("sq_GetChildByName"), GetChildByName, v);//ȡӶByName + RegisterNutApi(_SST("sq_RemoveChild"), RemoveActorChild, v);//ƳӶ + RegisterNutApi(_SST("sq_RemoveParent"), RemoveActorParent, v);//Ƴ + RegisterNutApi(_SST("sq_GetParent"), GetActorParent, v);//Ƴ + RegisterNutApi(_SST("sq_SetSize"), SetSize, v);//ôС + RegisterNutApi(_SST("sq_SetRotate"), SetRotate, v);//ת + + + //Sound + RegisterNutApi(_SST("sq_Create_Sound"), Create_Sound, v);// + RegisterNutApi(_SST("sq_Set_Sound_Task"), Set_Sound_Task, v);// + RegisterNutApi(_SST("sq_Get_Sound_Volume"), Get_Sound_Volume, v);//ȡ + RegisterNutApi(_SST("sq_Set_Sound_Volume"), Set_Sound_Volume, v);// + + RegisterNutApi(_SST("sq_PlaySoundEffect"), Squirrel_PlaySoundEffect, v);// + RegisterNutApi(_SST("sq_ReleseSoundEffect"), Squirrel_ReleseSoundEffect, v);// + + //Input + RegisterNutApi(_SST("sq_Key_Pressed"), Key_Pressed, v);//жϼֵ ͼ̶ + RegisterNutApi(_SST("sq_Key_Is_Down"), Key_Is_Down, v);//жϼֵ ͼ̶ + RegisterNutApi(_SST("sq_Key_WasReleased"), Key_WasReleased, v);//жϼֵ̧ ͼ̶ + + + // + RegisterNutApi(_SST("sq_Reset_Scene"), Reset_Scene, v);//ó + RegisterNutApi(_SST("sq_Create_Scene"), Create_Scene, v);// + RegisterNutApi(_SST("sq_Get_SceneByName"), Get_SceneByName, v);//ֻȡ ڻԶ + RegisterNutApi(_SST("sq_Get_TownSceneByName"), Get_TownSceneByName, v);//ֻȡ򳡾 ڻԶ + + + + + // + RegisterNutApi(_SST("sq_EnterStage"), Director_EnterStage, v);//л + RegisterNutApi(_SST("sq_PushStage"), Director_PushStage, v);//лǰPush볡ջ + RegisterNutApi(_SST("sq_PopStage"), Director_PopStage, v);//˳ǰлһ + RegisterNutApi(_SST("sq_GetScene"), Director_GetScene, v);//ݻȡǰ + RegisterNutApi(_SST("sq_ClearStages"), Director_ClearStages, v);//˳ǰճջ + + //ɶ + RegisterNutApi(_SST("sq_Create_FadeTransition"), Creat_FadeTransition, v);//뵭ɶ + + //ָ + RegisterNutApi(_SST("sq_SetCursor_Task"), SetCursor_Task, v);//뵭ɶ + RegisterNutApi(_SST("sq_Sync_CursorPos"), Sync_CursorPos, v);//ͬ + RegisterNutApi(_SST("sq_Get_Cursor"), Get_Cursor, v);//ȡ + + //UI + //UI-ť + RegisterNutApi(_SST("sq_Create_Button"), Create_Button, v);//ť + RegisterNutApi(_SST("sq_Button_Load_Texture"), Button_Load_Texture, v);//ðť״̬ + RegisterNutApi(_SST("sq_Button_Init"), Button_Init, v);//ðť״̬ + RegisterNutApi(_SST("sq_Button_IsPress"), Button_IsPress, v);//ȡťǷ񱻵 + RegisterNutApi(_SST("sq_Button_IsHover"), Button_IsHover, v);//ȡťǷ񱻵 + RegisterNutApi(_SST("sq_Button_RemoveZorder"), Button_RemoveZorder, v);//ƳԼZ + + //UI- + RegisterNutApi(_SST("sq_Create_Canvas"), Create_Canvas, v);// + RegisterNutApi(_SST("sq_Canvas_BeginDraw"), Canvas_BeginDraw, v);//ʼȾ + RegisterNutApi(_SST("sq_Canvas_EndDraw"), Canvas_EndDraw, v);//Ⱦ + RegisterNutApi(_SST("sq_Canvas_DrawTexture"), Canvas_DrawTexture, v);// + RegisterNutApi(_SST("sq_Canvas_DrawText"), Canvas_DrawText, v);// + + ////IMGUI + //RegisterNutApi(_SST("sq_Create_ImguiLayer"), Create_ImguiLayer, v);//Imguiͼ + //RegisterNutApi(_SST("sq_Imgui_Text"), Imgui_Text, v);//Imgui + //RegisterNutApi(_SST("sq_Imgui_InputText"), Imgui_InputText, v);//Imgui + //RegisterNutApi(_SST("sq_Imgui_SetWindowSize"), Imgui_SetWindowSize, v);//Imgui ôڴС + //RegisterNutApi(_SST("sq_Imgui_SetWindowPos"), Imgui_SetWindowPos, v);//Imgui ôڴС + +} + +void SquirrelClassEx::Run() +{ + + +} + +void SquirrelClassEx::Close() +{ + sq_close(v); +} + + diff --git a/SquirrelClassEx.h b/SquirrelClassEx.h new file mode 100644 index 0000000..5e58043 --- /dev/null +++ b/SquirrelClassEx.h @@ -0,0 +1,120 @@ +#pragma once + +#include "include/squirrel.h" +#include "include/sqstdaux.h" +#include "include/sqstdblob.h" +#include "include/sqstdio.h" +#include "include/sqstdmath.h" +#include "include/sqstdstring.h" +#include "include/sqstdsystem.h" + + +#include +using namespace kiwano; +#include +using namespace kiwano::audio; +#include +using namespace kiwano::imgui; +#include "WThreadPool.h" + + +#include "SquirrelStage.h" +#include "SquirrelTownStage.h" +#include "Cursor.h" +#include "SquirrelButton.h" +#include "SpriteEx.h" +#include "SquirrelCamera.h" +#include "Npk.h" +#include "json.hpp" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#ifdef SQUNICODE +#define scfprintf fwprintf +#define scfopen _wfopen +#define scvprintf vwprintf +#define _SST(a) (SQChar*)##a +#else +#define scfprintf fprintf +#define scfopen fopen +#define scvprintf vprintf +#endif + + +class SquirrelClassEx +{ + +public://չ + static int Sout(HSQUIRRELVM v);// + static int Error(HSQUIRRELVM v);// + +public://API + //Nutű + static SQInteger ReloadingScript(); + //˳Ϸ + static SQInteger Exit(HSQUIRRELVM v); + //ִCmd + static SQInteger Cmd(HSQUIRRELVM v); + //ýű + static void RunSceneScript(std::string FuncName, SquirrelStagePtr scene); + static void RunSceneScript(std::string FuncName, SquirrelStagePtr scene,SQInteger dt); + static void RunSceneScript(std::string FuncName, SquirrelStagePtr scene, SQFloat dt); + static void RunSceneScript(std::string FuncName, SquirrelTownStagePtr scene); + static void RunUpdateScript(std::string FuncName, SQInteger ObjectIdx); + static void RunUpdateScript(std::string FuncName, std::string string); + static void RunUpdateScript(std::string FuncName, SQInteger ObjectIdx, SQInteger Buf); + static void RunUpdateScript(std::string FuncName, SQInteger ObjectIdx, SQInteger Buf , SQInteger Buf2); + static void RunUpdateScriptPlayer(std::string FuncName, SQInteger ObjectIdx, SQFloat Buf); + //PushͼMap + static void PushLayerActorPtrToMap(LayerActorPtr Ptr); + //ȡList + static void LoadingListScript(); + +public: // + static TexturePtr GetTexturePtrByImg(const std::string ImgPath , const int Frame); + static void ReleaseTextureByImg(const std::string ImgPath); + +public://չ + //ַ + static void Split(const std::string& src, std::vector& dest, const std::string& separator); + static char* U8ToUnicode(const char* szU8); + static char* SquirrelU2W(const char* Str); + + + + + //ļ + //static int WriteFile(HSQUIRRELVM v);//ļд + + +public://עհ + //nutӿfuncNameCԺfuncAddr + static void RegisterNutApi(const SQChar* funcName, void* funcAddr, HSQUIRRELVM v); + //עӿ + void R_Register_Nut(HSQUIRRELVM v); + + + + +public: + SquirrelClassEx(); + //ʼ + void Init(); + // + void Run(); + //ر + void Close(); +}; + +static SquirrelClassEx* Object; +static HSQUIRRELVM v; \ No newline at end of file diff --git a/SquirrelStage.cpp b/SquirrelStage.cpp new file mode 100644 index 0000000..d64b0fb --- /dev/null +++ b/SquirrelStage.cpp @@ -0,0 +1,127 @@ +#include "SquirrelStage.h" + +#include "SquirrelClassEx.h" +extern SquirrelClassEx* TObject; +extern Cursor* Mouse_Object; + +extern std::mapUI_HOVER_ZORDER; +extern std::mapUI_HOVER_OBJECT; + + + +void SquirrelStage::OnEvent(Event* evt) { + if (evt->IsType()) + { + if (evt->IsType()) + { + KeyCode key = dynamic_cast(evt)->code; + SquirrelClassEx::RunUpdateScript("KeyDownEventCallBack", (int)key); + } + else if (evt->IsType()) + { + KeyCode key = dynamic_cast(evt)->code; + SquirrelClassEx::RunUpdateScript("KeyUpEventCallBack", (int)key); + } + else if (evt->IsType()) + { + char ch = dynamic_cast(evt)->value; + SquirrelClassEx::RunUpdateScript("KeyCharEventCallBack", (int)ch); + } + else if (evt->IsType()) + { + const auto& str = dynamic_cast(evt)->value; + const auto utf8_str = strings::WideToUTF8(strings::NarrowToWide(str)); + SquirrelClassEx::RunUpdateScript("KeyIMEInputEventCallBack", utf8_str.c_str()); + } + } +} + +void SquirrelStage::InitKeyInPut() +{ + AddListener(Closure(this, &SquirrelStage::OnEvent)); + AddListener(Closure(this, &SquirrelStage::OnEvent)); + AddListener(Closure(this, &SquirrelStage::OnEvent)); + AddListener(Closure(this, &SquirrelStage::OnEvent)); +} + +void SquirrelStage::PushBaseUi() +{ + //UIͼ + LayerActorPtr MouseUiLayer = new LayerActor(); + MouseUiLayer->SetName("Scene_Mouse_UI_Layer"); + //ͼ㼶 + MouseUiLayer->SetZOrder(100000); + SquirrelClassEx::PushLayerActorPtrToMap(MouseUiLayer); + this->AddChild(MouseUiLayer); + + //Ĭͼ + LayerActorPtr DefaultLayer = new LayerActor(); + DefaultLayer->SetName(this->GetName() + "_Default_Layer"); + SquirrelClassEx::PushLayerActorPtrToMap(DefaultLayer); + this->AddChild(DefaultLayer); +} + +void SquirrelStage::OnEnter() +{ + //ӸƳ + Mouse_Object->RemoveFromParent(); + + ActorPtr MouseUiLayer = this->GetChild("Scene_Mouse_UI_Layer"); + + //ΪǰӶ + MouseUiLayer->AddChild(Mouse_Object); + + // + if(this->GetName().find("GameMap") == std::string::npos)TObject->RunSceneScript(this->GetName() + "_Enter", this); + //ȫֽ + TObject->RunSceneScript("Game_Enter", this); +} + +void SquirrelStage::OnExit() +{ + //UIMap + UI_HOVER_ZORDER.clear(); + UI_HOVER_OBJECT.clear(); + + //ӸƳ + Mouse_Object->RemoveFromParent(); + //˳ + if (this->GetName().find("GameMap") == std::string::npos)TObject->RunSceneScript(this->GetName() + "_Exit", this); + //ȫ˳ + TObject->RunSceneScript("Game_Exit", this); +} + + +void SquirrelStage::OnUpdate(Duration dt) +{ + static float TimeFlag = 0.0; + + TimeFlag += dt.GetSeconds(); + + TObject->RunSceneScript("Game_Proc", this, dt.GetSeconds()); + + if (TimeFlag >= 0.00694) { + //Proc + if (this->GetName().find("GameMap") == std::string::npos)TObject->RunSceneScript(this->GetName() + "_Proc", this, TimeFlag); + + + if (Director::GetInstance().GetCurrentStage()->GetHashName() == this->GetHashName() && this->GetName().find("LoadingGame") == std::string::npos) { + //ȫProc + TObject->RunSceneScript("Game_Proc_144", this, TimeFlag); + //жǷҪ + if (FILE* file = fopen("Yosin_Game_Reloading.Sign", "r")) { + SquirrelClassEx::ReloadingScript(); + //OnExit(); + //OnEnter(); + fclose(file); + remove("Yosin_Game_Reloading.Sign"); + } + } + + TimeFlag = 0.0; + } + +} + + + diff --git a/SquirrelStage.h b/SquirrelStage.h new file mode 100644 index 0000000..2abaa16 --- /dev/null +++ b/SquirrelStage.h @@ -0,0 +1,41 @@ +#pragma once + + +#include +using namespace kiwano; + +KGE_DECLARE_SMART_PTR(SquirrelStage); +class SquirrelStage : + public Stage +{ +private: + float Base_X = 0; + float Base_Y = 0; +public: + //캯 + SquirrelStage(std::string gName) { + this->SetName(gName); + + InitKeyInPut(); + + PushBaseUi(); + + } + + //¼ص + void InitKeyInPut(); + + //ͼ + void PushBaseUi(); + + //볡 + void OnEnter() override; + //˳ + void OnExit()override; + //Ⱦ Proc + void OnUpdate(Duration dt)override; + + + void OnEvent(Event* evt); +}; + diff --git a/SquirrelTownStage.cpp b/SquirrelTownStage.cpp new file mode 100644 index 0000000..a3df342 --- /dev/null +++ b/SquirrelTownStage.cpp @@ -0,0 +1,69 @@ +#include "SquirrelTownStage.h" +#include "SquirrelClassEx.h" + +extern SquirrelClassEx* TObject; +extern Cursor* Mouse_Object; + +extern std::mapUI_HOVER_ZORDER; +extern std::mapUI_HOVER_OBJECT; + +void SquirrelTownStage::PushBaseUi() +{ + //UIͼ + LayerActorPtr MouseUiLayer = new LayerActor(); + MouseUiLayer->SetName("Scene_Mouse_UI_Layer"); + //ͼ㼶 + MouseUiLayer->SetZOrder(100000); + SquirrelClassEx::PushLayerActorPtrToMap(MouseUiLayer); + this->AddChild(MouseUiLayer); + + //Ĭͼ + LayerActorPtr DefaultLayer = new LayerActor(); + DefaultLayer->SetName(this->GetName() + "_Default_Layer"); + SquirrelClassEx::PushLayerActorPtrToMap(DefaultLayer); + this->AddChild(DefaultLayer); +} + +void SquirrelTownStage::OnEnter() +{ + //ӸƳ + Mouse_Object->RemoveFromParent(); + + ActorPtr MouseUiLayer = this->GetChild("Scene_Mouse_UI_Layer"); + + //ΪǰӶ + MouseUiLayer->AddChild(Mouse_Object); + + // + //TObject->RunSceneScript(this->GetName() + "_Enter", this); + //ȫֽ + TObject->RunSceneScript("Game_Enter", this); +} + +void SquirrelTownStage::OnExit() +{ + //UIMap + UI_HOVER_ZORDER.clear(); + UI_HOVER_OBJECT.clear(); + + //ӸƳ + Mouse_Object->RemoveFromParent(); + //ȫ˳ + TObject->RunSceneScript("Game_Exit", this); +} + +void SquirrelTownStage::OnUpdate(Duration dt) +{ + if (Director::GetInstance().GetCurrentStage()->GetHashName() == this->GetHashName() && this->GetName().find("LoadingGame") == std::string::npos) { + //ȫProc + TObject->RunSceneScript("Game_Proc", this); + //жǷҪ + if (FILE* file = fopen("Yosin_Game_Reloading.Sign", "r")) { + SquirrelClassEx::ReloadingScript(); + //OnExit(); + //OnEnter(); + fclose(file); + remove("Yosin_Game_Reloading.Sign"); + } + } +} diff --git a/SquirrelTownStage.h b/SquirrelTownStage.h new file mode 100644 index 0000000..1483ed4 --- /dev/null +++ b/SquirrelTownStage.h @@ -0,0 +1,31 @@ +#pragma once +#include +using namespace kiwano; + +#include "SquirrelStage.h" +KGE_DECLARE_SMART_PTR(SquirrelTownStage); + +class SquirrelTownStage : + public Stage +{ +private: + float Base_X = 0; + float Base_Y = 0; +public: + //캯 + SquirrelTownStage(std::string gName) { + this->SetName(gName); + + PushBaseUi(); + } + + //ͼ + void PushBaseUi(); + //볡 + void OnEnter() override; + //˳ + void OnExit()override; + //Ⱦ Proc + void OnUpdate(Duration dt)override; +}; + diff --git a/StageActorRegister.h b/StageActorRegister.h new file mode 100644 index 0000000..287174b --- /dev/null +++ b/StageActorRegister.h @@ -0,0 +1,358 @@ +#pragma once + +//ԱָMap +extern std::mapActorPtrMapObject; +//뵭ָMap +std::mapFadeTransitionPtrMapObject; +//Map +std::mapSquirrelStagePtrMapObject; + +//س +static SQInteger Reset_Scene(HSQUIRRELVM v) +{ + SQInteger Top = sq_gettop(v); + if (Top <= 0) + { + sq_throwerror(v, _SST("Incorrect function argument")); + return 0; + } + + //ȡ볡 + SQInteger gscene; + sq_getinteger(v, 2, &gscene); + + //ȡ볡 + if (ActorPtrMapObject.count(gscene)) { + SquirrelStagePtr scene = dynamic_cast(ActorPtrMapObject[gscene].Get()); + //ƳӶ + scene->RemoveAllChildren(); + //¹ + scene->PushBaseUi(); + //µý볡 + scene->OnEnter(); + + sq_pushbool(v, true); + } + else { + sq_pushbool(v, false); + } + + //ActorPtr c = scene->GetChild("Scene_Default_Layer"); + //c->RemoveAllChildren(); + + //ActorList ChildList = scene->GetAllChildren(); + + //for (auto& child : ChildList) + //{ + // if (!child->IsName("Scene_Mouse_UI_Layer")) { + // child->RemoveAllChildren(); + // } + //} + + return 1; +} + + +// +static SQInteger Create_Scene(HSQUIRRELVM v) +{ + SQInteger Top = sq_gettop(v); + if (Top <= 0) + { + sq_throwerror(v, _SST("Incorrect function argument")); + return 0; + } + + //ȡ + const SQChar* StageName; + sq_getstring(v, 2, &StageName); + + //˲NewһַҪֶ + char* gStageName = SquirrelClassEx::SquirrelU2W((char*)StageName); + + std::string RealStageName = gStageName; + + //Newַ + delete[]gStageName; + + // + SquirrelStagePtr scene = new SquirrelStage(RealStageName); + + //ȡUUID + uint32_t UUID = scene->GetObjectID(); + + //Map + ActorPtrMapObject[UUID] = scene; + SquirrelStagePtrMapObject[RealStageName] = UUID; + + sq_pushinteger(v, UUID); + + return 1; +} + +//ֻȡ ڻԶ +static SQInteger Get_SceneByName(HSQUIRRELVM v) +{ + SQInteger Top = sq_gettop(v); + if (Top <= 0) + { + sq_throwerror(v, _SST("Incorrect function argument")); + return 0; + } + + //ȡ + const SQChar* StageName; + sq_getstring(v, 2, &StageName); + + //˲NewһַҪֶ + char* gStageName = SquirrelClassEx::SquirrelU2W((char*)StageName); + + std::string RealStageName = gStageName; + + //Newַ + delete[]gStageName; + + if (SquirrelStagePtrMapObject.count(RealStageName) && ActorPtrMapObject.count(SquirrelStagePtrMapObject[RealStageName])) { + sq_pushinteger(v, SquirrelStagePtrMapObject[RealStageName]); + } + else { + // + SquirrelStagePtr scene = new SquirrelStage(RealStageName); + + //ȡUUID + uint32_t UUID = scene->GetObjectID(); + + //Map + ActorPtrMapObject[UUID] = scene; + SquirrelStagePtrMapObject[RealStageName] = UUID; + + sq_pushinteger(v, UUID); + } + + return 1; +} + +//ֻȡ򳡾 ڻԶ +static SQInteger Get_TownSceneByName(HSQUIRRELVM v) +{ + SQInteger Top = sq_gettop(v); + if (Top <= 0) + { + sq_throwerror(v, _SST("Incorrect function argument")); + return 0; + } + + //ȡ + const SQChar* StageName; + sq_getstring(v, 2, &StageName); + + //˲NewһַҪֶ + char* gStageName = SquirrelClassEx::SquirrelU2W((char*)StageName); + + std::string RealStageName = gStageName; + + //Newַ + delete[]gStageName; + + if (SquirrelStagePtrMapObject.count(RealStageName) && ActorPtrMapObject.count(SquirrelStagePtrMapObject[RealStageName])) { + sq_pushinteger(v, SquirrelStagePtrMapObject[RealStageName]); + } + else { + // + SquirrelTownStagePtr scene = new SquirrelTownStage(RealStageName); + + //ȡUUID + uint32_t UUID = scene->GetObjectID(); + + //Map + ActorPtrMapObject[UUID] = scene; + SquirrelStagePtrMapObject[RealStageName] = UUID; + + sq_pushinteger(v, UUID); + } + + return 1; +} + +//л +static SQInteger Director_EnterStage(HSQUIRRELVM v) +{ + SQInteger Top = sq_gettop(v); + if (Top <= 0) + { + sq_throwerror(v, _SST("Incorrect function argument")); + return 0; + } + + //ȡ볡 + SQInteger gscene; + sq_getinteger(v, 2, &gscene); + + //ȡ볡 + if (ActorPtrMapObject.count(gscene)) { + SquirrelStagePtr scene = dynamic_cast(ActorPtrMapObject[gscene].Get()); + if (Top == 2) { + Director::GetInstance().EnterStage(scene); + } + else if (Top == 3) { + SQInteger gTsn; + sq_getinteger(v, 3, &gTsn); + + if (FadeTransitionPtrMapObject.count(gTsn)) { + FadeTransitionPtr Tsn = FadeTransitionPtrMapObject[gTsn]; + Director::GetInstance().EnterStage(scene, Tsn); + } + else { + Director::GetInstance().EnterStage(scene); + } + } + sq_pushbool(v, true); + } + else { + sq_pushbool(v, false); + } + + return 1; +} + +//л +static SQInteger Director_PushStage(HSQUIRRELVM v) +{ + SQInteger Top = sq_gettop(v); + if (Top <= 0) + { + sq_throwerror(v, _SST("Incorrect function argument")); + return 0; + } + + //ȡ볡 + SQInteger gscene; + sq_getinteger(v, 2, &gscene); + + //ȡ볡 + if (ActorPtrMapObject.count(gscene)) { + SquirrelStagePtr scene = dynamic_cast(ActorPtrMapObject[gscene].Get()); + if (Top == 2) { + Director::GetInstance().PushStage(scene); + } + else if (Top == 3) { + SQInteger gTsn; + sq_getinteger(v, 3, &gTsn); + + if (FadeTransitionPtrMapObject.count(gTsn)) { + FadeTransitionPtr Tsn = FadeTransitionPtrMapObject[gTsn]; + Director::GetInstance().PushStage(scene, Tsn); + } + else { + Director::GetInstance().PushStage(scene); + } + } + sq_pushbool(v, true); + } + else { + sq_pushbool(v, false); + } + + return 1; +} + +//л +static SQInteger Director_PopStage(HSQUIRRELVM v) +{ + SQInteger Top = sq_gettop(v); + if (Top <= 0) + { + sq_throwerror(v, _SST("Incorrect function argument")); + return 0; + } + + //ȡ볡 + SQInteger gscene; + sq_getinteger(v, 2, &gscene); + + //ȡ볡 + if (ActorPtrMapObject.count(gscene)) { + SquirrelStagePtr scene = dynamic_cast(ActorPtrMapObject[gscene].Get()); + if (Top == 2) { + Director::GetInstance().PopStage(); + } + else if (Top == 3) { + SQInteger gTsn; + sq_getinteger(v, 3, &gTsn); + + if (FadeTransitionPtrMapObject.count(gTsn)) { + FadeTransitionPtr Tsn = FadeTransitionPtrMapObject[gTsn]; + Director::GetInstance().PopStage(Tsn); + } + else { + Director::GetInstance().PopStage(); + } + } + sq_pushbool(v, true); + } + else { + sq_pushbool(v, false); + } + + return 1; +} + +//ݻȡǰ +static SQInteger Director_GetScene(HSQUIRRELVM v) +{ + SQInteger Top = sq_gettop(v); + if (Top <= 0) + { + sq_throwerror(v, _SST("Incorrect function argument")); + return 0; + } + + uint32_t scene = Director::GetInstance().GetCurrentStage()->GetObjectID(); + sq_pushinteger(v, scene); + + return 1; +} + +//˳ǰճջ +static SQInteger Director_ClearStages(HSQUIRRELVM v) +{ + SQInteger Top = sq_gettop(v); + if (Top <= 0) + { + sq_throwerror(v, _SST("Incorrect function argument")); + return 0; + } + + Director::GetInstance().ClearStages(); + + return 0; +} + +//뵭ɶ +static SQInteger Creat_FadeTransition(HSQUIRRELVM v) +{ + SQInteger Top = sq_gettop(v); + if (Top <= 0) + { + sq_throwerror(v, _SST("Incorrect function argument")); + return 0; + } + + SQInteger gDuration; + SQBool gParallel; + sq_getinteger(v, 2, &gDuration); + sq_getbool(v, 3, &gParallel); + + Duration Time = Duration(gDuration); + FadeTransitionPtr Tsn = new FadeTransition(Time, gParallel); + + //ȡUUID + uint32_t UUID = Tsn->GetObjectID(); + + //߼Map + FadeTransitionPtrMapObject[UUID] = Tsn; + + sq_pushinteger(v, UUID); + + return 1; +} \ No newline at end of file diff --git a/TextActorRegister.h b/TextActorRegister.h new file mode 100644 index 0000000..375fe25 --- /dev/null +++ b/TextActorRegister.h @@ -0,0 +1,427 @@ +#pragma once + +extern std::mapActorPtrMapObject; +extern std::mapFontRecObject; + +//ֶ +static SQInteger Squirrle_Create_Text_Object(HSQUIRRELVM v) +{ + SQInteger Top = sq_gettop(v); + if (Top <= 0) + { + sq_throwerror(v, _SST("Incorrect function argument")); + return 0; + } + + + // һıɫ + TextActorPtr text = new TextActor(); + + //ȡֶUUID + uint64_t UUID = text->GetObjectID(); + + //ֶMap + ActorPtrMapObject[UUID] = text; + + //HshNameظ + sq_pushinteger(v, UUID); + + return 1; +} + +//ֶı +static SQInteger Squirrle_Set_Text_Object_Text(HSQUIRRELVM v) +{ + SQInteger Top = sq_gettop(v); + if (Top <= 0) + { + sq_throwerror(v, _SST("Incorrect function argument")); + return 0; + } + + SQInteger ActorUUID; + sq_getinteger(v, 2, &ActorUUID); + + //õSquirrelַ + const SQChar* OutPutBuffer; + sq_getstring(v, 3, &OutPutBuffer); + + //˲NewһַҪֶ + char* OutPutText = SquirrelClassEx::SquirrelU2W((char*)OutPutBuffer); + + //ȫMapлȡıɫ + if (ActorPtrMapObject.count(ActorUUID)) { + TextActorPtr text = dynamic_cast(ActorPtrMapObject[ActorUUID].Get()); + text->SetText(OutPutText); + sq_pushbool(v, true); + } + else { + sq_pushbool(v, false); + } + + //Newַ + delete[]OutPutText; + + return 1; +} + +//ֶɫ +static SQInteger Squirrle_Set_Text_Object_Color(HSQUIRRELVM v) +{ + SQInteger Top = sq_gettop(v); + if (Top <= 0) + { + sq_throwerror(v, _SST("Incorrect function argument")); + return 0; + } + + SQInteger ActorUUID; + sq_getinteger(v, 2, &ActorUUID); + + SQInteger TextColor; + sq_getinteger(v, 3, &TextColor); + + //ȫMapлȡıɫ + if (ActorPtrMapObject.count(ActorUUID)) { + TextActorPtr text = dynamic_cast(ActorPtrMapObject[ActorUUID].Get()); + text->SetFillColor(TextColor); + sq_pushbool(v, true); + } + else { + sq_pushbool(v, false); + } + + return 1; +} + +//ֶʽ +static SQInteger Squirrle_Set_Text_Object_TextStyle(HSQUIRRELVM v) +{ + SQInteger Top = sq_gettop(v); + if (Top <= 0) + { + sq_throwerror(v, _SST("Incorrect function argument")); + return 0; + } + + SQInteger ActorUUID; + sq_getinteger(v, 2, &ActorUUID); + + //õSquirrelַ ·Key + const SQChar* OutPutBuffer; + sq_getstring(v, 3, &OutPutBuffer); + + //˲NewһַҪֶ + char* OutPutText = SquirrelClassEx::SquirrelU2W((char*)OutPutBuffer); + std::string FontName = OutPutText; + //Newַ + delete[]OutPutText; + + + //ͨ崴ıʽ + if (Top == 3) { + //ȫMapлȡıɫ + if (ActorPtrMapObject.count(ActorUUID)) { + TextActorPtr text = dynamic_cast(ActorPtrMapObject[ActorUUID].Get()); + if (FontRecObject.count(FontName)) { + TextStyle TsP = TextStyle(FontRecObject[FontName]); + text->SetStyle(TsP); + } + sq_pushbool(v, true); + } + } + else if (Top == 8) { + //õֶ䷽ʽ + SQInteger gTextAlign; + sq_getinteger(v, 4, &gTextAlign); + + //õԶп + SQFloat gwrap_width; + sq_getfloat(v, 5, &gwrap_width); + + //õм + SQFloat gline_spacing; + sq_getfloat(v, 6, &gline_spacing); + + //õʾ» + SQBool gshow_underline; + sq_getbool(v, 7, &gshow_underline); + + //õʾɾ + SQBool gshow_strikethrough; + sq_getbool(v, 8, &gshow_strikethrough); + + //ȫMapлȡıɫ + if (ActorPtrMapObject.count(ActorUUID)) { + TextActorPtr text = dynamic_cast(ActorPtrMapObject[ActorUUID].Get()); + if (FontRecObject.count(FontName)) { + TextStyle TsP = TextStyle(FontRecObject[FontName]); + switch (gTextAlign) + { + case 0: + TsP.alignment = TextAlign::Left; + break; + case 1: + TsP.alignment = TextAlign::Right; + break; + case 2: + TsP.alignment = TextAlign::Center; + break; + case 3: + TsP.alignment = TextAlign::Justified; + break; + } + TsP.wrap_width = gwrap_width; + TsP.line_spacing = gline_spacing; + TsP.show_underline = gshow_underline; + TsP.show_strikethrough = gshow_strikethrough; + text->SetStyle(TsP); + } + sq_pushbool(v, true); + } + } + else { + sq_pushbool(v, false); + } + + + return 1; +} + + + +//ֶ䷽ʽ +static SQInteger Squirrle_Set_Text_Object_Alignment(HSQUIRRELVM v) +{ + SQInteger Top = sq_gettop(v); + if (Top <= 0) + { + sq_throwerror(v, _SST("Incorrect function argument")); + return 0; + } + + SQInteger ActorUUID; + sq_getinteger(v, 2, &ActorUUID); + + SQInteger TextAlignment; + sq_getinteger(v, 3, &TextAlignment); + + //ȫMapлȡıɫ + if (ActorPtrMapObject.count(ActorUUID)) { + TextActorPtr text = dynamic_cast(ActorPtrMapObject[ActorUUID].Get()); + switch (TextAlignment) + { + case 0: + text->SetAlignment(TextAlign::Left); + break; + case 1: + text->SetAlignment(TextAlign::Right); + break; + case 2: + text->SetAlignment(TextAlign::Center); + break; + case 3: + text->SetAlignment(TextAlign::Justified); + break; + } + sq_pushbool(v, true); + } + else { + sq_pushbool(v, false); + } + + return 1; +} + + +// +static SQInteger Squirrle_Set_Text_Object_Outline(HSQUIRRELVM v) +{ + SQInteger Top = sq_gettop(v); + if (Top <= 0) + { + sq_throwerror(v, _SST("Incorrect function argument")); + return 0; + } + + SQInteger ActorUUID; + sq_getinteger(v, 2, &ActorUUID); + + SQInteger OutlineStyle; + sq_getinteger(v, 3, &OutlineStyle); + + SQInteger OutlineColor; + sq_getinteger(v, 4, &OutlineColor); + + //ȫMapлȡıɫ + if (ActorPtrMapObject.count(ActorUUID)) { + TextActorPtr text = dynamic_cast(ActorPtrMapObject[ActorUUID].Get()); + StrokeStylePtr SSP = new StrokeStyle(2); + switch (OutlineStyle) + { + case 0 : + SSP->SetWidth(3.0); + //SSP->SetCapStyle(CapStyle::Flat); + //SSP->SetLineJoinStyle(LineJoinStyle::Miter); + break; + default: + break; + } + text->SetOutlineStrokeStyle(SSP); + text->SetOutlineColor(OutlineColor); + + sq_pushbool(v, true); + + + //TextStyle OldT = text->GetStyle(); + //std::string TString = text->GetText(); + + //TextActorPtr LeftUp = new TextActor(TString, OldT); + //LeftUp->SetPosition(-1.0, -1.0); + //LeftUp->SetFillColor(0xff000000); + //LeftUp->SetZOrder(-1); + //text->AddChild(LeftUp); + // + //TextActorPtr Left = new TextActor(TString, OldT); + //Left->SetPosition(-1.0, 0); + //Left->SetFillColor(0xff000000); + //Left->SetZOrder(-1); + //text->AddChild(Left); + + //TextActorPtr LeftDown = new TextActor(TString, OldT); + //LeftDown->SetPosition(-1.0, 1.0); + //LeftDown->SetFillColor(0xff000000); + //LeftDown->SetZOrder(-1); + //text->AddChild(LeftDown); + + //TextActorPtr Up = new TextActor(TString, OldT); + //Up->SetPosition(0.0, -1.0); + //Up->SetFillColor(0xff000000); + //Up->SetZOrder(-1); + //text->AddChild(Up); + + //TextActorPtr Down = new TextActor(TString, OldT); + //Down->SetPosition(0.0, 1.0); + //Down->SetFillColor(0xff000000); + //Down->SetZOrder(-1); + //text->AddChild(Down); + + //TextActorPtr RightUp = new TextActor(TString, OldT); + //RightUp->SetPosition(1.0, -1.0); + //RightUp->SetFillColor(0xff000000); + //RightUp->SetZOrder(-1); + //text->AddChild(RightUp); + + //TextActorPtr Right = new TextActor(TString, OldT); + //Right->SetPosition(1.0, 0.0); + //Right->SetFillColor(0xff000000); + //Right->SetZOrder(-1); + //text->AddChild(Right); + + //TextActorPtr RightDown = new TextActor(TString, OldT); + //RightDown->SetPosition(1.0, 1.0); + //RightDown->SetFillColor(0xff000000); + //RightDown->SetZOrder(-1); + //text->AddChild(RightDown); + + //sq_pushbool(v, true); + + + + } + else { + sq_pushbool(v, false); + } + + return 1; +} + + + + + + + + + + + + + + + + + + + + + + + + +//½ʽ +static SQInteger Squirrle_Create_Font(HSQUIRRELVM v) +{ + SQInteger Top = sq_gettop(v); + if (Top <= 0) + { + sq_throwerror(v, _SST("Incorrect function argument")); + return 0; + } + + //õSquirrelַ ·Key + const SQChar* gFontName; + sq_getstring(v, 2, &gFontName); + + //˲NewһַҪֶ + char* FontNamebuf = SquirrelClassEx::SquirrelU2W((char*)gFontName); + std::string FontName = FontNamebuf; + delete[]FontNamebuf; + + //岻ھȥ + if (!FontRecObject.count(FontName)) { + //õSquirrelַ ·Key + const SQChar* OutPutBuffer; + sq_getstring(v, 3, &OutPutBuffer); + + //˲NewһַҪֶ + char* gFontPath = SquirrelClassEx::SquirrelU2W((char*)OutPutBuffer); + std::string FontPath = gFontPath; + delete[]gFontPath; + + SQFloat gfont_size; + sq_getfloat(v, 4, &gfont_size); + + + FontPtr FontBuf = new Font(FontPath, gfont_size,400U,FontPosture::Normal,FontStretch::Normal); + + FontRecObject[FontName] = FontBuf; + sq_pushbool(v, true); + } + else { + sq_pushbool(v, false); + } + + return 1; +} + + + + + + + +void R_Register_Nut_Text() { + // + SquirrelClassEx::RegisterNutApi(_SST("sq_Create_Text_Object"), Squirrle_Create_Text_Object, v);//ֶ + SquirrelClassEx::RegisterNutApi(_SST("sq_Set_Text_Object_Text"), Squirrle_Set_Text_Object_Text, v);//ֶı + SquirrelClassEx::RegisterNutApi(_SST("sq_Set_Text_Object_Color"), Squirrle_Set_Text_Object_Color, v);//ֶɫ + SquirrelClassEx::RegisterNutApi(_SST("sq_Set_Text_Object_TextStyle"), Squirrle_Set_Text_Object_TextStyle, v);//ֶʽ + SquirrelClassEx::RegisterNutApi(_SST("sq_Set_Text_Object_Alignment"), Squirrle_Set_Text_Object_Alignment, v);//ֶ䷽ʽ + SquirrelClassEx::RegisterNutApi(_SST("sq_Set_Text_Object_Outline"), Squirrle_Set_Text_Object_Outline, v);// + + + + + SquirrelClassEx::RegisterNutApi(_SST("sq_Create_Font"), Squirrle_Create_Font, v);// +} \ No newline at end of file diff --git a/ThreadRegister.h b/ThreadRegister.h new file mode 100644 index 0000000..040fff0 --- /dev/null +++ b/ThreadRegister.h @@ -0,0 +1,106 @@ +#pragma once +//Map +extern std::unordered_map>ImageRecObject; +std::mutex ImageRecObjectmutex; + +extern NPK_M* npk; + +extern WThreadPool threadPool; + +void ThreadPreloadImg_Success(std::string Name , SQInteger Scene) +{ + //ûص + sq_pushroottable(v); + sq_pushstring(v, _SST(Name.c_str()), -1); + sq_get(v, -2); + sq_pushroottable(v); + sq_pushinteger(v, Scene); + sq_call(v, 2, 0, 1); + sq_pop(v, 2); +} + +void ThreadPreloadImgFunc(std::vector ImgList, std::string Name , SQInteger Scene) { + //ȱһ Ҫصimg + std::vector RealImgList; + ImageRecObjectmutex.lock(); + for (auto it = ImgList.begin(); it != ImgList.end(); ++it) { + std::string Iname = *it; + if (!ImageRecObject.count(Iname)) { + RealImgList.push_back(*it); + } + } + ImageRecObjectmutex.unlock(); + + //ʼimg ʱmap + std::map> TexturePtrVL; + for (auto it = RealImgList.begin(); it != RealImgList.end(); ++it) { + std::string imgpath = *it; + IMG* img = npk->ReadNpkTable(imgpath); + + for (int i = 0; i < img->png_sum; i++) + { + std::string RealTextureName = imgpath; + + DWORD Height = img->lp_lplist[i].Height; + DWORD Width = img->lp_lplist[i].Width; + BYTE* Data = img->lp_lplist[i].PNGdata; + + BinaryData data = { ((void*)Data) ,Height * Width * 4 }; + TexturePtr t = new Texture; + t->Load(PixelSize(Width, Height), data, PixelFormat::Bpp32BGRA); + t->SetUserData(&img->lp_lplist[i]); + + TexturePtrVL[RealTextureName][i] = t; + } + npk->ReleaseNpkTable(img); + } + + // ֵmap + ImageRecObjectmutex.lock(); + for (auto it = TexturePtrVL.begin(); it != TexturePtrVL.end(); it++) { + if (!ImageRecObject.count(it->first)) { + ImageRecObject[it->first] = it->second; + } + } + ImageRecObjectmutex.unlock(); + + + auto f1 = std::bind(&ThreadPreloadImg_Success, Name , Scene); + Application::GetInstance().PerformInMainThread(f1); +} + + +//̼߳ImgԴ +static SQInteger ThreadPreloadImg(HSQUIRRELVM v) +{ + SQInteger Top = sq_gettop(v); + if (Top <= 0) + { + sq_throwerror(v, _SST("Incorrect function argument")); + return 0; + } + + std::vector ImgList; + sq_pushnull(v); // null iterator + while (SQ_SUCCEEDED(sq_next(v, 2))) + { + const SQChar* path; + sq_getstring(v, -1, &path); + ImgList.push_back((char*)path); + //-1ֵ-2Ǽ + sq_pop(v, 2); //һε֮ǰֵ + } + sq_pop(v, 1); + + const SQChar* Name; + sq_getstring(v, 3,&Name); + + SQInteger SceneId; + sq_getinteger(v, 4, &SceneId); + + auto f1 = std::bind(&ThreadPreloadImgFunc, ImgList, (char*)Name, SceneId); + + threadPool.concurrentRun(f1); + + return 1; +} \ No newline at end of file diff --git a/UiFrameWork.cpp b/UiFrameWork.cpp new file mode 100644 index 0000000..fcb8562 --- /dev/null +++ b/UiFrameWork.cpp @@ -0,0 +1,73 @@ +#include "UiFrameWork.h" + +std::mapUI_HOVER_ZORDER; +std::mapUI_HOVER_OBJECT; + +void UiFrameWork::OnHoverEvent(Event* evt) { + //ÿUI౻ͣʱͻMap дλ + UI_HOVER_ZORDER[this->GetObjectID()] = this->GetZOrder(); + UI_HOVER_OBJECT[this->GetObjectID()] = this; + + //ȡMapĶ + auto MaxZorderMap = std::max_element(UI_HOVER_ZORDER.begin(), UI_HOVER_ZORDER.end(), [](std::pair left, std::pair right) { return left.second < right.second; }); + + std::map::reverse_iterator iter; + for (iter = UI_HOVER_OBJECT.rbegin(); iter != UI_HOVER_OBJECT.rend(); iter++) { + //ôͣǾ͵Ƴͣ + if (iter->first == MaxZorderMap->first) { + iter->second->OnHover(); + } + else { + iter->second->OnOut(); + } + } + +} + +void UiFrameWork::OnOutEvent(Event* evt) { + //ÿUI಻ڱͣʱ ͻMap Ƴλ + UI_HOVER_ZORDER.erase(this->GetObjectID()); + UI_HOVER_OBJECT.erase(this->GetObjectID()); + + this->OnOut(); + + //ȡMapĶ + auto MaxZorderMap = std::max_element(UI_HOVER_ZORDER.begin(), UI_HOVER_ZORDER.end(), [](std::pair left, std::pair right) { return left.second < right.second; }); + + std::map::reverse_iterator iter; + for (iter = UI_HOVER_OBJECT.rbegin(); iter != UI_HOVER_OBJECT.rend(); iter++) { + //ôͣǾ͵Ƴͣ + if (iter->first == MaxZorderMap->first) { + iter->second->OnHover(); + } + else { + iter->second->OnOut(); + } + } +} + +void UiFrameWork::RemoveZorder() +{ + UI_HOVER_ZORDER.erase(this->GetObjectID()); + UI_HOVER_OBJECT.erase(this->GetObjectID()); +} + + +void UiFrameWork::OnHover() +{ + +} + +void UiFrameWork::OnOut() +{ +} + +void UiFrameWork::Init() +{ + //UI + ComponentPtr comp = new MouseSensor; + AddComponent(0, comp); + //ͣƳӦ¼ + AddListener(Closure(this, &UiFrameWork::OnHoverEvent)); + AddListener(Closure(this, &UiFrameWork::OnOutEvent)); +} diff --git a/UiFrameWork.h b/UiFrameWork.h new file mode 100644 index 0000000..3ed02ea --- /dev/null +++ b/UiFrameWork.h @@ -0,0 +1,23 @@ +#pragma once +#include +using namespace kiwano; + +/* +UIΪ80000 - 90000 +*/ +class UiFrameWork : public Sprite +{ +private: + +public: + virtual void Init(); + //¼ + void OnHoverEvent(Event* evt); + void OnOutEvent(Event* evt); + void RemoveZorder(); + + //ص¼¼ + virtual void OnHover(); + virtual void OnOut(); +}; + diff --git a/WThreadPool.cpp b/WThreadPool.cpp new file mode 100644 index 0000000..cf4d997 --- /dev/null +++ b/WThreadPool.cpp @@ -0,0 +1,267 @@ +#include "WThreadPool.h" + +using namespace std; + +shared_ptr WThreadPool::s_threadPool; +std::mutex WThreadPool::s_globleMutex; + +WThreadPool::WThreadPool() +{ + _mgrThread = make_shared(&WThreadPool::managerThread, this); +} + +WThreadPool::~WThreadPool() +{ + stop(); +} + +WThreadPool *WThreadPool::globalInstance() +{ + if (!s_threadPool.get()) + { + unique_lock locker(s_globleMutex); + if (!s_threadPool.get()) + { + s_threadPool = make_shared(); + } + } + return s_threadPool.get(); +} + +void WThreadPool::setMaxThreadNum(int maxNum) +{ + if (maxNum > WPOOL_MAX_THREAD_NUM) + { + maxNum = WPOOL_MAX_THREAD_NUM; + } + else if (maxNum < WPOOL_MIN_THREAD_NUM) + { + maxNum = WPOOL_MIN_THREAD_NUM; + } + _maxThreadNum = maxNum; +} + +bool WThreadPool::waitForDone(int waitMs) +{ + int waitedMs = 0; + while(_busyThreadNum != 0 || !_eventQueue.empty()) + { + this_thread::sleep_for(chrono::milliseconds(1)); + waitedMs++; + if (waitMs > 0 && waitedMs >= waitMs) + { + return false; + } + } + return true; +} + +void WThreadPool::enQueueEvent(EventFun fun) +{ + bool res = _eventQueue.enQueue(fun); + assert(res); +} + +EventFun WThreadPool::deQueueEvent() +{ + EventFun fun; + if (_eventQueue.deQueue(fun)) + { + return fun; + } + else + { + return nullptr; + } + return fun; +} + +void WThreadPool::run() +{ + { + unique_lock locker(_threadIsRunMutex); + _threadIsRunMap[this_thread::get_id()] = true; + } + while (!_exitAllFlag) + { + { + unique_lock locker(_workMutex); + if (_eventQueue.empty() && !_exitAllFlag) + { + _workCondVar.wait(locker); + } + + if (_reduceThreadNum > 0) + { + _reduceThreadNum--; + break; + } + } + + _busyThreadNum++; + while (!_exitAllFlag) + { + EventFun fun = deQueueEvent(); + if (!fun) + { + break; + } + fun(); + } + _busyThreadNum--; + } + + { + unique_lock locker(_threadIsRunMutex); + _threadIsRunMap[this_thread::get_id()] = false; + } +} + +void WThreadPool::stop() +{ + _exitAllFlag = true; + { + unique_lock locker(_mgrMutex); + _mgrCondVar.notify_all(); + } + + if (_mgrThread->joinable()) + { + _mgrThread->join(); + } +} + +void WThreadPool::managerThread() +{ + startWorkThread(); + while (!_exitAllFlag) + { + { + unique_lock locker(_mgrMutex); + auto now = std::chrono::system_clock::now(); + + // if the number of threads reaches the maximum or the number of idle threads is enough to + // complete the task, sleep will be started + if (((int)_workThreadList.size() >= _maxThreadNum || + _eventQueue.size() < ((int)_workThreadList.size() - _busyThreadNum - ADD_THREAD_BOUNDARY)) && !_exitAllFlag) + { + _mgrCondVar.wait_until(locker, now + chrono::seconds(WPOOL_MANAGE_SECONDS)); + } + } + if (_exitAllFlag) + { + break; + } + + adjustWorkThread(); + // WThreadPool_log("get here to show work thread num:%d", _workThreadList.size()); + } + stopWorkThread(); +} + +void WThreadPool::startWorkThread() +{ + for (int i = 0; i < _minThreadNum; i++) + { + shared_ptr threadPtr = make_shared(&WThreadPool::run, this); + _workThreadList.emplace_back(threadPtr); + } +} + +void WThreadPool::stopWorkThread() +{ + { + unique_lock locker(_mgrMutex); + _workCondVar.notify_all(); + } + for (auto it = _workThreadList.begin(); it != _workThreadList.end(); it++) + { + if ((*it)->joinable()) + { + (*it)->join(); + } + } + _workThreadList.clear(); + _threadIsRunMap.clear(); + _eventQueue.clear(); +} + +void WThreadPool::adjustWorkThread() +{ + int queueSize = _eventQueue.size(); + int busyThreadNum = _busyThreadNum; + int liveThreadNum = _workThreadList.size(); + int maxThreadNum = _maxThreadNum; + int stepThreadNum = _stepThreadNum; + int minThreadNum = _minThreadNum; + + // if rest thread can not run all task concurrently, add the thread + if ((liveThreadNum < maxThreadNum) && (queueSize >= (liveThreadNum - busyThreadNum - ADD_THREAD_BOUNDARY))) + { + int restAllAddNum = maxThreadNum - liveThreadNum; + int addThreadNum = restAllAddNum > stepThreadNum ? stepThreadNum : restAllAddNum; + for (int i = 0; i < addThreadNum; i++) + { + shared_ptr threadPtr = make_shared(&WThreadPool::run, this); + _workThreadList.emplace_back(threadPtr); + } + } + else if ((liveThreadNum > minThreadNum) && (busyThreadNum*2 < liveThreadNum)) + { + int resAllReduceNum = liveThreadNum - minThreadNum; + int reduceThreadNum = resAllReduceNum > stepThreadNum ? stepThreadNum : resAllReduceNum; + _reduceThreadNum = reduceThreadNum; + int findExitThreadNum = 0; + do + { + if (_exitAllFlag) + { + return; + } + + for (int i = 0; i < (reduceThreadNum - findExitThreadNum); i++) + { + _workCondVar.notify_one(); + } + + this_thread::sleep_for(chrono::milliseconds(1)); + { + unique_lock locker(_threadIsRunMutex); + for (auto it = _workThreadList.begin(); it != _workThreadList.end();) + { + std::thread::id threadId = (*it)->get_id(); + auto threadIdIt = _threadIsRunMap.find(threadId); + if ((threadIdIt != _threadIsRunMap.end()) && (_threadIsRunMap[threadId] == false)) + { + findExitThreadNum++; + _threadIsRunMap.erase(threadIdIt); + (*it)->join(); + _workThreadList.erase(it++); + } + else + { + it++; + } + } + } + + if (findExitThreadNum < reduceThreadNum) + { + this_thread::sleep_for(chrono::milliseconds(1)); + } + + /* + WThreadPool_log("get here 3 to show findExitThreadNum:%d, reduceThreadNum:%d, _reduceThreadNum:%d", findExitThreadNum, reduceThreadNum, (int)_reduceThreadNum); + for (auto it = _workThreadList.begin(); it != _workThreadList.end(); it++) + { + WThreadPool_log("work thread pid:%lld", (*it)->get_id()); + } + for (auto it = _threadIsRunMap.begin(); it != _threadIsRunMap.end(); it++) + { + WThreadPool_log("it->first:%lld, it->second:%d", it->first, it->second); + } + */ + + } while(!(findExitThreadNum >= reduceThreadNum && _reduceThreadNum <= 0)); + } +} diff --git a/WThreadPool.h b/WThreadPool.h new file mode 100644 index 0000000..1ff41fc --- /dev/null +++ b/WThreadPool.h @@ -0,0 +1,90 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "LockQueue.hpp" +#include + +#define WThreadPool_log(fmt, ...) {printf(fmt, ##__VA_ARGS__);printf("\n");fflush(stdout);} + +#define WPOOL_MIN_THREAD_NUM 4 +#define WPOOL_MAX_THREAD_NUM 256 +#define WPOOL_MANAGE_SECONDS 20 +#define ADD_THREAD_BOUNDARY 1 + +using EventFun = std::function; +using int64 = long long int; + +class WThreadPool +{ +public: + WThreadPool(); + virtual ~WThreadPool(); + + static WThreadPool * globalInstance(); + + void setMaxThreadNum(int maxNum); + bool waitForDone(int waitMs = -1); + + template + void concurrentRun(Func func, Arguments... args) { + EventFun queunFun = std::bind(func, args...); + enQueueEvent(queunFun); + if (((int)_workThreadList.size() < _maxThreadNum) && + (_eventQueue.size() >= ((int)_workThreadList.size() - _busyThreadNum - ADD_THREAD_BOUNDARY))) + { + _mgrCondVar.notify_one(); + } + _workCondVar.notify_one(); + } + + template static int64_t threadIdToint64(T threadId) + { + std::string stid; + stid.resize(32); + snprintf((char *)stid.c_str(), 32, "%lld", threadId); + long long int tid = std::stoll(stid); + return tid; + } + +private: + int _minThreadNum = WPOOL_MIN_THREAD_NUM; + int _maxThreadNum = 8; + std::atomic _busyThreadNum = {0}; + int _stepThreadNum = 4; + volatile bool _exitAllFlag = false; + std::atomic _reduceThreadNum = {0}; + + std::shared_ptr _mgrThread; + LockQueue _eventQueue; + std::list> _workThreadList; + + std::mutex _threadIsRunMutex; + std::map _threadIsRunMap; + + std::condition_variable _workCondVar; + std::mutex _workMutex; + std::condition_variable _mgrCondVar; + std::mutex _mgrMutex; + + static std::shared_ptr s_threadPool; + static std::mutex s_globleMutex; + + void enQueueEvent(EventFun fun); + EventFun deQueueEvent(); + void run(); + void managerThread(); + void stop(); + void startWorkThread(); + void stopWorkThread(); + void adjustWorkThread(); +}; + diff --git a/Yosin_Game.aps b/Yosin_Game.aps new file mode 100644 index 0000000..f62951f Binary files /dev/null and b/Yosin_Game.aps differ diff --git a/Yosin_Game.sln b/Yosin_Game.sln new file mode 100644 index 0000000..541e345 --- /dev/null +++ b/Yosin_Game.sln @@ -0,0 +1,187 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.4.33122.133 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Yosin_Game", "Yosin_Game.vcxproj", "{26A5FEB5-A40D-4902-845C-2CB0635445CC}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "kiwano", "H:\kiwano\projects\kiwano\kiwano.vcxproj", "{FF7F943D-A89C-4E6C-97CF-84F7D8FF8EDF}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "kiwano-audio", "H:\kiwano\projects\kiwano-audio\kiwano-audio.vcxproj", "{1B97937D-8184-426C-BE71-29A163DC76C9}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "squirrel", "H:\squirrel_3_2_stable\squirrel3\squirrel\build\squirrel.vcxproj", "{35FBC183-03D6-307A-B4D7-3798A85056CD}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sqstdlib", "H:\squirrel_3_2_stable\squirrel3\sqstdlib\build\sqstdlib.vcxproj", "{9F91073D-8955-376C-ACFA-90271B243628}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sqstdlib_static", "H:\squirrel_3_2_stable\squirrel3\sqstdlib\build\sqstdlib_static.vcxproj", "{9FDC0714-6D07-3637-88C1-10E3A32F5458}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "squirrel_static", "H:\squirrel_3_2_stable\squirrel3\squirrel\build\squirrel_static.vcxproj", "{22BF092A-60A8-3196-B83B-4F16BA095260}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libogg", "H:\kiwano\projects\3rd-party\libogg\libogg.vcxproj", "{D8A5E8EC-3983-4028-9BA9-B1E337E75917}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libvorbis", "H:\kiwano\projects\3rd-party\vorbis\libvorbis.vcxproj", "{B62E3DE6-812D-4CE6-90D9-18FD4FEA8EB2}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + MinSizeRel|x64 = MinSizeRel|x64 + MinSizeRel|x86 = MinSizeRel|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + RelWithDebInfo|x64 = RelWithDebInfo|x64 + RelWithDebInfo|x86 = RelWithDebInfo|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {26A5FEB5-A40D-4902-845C-2CB0635445CC}.Debug|x64.ActiveCfg = Debug|x64 + {26A5FEB5-A40D-4902-845C-2CB0635445CC}.Debug|x64.Build.0 = Debug|x64 + {26A5FEB5-A40D-4902-845C-2CB0635445CC}.Debug|x86.ActiveCfg = Debug|Win32 + {26A5FEB5-A40D-4902-845C-2CB0635445CC}.Debug|x86.Build.0 = Debug|Win32 + {26A5FEB5-A40D-4902-845C-2CB0635445CC}.MinSizeRel|x64.ActiveCfg = Release|x64 + {26A5FEB5-A40D-4902-845C-2CB0635445CC}.MinSizeRel|x64.Build.0 = Release|x64 + {26A5FEB5-A40D-4902-845C-2CB0635445CC}.MinSizeRel|x86.ActiveCfg = Release|Win32 + {26A5FEB5-A40D-4902-845C-2CB0635445CC}.MinSizeRel|x86.Build.0 = Release|Win32 + {26A5FEB5-A40D-4902-845C-2CB0635445CC}.Release|x64.ActiveCfg = Release|x64 + {26A5FEB5-A40D-4902-845C-2CB0635445CC}.Release|x64.Build.0 = Release|x64 + {26A5FEB5-A40D-4902-845C-2CB0635445CC}.Release|x86.ActiveCfg = Release|Win32 + {26A5FEB5-A40D-4902-845C-2CB0635445CC}.Release|x86.Build.0 = Release|Win32 + {26A5FEB5-A40D-4902-845C-2CB0635445CC}.RelWithDebInfo|x64.ActiveCfg = Release|x64 + {26A5FEB5-A40D-4902-845C-2CB0635445CC}.RelWithDebInfo|x64.Build.0 = Release|x64 + {26A5FEB5-A40D-4902-845C-2CB0635445CC}.RelWithDebInfo|x86.ActiveCfg = Release|Win32 + {26A5FEB5-A40D-4902-845C-2CB0635445CC}.RelWithDebInfo|x86.Build.0 = Release|Win32 + {FF7F943D-A89C-4E6C-97CF-84F7D8FF8EDF}.Debug|x64.ActiveCfg = Debug|x64 + {FF7F943D-A89C-4E6C-97CF-84F7D8FF8EDF}.Debug|x64.Build.0 = Debug|x64 + {FF7F943D-A89C-4E6C-97CF-84F7D8FF8EDF}.Debug|x86.ActiveCfg = Debug|Win32 + {FF7F943D-A89C-4E6C-97CF-84F7D8FF8EDF}.Debug|x86.Build.0 = Debug|Win32 + {FF7F943D-A89C-4E6C-97CF-84F7D8FF8EDF}.MinSizeRel|x64.ActiveCfg = Release|x64 + {FF7F943D-A89C-4E6C-97CF-84F7D8FF8EDF}.MinSizeRel|x64.Build.0 = Release|x64 + {FF7F943D-A89C-4E6C-97CF-84F7D8FF8EDF}.MinSizeRel|x86.ActiveCfg = Release|Win32 + {FF7F943D-A89C-4E6C-97CF-84F7D8FF8EDF}.MinSizeRel|x86.Build.0 = Release|Win32 + {FF7F943D-A89C-4E6C-97CF-84F7D8FF8EDF}.Release|x64.ActiveCfg = Release|x64 + {FF7F943D-A89C-4E6C-97CF-84F7D8FF8EDF}.Release|x64.Build.0 = Release|x64 + {FF7F943D-A89C-4E6C-97CF-84F7D8FF8EDF}.Release|x86.ActiveCfg = Release|Win32 + {FF7F943D-A89C-4E6C-97CF-84F7D8FF8EDF}.Release|x86.Build.0 = Release|Win32 + {FF7F943D-A89C-4E6C-97CF-84F7D8FF8EDF}.RelWithDebInfo|x64.ActiveCfg = Release|x64 + {FF7F943D-A89C-4E6C-97CF-84F7D8FF8EDF}.RelWithDebInfo|x64.Build.0 = Release|x64 + {FF7F943D-A89C-4E6C-97CF-84F7D8FF8EDF}.RelWithDebInfo|x86.ActiveCfg = Release|Win32 + {FF7F943D-A89C-4E6C-97CF-84F7D8FF8EDF}.RelWithDebInfo|x86.Build.0 = Release|Win32 + {1B97937D-8184-426C-BE71-29A163DC76C9}.Debug|x64.ActiveCfg = Debug|x64 + {1B97937D-8184-426C-BE71-29A163DC76C9}.Debug|x64.Build.0 = Debug|x64 + {1B97937D-8184-426C-BE71-29A163DC76C9}.Debug|x86.ActiveCfg = Debug|Win32 + {1B97937D-8184-426C-BE71-29A163DC76C9}.Debug|x86.Build.0 = Debug|Win32 + {1B97937D-8184-426C-BE71-29A163DC76C9}.MinSizeRel|x64.ActiveCfg = Release|x64 + {1B97937D-8184-426C-BE71-29A163DC76C9}.MinSizeRel|x64.Build.0 = Release|x64 + {1B97937D-8184-426C-BE71-29A163DC76C9}.MinSizeRel|x86.ActiveCfg = Release|Win32 + {1B97937D-8184-426C-BE71-29A163DC76C9}.MinSizeRel|x86.Build.0 = Release|Win32 + {1B97937D-8184-426C-BE71-29A163DC76C9}.Release|x64.ActiveCfg = Release|x64 + {1B97937D-8184-426C-BE71-29A163DC76C9}.Release|x64.Build.0 = Release|x64 + {1B97937D-8184-426C-BE71-29A163DC76C9}.Release|x86.ActiveCfg = Release|Win32 + {1B97937D-8184-426C-BE71-29A163DC76C9}.Release|x86.Build.0 = Release|Win32 + {1B97937D-8184-426C-BE71-29A163DC76C9}.RelWithDebInfo|x64.ActiveCfg = Release|x64 + {1B97937D-8184-426C-BE71-29A163DC76C9}.RelWithDebInfo|x64.Build.0 = Release|x64 + {1B97937D-8184-426C-BE71-29A163DC76C9}.RelWithDebInfo|x86.ActiveCfg = Release|Win32 + {1B97937D-8184-426C-BE71-29A163DC76C9}.RelWithDebInfo|x86.Build.0 = Release|Win32 + {35FBC183-03D6-307A-B4D7-3798A85056CD}.Debug|x64.ActiveCfg = Debug|x64 + {35FBC183-03D6-307A-B4D7-3798A85056CD}.Debug|x64.Build.0 = Debug|x64 + {35FBC183-03D6-307A-B4D7-3798A85056CD}.Debug|x86.ActiveCfg = Debug|x64 + {35FBC183-03D6-307A-B4D7-3798A85056CD}.Debug|x86.Build.0 = Debug|x64 + {35FBC183-03D6-307A-B4D7-3798A85056CD}.MinSizeRel|x64.ActiveCfg = MinSizeRel|x64 + {35FBC183-03D6-307A-B4D7-3798A85056CD}.MinSizeRel|x64.Build.0 = MinSizeRel|x64 + {35FBC183-03D6-307A-B4D7-3798A85056CD}.MinSizeRel|x86.ActiveCfg = MinSizeRel|x64 + {35FBC183-03D6-307A-B4D7-3798A85056CD}.MinSizeRel|x86.Build.0 = MinSizeRel|x64 + {35FBC183-03D6-307A-B4D7-3798A85056CD}.Release|x64.ActiveCfg = Release|x64 + {35FBC183-03D6-307A-B4D7-3798A85056CD}.Release|x64.Build.0 = Release|x64 + {35FBC183-03D6-307A-B4D7-3798A85056CD}.Release|x86.ActiveCfg = Release|x64 + {35FBC183-03D6-307A-B4D7-3798A85056CD}.Release|x86.Build.0 = Release|x64 + {35FBC183-03D6-307A-B4D7-3798A85056CD}.RelWithDebInfo|x64.ActiveCfg = RelWithDebInfo|x64 + {35FBC183-03D6-307A-B4D7-3798A85056CD}.RelWithDebInfo|x64.Build.0 = RelWithDebInfo|x64 + {35FBC183-03D6-307A-B4D7-3798A85056CD}.RelWithDebInfo|x86.ActiveCfg = RelWithDebInfo|x64 + {35FBC183-03D6-307A-B4D7-3798A85056CD}.RelWithDebInfo|x86.Build.0 = RelWithDebInfo|x64 + {9F91073D-8955-376C-ACFA-90271B243628}.Debug|x64.ActiveCfg = Debug|x64 + {9F91073D-8955-376C-ACFA-90271B243628}.Debug|x64.Build.0 = Debug|x64 + {9F91073D-8955-376C-ACFA-90271B243628}.Debug|x86.ActiveCfg = Debug|x64 + {9F91073D-8955-376C-ACFA-90271B243628}.Debug|x86.Build.0 = Debug|x64 + {9F91073D-8955-376C-ACFA-90271B243628}.MinSizeRel|x64.ActiveCfg = MinSizeRel|x64 + {9F91073D-8955-376C-ACFA-90271B243628}.MinSizeRel|x64.Build.0 = MinSizeRel|x64 + {9F91073D-8955-376C-ACFA-90271B243628}.MinSizeRel|x86.ActiveCfg = MinSizeRel|x64 + {9F91073D-8955-376C-ACFA-90271B243628}.MinSizeRel|x86.Build.0 = MinSizeRel|x64 + {9F91073D-8955-376C-ACFA-90271B243628}.Release|x64.ActiveCfg = Release|x64 + {9F91073D-8955-376C-ACFA-90271B243628}.Release|x64.Build.0 = Release|x64 + {9F91073D-8955-376C-ACFA-90271B243628}.Release|x86.ActiveCfg = Release|x64 + {9F91073D-8955-376C-ACFA-90271B243628}.Release|x86.Build.0 = Release|x64 + {9F91073D-8955-376C-ACFA-90271B243628}.RelWithDebInfo|x64.ActiveCfg = RelWithDebInfo|x64 + {9F91073D-8955-376C-ACFA-90271B243628}.RelWithDebInfo|x64.Build.0 = RelWithDebInfo|x64 + {9F91073D-8955-376C-ACFA-90271B243628}.RelWithDebInfo|x86.ActiveCfg = RelWithDebInfo|x64 + {9F91073D-8955-376C-ACFA-90271B243628}.RelWithDebInfo|x86.Build.0 = RelWithDebInfo|x64 + {9FDC0714-6D07-3637-88C1-10E3A32F5458}.Debug|x64.ActiveCfg = Debug|x64 + {9FDC0714-6D07-3637-88C1-10E3A32F5458}.Debug|x64.Build.0 = Debug|x64 + {9FDC0714-6D07-3637-88C1-10E3A32F5458}.Debug|x86.ActiveCfg = Debug|x64 + {9FDC0714-6D07-3637-88C1-10E3A32F5458}.Debug|x86.Build.0 = Debug|x64 + {9FDC0714-6D07-3637-88C1-10E3A32F5458}.MinSizeRel|x64.ActiveCfg = MinSizeRel|x64 + {9FDC0714-6D07-3637-88C1-10E3A32F5458}.MinSizeRel|x64.Build.0 = MinSizeRel|x64 + {9FDC0714-6D07-3637-88C1-10E3A32F5458}.MinSizeRel|x86.ActiveCfg = MinSizeRel|x64 + {9FDC0714-6D07-3637-88C1-10E3A32F5458}.MinSizeRel|x86.Build.0 = MinSizeRel|x64 + {9FDC0714-6D07-3637-88C1-10E3A32F5458}.Release|x64.ActiveCfg = Release|x64 + {9FDC0714-6D07-3637-88C1-10E3A32F5458}.Release|x64.Build.0 = Release|x64 + {9FDC0714-6D07-3637-88C1-10E3A32F5458}.Release|x86.ActiveCfg = Release|x64 + {9FDC0714-6D07-3637-88C1-10E3A32F5458}.Release|x86.Build.0 = Release|x64 + {9FDC0714-6D07-3637-88C1-10E3A32F5458}.RelWithDebInfo|x64.ActiveCfg = RelWithDebInfo|x64 + {9FDC0714-6D07-3637-88C1-10E3A32F5458}.RelWithDebInfo|x64.Build.0 = RelWithDebInfo|x64 + {9FDC0714-6D07-3637-88C1-10E3A32F5458}.RelWithDebInfo|x86.ActiveCfg = RelWithDebInfo|x64 + {9FDC0714-6D07-3637-88C1-10E3A32F5458}.RelWithDebInfo|x86.Build.0 = RelWithDebInfo|x64 + {22BF092A-60A8-3196-B83B-4F16BA095260}.Debug|x64.ActiveCfg = Debug|x64 + {22BF092A-60A8-3196-B83B-4F16BA095260}.Debug|x64.Build.0 = Debug|x64 + {22BF092A-60A8-3196-B83B-4F16BA095260}.Debug|x86.ActiveCfg = Debug|x64 + {22BF092A-60A8-3196-B83B-4F16BA095260}.Debug|x86.Build.0 = Debug|x64 + {22BF092A-60A8-3196-B83B-4F16BA095260}.MinSizeRel|x64.ActiveCfg = MinSizeRel|x64 + {22BF092A-60A8-3196-B83B-4F16BA095260}.MinSizeRel|x64.Build.0 = MinSizeRel|x64 + {22BF092A-60A8-3196-B83B-4F16BA095260}.MinSizeRel|x86.ActiveCfg = MinSizeRel|x64 + {22BF092A-60A8-3196-B83B-4F16BA095260}.MinSizeRel|x86.Build.0 = MinSizeRel|x64 + {22BF092A-60A8-3196-B83B-4F16BA095260}.Release|x64.ActiveCfg = Release|x64 + {22BF092A-60A8-3196-B83B-4F16BA095260}.Release|x64.Build.0 = Release|x64 + {22BF092A-60A8-3196-B83B-4F16BA095260}.Release|x86.ActiveCfg = Release|x64 + {22BF092A-60A8-3196-B83B-4F16BA095260}.Release|x86.Build.0 = Release|x64 + {22BF092A-60A8-3196-B83B-4F16BA095260}.RelWithDebInfo|x64.ActiveCfg = RelWithDebInfo|x64 + {22BF092A-60A8-3196-B83B-4F16BA095260}.RelWithDebInfo|x64.Build.0 = RelWithDebInfo|x64 + {22BF092A-60A8-3196-B83B-4F16BA095260}.RelWithDebInfo|x86.ActiveCfg = RelWithDebInfo|x64 + {22BF092A-60A8-3196-B83B-4F16BA095260}.RelWithDebInfo|x86.Build.0 = RelWithDebInfo|x64 + {D8A5E8EC-3983-4028-9BA9-B1E337E75917}.Debug|x64.ActiveCfg = Debug|x64 + {D8A5E8EC-3983-4028-9BA9-B1E337E75917}.Debug|x64.Build.0 = Debug|x64 + {D8A5E8EC-3983-4028-9BA9-B1E337E75917}.Debug|x86.ActiveCfg = Debug|Win32 + {D8A5E8EC-3983-4028-9BA9-B1E337E75917}.Debug|x86.Build.0 = Debug|Win32 + {D8A5E8EC-3983-4028-9BA9-B1E337E75917}.MinSizeRel|x64.ActiveCfg = Debug|x64 + {D8A5E8EC-3983-4028-9BA9-B1E337E75917}.MinSizeRel|x64.Build.0 = Debug|x64 + {D8A5E8EC-3983-4028-9BA9-B1E337E75917}.MinSizeRel|x86.ActiveCfg = Debug|Win32 + {D8A5E8EC-3983-4028-9BA9-B1E337E75917}.MinSizeRel|x86.Build.0 = Debug|Win32 + {D8A5E8EC-3983-4028-9BA9-B1E337E75917}.Release|x64.ActiveCfg = Release|x64 + {D8A5E8EC-3983-4028-9BA9-B1E337E75917}.Release|x64.Build.0 = Release|x64 + {D8A5E8EC-3983-4028-9BA9-B1E337E75917}.Release|x86.ActiveCfg = Release|Win32 + {D8A5E8EC-3983-4028-9BA9-B1E337E75917}.Release|x86.Build.0 = Release|Win32 + {D8A5E8EC-3983-4028-9BA9-B1E337E75917}.RelWithDebInfo|x64.ActiveCfg = Release|x64 + {D8A5E8EC-3983-4028-9BA9-B1E337E75917}.RelWithDebInfo|x64.Build.0 = Release|x64 + {D8A5E8EC-3983-4028-9BA9-B1E337E75917}.RelWithDebInfo|x86.ActiveCfg = Release|Win32 + {D8A5E8EC-3983-4028-9BA9-B1E337E75917}.RelWithDebInfo|x86.Build.0 = Release|Win32 + {B62E3DE6-812D-4CE6-90D9-18FD4FEA8EB2}.Debug|x64.ActiveCfg = Debug|x64 + {B62E3DE6-812D-4CE6-90D9-18FD4FEA8EB2}.Debug|x64.Build.0 = Debug|x64 + {B62E3DE6-812D-4CE6-90D9-18FD4FEA8EB2}.Debug|x86.ActiveCfg = Debug|Win32 + {B62E3DE6-812D-4CE6-90D9-18FD4FEA8EB2}.Debug|x86.Build.0 = Debug|Win32 + {B62E3DE6-812D-4CE6-90D9-18FD4FEA8EB2}.MinSizeRel|x64.ActiveCfg = Debug|x64 + {B62E3DE6-812D-4CE6-90D9-18FD4FEA8EB2}.MinSizeRel|x64.Build.0 = Debug|x64 + {B62E3DE6-812D-4CE6-90D9-18FD4FEA8EB2}.MinSizeRel|x86.ActiveCfg = Debug|Win32 + {B62E3DE6-812D-4CE6-90D9-18FD4FEA8EB2}.MinSizeRel|x86.Build.0 = Debug|Win32 + {B62E3DE6-812D-4CE6-90D9-18FD4FEA8EB2}.Release|x64.ActiveCfg = Release|x64 + {B62E3DE6-812D-4CE6-90D9-18FD4FEA8EB2}.Release|x64.Build.0 = Release|x64 + {B62E3DE6-812D-4CE6-90D9-18FD4FEA8EB2}.Release|x86.ActiveCfg = Release|Win32 + {B62E3DE6-812D-4CE6-90D9-18FD4FEA8EB2}.Release|x86.Build.0 = Release|Win32 + {B62E3DE6-812D-4CE6-90D9-18FD4FEA8EB2}.RelWithDebInfo|x64.ActiveCfg = Release|x64 + {B62E3DE6-812D-4CE6-90D9-18FD4FEA8EB2}.RelWithDebInfo|x64.Build.0 = Release|x64 + {B62E3DE6-812D-4CE6-90D9-18FD4FEA8EB2}.RelWithDebInfo|x86.ActiveCfg = Release|Win32 + {B62E3DE6-812D-4CE6-90D9-18FD4FEA8EB2}.RelWithDebInfo|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {C4FDA2BA-AA6C-49FB-93F6-471AC5BE927A} + EndGlobalSection +EndGlobal diff --git a/Yosin_Game.vcxproj b/Yosin_Game.vcxproj new file mode 100644 index 0000000..4b45aa1 --- /dev/null +++ b/Yosin_Game.vcxproj @@ -0,0 +1,205 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 16.0 + Win32Proj + {26a5feb5-a40d-4902-845c-2cb0635445cc} + YosinGame + 10.0 + + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + + + + + + + + + + + + + + + + + + + I:\Yosin_Game\Yosin_Game\include;$(IncludePath) + I:\YosinGame\ + $(LibraryPath) + $(ReferencePath) + + + + Level3 + true + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + Level3 + true + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + TurnOffAllWarnings + true + true + true + NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;NOMINMAX;_SQ64;SQUNICODE;%(PreprocessorDefinitions) + true + H:\kiwano\src;H:\kiwano\src\3rd-party;%(AdditionalIncludeDirectories) + + + Console + true + true + true + sqstdlib.lib;squirrel.lib;%(AdditionalDependencies) + I:\Yosin_Game\Yosin_Game\lib + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {d8a5e8ec-3983-4028-9ba9-b1e337e75917} + + + {1b97937d-8184-426c-be71-29a163dc76c9} + + + {ff7f943d-a89c-4e6c-97cf-84f7d8ff8edf} + + + + + + + + + 这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。 + + + + \ No newline at end of file diff --git a/Yosin_Game.vcxproj.filters b/Yosin_Game.vcxproj.filters new file mode 100644 index 0000000..c8b8b4a --- /dev/null +++ b/Yosin_Game.vcxproj.filters @@ -0,0 +1,159 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + {0d071ac7-fac4-49ac-8710-9e288f776542} + + + {d1c0efa4-8635-4763-8881-888e78127822} + + + {d55ea374-ebc7-4345-8e15-dfb18c8dc856} + + + {7c17ea16-1631-4176-a371-194092bc82e3} + + + {8eaaa8e3-81bc-4b00-89f4-1c716f5639fa} + + + {53dcb392-061b-469f-957c-4af7c786f9dc} + + + + + 源文件 + + + 源文件\BaseToolClass + + + 源文件\BaseToolClass + + + 源文件 + + + 源文件 + + + 源文件\SquirrelActorClass + + + 源文件\BaseToolClass + + + 源文件\BaseToolClass + + + 源文件\BaseToolClass + + + 源文件\BaseToolClass + + + 源文件 + + + 源文件\SquirrelActorClass + + + 源文件\SquirrelActorClass + + + 源文件\SquirrelActorClass + + + 源文件\SquirrelActorClass + + + + + 头文件\BaseToolClass + + + 头文件\BaseToolClass + + + 头文件 + + + 头文件 + + + 头文件\SquirrelActorClass + + + 头文件\BaseToolClass + + + 头文件\BaseToolClass + + + 头文件\BaseToolClass + + + 头文件\BaseToolClass + + + 头文件\SquirrelRegister + + + 头文件\SquirrelRegister + + + 头文件\SquirrelRegister + + + 头文件\SquirrelRegister + + + 头文件\SquirrelRegister + + + 头文件\SquirrelRegister + + + 头文件\SquirrelRegister + + + 头文件 + + + 头文件 + + + 头文件 + + + 头文件\SquirrelRegister + + + 头文件\SquirrelActorClass + + + 头文件\SquirrelActorClass + + + 头文件\SquirrelActorClass + + + 头文件\SquirrelActorClass + + + + + + \ No newline at end of file diff --git a/Yosin_Game.vcxproj.user b/Yosin_Game.vcxproj.user new file mode 100644 index 0000000..3eb7802 --- /dev/null +++ b/Yosin_Game.vcxproj.user @@ -0,0 +1,7 @@ + + + + I:\YosinGame + WindowsLocalDebugger + + \ No newline at end of file diff --git a/imgui.ini b/imgui.ini new file mode 100644 index 0000000..a54c042 --- /dev/null +++ b/imgui.ini @@ -0,0 +1,10 @@ +[Window][Debug##Default] +Pos=60,60 +Size=400,400 +Collapsed=0 + +[Window][测试窗口] +Pos=398,335 +Size=54,120 +Collapsed=0 + diff --git a/include/json.hpp b/include/json.hpp new file mode 100644 index 0000000..4d1a37a --- /dev/null +++ b/include/json.hpp @@ -0,0 +1,24596 @@ +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.2 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann +// SPDX-License-Identifier: MIT + +/****************************************************************************\ + * Note on documentation: The source files contain links to the online * + * documentation of the public API at https://json.nlohmann.me. This URL * + * contains the most recent documentation and should also be applicable to * + * previous versions; documentation for deprecated functions is not * + * removed, but marked deprecated. See "Generate documentation" section in * + * file docs/README.md. * +\****************************************************************************/ + +#ifndef INCLUDE_NLOHMANN_JSON_HPP_ +#define INCLUDE_NLOHMANN_JSON_HPP_ + +#include // all_of, find, for_each +#include // nullptr_t, ptrdiff_t, size_t +#include // hash, less +#include // initializer_list +#ifndef JSON_NO_IO + #include // istream, ostream +#endif // JSON_NO_IO +#include // random_access_iterator_tag +#include // unique_ptr +#include // accumulate +#include // string, stoi, to_string +#include // declval, forward, move, pair, swap +#include // vector + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.2 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +#include + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.2 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +// This file contains all macro definitions affecting or depending on the ABI + +#ifndef JSON_SKIP_LIBRARY_VERSION_CHECK + #if defined(NLOHMANN_JSON_VERSION_MAJOR) && defined(NLOHMANN_JSON_VERSION_MINOR) && defined(NLOHMANN_JSON_VERSION_PATCH) + #if NLOHMANN_JSON_VERSION_MAJOR != 3 || NLOHMANN_JSON_VERSION_MINOR != 11 || NLOHMANN_JSON_VERSION_PATCH != 2 + #warning "Already included a different version of the library!" + #endif + #endif +#endif + +#define NLOHMANN_JSON_VERSION_MAJOR 3 // NOLINT(modernize-macro-to-enum) +#define NLOHMANN_JSON_VERSION_MINOR 11 // NOLINT(modernize-macro-to-enum) +#define NLOHMANN_JSON_VERSION_PATCH 2 // NOLINT(modernize-macro-to-enum) + +#ifndef JSON_DIAGNOSTICS + #define JSON_DIAGNOSTICS 0 +#endif + +#ifndef JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON + #define JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON 0 +#endif + +#if JSON_DIAGNOSTICS + #define NLOHMANN_JSON_ABI_TAG_DIAGNOSTICS _diag +#else + #define NLOHMANN_JSON_ABI_TAG_DIAGNOSTICS +#endif + +#if JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON + #define NLOHMANN_JSON_ABI_TAG_LEGACY_DISCARDED_VALUE_COMPARISON _ldvcmp +#else + #define NLOHMANN_JSON_ABI_TAG_LEGACY_DISCARDED_VALUE_COMPARISON +#endif + +#ifndef NLOHMANN_JSON_NAMESPACE_NO_VERSION + #define NLOHMANN_JSON_NAMESPACE_NO_VERSION 0 +#endif + +// Construct the namespace ABI tags component +#define NLOHMANN_JSON_ABI_TAGS_CONCAT_EX(a, b) json_abi ## a ## b +#define NLOHMANN_JSON_ABI_TAGS_CONCAT(a, b) \ + NLOHMANN_JSON_ABI_TAGS_CONCAT_EX(a, b) + +#define NLOHMANN_JSON_ABI_TAGS \ + NLOHMANN_JSON_ABI_TAGS_CONCAT( \ + NLOHMANN_JSON_ABI_TAG_DIAGNOSTICS, \ + NLOHMANN_JSON_ABI_TAG_LEGACY_DISCARDED_VALUE_COMPARISON) + +// Construct the namespace version component +#define NLOHMANN_JSON_NAMESPACE_VERSION_CONCAT_EX(major, minor, patch) \ + _v ## major ## _ ## minor ## _ ## patch +#define NLOHMANN_JSON_NAMESPACE_VERSION_CONCAT(major, minor, patch) \ + NLOHMANN_JSON_NAMESPACE_VERSION_CONCAT_EX(major, minor, patch) + +#if NLOHMANN_JSON_NAMESPACE_NO_VERSION +#define NLOHMANN_JSON_NAMESPACE_VERSION +#else +#define NLOHMANN_JSON_NAMESPACE_VERSION \ + NLOHMANN_JSON_NAMESPACE_VERSION_CONCAT(NLOHMANN_JSON_VERSION_MAJOR, \ + NLOHMANN_JSON_VERSION_MINOR, \ + NLOHMANN_JSON_VERSION_PATCH) +#endif + +// Combine namespace components +#define NLOHMANN_JSON_NAMESPACE_CONCAT_EX(a, b) a ## b +#define NLOHMANN_JSON_NAMESPACE_CONCAT(a, b) \ + NLOHMANN_JSON_NAMESPACE_CONCAT_EX(a, b) + +#ifndef NLOHMANN_JSON_NAMESPACE +#define NLOHMANN_JSON_NAMESPACE \ + nlohmann::NLOHMANN_JSON_NAMESPACE_CONCAT( \ + NLOHMANN_JSON_ABI_TAGS, \ + NLOHMANN_JSON_NAMESPACE_VERSION) +#endif + +#ifndef NLOHMANN_JSON_NAMESPACE_BEGIN +#define NLOHMANN_JSON_NAMESPACE_BEGIN \ + namespace nlohmann \ + { \ + inline namespace NLOHMANN_JSON_NAMESPACE_CONCAT( \ + NLOHMANN_JSON_ABI_TAGS, \ + NLOHMANN_JSON_NAMESPACE_VERSION) \ + { +#endif + +#ifndef NLOHMANN_JSON_NAMESPACE_END +#define NLOHMANN_JSON_NAMESPACE_END \ + } /* namespace (inline namespace) NOLINT(readability/namespace) */ \ + } // namespace nlohmann +#endif + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.2 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +#include // transform +#include // array +#include // forward_list +#include // inserter, front_inserter, end +#include // map +#include // string +#include // tuple, make_tuple +#include // is_arithmetic, is_same, is_enum, underlying_type, is_convertible +#include // unordered_map +#include // pair, declval +#include // valarray + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.2 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +#include // nullptr_t +#include // exception +#include // runtime_error +#include // to_string +#include // vector + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.2 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +#include // array +#include // size_t +#include // uint8_t +#include // string + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.2 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +#include // declval, pair +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.2 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +#include + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.2 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +// #include + + +NLOHMANN_JSON_NAMESPACE_BEGIN +namespace detail +{ + +template struct make_void +{ + using type = void; +}; +template using void_t = typename make_void::type; + +} // namespace detail +NLOHMANN_JSON_NAMESPACE_END + + +NLOHMANN_JSON_NAMESPACE_BEGIN +namespace detail +{ + +// https://en.cppreference.com/w/cpp/experimental/is_detected +struct nonesuch +{ + nonesuch() = delete; + ~nonesuch() = delete; + nonesuch(nonesuch const&) = delete; + nonesuch(nonesuch const&&) = delete; + void operator=(nonesuch const&) = delete; + void operator=(nonesuch&&) = delete; +}; + +template class Op, + class... Args> +struct detector +{ + using value_t = std::false_type; + using type = Default; +}; + +template class Op, class... Args> +struct detector>, Op, Args...> +{ + using value_t = std::true_type; + using type = Op; +}; + +template class Op, class... Args> +using is_detected = typename detector::value_t; + +template class Op, class... Args> +struct is_detected_lazy : is_detected { }; + +template class Op, class... Args> +using detected_t = typename detector::type; + +template class Op, class... Args> +using detected_or = detector; + +template class Op, class... Args> +using detected_or_t = typename detected_or::type; + +template class Op, class... Args> +using is_detected_exact = std::is_same>; + +template class Op, class... Args> +using is_detected_convertible = + std::is_convertible, To>; + +} // namespace detail +NLOHMANN_JSON_NAMESPACE_END + +// #include + + +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.2 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann +// SPDX-FileCopyrightText: 2016-2021 Evan Nemerson +// SPDX-License-Identifier: MIT + +/* Hedley - https://nemequ.github.io/hedley + * Created by Evan Nemerson + */ + +#if !defined(JSON_HEDLEY_VERSION) || (JSON_HEDLEY_VERSION < 15) +#if defined(JSON_HEDLEY_VERSION) + #undef JSON_HEDLEY_VERSION +#endif +#define JSON_HEDLEY_VERSION 15 + +#if defined(JSON_HEDLEY_STRINGIFY_EX) + #undef JSON_HEDLEY_STRINGIFY_EX +#endif +#define JSON_HEDLEY_STRINGIFY_EX(x) #x + +#if defined(JSON_HEDLEY_STRINGIFY) + #undef JSON_HEDLEY_STRINGIFY +#endif +#define JSON_HEDLEY_STRINGIFY(x) JSON_HEDLEY_STRINGIFY_EX(x) + +#if defined(JSON_HEDLEY_CONCAT_EX) + #undef JSON_HEDLEY_CONCAT_EX +#endif +#define JSON_HEDLEY_CONCAT_EX(a,b) a##b + +#if defined(JSON_HEDLEY_CONCAT) + #undef JSON_HEDLEY_CONCAT +#endif +#define JSON_HEDLEY_CONCAT(a,b) JSON_HEDLEY_CONCAT_EX(a,b) + +#if defined(JSON_HEDLEY_CONCAT3_EX) + #undef JSON_HEDLEY_CONCAT3_EX +#endif +#define JSON_HEDLEY_CONCAT3_EX(a,b,c) a##b##c + +#if defined(JSON_HEDLEY_CONCAT3) + #undef JSON_HEDLEY_CONCAT3 +#endif +#define JSON_HEDLEY_CONCAT3(a,b,c) JSON_HEDLEY_CONCAT3_EX(a,b,c) + +#if defined(JSON_HEDLEY_VERSION_ENCODE) + #undef JSON_HEDLEY_VERSION_ENCODE +#endif +#define JSON_HEDLEY_VERSION_ENCODE(major,minor,revision) (((major) * 1000000) + ((minor) * 1000) + (revision)) + +#if defined(JSON_HEDLEY_VERSION_DECODE_MAJOR) + #undef JSON_HEDLEY_VERSION_DECODE_MAJOR +#endif +#define JSON_HEDLEY_VERSION_DECODE_MAJOR(version) ((version) / 1000000) + +#if defined(JSON_HEDLEY_VERSION_DECODE_MINOR) + #undef JSON_HEDLEY_VERSION_DECODE_MINOR +#endif +#define JSON_HEDLEY_VERSION_DECODE_MINOR(version) (((version) % 1000000) / 1000) + +#if defined(JSON_HEDLEY_VERSION_DECODE_REVISION) + #undef JSON_HEDLEY_VERSION_DECODE_REVISION +#endif +#define JSON_HEDLEY_VERSION_DECODE_REVISION(version) ((version) % 1000) + +#if defined(JSON_HEDLEY_GNUC_VERSION) + #undef JSON_HEDLEY_GNUC_VERSION +#endif +#if defined(__GNUC__) && defined(__GNUC_PATCHLEVEL__) + #define JSON_HEDLEY_GNUC_VERSION JSON_HEDLEY_VERSION_ENCODE(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__) +#elif defined(__GNUC__) + #define JSON_HEDLEY_GNUC_VERSION JSON_HEDLEY_VERSION_ENCODE(__GNUC__, __GNUC_MINOR__, 0) +#endif + +#if defined(JSON_HEDLEY_GNUC_VERSION_CHECK) + #undef JSON_HEDLEY_GNUC_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_GNUC_VERSION) + #define JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_GNUC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_MSVC_VERSION) + #undef JSON_HEDLEY_MSVC_VERSION +#endif +#if defined(_MSC_FULL_VER) && (_MSC_FULL_VER >= 140000000) && !defined(__ICL) + #define JSON_HEDLEY_MSVC_VERSION JSON_HEDLEY_VERSION_ENCODE(_MSC_FULL_VER / 10000000, (_MSC_FULL_VER % 10000000) / 100000, (_MSC_FULL_VER % 100000) / 100) +#elif defined(_MSC_FULL_VER) && !defined(__ICL) + #define JSON_HEDLEY_MSVC_VERSION JSON_HEDLEY_VERSION_ENCODE(_MSC_FULL_VER / 1000000, (_MSC_FULL_VER % 1000000) / 10000, (_MSC_FULL_VER % 10000) / 10) +#elif defined(_MSC_VER) && !defined(__ICL) + #define JSON_HEDLEY_MSVC_VERSION JSON_HEDLEY_VERSION_ENCODE(_MSC_VER / 100, _MSC_VER % 100, 0) +#endif + +#if defined(JSON_HEDLEY_MSVC_VERSION_CHECK) + #undef JSON_HEDLEY_MSVC_VERSION_CHECK +#endif +#if !defined(JSON_HEDLEY_MSVC_VERSION) + #define JSON_HEDLEY_MSVC_VERSION_CHECK(major,minor,patch) (0) +#elif defined(_MSC_VER) && (_MSC_VER >= 1400) + #define JSON_HEDLEY_MSVC_VERSION_CHECK(major,minor,patch) (_MSC_FULL_VER >= ((major * 10000000) + (minor * 100000) + (patch))) +#elif defined(_MSC_VER) && (_MSC_VER >= 1200) + #define JSON_HEDLEY_MSVC_VERSION_CHECK(major,minor,patch) (_MSC_FULL_VER >= ((major * 1000000) + (minor * 10000) + (patch))) +#else + #define JSON_HEDLEY_MSVC_VERSION_CHECK(major,minor,patch) (_MSC_VER >= ((major * 100) + (minor))) +#endif + +#if defined(JSON_HEDLEY_INTEL_VERSION) + #undef JSON_HEDLEY_INTEL_VERSION +#endif +#if defined(__INTEL_COMPILER) && defined(__INTEL_COMPILER_UPDATE) && !defined(__ICL) + #define JSON_HEDLEY_INTEL_VERSION JSON_HEDLEY_VERSION_ENCODE(__INTEL_COMPILER / 100, __INTEL_COMPILER % 100, __INTEL_COMPILER_UPDATE) +#elif defined(__INTEL_COMPILER) && !defined(__ICL) + #define JSON_HEDLEY_INTEL_VERSION JSON_HEDLEY_VERSION_ENCODE(__INTEL_COMPILER / 100, __INTEL_COMPILER % 100, 0) +#endif + +#if defined(JSON_HEDLEY_INTEL_VERSION_CHECK) + #undef JSON_HEDLEY_INTEL_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_INTEL_VERSION) + #define JSON_HEDLEY_INTEL_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_INTEL_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_INTEL_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_INTEL_CL_VERSION) + #undef JSON_HEDLEY_INTEL_CL_VERSION +#endif +#if defined(__INTEL_COMPILER) && defined(__INTEL_COMPILER_UPDATE) && defined(__ICL) + #define JSON_HEDLEY_INTEL_CL_VERSION JSON_HEDLEY_VERSION_ENCODE(__INTEL_COMPILER, __INTEL_COMPILER_UPDATE, 0) +#endif + +#if defined(JSON_HEDLEY_INTEL_CL_VERSION_CHECK) + #undef JSON_HEDLEY_INTEL_CL_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_INTEL_CL_VERSION) + #define JSON_HEDLEY_INTEL_CL_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_INTEL_CL_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_INTEL_CL_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_PGI_VERSION) + #undef JSON_HEDLEY_PGI_VERSION +#endif +#if defined(__PGI) && defined(__PGIC__) && defined(__PGIC_MINOR__) && defined(__PGIC_PATCHLEVEL__) + #define JSON_HEDLEY_PGI_VERSION JSON_HEDLEY_VERSION_ENCODE(__PGIC__, __PGIC_MINOR__, __PGIC_PATCHLEVEL__) +#endif + +#if defined(JSON_HEDLEY_PGI_VERSION_CHECK) + #undef JSON_HEDLEY_PGI_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_PGI_VERSION) + #define JSON_HEDLEY_PGI_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_PGI_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_PGI_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_SUNPRO_VERSION) + #undef JSON_HEDLEY_SUNPRO_VERSION +#endif +#if defined(__SUNPRO_C) && (__SUNPRO_C > 0x1000) + #define JSON_HEDLEY_SUNPRO_VERSION JSON_HEDLEY_VERSION_ENCODE((((__SUNPRO_C >> 16) & 0xf) * 10) + ((__SUNPRO_C >> 12) & 0xf), (((__SUNPRO_C >> 8) & 0xf) * 10) + ((__SUNPRO_C >> 4) & 0xf), (__SUNPRO_C & 0xf) * 10) +#elif defined(__SUNPRO_C) + #define JSON_HEDLEY_SUNPRO_VERSION JSON_HEDLEY_VERSION_ENCODE((__SUNPRO_C >> 8) & 0xf, (__SUNPRO_C >> 4) & 0xf, (__SUNPRO_C) & 0xf) +#elif defined(__SUNPRO_CC) && (__SUNPRO_CC > 0x1000) + #define JSON_HEDLEY_SUNPRO_VERSION JSON_HEDLEY_VERSION_ENCODE((((__SUNPRO_CC >> 16) & 0xf) * 10) + ((__SUNPRO_CC >> 12) & 0xf), (((__SUNPRO_CC >> 8) & 0xf) * 10) + ((__SUNPRO_CC >> 4) & 0xf), (__SUNPRO_CC & 0xf) * 10) +#elif defined(__SUNPRO_CC) + #define JSON_HEDLEY_SUNPRO_VERSION JSON_HEDLEY_VERSION_ENCODE((__SUNPRO_CC >> 8) & 0xf, (__SUNPRO_CC >> 4) & 0xf, (__SUNPRO_CC) & 0xf) +#endif + +#if defined(JSON_HEDLEY_SUNPRO_VERSION_CHECK) + #undef JSON_HEDLEY_SUNPRO_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_SUNPRO_VERSION) + #define JSON_HEDLEY_SUNPRO_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_SUNPRO_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_SUNPRO_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_EMSCRIPTEN_VERSION) + #undef JSON_HEDLEY_EMSCRIPTEN_VERSION +#endif +#if defined(__EMSCRIPTEN__) + #define JSON_HEDLEY_EMSCRIPTEN_VERSION JSON_HEDLEY_VERSION_ENCODE(__EMSCRIPTEN_major__, __EMSCRIPTEN_minor__, __EMSCRIPTEN_tiny__) +#endif + +#if defined(JSON_HEDLEY_EMSCRIPTEN_VERSION_CHECK) + #undef JSON_HEDLEY_EMSCRIPTEN_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_EMSCRIPTEN_VERSION) + #define JSON_HEDLEY_EMSCRIPTEN_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_EMSCRIPTEN_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_EMSCRIPTEN_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_ARM_VERSION) + #undef JSON_HEDLEY_ARM_VERSION +#endif +#if defined(__CC_ARM) && defined(__ARMCOMPILER_VERSION) + #define JSON_HEDLEY_ARM_VERSION JSON_HEDLEY_VERSION_ENCODE(__ARMCOMPILER_VERSION / 1000000, (__ARMCOMPILER_VERSION % 1000000) / 10000, (__ARMCOMPILER_VERSION % 10000) / 100) +#elif defined(__CC_ARM) && defined(__ARMCC_VERSION) + #define JSON_HEDLEY_ARM_VERSION JSON_HEDLEY_VERSION_ENCODE(__ARMCC_VERSION / 1000000, (__ARMCC_VERSION % 1000000) / 10000, (__ARMCC_VERSION % 10000) / 100) +#endif + +#if defined(JSON_HEDLEY_ARM_VERSION_CHECK) + #undef JSON_HEDLEY_ARM_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_ARM_VERSION) + #define JSON_HEDLEY_ARM_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_ARM_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_ARM_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_IBM_VERSION) + #undef JSON_HEDLEY_IBM_VERSION +#endif +#if defined(__ibmxl__) + #define JSON_HEDLEY_IBM_VERSION JSON_HEDLEY_VERSION_ENCODE(__ibmxl_version__, __ibmxl_release__, __ibmxl_modification__) +#elif defined(__xlC__) && defined(__xlC_ver__) + #define JSON_HEDLEY_IBM_VERSION JSON_HEDLEY_VERSION_ENCODE(__xlC__ >> 8, __xlC__ & 0xff, (__xlC_ver__ >> 8) & 0xff) +#elif defined(__xlC__) + #define JSON_HEDLEY_IBM_VERSION JSON_HEDLEY_VERSION_ENCODE(__xlC__ >> 8, __xlC__ & 0xff, 0) +#endif + +#if defined(JSON_HEDLEY_IBM_VERSION_CHECK) + #undef JSON_HEDLEY_IBM_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_IBM_VERSION) + #define JSON_HEDLEY_IBM_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_IBM_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_IBM_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_TI_VERSION) + #undef JSON_HEDLEY_TI_VERSION +#endif +#if \ + defined(__TI_COMPILER_VERSION__) && \ + ( \ + defined(__TMS470__) || defined(__TI_ARM__) || \ + defined(__MSP430__) || \ + defined(__TMS320C2000__) \ + ) +#if (__TI_COMPILER_VERSION__ >= 16000000) + #define JSON_HEDLEY_TI_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) +#endif +#endif + +#if defined(JSON_HEDLEY_TI_VERSION_CHECK) + #undef JSON_HEDLEY_TI_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_TI_VERSION) + #define JSON_HEDLEY_TI_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_TI_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_TI_CL2000_VERSION) + #undef JSON_HEDLEY_TI_CL2000_VERSION +#endif +#if defined(__TI_COMPILER_VERSION__) && defined(__TMS320C2000__) + #define JSON_HEDLEY_TI_CL2000_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) +#endif + +#if defined(JSON_HEDLEY_TI_CL2000_VERSION_CHECK) + #undef JSON_HEDLEY_TI_CL2000_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_TI_CL2000_VERSION) + #define JSON_HEDLEY_TI_CL2000_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_CL2000_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_TI_CL2000_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_TI_CL430_VERSION) + #undef JSON_HEDLEY_TI_CL430_VERSION +#endif +#if defined(__TI_COMPILER_VERSION__) && defined(__MSP430__) + #define JSON_HEDLEY_TI_CL430_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) +#endif + +#if defined(JSON_HEDLEY_TI_CL430_VERSION_CHECK) + #undef JSON_HEDLEY_TI_CL430_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_TI_CL430_VERSION) + #define JSON_HEDLEY_TI_CL430_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_CL430_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_TI_CL430_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_TI_ARMCL_VERSION) + #undef JSON_HEDLEY_TI_ARMCL_VERSION +#endif +#if defined(__TI_COMPILER_VERSION__) && (defined(__TMS470__) || defined(__TI_ARM__)) + #define JSON_HEDLEY_TI_ARMCL_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) +#endif + +#if defined(JSON_HEDLEY_TI_ARMCL_VERSION_CHECK) + #undef JSON_HEDLEY_TI_ARMCL_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_TI_ARMCL_VERSION) + #define JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_ARMCL_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_TI_CL6X_VERSION) + #undef JSON_HEDLEY_TI_CL6X_VERSION +#endif +#if defined(__TI_COMPILER_VERSION__) && defined(__TMS320C6X__) + #define JSON_HEDLEY_TI_CL6X_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) +#endif + +#if defined(JSON_HEDLEY_TI_CL6X_VERSION_CHECK) + #undef JSON_HEDLEY_TI_CL6X_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_TI_CL6X_VERSION) + #define JSON_HEDLEY_TI_CL6X_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_CL6X_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_TI_CL6X_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_TI_CL7X_VERSION) + #undef JSON_HEDLEY_TI_CL7X_VERSION +#endif +#if defined(__TI_COMPILER_VERSION__) && defined(__C7000__) + #define JSON_HEDLEY_TI_CL7X_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) +#endif + +#if defined(JSON_HEDLEY_TI_CL7X_VERSION_CHECK) + #undef JSON_HEDLEY_TI_CL7X_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_TI_CL7X_VERSION) + #define JSON_HEDLEY_TI_CL7X_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_CL7X_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_TI_CL7X_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_TI_CLPRU_VERSION) + #undef JSON_HEDLEY_TI_CLPRU_VERSION +#endif +#if defined(__TI_COMPILER_VERSION__) && defined(__PRU__) + #define JSON_HEDLEY_TI_CLPRU_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) +#endif + +#if defined(JSON_HEDLEY_TI_CLPRU_VERSION_CHECK) + #undef JSON_HEDLEY_TI_CLPRU_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_TI_CLPRU_VERSION) + #define JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_CLPRU_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_CRAY_VERSION) + #undef JSON_HEDLEY_CRAY_VERSION +#endif +#if defined(_CRAYC) + #if defined(_RELEASE_PATCHLEVEL) + #define JSON_HEDLEY_CRAY_VERSION JSON_HEDLEY_VERSION_ENCODE(_RELEASE_MAJOR, _RELEASE_MINOR, _RELEASE_PATCHLEVEL) + #else + #define JSON_HEDLEY_CRAY_VERSION JSON_HEDLEY_VERSION_ENCODE(_RELEASE_MAJOR, _RELEASE_MINOR, 0) + #endif +#endif + +#if defined(JSON_HEDLEY_CRAY_VERSION_CHECK) + #undef JSON_HEDLEY_CRAY_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_CRAY_VERSION) + #define JSON_HEDLEY_CRAY_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_CRAY_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_CRAY_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_IAR_VERSION) + #undef JSON_HEDLEY_IAR_VERSION +#endif +#if defined(__IAR_SYSTEMS_ICC__) + #if __VER__ > 1000 + #define JSON_HEDLEY_IAR_VERSION JSON_HEDLEY_VERSION_ENCODE((__VER__ / 1000000), ((__VER__ / 1000) % 1000), (__VER__ % 1000)) + #else + #define JSON_HEDLEY_IAR_VERSION JSON_HEDLEY_VERSION_ENCODE(__VER__ / 100, __VER__ % 100, 0) + #endif +#endif + +#if defined(JSON_HEDLEY_IAR_VERSION_CHECK) + #undef JSON_HEDLEY_IAR_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_IAR_VERSION) + #define JSON_HEDLEY_IAR_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_IAR_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_IAR_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_TINYC_VERSION) + #undef JSON_HEDLEY_TINYC_VERSION +#endif +#if defined(__TINYC__) + #define JSON_HEDLEY_TINYC_VERSION JSON_HEDLEY_VERSION_ENCODE(__TINYC__ / 1000, (__TINYC__ / 100) % 10, __TINYC__ % 100) +#endif + +#if defined(JSON_HEDLEY_TINYC_VERSION_CHECK) + #undef JSON_HEDLEY_TINYC_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_TINYC_VERSION) + #define JSON_HEDLEY_TINYC_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TINYC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_TINYC_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_DMC_VERSION) + #undef JSON_HEDLEY_DMC_VERSION +#endif +#if defined(__DMC__) + #define JSON_HEDLEY_DMC_VERSION JSON_HEDLEY_VERSION_ENCODE(__DMC__ >> 8, (__DMC__ >> 4) & 0xf, __DMC__ & 0xf) +#endif + +#if defined(JSON_HEDLEY_DMC_VERSION_CHECK) + #undef JSON_HEDLEY_DMC_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_DMC_VERSION) + #define JSON_HEDLEY_DMC_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_DMC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_DMC_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_COMPCERT_VERSION) + #undef JSON_HEDLEY_COMPCERT_VERSION +#endif +#if defined(__COMPCERT_VERSION__) + #define JSON_HEDLEY_COMPCERT_VERSION JSON_HEDLEY_VERSION_ENCODE(__COMPCERT_VERSION__ / 10000, (__COMPCERT_VERSION__ / 100) % 100, __COMPCERT_VERSION__ % 100) +#endif + +#if defined(JSON_HEDLEY_COMPCERT_VERSION_CHECK) + #undef JSON_HEDLEY_COMPCERT_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_COMPCERT_VERSION) + #define JSON_HEDLEY_COMPCERT_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_COMPCERT_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_COMPCERT_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_PELLES_VERSION) + #undef JSON_HEDLEY_PELLES_VERSION +#endif +#if defined(__POCC__) + #define JSON_HEDLEY_PELLES_VERSION JSON_HEDLEY_VERSION_ENCODE(__POCC__ / 100, __POCC__ % 100, 0) +#endif + +#if defined(JSON_HEDLEY_PELLES_VERSION_CHECK) + #undef JSON_HEDLEY_PELLES_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_PELLES_VERSION) + #define JSON_HEDLEY_PELLES_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_PELLES_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_PELLES_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_MCST_LCC_VERSION) + #undef JSON_HEDLEY_MCST_LCC_VERSION +#endif +#if defined(__LCC__) && defined(__LCC_MINOR__) + #define JSON_HEDLEY_MCST_LCC_VERSION JSON_HEDLEY_VERSION_ENCODE(__LCC__ / 100, __LCC__ % 100, __LCC_MINOR__) +#endif + +#if defined(JSON_HEDLEY_MCST_LCC_VERSION_CHECK) + #undef JSON_HEDLEY_MCST_LCC_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_MCST_LCC_VERSION) + #define JSON_HEDLEY_MCST_LCC_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_MCST_LCC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_MCST_LCC_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_GCC_VERSION) + #undef JSON_HEDLEY_GCC_VERSION +#endif +#if \ + defined(JSON_HEDLEY_GNUC_VERSION) && \ + !defined(__clang__) && \ + !defined(JSON_HEDLEY_INTEL_VERSION) && \ + !defined(JSON_HEDLEY_PGI_VERSION) && \ + !defined(JSON_HEDLEY_ARM_VERSION) && \ + !defined(JSON_HEDLEY_CRAY_VERSION) && \ + !defined(JSON_HEDLEY_TI_VERSION) && \ + !defined(JSON_HEDLEY_TI_ARMCL_VERSION) && \ + !defined(JSON_HEDLEY_TI_CL430_VERSION) && \ + !defined(JSON_HEDLEY_TI_CL2000_VERSION) && \ + !defined(JSON_HEDLEY_TI_CL6X_VERSION) && \ + !defined(JSON_HEDLEY_TI_CL7X_VERSION) && \ + !defined(JSON_HEDLEY_TI_CLPRU_VERSION) && \ + !defined(__COMPCERT__) && \ + !defined(JSON_HEDLEY_MCST_LCC_VERSION) + #define JSON_HEDLEY_GCC_VERSION JSON_HEDLEY_GNUC_VERSION +#endif + +#if defined(JSON_HEDLEY_GCC_VERSION_CHECK) + #undef JSON_HEDLEY_GCC_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_GCC_VERSION) + #define JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_GCC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_HAS_ATTRIBUTE) + #undef JSON_HEDLEY_HAS_ATTRIBUTE +#endif +#if \ + defined(__has_attribute) && \ + ( \ + (!defined(JSON_HEDLEY_IAR_VERSION) || JSON_HEDLEY_IAR_VERSION_CHECK(8,5,9)) \ + ) +# define JSON_HEDLEY_HAS_ATTRIBUTE(attribute) __has_attribute(attribute) +#else +# define JSON_HEDLEY_HAS_ATTRIBUTE(attribute) (0) +#endif + +#if defined(JSON_HEDLEY_GNUC_HAS_ATTRIBUTE) + #undef JSON_HEDLEY_GNUC_HAS_ATTRIBUTE +#endif +#if defined(__has_attribute) + #define JSON_HEDLEY_GNUC_HAS_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_HAS_ATTRIBUTE(attribute) +#else + #define JSON_HEDLEY_GNUC_HAS_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(JSON_HEDLEY_GCC_HAS_ATTRIBUTE) + #undef JSON_HEDLEY_GCC_HAS_ATTRIBUTE +#endif +#if defined(__has_attribute) + #define JSON_HEDLEY_GCC_HAS_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_HAS_ATTRIBUTE(attribute) +#else + #define JSON_HEDLEY_GCC_HAS_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(JSON_HEDLEY_HAS_CPP_ATTRIBUTE) + #undef JSON_HEDLEY_HAS_CPP_ATTRIBUTE +#endif +#if \ + defined(__has_cpp_attribute) && \ + defined(__cplusplus) && \ + (!defined(JSON_HEDLEY_SUNPRO_VERSION) || JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,15,0)) + #define JSON_HEDLEY_HAS_CPP_ATTRIBUTE(attribute) __has_cpp_attribute(attribute) +#else + #define JSON_HEDLEY_HAS_CPP_ATTRIBUTE(attribute) (0) +#endif + +#if defined(JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS) + #undef JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS +#endif +#if !defined(__cplusplus) || !defined(__has_cpp_attribute) + #define JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS(ns,attribute) (0) +#elif \ + !defined(JSON_HEDLEY_PGI_VERSION) && \ + !defined(JSON_HEDLEY_IAR_VERSION) && \ + (!defined(JSON_HEDLEY_SUNPRO_VERSION) || JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,15,0)) && \ + (!defined(JSON_HEDLEY_MSVC_VERSION) || JSON_HEDLEY_MSVC_VERSION_CHECK(19,20,0)) + #define JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS(ns,attribute) JSON_HEDLEY_HAS_CPP_ATTRIBUTE(ns::attribute) +#else + #define JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS(ns,attribute) (0) +#endif + +#if defined(JSON_HEDLEY_GNUC_HAS_CPP_ATTRIBUTE) + #undef JSON_HEDLEY_GNUC_HAS_CPP_ATTRIBUTE +#endif +#if defined(__has_cpp_attribute) && defined(__cplusplus) + #define JSON_HEDLEY_GNUC_HAS_CPP_ATTRIBUTE(attribute,major,minor,patch) __has_cpp_attribute(attribute) +#else + #define JSON_HEDLEY_GNUC_HAS_CPP_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(JSON_HEDLEY_GCC_HAS_CPP_ATTRIBUTE) + #undef JSON_HEDLEY_GCC_HAS_CPP_ATTRIBUTE +#endif +#if defined(__has_cpp_attribute) && defined(__cplusplus) + #define JSON_HEDLEY_GCC_HAS_CPP_ATTRIBUTE(attribute,major,minor,patch) __has_cpp_attribute(attribute) +#else + #define JSON_HEDLEY_GCC_HAS_CPP_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(JSON_HEDLEY_HAS_BUILTIN) + #undef JSON_HEDLEY_HAS_BUILTIN +#endif +#if defined(__has_builtin) + #define JSON_HEDLEY_HAS_BUILTIN(builtin) __has_builtin(builtin) +#else + #define JSON_HEDLEY_HAS_BUILTIN(builtin) (0) +#endif + +#if defined(JSON_HEDLEY_GNUC_HAS_BUILTIN) + #undef JSON_HEDLEY_GNUC_HAS_BUILTIN +#endif +#if defined(__has_builtin) + #define JSON_HEDLEY_GNUC_HAS_BUILTIN(builtin,major,minor,patch) __has_builtin(builtin) +#else + #define JSON_HEDLEY_GNUC_HAS_BUILTIN(builtin,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(JSON_HEDLEY_GCC_HAS_BUILTIN) + #undef JSON_HEDLEY_GCC_HAS_BUILTIN +#endif +#if defined(__has_builtin) + #define JSON_HEDLEY_GCC_HAS_BUILTIN(builtin,major,minor,patch) __has_builtin(builtin) +#else + #define JSON_HEDLEY_GCC_HAS_BUILTIN(builtin,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(JSON_HEDLEY_HAS_FEATURE) + #undef JSON_HEDLEY_HAS_FEATURE +#endif +#if defined(__has_feature) + #define JSON_HEDLEY_HAS_FEATURE(feature) __has_feature(feature) +#else + #define JSON_HEDLEY_HAS_FEATURE(feature) (0) +#endif + +#if defined(JSON_HEDLEY_GNUC_HAS_FEATURE) + #undef JSON_HEDLEY_GNUC_HAS_FEATURE +#endif +#if defined(__has_feature) + #define JSON_HEDLEY_GNUC_HAS_FEATURE(feature,major,minor,patch) __has_feature(feature) +#else + #define JSON_HEDLEY_GNUC_HAS_FEATURE(feature,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(JSON_HEDLEY_GCC_HAS_FEATURE) + #undef JSON_HEDLEY_GCC_HAS_FEATURE +#endif +#if defined(__has_feature) + #define JSON_HEDLEY_GCC_HAS_FEATURE(feature,major,minor,patch) __has_feature(feature) +#else + #define JSON_HEDLEY_GCC_HAS_FEATURE(feature,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(JSON_HEDLEY_HAS_EXTENSION) + #undef JSON_HEDLEY_HAS_EXTENSION +#endif +#if defined(__has_extension) + #define JSON_HEDLEY_HAS_EXTENSION(extension) __has_extension(extension) +#else + #define JSON_HEDLEY_HAS_EXTENSION(extension) (0) +#endif + +#if defined(JSON_HEDLEY_GNUC_HAS_EXTENSION) + #undef JSON_HEDLEY_GNUC_HAS_EXTENSION +#endif +#if defined(__has_extension) + #define JSON_HEDLEY_GNUC_HAS_EXTENSION(extension,major,minor,patch) __has_extension(extension) +#else + #define JSON_HEDLEY_GNUC_HAS_EXTENSION(extension,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(JSON_HEDLEY_GCC_HAS_EXTENSION) + #undef JSON_HEDLEY_GCC_HAS_EXTENSION +#endif +#if defined(__has_extension) + #define JSON_HEDLEY_GCC_HAS_EXTENSION(extension,major,minor,patch) __has_extension(extension) +#else + #define JSON_HEDLEY_GCC_HAS_EXTENSION(extension,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE) + #undef JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE +#endif +#if defined(__has_declspec_attribute) + #define JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE(attribute) __has_declspec_attribute(attribute) +#else + #define JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE(attribute) (0) +#endif + +#if defined(JSON_HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE) + #undef JSON_HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE +#endif +#if defined(__has_declspec_attribute) + #define JSON_HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE(attribute,major,minor,patch) __has_declspec_attribute(attribute) +#else + #define JSON_HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(JSON_HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE) + #undef JSON_HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE +#endif +#if defined(__has_declspec_attribute) + #define JSON_HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE(attribute,major,minor,patch) __has_declspec_attribute(attribute) +#else + #define JSON_HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(JSON_HEDLEY_HAS_WARNING) + #undef JSON_HEDLEY_HAS_WARNING +#endif +#if defined(__has_warning) + #define JSON_HEDLEY_HAS_WARNING(warning) __has_warning(warning) +#else + #define JSON_HEDLEY_HAS_WARNING(warning) (0) +#endif + +#if defined(JSON_HEDLEY_GNUC_HAS_WARNING) + #undef JSON_HEDLEY_GNUC_HAS_WARNING +#endif +#if defined(__has_warning) + #define JSON_HEDLEY_GNUC_HAS_WARNING(warning,major,minor,patch) __has_warning(warning) +#else + #define JSON_HEDLEY_GNUC_HAS_WARNING(warning,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(JSON_HEDLEY_GCC_HAS_WARNING) + #undef JSON_HEDLEY_GCC_HAS_WARNING +#endif +#if defined(__has_warning) + #define JSON_HEDLEY_GCC_HAS_WARNING(warning,major,minor,patch) __has_warning(warning) +#else + #define JSON_HEDLEY_GCC_HAS_WARNING(warning,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) +#endif + +#if \ + (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) || \ + defined(__clang__) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(3,0,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) || \ + JSON_HEDLEY_PGI_VERSION_CHECK(18,4,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,7,0) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(2,0,1) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,1,0) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,0,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + JSON_HEDLEY_CRAY_VERSION_CHECK(5,0,0) || \ + JSON_HEDLEY_TINYC_VERSION_CHECK(0,9,17) || \ + JSON_HEDLEY_SUNPRO_VERSION_CHECK(8,0,0) || \ + (JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) && defined(__C99_PRAGMA_OPERATOR)) + #define JSON_HEDLEY_PRAGMA(value) _Pragma(#value) +#elif JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0) + #define JSON_HEDLEY_PRAGMA(value) __pragma(value) +#else + #define JSON_HEDLEY_PRAGMA(value) +#endif + +#if defined(JSON_HEDLEY_DIAGNOSTIC_PUSH) + #undef JSON_HEDLEY_DIAGNOSTIC_PUSH +#endif +#if defined(JSON_HEDLEY_DIAGNOSTIC_POP) + #undef JSON_HEDLEY_DIAGNOSTIC_POP +#endif +#if defined(__clang__) + #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("clang diagnostic push") + #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("clang diagnostic pop") +#elif JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) + #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("warning(push)") + #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("warning(pop)") +#elif JSON_HEDLEY_GCC_VERSION_CHECK(4,6,0) + #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("GCC diagnostic push") + #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("GCC diagnostic pop") +#elif \ + JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) + #define JSON_HEDLEY_DIAGNOSTIC_PUSH __pragma(warning(push)) + #define JSON_HEDLEY_DIAGNOSTIC_POP __pragma(warning(pop)) +#elif JSON_HEDLEY_ARM_VERSION_CHECK(5,6,0) + #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("push") + #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("pop") +#elif \ + JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,4,0) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,1,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) + #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("diag_push") + #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("diag_pop") +#elif JSON_HEDLEY_PELLES_VERSION_CHECK(2,90,0) + #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("warning(push)") + #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("warning(pop)") +#else + #define JSON_HEDLEY_DIAGNOSTIC_PUSH + #define JSON_HEDLEY_DIAGNOSTIC_POP +#endif + +/* JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_ is for + HEDLEY INTERNAL USE ONLY. API subject to change without notice. */ +#if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_) + #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_ +#endif +#if defined(__cplusplus) +# if JSON_HEDLEY_HAS_WARNING("-Wc++98-compat") +# if JSON_HEDLEY_HAS_WARNING("-Wc++17-extensions") +# if JSON_HEDLEY_HAS_WARNING("-Wc++1z-extensions") +# define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(xpr) \ + JSON_HEDLEY_DIAGNOSTIC_PUSH \ + _Pragma("clang diagnostic ignored \"-Wc++98-compat\"") \ + _Pragma("clang diagnostic ignored \"-Wc++17-extensions\"") \ + _Pragma("clang diagnostic ignored \"-Wc++1z-extensions\"") \ + xpr \ + JSON_HEDLEY_DIAGNOSTIC_POP +# else +# define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(xpr) \ + JSON_HEDLEY_DIAGNOSTIC_PUSH \ + _Pragma("clang diagnostic ignored \"-Wc++98-compat\"") \ + _Pragma("clang diagnostic ignored \"-Wc++17-extensions\"") \ + xpr \ + JSON_HEDLEY_DIAGNOSTIC_POP +# endif +# else +# define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(xpr) \ + JSON_HEDLEY_DIAGNOSTIC_PUSH \ + _Pragma("clang diagnostic ignored \"-Wc++98-compat\"") \ + xpr \ + JSON_HEDLEY_DIAGNOSTIC_POP +# endif +# endif +#endif +#if !defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(x) x +#endif + +#if defined(JSON_HEDLEY_CONST_CAST) + #undef JSON_HEDLEY_CONST_CAST +#endif +#if defined(__cplusplus) +# define JSON_HEDLEY_CONST_CAST(T, expr) (const_cast(expr)) +#elif \ + JSON_HEDLEY_HAS_WARNING("-Wcast-qual") || \ + JSON_HEDLEY_GCC_VERSION_CHECK(4,6,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) +# define JSON_HEDLEY_CONST_CAST(T, expr) (__extension__ ({ \ + JSON_HEDLEY_DIAGNOSTIC_PUSH \ + JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL \ + ((T) (expr)); \ + JSON_HEDLEY_DIAGNOSTIC_POP \ + })) +#else +# define JSON_HEDLEY_CONST_CAST(T, expr) ((T) (expr)) +#endif + +#if defined(JSON_HEDLEY_REINTERPRET_CAST) + #undef JSON_HEDLEY_REINTERPRET_CAST +#endif +#if defined(__cplusplus) + #define JSON_HEDLEY_REINTERPRET_CAST(T, expr) (reinterpret_cast(expr)) +#else + #define JSON_HEDLEY_REINTERPRET_CAST(T, expr) ((T) (expr)) +#endif + +#if defined(JSON_HEDLEY_STATIC_CAST) + #undef JSON_HEDLEY_STATIC_CAST +#endif +#if defined(__cplusplus) + #define JSON_HEDLEY_STATIC_CAST(T, expr) (static_cast(expr)) +#else + #define JSON_HEDLEY_STATIC_CAST(T, expr) ((T) (expr)) +#endif + +#if defined(JSON_HEDLEY_CPP_CAST) + #undef JSON_HEDLEY_CPP_CAST +#endif +#if defined(__cplusplus) +# if JSON_HEDLEY_HAS_WARNING("-Wold-style-cast") +# define JSON_HEDLEY_CPP_CAST(T, expr) \ + JSON_HEDLEY_DIAGNOSTIC_PUSH \ + _Pragma("clang diagnostic ignored \"-Wold-style-cast\"") \ + ((T) (expr)) \ + JSON_HEDLEY_DIAGNOSTIC_POP +# elif JSON_HEDLEY_IAR_VERSION_CHECK(8,3,0) +# define JSON_HEDLEY_CPP_CAST(T, expr) \ + JSON_HEDLEY_DIAGNOSTIC_PUSH \ + _Pragma("diag_suppress=Pe137") \ + JSON_HEDLEY_DIAGNOSTIC_POP +# else +# define JSON_HEDLEY_CPP_CAST(T, expr) ((T) (expr)) +# endif +#else +# define JSON_HEDLEY_CPP_CAST(T, expr) (expr) +#endif + +#if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED) + #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED +#endif +#if JSON_HEDLEY_HAS_WARNING("-Wdeprecated-declarations") + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"") +#elif JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("warning(disable:1478 1786)") +#elif JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED __pragma(warning(disable:1478 1786)) +#elif JSON_HEDLEY_PGI_VERSION_CHECK(20,7,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress 1215,1216,1444,1445") +#elif JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress 1215,1444") +#elif JSON_HEDLEY_GCC_VERSION_CHECK(4,3,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") +#elif JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED __pragma(warning(disable:4996)) +#elif JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress 1215,1444") +#elif \ + JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ + (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress 1291,1718") +#elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,13,0) && !defined(__cplusplus) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("error_messages(off,E_DEPRECATED_ATT,E_DEPRECATED_ATT_MESS)") +#elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,13,0) && defined(__cplusplus) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("error_messages(off,symdeprecated,symdeprecated2)") +#elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress=Pe1444,Pe1215") +#elif JSON_HEDLEY_PELLES_VERSION_CHECK(2,90,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("warn(disable:2241)") +#else + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED +#endif + +#if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS) + #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS +#endif +#if JSON_HEDLEY_HAS_WARNING("-Wunknown-pragmas") + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("clang diagnostic ignored \"-Wunknown-pragmas\"") +#elif JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("warning(disable:161)") +#elif JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS __pragma(warning(disable:161)) +#elif JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress 1675") +#elif JSON_HEDLEY_GCC_VERSION_CHECK(4,3,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("GCC diagnostic ignored \"-Wunknown-pragmas\"") +#elif JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS __pragma(warning(disable:4068)) +#elif \ + JSON_HEDLEY_TI_VERSION_CHECK(16,9,0) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,0,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,3,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress 163") +#elif JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,0,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress 163") +#elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress=Pe161") +#elif JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress 161") +#else + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS +#endif + +#if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES) + #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES +#endif +#if JSON_HEDLEY_HAS_WARNING("-Wunknown-attributes") + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("clang diagnostic ignored \"-Wunknown-attributes\"") +#elif JSON_HEDLEY_GCC_VERSION_CHECK(4,6,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") +#elif JSON_HEDLEY_INTEL_VERSION_CHECK(17,0,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("warning(disable:1292)") +#elif JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES __pragma(warning(disable:1292)) +#elif JSON_HEDLEY_MSVC_VERSION_CHECK(19,0,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES __pragma(warning(disable:5030)) +#elif JSON_HEDLEY_PGI_VERSION_CHECK(20,7,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress 1097,1098") +#elif JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress 1097") +#elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,14,0) && defined(__cplusplus) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("error_messages(off,attrskipunsup)") +#elif \ + JSON_HEDLEY_TI_VERSION_CHECK(18,1,0) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,3,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress 1173") +#elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress=Pe1097") +#elif JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress 1097") +#else + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES +#endif + +#if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL) + #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL +#endif +#if JSON_HEDLEY_HAS_WARNING("-Wcast-qual") + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL _Pragma("clang diagnostic ignored \"-Wcast-qual\"") +#elif JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL _Pragma("warning(disable:2203 2331)") +#elif JSON_HEDLEY_GCC_VERSION_CHECK(3,0,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL _Pragma("GCC diagnostic ignored \"-Wcast-qual\"") +#else + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL +#endif + +#if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION) + #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION +#endif +#if JSON_HEDLEY_HAS_WARNING("-Wunused-function") + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION _Pragma("clang diagnostic ignored \"-Wunused-function\"") +#elif JSON_HEDLEY_GCC_VERSION_CHECK(3,4,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION _Pragma("GCC diagnostic ignored \"-Wunused-function\"") +#elif JSON_HEDLEY_MSVC_VERSION_CHECK(1,0,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION __pragma(warning(disable:4505)) +#elif JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION _Pragma("diag_suppress 3142") +#else + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION +#endif + +#if defined(JSON_HEDLEY_DEPRECATED) + #undef JSON_HEDLEY_DEPRECATED +#endif +#if defined(JSON_HEDLEY_DEPRECATED_FOR) + #undef JSON_HEDLEY_DEPRECATED_FOR +#endif +#if \ + JSON_HEDLEY_MSVC_VERSION_CHECK(14,0,0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) + #define JSON_HEDLEY_DEPRECATED(since) __declspec(deprecated("Since " # since)) + #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) __declspec(deprecated("Since " #since "; use " #replacement)) +#elif \ + (JSON_HEDLEY_HAS_EXTENSION(attribute_deprecated_with_message) && !defined(JSON_HEDLEY_IAR_VERSION)) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(4,5,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(5,6,0) || \ + JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,13,0) || \ + JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) || \ + JSON_HEDLEY_TI_VERSION_CHECK(18,1,0) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(18,1,0) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,3,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,3,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_DEPRECATED(since) __attribute__((__deprecated__("Since " #since))) + #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) __attribute__((__deprecated__("Since " #since "; use " #replacement))) +#elif defined(__cplusplus) && (__cplusplus >= 201402L) + #define JSON_HEDLEY_DEPRECATED(since) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[deprecated("Since " #since)]]) + #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[deprecated("Since " #since "; use " #replacement)]]) +#elif \ + JSON_HEDLEY_HAS_ATTRIBUTE(deprecated) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(3,1,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ + (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) || \ + JSON_HEDLEY_IAR_VERSION_CHECK(8,10,0) + #define JSON_HEDLEY_DEPRECATED(since) __attribute__((__deprecated__)) + #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) __attribute__((__deprecated__)) +#elif \ + JSON_HEDLEY_MSVC_VERSION_CHECK(13,10,0) || \ + JSON_HEDLEY_PELLES_VERSION_CHECK(6,50,0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) + #define JSON_HEDLEY_DEPRECATED(since) __declspec(deprecated) + #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) __declspec(deprecated) +#elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) + #define JSON_HEDLEY_DEPRECATED(since) _Pragma("deprecated") + #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) _Pragma("deprecated") +#else + #define JSON_HEDLEY_DEPRECATED(since) + #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) +#endif + +#if defined(JSON_HEDLEY_UNAVAILABLE) + #undef JSON_HEDLEY_UNAVAILABLE +#endif +#if \ + JSON_HEDLEY_HAS_ATTRIBUTE(warning) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(4,3,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_UNAVAILABLE(available_since) __attribute__((__warning__("Not available until " #available_since))) +#else + #define JSON_HEDLEY_UNAVAILABLE(available_since) +#endif + +#if defined(JSON_HEDLEY_WARN_UNUSED_RESULT) + #undef JSON_HEDLEY_WARN_UNUSED_RESULT +#endif +#if defined(JSON_HEDLEY_WARN_UNUSED_RESULT_MSG) + #undef JSON_HEDLEY_WARN_UNUSED_RESULT_MSG +#endif +#if \ + JSON_HEDLEY_HAS_ATTRIBUTE(warn_unused_result) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(3,4,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ + (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + (JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,15,0) && defined(__cplusplus)) || \ + JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_WARN_UNUSED_RESULT __attribute__((__warn_unused_result__)) + #define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg) __attribute__((__warn_unused_result__)) +#elif (JSON_HEDLEY_HAS_CPP_ATTRIBUTE(nodiscard) >= 201907L) + #define JSON_HEDLEY_WARN_UNUSED_RESULT JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[nodiscard]]) + #define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[nodiscard(msg)]]) +#elif JSON_HEDLEY_HAS_CPP_ATTRIBUTE(nodiscard) + #define JSON_HEDLEY_WARN_UNUSED_RESULT JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[nodiscard]]) + #define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[nodiscard]]) +#elif defined(_Check_return_) /* SAL */ + #define JSON_HEDLEY_WARN_UNUSED_RESULT _Check_return_ + #define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg) _Check_return_ +#else + #define JSON_HEDLEY_WARN_UNUSED_RESULT + #define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg) +#endif + +#if defined(JSON_HEDLEY_SENTINEL) + #undef JSON_HEDLEY_SENTINEL +#endif +#if \ + JSON_HEDLEY_HAS_ATTRIBUTE(sentinel) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(4,0,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(5,4,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_SENTINEL(position) __attribute__((__sentinel__(position))) +#else + #define JSON_HEDLEY_SENTINEL(position) +#endif + +#if defined(JSON_HEDLEY_NO_RETURN) + #undef JSON_HEDLEY_NO_RETURN +#endif +#if JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) + #define JSON_HEDLEY_NO_RETURN __noreturn +#elif \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_NO_RETURN __attribute__((__noreturn__)) +#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L + #define JSON_HEDLEY_NO_RETURN _Noreturn +#elif defined(__cplusplus) && (__cplusplus >= 201103L) + #define JSON_HEDLEY_NO_RETURN JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[noreturn]]) +#elif \ + JSON_HEDLEY_HAS_ATTRIBUTE(noreturn) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(3,2,0) || \ + JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ + JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ + (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + JSON_HEDLEY_IAR_VERSION_CHECK(8,10,0) + #define JSON_HEDLEY_NO_RETURN __attribute__((__noreturn__)) +#elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0) + #define JSON_HEDLEY_NO_RETURN _Pragma("does_not_return") +#elif \ + JSON_HEDLEY_MSVC_VERSION_CHECK(13,10,0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) + #define JSON_HEDLEY_NO_RETURN __declspec(noreturn) +#elif JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6,0,0) && defined(__cplusplus) + #define JSON_HEDLEY_NO_RETURN _Pragma("FUNC_NEVER_RETURNS;") +#elif JSON_HEDLEY_COMPCERT_VERSION_CHECK(3,2,0) + #define JSON_HEDLEY_NO_RETURN __attribute((noreturn)) +#elif JSON_HEDLEY_PELLES_VERSION_CHECK(9,0,0) + #define JSON_HEDLEY_NO_RETURN __declspec(noreturn) +#else + #define JSON_HEDLEY_NO_RETURN +#endif + +#if defined(JSON_HEDLEY_NO_ESCAPE) + #undef JSON_HEDLEY_NO_ESCAPE +#endif +#if JSON_HEDLEY_HAS_ATTRIBUTE(noescape) + #define JSON_HEDLEY_NO_ESCAPE __attribute__((__noescape__)) +#else + #define JSON_HEDLEY_NO_ESCAPE +#endif + +#if defined(JSON_HEDLEY_UNREACHABLE) + #undef JSON_HEDLEY_UNREACHABLE +#endif +#if defined(JSON_HEDLEY_UNREACHABLE_RETURN) + #undef JSON_HEDLEY_UNREACHABLE_RETURN +#endif +#if defined(JSON_HEDLEY_ASSUME) + #undef JSON_HEDLEY_ASSUME +#endif +#if \ + JSON_HEDLEY_MSVC_VERSION_CHECK(13,10,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) + #define JSON_HEDLEY_ASSUME(expr) __assume(expr) +#elif JSON_HEDLEY_HAS_BUILTIN(__builtin_assume) + #define JSON_HEDLEY_ASSUME(expr) __builtin_assume(expr) +#elif \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,2,0) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(4,0,0) + #if defined(__cplusplus) + #define JSON_HEDLEY_ASSUME(expr) std::_nassert(expr) + #else + #define JSON_HEDLEY_ASSUME(expr) _nassert(expr) + #endif +#endif +#if \ + (JSON_HEDLEY_HAS_BUILTIN(__builtin_unreachable) && (!defined(JSON_HEDLEY_ARM_VERSION))) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(4,5,0) || \ + JSON_HEDLEY_PGI_VERSION_CHECK(18,10,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(13,1,5) || \ + JSON_HEDLEY_CRAY_VERSION_CHECK(10,0,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_UNREACHABLE() __builtin_unreachable() +#elif defined(JSON_HEDLEY_ASSUME) + #define JSON_HEDLEY_UNREACHABLE() JSON_HEDLEY_ASSUME(0) +#endif +#if !defined(JSON_HEDLEY_ASSUME) + #if defined(JSON_HEDLEY_UNREACHABLE) + #define JSON_HEDLEY_ASSUME(expr) JSON_HEDLEY_STATIC_CAST(void, ((expr) ? 1 : (JSON_HEDLEY_UNREACHABLE(), 1))) + #else + #define JSON_HEDLEY_ASSUME(expr) JSON_HEDLEY_STATIC_CAST(void, expr) + #endif +#endif +#if defined(JSON_HEDLEY_UNREACHABLE) + #if \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,2,0) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(4,0,0) + #define JSON_HEDLEY_UNREACHABLE_RETURN(value) return (JSON_HEDLEY_STATIC_CAST(void, JSON_HEDLEY_ASSUME(0)), (value)) + #else + #define JSON_HEDLEY_UNREACHABLE_RETURN(value) JSON_HEDLEY_UNREACHABLE() + #endif +#else + #define JSON_HEDLEY_UNREACHABLE_RETURN(value) return (value) +#endif +#if !defined(JSON_HEDLEY_UNREACHABLE) + #define JSON_HEDLEY_UNREACHABLE() JSON_HEDLEY_ASSUME(0) +#endif + +JSON_HEDLEY_DIAGNOSTIC_PUSH +#if JSON_HEDLEY_HAS_WARNING("-Wpedantic") + #pragma clang diagnostic ignored "-Wpedantic" +#endif +#if JSON_HEDLEY_HAS_WARNING("-Wc++98-compat-pedantic") && defined(__cplusplus) + #pragma clang diagnostic ignored "-Wc++98-compat-pedantic" +#endif +#if JSON_HEDLEY_GCC_HAS_WARNING("-Wvariadic-macros",4,0,0) + #if defined(__clang__) + #pragma clang diagnostic ignored "-Wvariadic-macros" + #elif defined(JSON_HEDLEY_GCC_VERSION) + #pragma GCC diagnostic ignored "-Wvariadic-macros" + #endif +#endif +#if defined(JSON_HEDLEY_NON_NULL) + #undef JSON_HEDLEY_NON_NULL +#endif +#if \ + JSON_HEDLEY_HAS_ATTRIBUTE(nonnull) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(3,3,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) + #define JSON_HEDLEY_NON_NULL(...) __attribute__((__nonnull__(__VA_ARGS__))) +#else + #define JSON_HEDLEY_NON_NULL(...) +#endif +JSON_HEDLEY_DIAGNOSTIC_POP + +#if defined(JSON_HEDLEY_PRINTF_FORMAT) + #undef JSON_HEDLEY_PRINTF_FORMAT +#endif +#if defined(__MINGW32__) && JSON_HEDLEY_GCC_HAS_ATTRIBUTE(format,4,4,0) && !defined(__USE_MINGW_ANSI_STDIO) + #define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) __attribute__((__format__(ms_printf, string_idx, first_to_check))) +#elif defined(__MINGW32__) && JSON_HEDLEY_GCC_HAS_ATTRIBUTE(format,4,4,0) && defined(__USE_MINGW_ANSI_STDIO) + #define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) __attribute__((__format__(gnu_printf, string_idx, first_to_check))) +#elif \ + JSON_HEDLEY_HAS_ATTRIBUTE(format) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(3,1,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(5,6,0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ + JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ + (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) __attribute__((__format__(__printf__, string_idx, first_to_check))) +#elif JSON_HEDLEY_PELLES_VERSION_CHECK(6,0,0) + #define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) __declspec(vaformat(printf,string_idx,first_to_check)) +#else + #define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) +#endif + +#if defined(JSON_HEDLEY_CONSTEXPR) + #undef JSON_HEDLEY_CONSTEXPR +#endif +#if defined(__cplusplus) + #if __cplusplus >= 201103L + #define JSON_HEDLEY_CONSTEXPR JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(constexpr) + #endif +#endif +#if !defined(JSON_HEDLEY_CONSTEXPR) + #define JSON_HEDLEY_CONSTEXPR +#endif + +#if defined(JSON_HEDLEY_PREDICT) + #undef JSON_HEDLEY_PREDICT +#endif +#if defined(JSON_HEDLEY_LIKELY) + #undef JSON_HEDLEY_LIKELY +#endif +#if defined(JSON_HEDLEY_UNLIKELY) + #undef JSON_HEDLEY_UNLIKELY +#endif +#if defined(JSON_HEDLEY_UNPREDICTABLE) + #undef JSON_HEDLEY_UNPREDICTABLE +#endif +#if JSON_HEDLEY_HAS_BUILTIN(__builtin_unpredictable) + #define JSON_HEDLEY_UNPREDICTABLE(expr) __builtin_unpredictable((expr)) +#endif +#if \ + (JSON_HEDLEY_HAS_BUILTIN(__builtin_expect_with_probability) && !defined(JSON_HEDLEY_PGI_VERSION)) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(9,0,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) +# define JSON_HEDLEY_PREDICT(expr, value, probability) __builtin_expect_with_probability( (expr), (value), (probability)) +# define JSON_HEDLEY_PREDICT_TRUE(expr, probability) __builtin_expect_with_probability(!!(expr), 1 , (probability)) +# define JSON_HEDLEY_PREDICT_FALSE(expr, probability) __builtin_expect_with_probability(!!(expr), 0 , (probability)) +# define JSON_HEDLEY_LIKELY(expr) __builtin_expect (!!(expr), 1 ) +# define JSON_HEDLEY_UNLIKELY(expr) __builtin_expect (!!(expr), 0 ) +#elif \ + (JSON_HEDLEY_HAS_BUILTIN(__builtin_expect) && !defined(JSON_HEDLEY_INTEL_CL_VERSION)) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(3,0,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + (JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,15,0) && defined(__cplusplus)) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ + JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,7,0) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(3,1,0) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,1,0) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6,1,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + JSON_HEDLEY_TINYC_VERSION_CHECK(0,9,27) || \ + JSON_HEDLEY_CRAY_VERSION_CHECK(8,1,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) +# define JSON_HEDLEY_PREDICT(expr, expected, probability) \ + (((probability) >= 0.9) ? __builtin_expect((expr), (expected)) : (JSON_HEDLEY_STATIC_CAST(void, expected), (expr))) +# define JSON_HEDLEY_PREDICT_TRUE(expr, probability) \ + (__extension__ ({ \ + double hedley_probability_ = (probability); \ + ((hedley_probability_ >= 0.9) ? __builtin_expect(!!(expr), 1) : ((hedley_probability_ <= 0.1) ? __builtin_expect(!!(expr), 0) : !!(expr))); \ + })) +# define JSON_HEDLEY_PREDICT_FALSE(expr, probability) \ + (__extension__ ({ \ + double hedley_probability_ = (probability); \ + ((hedley_probability_ >= 0.9) ? __builtin_expect(!!(expr), 0) : ((hedley_probability_ <= 0.1) ? __builtin_expect(!!(expr), 1) : !!(expr))); \ + })) +# define JSON_HEDLEY_LIKELY(expr) __builtin_expect(!!(expr), 1) +# define JSON_HEDLEY_UNLIKELY(expr) __builtin_expect(!!(expr), 0) +#else +# define JSON_HEDLEY_PREDICT(expr, expected, probability) (JSON_HEDLEY_STATIC_CAST(void, expected), (expr)) +# define JSON_HEDLEY_PREDICT_TRUE(expr, probability) (!!(expr)) +# define JSON_HEDLEY_PREDICT_FALSE(expr, probability) (!!(expr)) +# define JSON_HEDLEY_LIKELY(expr) (!!(expr)) +# define JSON_HEDLEY_UNLIKELY(expr) (!!(expr)) +#endif +#if !defined(JSON_HEDLEY_UNPREDICTABLE) + #define JSON_HEDLEY_UNPREDICTABLE(expr) JSON_HEDLEY_PREDICT(expr, 1, 0.5) +#endif + +#if defined(JSON_HEDLEY_MALLOC) + #undef JSON_HEDLEY_MALLOC +#endif +#if \ + JSON_HEDLEY_HAS_ATTRIBUTE(malloc) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(3,1,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(12,1,0) || \ + JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ + (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_MALLOC __attribute__((__malloc__)) +#elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0) + #define JSON_HEDLEY_MALLOC _Pragma("returns_new_memory") +#elif \ + JSON_HEDLEY_MSVC_VERSION_CHECK(14,0,0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) + #define JSON_HEDLEY_MALLOC __declspec(restrict) +#else + #define JSON_HEDLEY_MALLOC +#endif + +#if defined(JSON_HEDLEY_PURE) + #undef JSON_HEDLEY_PURE +#endif +#if \ + JSON_HEDLEY_HAS_ATTRIBUTE(pure) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(2,96,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ + JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ + (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) +# define JSON_HEDLEY_PURE __attribute__((__pure__)) +#elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0) +# define JSON_HEDLEY_PURE _Pragma("does_not_write_global_data") +#elif defined(__cplusplus) && \ + ( \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(2,0,1) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(4,0,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) \ + ) +# define JSON_HEDLEY_PURE _Pragma("FUNC_IS_PURE;") +#else +# define JSON_HEDLEY_PURE +#endif + +#if defined(JSON_HEDLEY_CONST) + #undef JSON_HEDLEY_CONST +#endif +#if \ + JSON_HEDLEY_HAS_ATTRIBUTE(const) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(2,5,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ + JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ + (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_CONST __attribute__((__const__)) +#elif \ + JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0) + #define JSON_HEDLEY_CONST _Pragma("no_side_effect") +#else + #define JSON_HEDLEY_CONST JSON_HEDLEY_PURE +#endif + +#if defined(JSON_HEDLEY_RESTRICT) + #undef JSON_HEDLEY_RESTRICT +#endif +#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) && !defined(__cplusplus) + #define JSON_HEDLEY_RESTRICT restrict +#elif \ + JSON_HEDLEY_GCC_VERSION_CHECK(3,1,0) || \ + JSON_HEDLEY_MSVC_VERSION_CHECK(14,0,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ + JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,2,4) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,1,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + (JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,14,0) && defined(__cplusplus)) || \ + JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) || \ + defined(__clang__) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_RESTRICT __restrict +#elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,3,0) && !defined(__cplusplus) + #define JSON_HEDLEY_RESTRICT _Restrict +#else + #define JSON_HEDLEY_RESTRICT +#endif + +#if defined(JSON_HEDLEY_INLINE) + #undef JSON_HEDLEY_INLINE +#endif +#if \ + (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) || \ + (defined(__cplusplus) && (__cplusplus >= 199711L)) + #define JSON_HEDLEY_INLINE inline +#elif \ + defined(JSON_HEDLEY_GCC_VERSION) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(6,2,0) + #define JSON_HEDLEY_INLINE __inline__ +#elif \ + JSON_HEDLEY_MSVC_VERSION_CHECK(12,0,0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,1,0) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(3,1,0) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,2,0) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,0,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_INLINE __inline +#else + #define JSON_HEDLEY_INLINE +#endif + +#if defined(JSON_HEDLEY_ALWAYS_INLINE) + #undef JSON_HEDLEY_ALWAYS_INLINE +#endif +#if \ + JSON_HEDLEY_HAS_ATTRIBUTE(always_inline) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(4,0,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ + JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ + (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) || \ + JSON_HEDLEY_IAR_VERSION_CHECK(8,10,0) +# define JSON_HEDLEY_ALWAYS_INLINE __attribute__((__always_inline__)) JSON_HEDLEY_INLINE +#elif \ + JSON_HEDLEY_MSVC_VERSION_CHECK(12,0,0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) +# define JSON_HEDLEY_ALWAYS_INLINE __forceinline +#elif defined(__cplusplus) && \ + ( \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6,1,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) \ + ) +# define JSON_HEDLEY_ALWAYS_INLINE _Pragma("FUNC_ALWAYS_INLINE;") +#elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) +# define JSON_HEDLEY_ALWAYS_INLINE _Pragma("inline=forced") +#else +# define JSON_HEDLEY_ALWAYS_INLINE JSON_HEDLEY_INLINE +#endif + +#if defined(JSON_HEDLEY_NEVER_INLINE) + #undef JSON_HEDLEY_NEVER_INLINE +#endif +#if \ + JSON_HEDLEY_HAS_ATTRIBUTE(noinline) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(4,0,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ + JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ + (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) || \ + JSON_HEDLEY_IAR_VERSION_CHECK(8,10,0) + #define JSON_HEDLEY_NEVER_INLINE __attribute__((__noinline__)) +#elif \ + JSON_HEDLEY_MSVC_VERSION_CHECK(13,10,0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) + #define JSON_HEDLEY_NEVER_INLINE __declspec(noinline) +#elif JSON_HEDLEY_PGI_VERSION_CHECK(10,2,0) + #define JSON_HEDLEY_NEVER_INLINE _Pragma("noinline") +#elif JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6,0,0) && defined(__cplusplus) + #define JSON_HEDLEY_NEVER_INLINE _Pragma("FUNC_CANNOT_INLINE;") +#elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) + #define JSON_HEDLEY_NEVER_INLINE _Pragma("inline=never") +#elif JSON_HEDLEY_COMPCERT_VERSION_CHECK(3,2,0) + #define JSON_HEDLEY_NEVER_INLINE __attribute((noinline)) +#elif JSON_HEDLEY_PELLES_VERSION_CHECK(9,0,0) + #define JSON_HEDLEY_NEVER_INLINE __declspec(noinline) +#else + #define JSON_HEDLEY_NEVER_INLINE +#endif + +#if defined(JSON_HEDLEY_PRIVATE) + #undef JSON_HEDLEY_PRIVATE +#endif +#if defined(JSON_HEDLEY_PUBLIC) + #undef JSON_HEDLEY_PUBLIC +#endif +#if defined(JSON_HEDLEY_IMPORT) + #undef JSON_HEDLEY_IMPORT +#endif +#if defined(_WIN32) || defined(__CYGWIN__) +# define JSON_HEDLEY_PRIVATE +# define JSON_HEDLEY_PUBLIC __declspec(dllexport) +# define JSON_HEDLEY_IMPORT __declspec(dllimport) +#else +# if \ + JSON_HEDLEY_HAS_ATTRIBUTE(visibility) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(3,3,0) || \ + JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(13,1,0) || \ + ( \ + defined(__TI_EABI__) && \ + ( \ + (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) \ + ) \ + ) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) +# define JSON_HEDLEY_PRIVATE __attribute__((__visibility__("hidden"))) +# define JSON_HEDLEY_PUBLIC __attribute__((__visibility__("default"))) +# else +# define JSON_HEDLEY_PRIVATE +# define JSON_HEDLEY_PUBLIC +# endif +# define JSON_HEDLEY_IMPORT extern +#endif + +#if defined(JSON_HEDLEY_NO_THROW) + #undef JSON_HEDLEY_NO_THROW +#endif +#if \ + JSON_HEDLEY_HAS_ATTRIBUTE(nothrow) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(3,3,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_NO_THROW __attribute__((__nothrow__)) +#elif \ + JSON_HEDLEY_MSVC_VERSION_CHECK(13,1,0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) + #define JSON_HEDLEY_NO_THROW __declspec(nothrow) +#else + #define JSON_HEDLEY_NO_THROW +#endif + +#if defined(JSON_HEDLEY_FALL_THROUGH) + #undef JSON_HEDLEY_FALL_THROUGH +#endif +#if \ + JSON_HEDLEY_HAS_ATTRIBUTE(fallthrough) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(7,0,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_FALL_THROUGH __attribute__((__fallthrough__)) +#elif JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS(clang,fallthrough) + #define JSON_HEDLEY_FALL_THROUGH JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[clang::fallthrough]]) +#elif JSON_HEDLEY_HAS_CPP_ATTRIBUTE(fallthrough) + #define JSON_HEDLEY_FALL_THROUGH JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[fallthrough]]) +#elif defined(__fallthrough) /* SAL */ + #define JSON_HEDLEY_FALL_THROUGH __fallthrough +#else + #define JSON_HEDLEY_FALL_THROUGH +#endif + +#if defined(JSON_HEDLEY_RETURNS_NON_NULL) + #undef JSON_HEDLEY_RETURNS_NON_NULL +#endif +#if \ + JSON_HEDLEY_HAS_ATTRIBUTE(returns_nonnull) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(4,9,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_RETURNS_NON_NULL __attribute__((__returns_nonnull__)) +#elif defined(_Ret_notnull_) /* SAL */ + #define JSON_HEDLEY_RETURNS_NON_NULL _Ret_notnull_ +#else + #define JSON_HEDLEY_RETURNS_NON_NULL +#endif + +#if defined(JSON_HEDLEY_ARRAY_PARAM) + #undef JSON_HEDLEY_ARRAY_PARAM +#endif +#if \ + defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) && \ + !defined(__STDC_NO_VLA__) && \ + !defined(__cplusplus) && \ + !defined(JSON_HEDLEY_PGI_VERSION) && \ + !defined(JSON_HEDLEY_TINYC_VERSION) + #define JSON_HEDLEY_ARRAY_PARAM(name) (name) +#else + #define JSON_HEDLEY_ARRAY_PARAM(name) +#endif + +#if defined(JSON_HEDLEY_IS_CONSTANT) + #undef JSON_HEDLEY_IS_CONSTANT +#endif +#if defined(JSON_HEDLEY_REQUIRE_CONSTEXPR) + #undef JSON_HEDLEY_REQUIRE_CONSTEXPR +#endif +/* JSON_HEDLEY_IS_CONSTEXPR_ is for + HEDLEY INTERNAL USE ONLY. API subject to change without notice. */ +#if defined(JSON_HEDLEY_IS_CONSTEXPR_) + #undef JSON_HEDLEY_IS_CONSTEXPR_ +#endif +#if \ + JSON_HEDLEY_HAS_BUILTIN(__builtin_constant_p) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(3,4,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_TINYC_VERSION_CHECK(0,9,19) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(13,1,0) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6,1,0) || \ + (JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0) && !defined(__cplusplus)) || \ + JSON_HEDLEY_CRAY_VERSION_CHECK(8,1,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_IS_CONSTANT(expr) __builtin_constant_p(expr) +#endif +#if !defined(__cplusplus) +# if \ + JSON_HEDLEY_HAS_BUILTIN(__builtin_types_compatible_p) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(3,4,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(13,1,0) || \ + JSON_HEDLEY_CRAY_VERSION_CHECK(8,1,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(5,4,0) || \ + JSON_HEDLEY_TINYC_VERSION_CHECK(0,9,24) +#if defined(__INTPTR_TYPE__) + #define JSON_HEDLEY_IS_CONSTEXPR_(expr) __builtin_types_compatible_p(__typeof__((1 ? (void*) ((__INTPTR_TYPE__) ((expr) * 0)) : (int*) 0)), int*) +#else + #include + #define JSON_HEDLEY_IS_CONSTEXPR_(expr) __builtin_types_compatible_p(__typeof__((1 ? (void*) ((intptr_t) ((expr) * 0)) : (int*) 0)), int*) +#endif +# elif \ + ( \ + defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) && \ + !defined(JSON_HEDLEY_SUNPRO_VERSION) && \ + !defined(JSON_HEDLEY_PGI_VERSION) && \ + !defined(JSON_HEDLEY_IAR_VERSION)) || \ + (JSON_HEDLEY_HAS_EXTENSION(c_generic_selections) && !defined(JSON_HEDLEY_IAR_VERSION)) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(4,9,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(17,0,0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(12,1,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(5,3,0) +#if defined(__INTPTR_TYPE__) + #define JSON_HEDLEY_IS_CONSTEXPR_(expr) _Generic((1 ? (void*) ((__INTPTR_TYPE__) ((expr) * 0)) : (int*) 0), int*: 1, void*: 0) +#else + #include + #define JSON_HEDLEY_IS_CONSTEXPR_(expr) _Generic((1 ? (void*) ((intptr_t) * 0) : (int*) 0), int*: 1, void*: 0) +#endif +# elif \ + defined(JSON_HEDLEY_GCC_VERSION) || \ + defined(JSON_HEDLEY_INTEL_VERSION) || \ + defined(JSON_HEDLEY_TINYC_VERSION) || \ + defined(JSON_HEDLEY_TI_ARMCL_VERSION) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(18,12,0) || \ + defined(JSON_HEDLEY_TI_CL2000_VERSION) || \ + defined(JSON_HEDLEY_TI_CL6X_VERSION) || \ + defined(JSON_HEDLEY_TI_CL7X_VERSION) || \ + defined(JSON_HEDLEY_TI_CLPRU_VERSION) || \ + defined(__clang__) +# define JSON_HEDLEY_IS_CONSTEXPR_(expr) ( \ + sizeof(void) != \ + sizeof(*( \ + 1 ? \ + ((void*) ((expr) * 0L) ) : \ +((struct { char v[sizeof(void) * 2]; } *) 1) \ + ) \ + ) \ + ) +# endif +#endif +#if defined(JSON_HEDLEY_IS_CONSTEXPR_) + #if !defined(JSON_HEDLEY_IS_CONSTANT) + #define JSON_HEDLEY_IS_CONSTANT(expr) JSON_HEDLEY_IS_CONSTEXPR_(expr) + #endif + #define JSON_HEDLEY_REQUIRE_CONSTEXPR(expr) (JSON_HEDLEY_IS_CONSTEXPR_(expr) ? (expr) : (-1)) +#else + #if !defined(JSON_HEDLEY_IS_CONSTANT) + #define JSON_HEDLEY_IS_CONSTANT(expr) (0) + #endif + #define JSON_HEDLEY_REQUIRE_CONSTEXPR(expr) (expr) +#endif + +#if defined(JSON_HEDLEY_BEGIN_C_DECLS) + #undef JSON_HEDLEY_BEGIN_C_DECLS +#endif +#if defined(JSON_HEDLEY_END_C_DECLS) + #undef JSON_HEDLEY_END_C_DECLS +#endif +#if defined(JSON_HEDLEY_C_DECL) + #undef JSON_HEDLEY_C_DECL +#endif +#if defined(__cplusplus) + #define JSON_HEDLEY_BEGIN_C_DECLS extern "C" { + #define JSON_HEDLEY_END_C_DECLS } + #define JSON_HEDLEY_C_DECL extern "C" +#else + #define JSON_HEDLEY_BEGIN_C_DECLS + #define JSON_HEDLEY_END_C_DECLS + #define JSON_HEDLEY_C_DECL +#endif + +#if defined(JSON_HEDLEY_STATIC_ASSERT) + #undef JSON_HEDLEY_STATIC_ASSERT +#endif +#if \ + !defined(__cplusplus) && ( \ + (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)) || \ + (JSON_HEDLEY_HAS_FEATURE(c_static_assert) && !defined(JSON_HEDLEY_INTEL_CL_VERSION)) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(6,0,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + defined(_Static_assert) \ + ) +# define JSON_HEDLEY_STATIC_ASSERT(expr, message) _Static_assert(expr, message) +#elif \ + (defined(__cplusplus) && (__cplusplus >= 201103L)) || \ + JSON_HEDLEY_MSVC_VERSION_CHECK(16,0,0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) +# define JSON_HEDLEY_STATIC_ASSERT(expr, message) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(static_assert(expr, message)) +#else +# define JSON_HEDLEY_STATIC_ASSERT(expr, message) +#endif + +#if defined(JSON_HEDLEY_NULL) + #undef JSON_HEDLEY_NULL +#endif +#if defined(__cplusplus) + #if __cplusplus >= 201103L + #define JSON_HEDLEY_NULL JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(nullptr) + #elif defined(NULL) + #define JSON_HEDLEY_NULL NULL + #else + #define JSON_HEDLEY_NULL JSON_HEDLEY_STATIC_CAST(void*, 0) + #endif +#elif defined(NULL) + #define JSON_HEDLEY_NULL NULL +#else + #define JSON_HEDLEY_NULL ((void*) 0) +#endif + +#if defined(JSON_HEDLEY_MESSAGE) + #undef JSON_HEDLEY_MESSAGE +#endif +#if JSON_HEDLEY_HAS_WARNING("-Wunknown-pragmas") +# define JSON_HEDLEY_MESSAGE(msg) \ + JSON_HEDLEY_DIAGNOSTIC_PUSH \ + JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS \ + JSON_HEDLEY_PRAGMA(message msg) \ + JSON_HEDLEY_DIAGNOSTIC_POP +#elif \ + JSON_HEDLEY_GCC_VERSION_CHECK(4,4,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) +# define JSON_HEDLEY_MESSAGE(msg) JSON_HEDLEY_PRAGMA(message msg) +#elif JSON_HEDLEY_CRAY_VERSION_CHECK(5,0,0) +# define JSON_HEDLEY_MESSAGE(msg) JSON_HEDLEY_PRAGMA(_CRI message msg) +#elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) +# define JSON_HEDLEY_MESSAGE(msg) JSON_HEDLEY_PRAGMA(message(msg)) +#elif JSON_HEDLEY_PELLES_VERSION_CHECK(2,0,0) +# define JSON_HEDLEY_MESSAGE(msg) JSON_HEDLEY_PRAGMA(message(msg)) +#else +# define JSON_HEDLEY_MESSAGE(msg) +#endif + +#if defined(JSON_HEDLEY_WARNING) + #undef JSON_HEDLEY_WARNING +#endif +#if JSON_HEDLEY_HAS_WARNING("-Wunknown-pragmas") +# define JSON_HEDLEY_WARNING(msg) \ + JSON_HEDLEY_DIAGNOSTIC_PUSH \ + JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS \ + JSON_HEDLEY_PRAGMA(clang warning msg) \ + JSON_HEDLEY_DIAGNOSTIC_POP +#elif \ + JSON_HEDLEY_GCC_VERSION_CHECK(4,8,0) || \ + JSON_HEDLEY_PGI_VERSION_CHECK(18,4,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) +# define JSON_HEDLEY_WARNING(msg) JSON_HEDLEY_PRAGMA(GCC warning msg) +#elif \ + JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) +# define JSON_HEDLEY_WARNING(msg) JSON_HEDLEY_PRAGMA(message(msg)) +#else +# define JSON_HEDLEY_WARNING(msg) JSON_HEDLEY_MESSAGE(msg) +#endif + +#if defined(JSON_HEDLEY_REQUIRE) + #undef JSON_HEDLEY_REQUIRE +#endif +#if defined(JSON_HEDLEY_REQUIRE_MSG) + #undef JSON_HEDLEY_REQUIRE_MSG +#endif +#if JSON_HEDLEY_HAS_ATTRIBUTE(diagnose_if) +# if JSON_HEDLEY_HAS_WARNING("-Wgcc-compat") +# define JSON_HEDLEY_REQUIRE(expr) \ + JSON_HEDLEY_DIAGNOSTIC_PUSH \ + _Pragma("clang diagnostic ignored \"-Wgcc-compat\"") \ + __attribute__((diagnose_if(!(expr), #expr, "error"))) \ + JSON_HEDLEY_DIAGNOSTIC_POP +# define JSON_HEDLEY_REQUIRE_MSG(expr,msg) \ + JSON_HEDLEY_DIAGNOSTIC_PUSH \ + _Pragma("clang diagnostic ignored \"-Wgcc-compat\"") \ + __attribute__((diagnose_if(!(expr), msg, "error"))) \ + JSON_HEDLEY_DIAGNOSTIC_POP +# else +# define JSON_HEDLEY_REQUIRE(expr) __attribute__((diagnose_if(!(expr), #expr, "error"))) +# define JSON_HEDLEY_REQUIRE_MSG(expr,msg) __attribute__((diagnose_if(!(expr), msg, "error"))) +# endif +#else +# define JSON_HEDLEY_REQUIRE(expr) +# define JSON_HEDLEY_REQUIRE_MSG(expr,msg) +#endif + +#if defined(JSON_HEDLEY_FLAGS) + #undef JSON_HEDLEY_FLAGS +#endif +#if JSON_HEDLEY_HAS_ATTRIBUTE(flag_enum) && (!defined(__cplusplus) || JSON_HEDLEY_HAS_WARNING("-Wbitfield-enum-conversion")) + #define JSON_HEDLEY_FLAGS __attribute__((__flag_enum__)) +#else + #define JSON_HEDLEY_FLAGS +#endif + +#if defined(JSON_HEDLEY_FLAGS_CAST) + #undef JSON_HEDLEY_FLAGS_CAST +#endif +#if JSON_HEDLEY_INTEL_VERSION_CHECK(19,0,0) +# define JSON_HEDLEY_FLAGS_CAST(T, expr) (__extension__ ({ \ + JSON_HEDLEY_DIAGNOSTIC_PUSH \ + _Pragma("warning(disable:188)") \ + ((T) (expr)); \ + JSON_HEDLEY_DIAGNOSTIC_POP \ + })) +#else +# define JSON_HEDLEY_FLAGS_CAST(T, expr) JSON_HEDLEY_STATIC_CAST(T, expr) +#endif + +#if defined(JSON_HEDLEY_EMPTY_BASES) + #undef JSON_HEDLEY_EMPTY_BASES +#endif +#if \ + (JSON_HEDLEY_MSVC_VERSION_CHECK(19,0,23918) && !JSON_HEDLEY_MSVC_VERSION_CHECK(20,0,0)) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) + #define JSON_HEDLEY_EMPTY_BASES __declspec(empty_bases) +#else + #define JSON_HEDLEY_EMPTY_BASES +#endif + +/* Remaining macros are deprecated. */ + +#if defined(JSON_HEDLEY_GCC_NOT_CLANG_VERSION_CHECK) + #undef JSON_HEDLEY_GCC_NOT_CLANG_VERSION_CHECK +#endif +#if defined(__clang__) + #define JSON_HEDLEY_GCC_NOT_CLANG_VERSION_CHECK(major,minor,patch) (0) +#else + #define JSON_HEDLEY_GCC_NOT_CLANG_VERSION_CHECK(major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(JSON_HEDLEY_CLANG_HAS_ATTRIBUTE) + #undef JSON_HEDLEY_CLANG_HAS_ATTRIBUTE +#endif +#define JSON_HEDLEY_CLANG_HAS_ATTRIBUTE(attribute) JSON_HEDLEY_HAS_ATTRIBUTE(attribute) + +#if defined(JSON_HEDLEY_CLANG_HAS_CPP_ATTRIBUTE) + #undef JSON_HEDLEY_CLANG_HAS_CPP_ATTRIBUTE +#endif +#define JSON_HEDLEY_CLANG_HAS_CPP_ATTRIBUTE(attribute) JSON_HEDLEY_HAS_CPP_ATTRIBUTE(attribute) + +#if defined(JSON_HEDLEY_CLANG_HAS_BUILTIN) + #undef JSON_HEDLEY_CLANG_HAS_BUILTIN +#endif +#define JSON_HEDLEY_CLANG_HAS_BUILTIN(builtin) JSON_HEDLEY_HAS_BUILTIN(builtin) + +#if defined(JSON_HEDLEY_CLANG_HAS_FEATURE) + #undef JSON_HEDLEY_CLANG_HAS_FEATURE +#endif +#define JSON_HEDLEY_CLANG_HAS_FEATURE(feature) JSON_HEDLEY_HAS_FEATURE(feature) + +#if defined(JSON_HEDLEY_CLANG_HAS_EXTENSION) + #undef JSON_HEDLEY_CLANG_HAS_EXTENSION +#endif +#define JSON_HEDLEY_CLANG_HAS_EXTENSION(extension) JSON_HEDLEY_HAS_EXTENSION(extension) + +#if defined(JSON_HEDLEY_CLANG_HAS_DECLSPEC_DECLSPEC_ATTRIBUTE) + #undef JSON_HEDLEY_CLANG_HAS_DECLSPEC_DECLSPEC_ATTRIBUTE +#endif +#define JSON_HEDLEY_CLANG_HAS_DECLSPEC_ATTRIBUTE(attribute) JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE(attribute) + +#if defined(JSON_HEDLEY_CLANG_HAS_WARNING) + #undef JSON_HEDLEY_CLANG_HAS_WARNING +#endif +#define JSON_HEDLEY_CLANG_HAS_WARNING(warning) JSON_HEDLEY_HAS_WARNING(warning) + +#endif /* !defined(JSON_HEDLEY_VERSION) || (JSON_HEDLEY_VERSION < X) */ + + +// This file contains all internal macro definitions (except those affecting ABI) +// You MUST include macro_unscope.hpp at the end of json.hpp to undef all of them + +// #include + + +// exclude unsupported compilers +#if !defined(JSON_SKIP_UNSUPPORTED_COMPILER_CHECK) + #if defined(__clang__) + #if (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__) < 30400 + #error "unsupported Clang version - see https://github.com/nlohmann/json#supported-compilers" + #endif + #elif defined(__GNUC__) && !(defined(__ICC) || defined(__INTEL_COMPILER)) + #if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) < 40800 + #error "unsupported GCC version - see https://github.com/nlohmann/json#supported-compilers" + #endif + #endif +#endif + +// C++ language standard detection +// if the user manually specified the used c++ version this is skipped +#if !defined(JSON_HAS_CPP_20) && !defined(JSON_HAS_CPP_17) && !defined(JSON_HAS_CPP_14) && !defined(JSON_HAS_CPP_11) + #if (defined(__cplusplus) && __cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + #define JSON_HAS_CPP_20 + #define JSON_HAS_CPP_17 + #define JSON_HAS_CPP_14 + #elif (defined(__cplusplus) && __cplusplus >= 201703L) || (defined(_HAS_CXX17) && _HAS_CXX17 == 1) // fix for issue #464 + #define JSON_HAS_CPP_17 + #define JSON_HAS_CPP_14 + #elif (defined(__cplusplus) && __cplusplus >= 201402L) || (defined(_HAS_CXX14) && _HAS_CXX14 == 1) + #define JSON_HAS_CPP_14 + #endif + // the cpp 11 flag is always specified because it is the minimal required version + #define JSON_HAS_CPP_11 +#endif + +#ifdef __has_include + #if __has_include() + #include + #endif +#endif + +#if !defined(JSON_HAS_FILESYSTEM) && !defined(JSON_HAS_EXPERIMENTAL_FILESYSTEM) + #ifdef JSON_HAS_CPP_17 + #if defined(__cpp_lib_filesystem) + #define JSON_HAS_FILESYSTEM 1 + #elif defined(__cpp_lib_experimental_filesystem) + #define JSON_HAS_EXPERIMENTAL_FILESYSTEM 1 + #elif !defined(__has_include) + #define JSON_HAS_EXPERIMENTAL_FILESYSTEM 1 + #elif __has_include() + #define JSON_HAS_FILESYSTEM 1 + #elif __has_include() + #define JSON_HAS_EXPERIMENTAL_FILESYSTEM 1 + #endif + + // std::filesystem does not work on MinGW GCC 8: https://sourceforge.net/p/mingw-w64/bugs/737/ + #if defined(__MINGW32__) && defined(__GNUC__) && __GNUC__ == 8 + #undef JSON_HAS_FILESYSTEM + #undef JSON_HAS_EXPERIMENTAL_FILESYSTEM + #endif + + // no filesystem support before GCC 8: https://en.cppreference.com/w/cpp/compiler_support + #if defined(__GNUC__) && !defined(__clang__) && __GNUC__ < 8 + #undef JSON_HAS_FILESYSTEM + #undef JSON_HAS_EXPERIMENTAL_FILESYSTEM + #endif + + // no filesystem support before Clang 7: https://en.cppreference.com/w/cpp/compiler_support + #if defined(__clang_major__) && __clang_major__ < 7 + #undef JSON_HAS_FILESYSTEM + #undef JSON_HAS_EXPERIMENTAL_FILESYSTEM + #endif + + // no filesystem support before MSVC 19.14: https://en.cppreference.com/w/cpp/compiler_support + #if defined(_MSC_VER) && _MSC_VER < 1914 + #undef JSON_HAS_FILESYSTEM + #undef JSON_HAS_EXPERIMENTAL_FILESYSTEM + #endif + + // no filesystem support before iOS 13 + #if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED < 130000 + #undef JSON_HAS_FILESYSTEM + #undef JSON_HAS_EXPERIMENTAL_FILESYSTEM + #endif + + // no filesystem support before macOS Catalina + #if defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101500 + #undef JSON_HAS_FILESYSTEM + #undef JSON_HAS_EXPERIMENTAL_FILESYSTEM + #endif + #endif +#endif + +#ifndef JSON_HAS_EXPERIMENTAL_FILESYSTEM + #define JSON_HAS_EXPERIMENTAL_FILESYSTEM 0 +#endif + +#ifndef JSON_HAS_FILESYSTEM + #define JSON_HAS_FILESYSTEM 0 +#endif + +#ifndef JSON_HAS_THREE_WAY_COMPARISON + #if defined(__cpp_impl_three_way_comparison) && __cpp_impl_three_way_comparison >= 201907L \ + && defined(__cpp_lib_three_way_comparison) && __cpp_lib_three_way_comparison >= 201907L + #define JSON_HAS_THREE_WAY_COMPARISON 1 + #else + #define JSON_HAS_THREE_WAY_COMPARISON 0 + #endif +#endif + +#ifndef JSON_HAS_RANGES + // ranges header shipping in GCC 11.1.0 (released 2021-04-27) has syntax error + #if defined(__GLIBCXX__) && __GLIBCXX__ == 20210427 + #define JSON_HAS_RANGES 0 + #elif defined(__cpp_lib_ranges) + #define JSON_HAS_RANGES 1 + #else + #define JSON_HAS_RANGES 0 + #endif +#endif + +#ifdef JSON_HAS_CPP_17 + #define JSON_INLINE_VARIABLE inline +#else + #define JSON_INLINE_VARIABLE +#endif + +#if JSON_HEDLEY_HAS_ATTRIBUTE(no_unique_address) + #define JSON_NO_UNIQUE_ADDRESS [[no_unique_address]] +#else + #define JSON_NO_UNIQUE_ADDRESS +#endif + +// disable documentation warnings on clang +#if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wdocumentation" + #pragma clang diagnostic ignored "-Wdocumentation-unknown-command" +#endif + +// allow disabling exceptions +#if (defined(__cpp_exceptions) || defined(__EXCEPTIONS) || defined(_CPPUNWIND)) && !defined(JSON_NOEXCEPTION) + #define JSON_THROW(exception) throw exception + #define JSON_TRY try + #define JSON_CATCH(exception) catch(exception) + #define JSON_INTERNAL_CATCH(exception) catch(exception) +#else + #include + #define JSON_THROW(exception) std::abort() + #define JSON_TRY if(true) + #define JSON_CATCH(exception) if(false) + #define JSON_INTERNAL_CATCH(exception) if(false) +#endif + +// override exception macros +#if defined(JSON_THROW_USER) + #undef JSON_THROW + #define JSON_THROW JSON_THROW_USER +#endif +#if defined(JSON_TRY_USER) + #undef JSON_TRY + #define JSON_TRY JSON_TRY_USER +#endif +#if defined(JSON_CATCH_USER) + #undef JSON_CATCH + #define JSON_CATCH JSON_CATCH_USER + #undef JSON_INTERNAL_CATCH + #define JSON_INTERNAL_CATCH JSON_CATCH_USER +#endif +#if defined(JSON_INTERNAL_CATCH_USER) + #undef JSON_INTERNAL_CATCH + #define JSON_INTERNAL_CATCH JSON_INTERNAL_CATCH_USER +#endif + +// allow overriding assert +#if !defined(JSON_ASSERT) + #include // assert + #define JSON_ASSERT(x) assert(x) +#endif + +// allow to access some private functions (needed by the test suite) +#if defined(JSON_TESTS_PRIVATE) + #define JSON_PRIVATE_UNLESS_TESTED public +#else + #define JSON_PRIVATE_UNLESS_TESTED private +#endif + +/*! +@brief macro to briefly define a mapping between an enum and JSON +@def NLOHMANN_JSON_SERIALIZE_ENUM +@since version 3.4.0 +*/ +#define NLOHMANN_JSON_SERIALIZE_ENUM(ENUM_TYPE, ...) \ + template \ + inline void to_json(BasicJsonType& j, const ENUM_TYPE& e) \ + { \ + static_assert(std::is_enum::value, #ENUM_TYPE " must be an enum!"); \ + static const std::pair m[] = __VA_ARGS__; \ + auto it = std::find_if(std::begin(m), std::end(m), \ + [e](const std::pair& ej_pair) -> bool \ + { \ + return ej_pair.first == e; \ + }); \ + j = ((it != std::end(m)) ? it : std::begin(m))->second; \ + } \ + template \ + inline void from_json(const BasicJsonType& j, ENUM_TYPE& e) \ + { \ + static_assert(std::is_enum::value, #ENUM_TYPE " must be an enum!"); \ + static const std::pair m[] = __VA_ARGS__; \ + auto it = std::find_if(std::begin(m), std::end(m), \ + [&j](const std::pair& ej_pair) -> bool \ + { \ + return ej_pair.second == j; \ + }); \ + e = ((it != std::end(m)) ? it : std::begin(m))->first; \ + } + +// Ugly macros to avoid uglier copy-paste when specializing basic_json. They +// may be removed in the future once the class is split. + +#define NLOHMANN_BASIC_JSON_TPL_DECLARATION \ + template class ObjectType, \ + template class ArrayType, \ + class StringType, class BooleanType, class NumberIntegerType, \ + class NumberUnsignedType, class NumberFloatType, \ + template class AllocatorType, \ + template class JSONSerializer, \ + class BinaryType> + +#define NLOHMANN_BASIC_JSON_TPL \ + basic_json + +// Macros to simplify conversion from/to types + +#define NLOHMANN_JSON_EXPAND( x ) x +#define NLOHMANN_JSON_GET_MACRO(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, _61, _62, _63, _64, NAME,...) NAME +#define NLOHMANN_JSON_PASTE(...) NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_GET_MACRO(__VA_ARGS__, \ + NLOHMANN_JSON_PASTE64, \ + NLOHMANN_JSON_PASTE63, \ + NLOHMANN_JSON_PASTE62, \ + NLOHMANN_JSON_PASTE61, \ + NLOHMANN_JSON_PASTE60, \ + NLOHMANN_JSON_PASTE59, \ + NLOHMANN_JSON_PASTE58, \ + NLOHMANN_JSON_PASTE57, \ + NLOHMANN_JSON_PASTE56, \ + NLOHMANN_JSON_PASTE55, \ + NLOHMANN_JSON_PASTE54, \ + NLOHMANN_JSON_PASTE53, \ + NLOHMANN_JSON_PASTE52, \ + NLOHMANN_JSON_PASTE51, \ + NLOHMANN_JSON_PASTE50, \ + NLOHMANN_JSON_PASTE49, \ + NLOHMANN_JSON_PASTE48, \ + NLOHMANN_JSON_PASTE47, \ + NLOHMANN_JSON_PASTE46, \ + NLOHMANN_JSON_PASTE45, \ + NLOHMANN_JSON_PASTE44, \ + NLOHMANN_JSON_PASTE43, \ + NLOHMANN_JSON_PASTE42, \ + NLOHMANN_JSON_PASTE41, \ + NLOHMANN_JSON_PASTE40, \ + NLOHMANN_JSON_PASTE39, \ + NLOHMANN_JSON_PASTE38, \ + NLOHMANN_JSON_PASTE37, \ + NLOHMANN_JSON_PASTE36, \ + NLOHMANN_JSON_PASTE35, \ + NLOHMANN_JSON_PASTE34, \ + NLOHMANN_JSON_PASTE33, \ + NLOHMANN_JSON_PASTE32, \ + NLOHMANN_JSON_PASTE31, \ + NLOHMANN_JSON_PASTE30, \ + NLOHMANN_JSON_PASTE29, \ + NLOHMANN_JSON_PASTE28, \ + NLOHMANN_JSON_PASTE27, \ + NLOHMANN_JSON_PASTE26, \ + NLOHMANN_JSON_PASTE25, \ + NLOHMANN_JSON_PASTE24, \ + NLOHMANN_JSON_PASTE23, \ + NLOHMANN_JSON_PASTE22, \ + NLOHMANN_JSON_PASTE21, \ + NLOHMANN_JSON_PASTE20, \ + NLOHMANN_JSON_PASTE19, \ + NLOHMANN_JSON_PASTE18, \ + NLOHMANN_JSON_PASTE17, \ + NLOHMANN_JSON_PASTE16, \ + NLOHMANN_JSON_PASTE15, \ + NLOHMANN_JSON_PASTE14, \ + NLOHMANN_JSON_PASTE13, \ + NLOHMANN_JSON_PASTE12, \ + NLOHMANN_JSON_PASTE11, \ + NLOHMANN_JSON_PASTE10, \ + NLOHMANN_JSON_PASTE9, \ + NLOHMANN_JSON_PASTE8, \ + NLOHMANN_JSON_PASTE7, \ + NLOHMANN_JSON_PASTE6, \ + NLOHMANN_JSON_PASTE5, \ + NLOHMANN_JSON_PASTE4, \ + NLOHMANN_JSON_PASTE3, \ + NLOHMANN_JSON_PASTE2, \ + NLOHMANN_JSON_PASTE1)(__VA_ARGS__)) +#define NLOHMANN_JSON_PASTE2(func, v1) func(v1) +#define NLOHMANN_JSON_PASTE3(func, v1, v2) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE2(func, v2) +#define NLOHMANN_JSON_PASTE4(func, v1, v2, v3) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE3(func, v2, v3) +#define NLOHMANN_JSON_PASTE5(func, v1, v2, v3, v4) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE4(func, v2, v3, v4) +#define NLOHMANN_JSON_PASTE6(func, v1, v2, v3, v4, v5) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE5(func, v2, v3, v4, v5) +#define NLOHMANN_JSON_PASTE7(func, v1, v2, v3, v4, v5, v6) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE6(func, v2, v3, v4, v5, v6) +#define NLOHMANN_JSON_PASTE8(func, v1, v2, v3, v4, v5, v6, v7) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE7(func, v2, v3, v4, v5, v6, v7) +#define NLOHMANN_JSON_PASTE9(func, v1, v2, v3, v4, v5, v6, v7, v8) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE8(func, v2, v3, v4, v5, v6, v7, v8) +#define NLOHMANN_JSON_PASTE10(func, v1, v2, v3, v4, v5, v6, v7, v8, v9) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE9(func, v2, v3, v4, v5, v6, v7, v8, v9) +#define NLOHMANN_JSON_PASTE11(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE10(func, v2, v3, v4, v5, v6, v7, v8, v9, v10) +#define NLOHMANN_JSON_PASTE12(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE11(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11) +#define NLOHMANN_JSON_PASTE13(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE12(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12) +#define NLOHMANN_JSON_PASTE14(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE13(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13) +#define NLOHMANN_JSON_PASTE15(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE14(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14) +#define NLOHMANN_JSON_PASTE16(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE15(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15) +#define NLOHMANN_JSON_PASTE17(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE16(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16) +#define NLOHMANN_JSON_PASTE18(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE17(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17) +#define NLOHMANN_JSON_PASTE19(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE18(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18) +#define NLOHMANN_JSON_PASTE20(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE19(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19) +#define NLOHMANN_JSON_PASTE21(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE20(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20) +#define NLOHMANN_JSON_PASTE22(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE21(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21) +#define NLOHMANN_JSON_PASTE23(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE22(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22) +#define NLOHMANN_JSON_PASTE24(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE23(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23) +#define NLOHMANN_JSON_PASTE25(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE24(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24) +#define NLOHMANN_JSON_PASTE26(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE25(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25) +#define NLOHMANN_JSON_PASTE27(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE26(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26) +#define NLOHMANN_JSON_PASTE28(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE27(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27) +#define NLOHMANN_JSON_PASTE29(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE28(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28) +#define NLOHMANN_JSON_PASTE30(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE29(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29) +#define NLOHMANN_JSON_PASTE31(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE30(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30) +#define NLOHMANN_JSON_PASTE32(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE31(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31) +#define NLOHMANN_JSON_PASTE33(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE32(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32) +#define NLOHMANN_JSON_PASTE34(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE33(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33) +#define NLOHMANN_JSON_PASTE35(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE34(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34) +#define NLOHMANN_JSON_PASTE36(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE35(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35) +#define NLOHMANN_JSON_PASTE37(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE36(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36) +#define NLOHMANN_JSON_PASTE38(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE37(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37) +#define NLOHMANN_JSON_PASTE39(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE38(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38) +#define NLOHMANN_JSON_PASTE40(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE39(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39) +#define NLOHMANN_JSON_PASTE41(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE40(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40) +#define NLOHMANN_JSON_PASTE42(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE41(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41) +#define NLOHMANN_JSON_PASTE43(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE42(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42) +#define NLOHMANN_JSON_PASTE44(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE43(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43) +#define NLOHMANN_JSON_PASTE45(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE44(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44) +#define NLOHMANN_JSON_PASTE46(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE45(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45) +#define NLOHMANN_JSON_PASTE47(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE46(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46) +#define NLOHMANN_JSON_PASTE48(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE47(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47) +#define NLOHMANN_JSON_PASTE49(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE48(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48) +#define NLOHMANN_JSON_PASTE50(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE49(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49) +#define NLOHMANN_JSON_PASTE51(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE50(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50) +#define NLOHMANN_JSON_PASTE52(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE51(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51) +#define NLOHMANN_JSON_PASTE53(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE52(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52) +#define NLOHMANN_JSON_PASTE54(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE53(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53) +#define NLOHMANN_JSON_PASTE55(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE54(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54) +#define NLOHMANN_JSON_PASTE56(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE55(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55) +#define NLOHMANN_JSON_PASTE57(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE56(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56) +#define NLOHMANN_JSON_PASTE58(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE57(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57) +#define NLOHMANN_JSON_PASTE59(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE58(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58) +#define NLOHMANN_JSON_PASTE60(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE59(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59) +#define NLOHMANN_JSON_PASTE61(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE60(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60) +#define NLOHMANN_JSON_PASTE62(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE61(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61) +#define NLOHMANN_JSON_PASTE63(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61, v62) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE62(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61, v62) +#define NLOHMANN_JSON_PASTE64(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61, v62, v63) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE63(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61, v62, v63) + +#define NLOHMANN_JSON_TO(v1) nlohmann_json_j[#v1] = nlohmann_json_t.v1; +#define NLOHMANN_JSON_FROM(v1) nlohmann_json_j.at(#v1).get_to(nlohmann_json_t.v1); +#define NLOHMANN_JSON_FROM_WITH_DEFAULT(v1) nlohmann_json_t.v1 = nlohmann_json_j.value(#v1, nlohmann_json_default_obj.v1); + +/*! +@brief macro +@def NLOHMANN_DEFINE_TYPE_INTRUSIVE +@since version 3.9.0 +*/ +#define NLOHMANN_DEFINE_TYPE_INTRUSIVE(Type, ...) \ + friend void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \ + friend void from_json(const nlohmann::json& nlohmann_json_j, Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM, __VA_ARGS__)) } + +#define NLOHMANN_DEFINE_TYPE_INTRUSIVE_WITH_DEFAULT(Type, ...) \ + friend void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \ + friend void from_json(const nlohmann::json& nlohmann_json_j, Type& nlohmann_json_t) { Type nlohmann_json_default_obj; NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM_WITH_DEFAULT, __VA_ARGS__)) } + +/*! +@brief macro +@def NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE +@since version 3.9.0 +*/ +#define NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(Type, ...) \ + inline void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \ + inline void from_json(const nlohmann::json& nlohmann_json_j, Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM, __VA_ARGS__)) } + +#define NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT(Type, ...) \ + inline void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \ + inline void from_json(const nlohmann::json& nlohmann_json_j, Type& nlohmann_json_t) { Type nlohmann_json_default_obj; NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM_WITH_DEFAULT, __VA_ARGS__)) } + + +// inspired from https://stackoverflow.com/a/26745591 +// allows to call any std function as if (e.g. with begin): +// using std::begin; begin(x); +// +// it allows using the detected idiom to retrieve the return type +// of such an expression +#define NLOHMANN_CAN_CALL_STD_FUNC_IMPL(std_name) \ + namespace detail { \ + using std::std_name; \ + \ + template \ + using result_of_##std_name = decltype(std_name(std::declval()...)); \ + } \ + \ + namespace detail2 { \ + struct std_name##_tag \ + { \ + }; \ + \ + template \ + std_name##_tag std_name(T&&...); \ + \ + template \ + using result_of_##std_name = decltype(std_name(std::declval()...)); \ + \ + template \ + struct would_call_std_##std_name \ + { \ + static constexpr auto const value = ::nlohmann::detail:: \ + is_detected_exact::value; \ + }; \ + } /* namespace detail2 */ \ + \ + template \ + struct would_call_std_##std_name : detail2::would_call_std_##std_name \ + { \ + } + +#ifndef JSON_USE_IMPLICIT_CONVERSIONS + #define JSON_USE_IMPLICIT_CONVERSIONS 1 +#endif + +#if JSON_USE_IMPLICIT_CONVERSIONS + #define JSON_EXPLICIT +#else + #define JSON_EXPLICIT explicit +#endif + +#ifndef JSON_DISABLE_ENUM_SERIALIZATION + #define JSON_DISABLE_ENUM_SERIALIZATION 0 +#endif + +#ifndef JSON_USE_GLOBAL_UDLS + #define JSON_USE_GLOBAL_UDLS 1 +#endif + +#if JSON_HAS_THREE_WAY_COMPARISON + #include // partial_ordering +#endif + +NLOHMANN_JSON_NAMESPACE_BEGIN +namespace detail +{ + +/////////////////////////// +// JSON type enumeration // +/////////////////////////// + +/*! +@brief the JSON type enumeration + +This enumeration collects the different JSON types. It is internally used to +distinguish the stored values, and the functions @ref basic_json::is_null(), +@ref basic_json::is_object(), @ref basic_json::is_array(), +@ref basic_json::is_string(), @ref basic_json::is_boolean(), +@ref basic_json::is_number() (with @ref basic_json::is_number_integer(), +@ref basic_json::is_number_unsigned(), and @ref basic_json::is_number_float()), +@ref basic_json::is_discarded(), @ref basic_json::is_primitive(), and +@ref basic_json::is_structured() rely on it. + +@note There are three enumeration entries (number_integer, number_unsigned, and +number_float), because the library distinguishes these three types for numbers: +@ref basic_json::number_unsigned_t is used for unsigned integers, +@ref basic_json::number_integer_t is used for signed integers, and +@ref basic_json::number_float_t is used for floating-point numbers or to +approximate integers which do not fit in the limits of their respective type. + +@sa see @ref basic_json::basic_json(const value_t value_type) -- create a JSON +value with the default value for a given type + +@since version 1.0.0 +*/ +enum class value_t : std::uint8_t +{ + null, ///< null value + object, ///< object (unordered set of name/value pairs) + array, ///< array (ordered collection of values) + string, ///< string value + boolean, ///< boolean value + number_integer, ///< number value (signed integer) + number_unsigned, ///< number value (unsigned integer) + number_float, ///< number value (floating-point) + binary, ///< binary array (ordered collection of bytes) + discarded ///< discarded by the parser callback function +}; + +/*! +@brief comparison operator for JSON types + +Returns an ordering that is similar to Python: +- order: null < boolean < number < object < array < string < binary +- furthermore, each type is not smaller than itself +- discarded values are not comparable +- binary is represented as a b"" string in python and directly comparable to a + string; however, making a binary array directly comparable with a string would + be surprising behavior in a JSON file. + +@since version 1.0.0 +*/ +#if JSON_HAS_THREE_WAY_COMPARISON + inline std::partial_ordering operator<=>(const value_t lhs, const value_t rhs) noexcept // *NOPAD* +#else + inline bool operator<(const value_t lhs, const value_t rhs) noexcept +#endif +{ + static constexpr std::array order = {{ + 0 /* null */, 3 /* object */, 4 /* array */, 5 /* string */, + 1 /* boolean */, 2 /* integer */, 2 /* unsigned */, 2 /* float */, + 6 /* binary */ + } + }; + + const auto l_index = static_cast(lhs); + const auto r_index = static_cast(rhs); +#if JSON_HAS_THREE_WAY_COMPARISON + if (l_index < order.size() && r_index < order.size()) + { + return order[l_index] <=> order[r_index]; // *NOPAD* + } + return std::partial_ordering::unordered; +#else + return l_index < order.size() && r_index < order.size() && order[l_index] < order[r_index]; +#endif +} + +// GCC selects the built-in operator< over an operator rewritten from +// a user-defined spaceship operator +// Clang, MSVC, and ICC select the rewritten candidate +// (see GCC bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105200) +#if JSON_HAS_THREE_WAY_COMPARISON && defined(__GNUC__) +inline bool operator<(const value_t lhs, const value_t rhs) noexcept +{ + return std::is_lt(lhs <=> rhs); // *NOPAD* +} +#endif + +} // namespace detail +NLOHMANN_JSON_NAMESPACE_END + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.2 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +// #include + + +NLOHMANN_JSON_NAMESPACE_BEGIN +namespace detail +{ + +/*! +@brief replace all occurrences of a substring by another string + +@param[in,out] s the string to manipulate; changed so that all + occurrences of @a f are replaced with @a t +@param[in] f the substring to replace with @a t +@param[in] t the string to replace @a f + +@pre The search string @a f must not be empty. **This precondition is +enforced with an assertion.** + +@since version 2.0.0 +*/ +template +inline void replace_substring(StringType& s, const StringType& f, + const StringType& t) +{ + JSON_ASSERT(!f.empty()); + for (auto pos = s.find(f); // find first occurrence of f + pos != StringType::npos; // make sure f was found + s.replace(pos, f.size(), t), // replace with t, and + pos = s.find(f, pos + t.size())) // find next occurrence of f + {} +} + +/*! + * @brief string escaping as described in RFC 6901 (Sect. 4) + * @param[in] s string to escape + * @return escaped string + * + * Note the order of escaping "~" to "~0" and "/" to "~1" is important. + */ +template +inline StringType escape(StringType s) +{ + replace_substring(s, StringType{"~"}, StringType{"~0"}); + replace_substring(s, StringType{"/"}, StringType{"~1"}); + return s; +} + +/*! + * @brief string unescaping as described in RFC 6901 (Sect. 4) + * @param[in] s string to unescape + * @return unescaped string + * + * Note the order of escaping "~1" to "/" and "~0" to "~" is important. + */ +template +static void unescape(StringType& s) +{ + replace_substring(s, StringType{"~1"}, StringType{"/"}); + replace_substring(s, StringType{"~0"}, StringType{"~"}); +} + +} // namespace detail +NLOHMANN_JSON_NAMESPACE_END + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.2 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +#include // size_t + +// #include + + +NLOHMANN_JSON_NAMESPACE_BEGIN +namespace detail +{ + +/// struct to capture the start position of the current token +struct position_t +{ + /// the total number of characters read + std::size_t chars_read_total = 0; + /// the number of characters read in the current line + std::size_t chars_read_current_line = 0; + /// the number of lines read + std::size_t lines_read = 0; + + /// conversion to size_t to preserve SAX interface + constexpr operator size_t() const + { + return chars_read_total; + } +}; + +} // namespace detail +NLOHMANN_JSON_NAMESPACE_END + +// #include + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.2 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann +// SPDX-FileCopyrightText: 2018 The Abseil Authors +// SPDX-License-Identifier: MIT + + + +#include // array +#include // size_t +#include // conditional, enable_if, false_type, integral_constant, is_constructible, is_integral, is_same, remove_cv, remove_reference, true_type +#include // index_sequence, make_index_sequence, index_sequence_for + +// #include + + +NLOHMANN_JSON_NAMESPACE_BEGIN +namespace detail +{ + +template +using uncvref_t = typename std::remove_cv::type>::type; + +#ifdef JSON_HAS_CPP_14 + +// the following utilities are natively available in C++14 +using std::enable_if_t; +using std::index_sequence; +using std::make_index_sequence; +using std::index_sequence_for; + +#else + +// alias templates to reduce boilerplate +template +using enable_if_t = typename std::enable_if::type; + +// The following code is taken from https://github.com/abseil/abseil-cpp/blob/10cb35e459f5ecca5b2ff107635da0bfa41011b4/absl/utility/utility.h +// which is part of Google Abseil (https://github.com/abseil/abseil-cpp), licensed under the Apache License 2.0. + +//// START OF CODE FROM GOOGLE ABSEIL + +// integer_sequence +// +// Class template representing a compile-time integer sequence. An instantiation +// of `integer_sequence` has a sequence of integers encoded in its +// type through its template arguments (which is a common need when +// working with C++11 variadic templates). `absl::integer_sequence` is designed +// to be a drop-in replacement for C++14's `std::integer_sequence`. +// +// Example: +// +// template< class T, T... Ints > +// void user_function(integer_sequence); +// +// int main() +// { +// // user_function's `T` will be deduced to `int` and `Ints...` +// // will be deduced to `0, 1, 2, 3, 4`. +// user_function(make_integer_sequence()); +// } +template +struct integer_sequence +{ + using value_type = T; + static constexpr std::size_t size() noexcept + { + return sizeof...(Ints); + } +}; + +// index_sequence +// +// A helper template for an `integer_sequence` of `size_t`, +// `absl::index_sequence` is designed to be a drop-in replacement for C++14's +// `std::index_sequence`. +template +using index_sequence = integer_sequence; + +namespace utility_internal +{ + +template +struct Extend; + +// Note that SeqSize == sizeof...(Ints). It's passed explicitly for efficiency. +template +struct Extend, SeqSize, 0> +{ + using type = integer_sequence < T, Ints..., (Ints + SeqSize)... >; +}; + +template +struct Extend, SeqSize, 1> +{ + using type = integer_sequence < T, Ints..., (Ints + SeqSize)..., 2 * SeqSize >; +}; + +// Recursion helper for 'make_integer_sequence'. +// 'Gen::type' is an alias for 'integer_sequence'. +template +struct Gen +{ + using type = + typename Extend < typename Gen < T, N / 2 >::type, N / 2, N % 2 >::type; +}; + +template +struct Gen +{ + using type = integer_sequence; +}; + +} // namespace utility_internal + +// Compile-time sequences of integers + +// make_integer_sequence +// +// This template alias is equivalent to +// `integer_sequence`, and is designed to be a drop-in +// replacement for C++14's `std::make_integer_sequence`. +template +using make_integer_sequence = typename utility_internal::Gen::type; + +// make_index_sequence +// +// This template alias is equivalent to `index_sequence<0, 1, ..., N-1>`, +// and is designed to be a drop-in replacement for C++14's +// `std::make_index_sequence`. +template +using make_index_sequence = make_integer_sequence; + +// index_sequence_for +// +// Converts a typename pack into an index sequence of the same length, and +// is designed to be a drop-in replacement for C++14's +// `std::index_sequence_for()` +template +using index_sequence_for = make_index_sequence; + +//// END OF CODE FROM GOOGLE ABSEIL + +#endif + +// dispatch utility (taken from ranges-v3) +template struct priority_tag : priority_tag < N - 1 > {}; +template<> struct priority_tag<0> {}; + +// taken from ranges-v3 +template +struct static_const +{ + static JSON_INLINE_VARIABLE constexpr T value{}; +}; + +#ifndef JSON_HAS_CPP_17 + template + constexpr T static_const::value; +#endif + +template +inline constexpr std::array make_array(Args&& ... args) +{ + return std::array {{static_cast(std::forward(args))...}}; +} + +} // namespace detail +NLOHMANN_JSON_NAMESPACE_END + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.2 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +#include // numeric_limits +#include // false_type, is_constructible, is_integral, is_same, true_type +#include // declval +#include // tuple + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.2 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +#include // random_access_iterator_tag + +// #include + +// #include + +// #include + + +NLOHMANN_JSON_NAMESPACE_BEGIN +namespace detail +{ + +template +struct iterator_types {}; + +template +struct iterator_types < + It, + void_t> +{ + using difference_type = typename It::difference_type; + using value_type = typename It::value_type; + using pointer = typename It::pointer; + using reference = typename It::reference; + using iterator_category = typename It::iterator_category; +}; + +// This is required as some compilers implement std::iterator_traits in a way that +// doesn't work with SFINAE. See https://github.com/nlohmann/json/issues/1341. +template +struct iterator_traits +{ +}; + +template +struct iterator_traits < T, enable_if_t < !std::is_pointer::value >> + : iterator_types +{ +}; + +template +struct iterator_traits::value>> +{ + using iterator_category = std::random_access_iterator_tag; + using value_type = T; + using difference_type = ptrdiff_t; + using pointer = T*; + using reference = T&; +}; + +} // namespace detail +NLOHMANN_JSON_NAMESPACE_END + +// #include + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.2 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +// #include + + +NLOHMANN_JSON_NAMESPACE_BEGIN + +NLOHMANN_CAN_CALL_STD_FUNC_IMPL(begin); + +NLOHMANN_JSON_NAMESPACE_END + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.2 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +// #include + + +NLOHMANN_JSON_NAMESPACE_BEGIN + +NLOHMANN_CAN_CALL_STD_FUNC_IMPL(end); + +NLOHMANN_JSON_NAMESPACE_END + +// #include + +// #include + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.2 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann +// SPDX-License-Identifier: MIT + +#ifndef INCLUDE_NLOHMANN_JSON_FWD_HPP_ + #define INCLUDE_NLOHMANN_JSON_FWD_HPP_ + + #include // int64_t, uint64_t + #include // map + #include // allocator + #include // string + #include // vector + + // #include + + + /*! + @brief namespace for Niels Lohmann + @see https://github.com/nlohmann + @since version 1.0.0 + */ + NLOHMANN_JSON_NAMESPACE_BEGIN + + /*! + @brief default JSONSerializer template argument + + This serializer ignores the template arguments and uses ADL + ([argument-dependent lookup](https://en.cppreference.com/w/cpp/language/adl)) + for serialization. + */ + template + struct adl_serializer; + + /// a class to store JSON values + /// @sa https://json.nlohmann.me/api/basic_json/ + template class ObjectType = + std::map, + template class ArrayType = std::vector, + class StringType = std::string, class BooleanType = bool, + class NumberIntegerType = std::int64_t, + class NumberUnsignedType = std::uint64_t, + class NumberFloatType = double, + template class AllocatorType = std::allocator, + template class JSONSerializer = + adl_serializer, + class BinaryType = std::vector> + class basic_json; + + /// @brief JSON Pointer defines a string syntax for identifying a specific value within a JSON document + /// @sa https://json.nlohmann.me/api/json_pointer/ + template + class json_pointer; + + /*! + @brief default specialization + @sa https://json.nlohmann.me/api/json/ + */ + using json = basic_json<>; + + /// @brief a minimal map-like container that preserves insertion order + /// @sa https://json.nlohmann.me/api/ordered_map/ + template + struct ordered_map; + + /// @brief specialization that maintains the insertion order of object keys + /// @sa https://json.nlohmann.me/api/ordered_json/ + using ordered_json = basic_json; + + NLOHMANN_JSON_NAMESPACE_END + +#endif // INCLUDE_NLOHMANN_JSON_FWD_HPP_ + + +NLOHMANN_JSON_NAMESPACE_BEGIN +/*! +@brief detail namespace with internal helper functions + +This namespace collects functions that should not be exposed, +implementations of some @ref basic_json methods, and meta-programming helpers. + +@since version 2.1.0 +*/ +namespace detail +{ + +///////////// +// helpers // +///////////// + +// Note to maintainers: +// +// Every trait in this file expects a non CV-qualified type. +// The only exceptions are in the 'aliases for detected' section +// (i.e. those of the form: decltype(T::member_function(std::declval()))) +// +// In this case, T has to be properly CV-qualified to constraint the function arguments +// (e.g. to_json(BasicJsonType&, const T&)) + +template struct is_basic_json : std::false_type {}; + +NLOHMANN_BASIC_JSON_TPL_DECLARATION +struct is_basic_json : std::true_type {}; + +// used by exceptions create() member functions +// true_type for pointer to possibly cv-qualified basic_json or std::nullptr_t +// false_type otherwise +template +struct is_basic_json_context : + std::integral_constant < bool, + is_basic_json::type>::type>::value + || std::is_same::value > +{}; + +////////////////////// +// json_ref helpers // +////////////////////// + +template +class json_ref; + +template +struct is_json_ref : std::false_type {}; + +template +struct is_json_ref> : std::true_type {}; + +////////////////////////// +// aliases for detected // +////////////////////////// + +template +using mapped_type_t = typename T::mapped_type; + +template +using key_type_t = typename T::key_type; + +template +using value_type_t = typename T::value_type; + +template +using difference_type_t = typename T::difference_type; + +template +using pointer_t = typename T::pointer; + +template +using reference_t = typename T::reference; + +template +using iterator_category_t = typename T::iterator_category; + +template +using to_json_function = decltype(T::to_json(std::declval()...)); + +template +using from_json_function = decltype(T::from_json(std::declval()...)); + +template +using get_template_function = decltype(std::declval().template get()); + +// trait checking if JSONSerializer::from_json(json const&, udt&) exists +template +struct has_from_json : std::false_type {}; + +// trait checking if j.get is valid +// use this trait instead of std::is_constructible or std::is_convertible, +// both rely on, or make use of implicit conversions, and thus fail when T +// has several constructors/operator= (see https://github.com/nlohmann/json/issues/958) +template +struct is_getable +{ + static constexpr bool value = is_detected::value; +}; + +template +struct has_from_json < BasicJsonType, T, enable_if_t < !is_basic_json::value >> +{ + using serializer = typename BasicJsonType::template json_serializer; + + static constexpr bool value = + is_detected_exact::value; +}; + +// This trait checks if JSONSerializer::from_json(json const&) exists +// this overload is used for non-default-constructible user-defined-types +template +struct has_non_default_from_json : std::false_type {}; + +template +struct has_non_default_from_json < BasicJsonType, T, enable_if_t < !is_basic_json::value >> +{ + using serializer = typename BasicJsonType::template json_serializer; + + static constexpr bool value = + is_detected_exact::value; +}; + +// This trait checks if BasicJsonType::json_serializer::to_json exists +// Do not evaluate the trait when T is a basic_json type, to avoid template instantiation infinite recursion. +template +struct has_to_json : std::false_type {}; + +template +struct has_to_json < BasicJsonType, T, enable_if_t < !is_basic_json::value >> +{ + using serializer = typename BasicJsonType::template json_serializer; + + static constexpr bool value = + is_detected_exact::value; +}; + +template +using detect_key_compare = typename T::key_compare; + +template +struct has_key_compare : std::integral_constant::value> {}; + +// obtains the actual object key comparator +template +struct actual_object_comparator +{ + using object_t = typename BasicJsonType::object_t; + using object_comparator_t = typename BasicJsonType::default_object_comparator_t; + using type = typename std::conditional < has_key_compare::value, + typename object_t::key_compare, object_comparator_t>::type; +}; + +template +using actual_object_comparator_t = typename actual_object_comparator::type; + +/////////////////// +// is_ functions // +/////////////////// + +// https://en.cppreference.com/w/cpp/types/conjunction +template struct conjunction : std::true_type { }; +template struct conjunction : B { }; +template +struct conjunction +: std::conditional(B::value), conjunction, B>::type {}; + +// https://en.cppreference.com/w/cpp/types/negation +template struct negation : std::integral_constant < bool, !B::value > { }; + +// Reimplementation of is_constructible and is_default_constructible, due to them being broken for +// std::pair and std::tuple until LWG 2367 fix (see https://cplusplus.github.io/LWG/lwg-defects.html#2367). +// This causes compile errors in e.g. clang 3.5 or gcc 4.9. +template +struct is_default_constructible : std::is_default_constructible {}; + +template +struct is_default_constructible> + : conjunction, is_default_constructible> {}; + +template +struct is_default_constructible> + : conjunction, is_default_constructible> {}; + +template +struct is_default_constructible> + : conjunction...> {}; + +template +struct is_default_constructible> + : conjunction...> {}; + + +template +struct is_constructible : std::is_constructible {}; + +template +struct is_constructible> : is_default_constructible> {}; + +template +struct is_constructible> : is_default_constructible> {}; + +template +struct is_constructible> : is_default_constructible> {}; + +template +struct is_constructible> : is_default_constructible> {}; + + +template +struct is_iterator_traits : std::false_type {}; + +template +struct is_iterator_traits> +{ + private: + using traits = iterator_traits; + + public: + static constexpr auto value = + is_detected::value && + is_detected::value && + is_detected::value && + is_detected::value && + is_detected::value; +}; + +template +struct is_range +{ + private: + using t_ref = typename std::add_lvalue_reference::type; + + using iterator = detected_t; + using sentinel = detected_t; + + // to be 100% correct, it should use https://en.cppreference.com/w/cpp/iterator/input_or_output_iterator + // and https://en.cppreference.com/w/cpp/iterator/sentinel_for + // but reimplementing these would be too much work, as a lot of other concepts are used underneath + static constexpr auto is_iterator_begin = + is_iterator_traits>::value; + + public: + static constexpr bool value = !std::is_same::value && !std::is_same::value && is_iterator_begin; +}; + +template +using iterator_t = enable_if_t::value, result_of_begin())>>; + +template +using range_value_t = value_type_t>>; + +// The following implementation of is_complete_type is taken from +// https://blogs.msdn.microsoft.com/vcblog/2015/12/02/partial-support-for-expression-sfinae-in-vs-2015-update-1/ +// and is written by Xiang Fan who agreed to using it in this library. + +template +struct is_complete_type : std::false_type {}; + +template +struct is_complete_type : std::true_type {}; + +template +struct is_compatible_object_type_impl : std::false_type {}; + +template +struct is_compatible_object_type_impl < + BasicJsonType, CompatibleObjectType, + enable_if_t < is_detected::value&& + is_detected::value >> +{ + using object_t = typename BasicJsonType::object_t; + + // macOS's is_constructible does not play well with nonesuch... + static constexpr bool value = + is_constructible::value && + is_constructible::value; +}; + +template +struct is_compatible_object_type + : is_compatible_object_type_impl {}; + +template +struct is_constructible_object_type_impl : std::false_type {}; + +template +struct is_constructible_object_type_impl < + BasicJsonType, ConstructibleObjectType, + enable_if_t < is_detected::value&& + is_detected::value >> +{ + using object_t = typename BasicJsonType::object_t; + + static constexpr bool value = + (is_default_constructible::value && + (std::is_move_assignable::value || + std::is_copy_assignable::value) && + (is_constructible::value && + std::is_same < + typename object_t::mapped_type, + typename ConstructibleObjectType::mapped_type >::value)) || + (has_from_json::value || + has_non_default_from_json < + BasicJsonType, + typename ConstructibleObjectType::mapped_type >::value); +}; + +template +struct is_constructible_object_type + : is_constructible_object_type_impl {}; + +template +struct is_compatible_string_type +{ + static constexpr auto value = + is_constructible::value; +}; + +template +struct is_constructible_string_type +{ + // launder type through decltype() to fix compilation failure on ICPC +#ifdef __INTEL_COMPILER + using laundered_type = decltype(std::declval()); +#else + using laundered_type = ConstructibleStringType; +#endif + + static constexpr auto value = + conjunction < + is_constructible, + is_detected_exact>::value; +}; + +template +struct is_compatible_array_type_impl : std::false_type {}; + +template +struct is_compatible_array_type_impl < + BasicJsonType, CompatibleArrayType, + enable_if_t < + is_detected::value&& + is_iterator_traits>>::value&& +// special case for types like std::filesystem::path whose iterator's value_type are themselves +// c.f. https://github.com/nlohmann/json/pull/3073 + !std::is_same>::value >> +{ + static constexpr bool value = + is_constructible>::value; +}; + +template +struct is_compatible_array_type + : is_compatible_array_type_impl {}; + +template +struct is_constructible_array_type_impl : std::false_type {}; + +template +struct is_constructible_array_type_impl < + BasicJsonType, ConstructibleArrayType, + enable_if_t::value >> + : std::true_type {}; + +template +struct is_constructible_array_type_impl < + BasicJsonType, ConstructibleArrayType, + enable_if_t < !std::is_same::value&& + !is_compatible_string_type::value&& + is_default_constructible::value&& +(std::is_move_assignable::value || + std::is_copy_assignable::value)&& +is_detected::value&& +is_iterator_traits>>::value&& +is_detected::value&& +// special case for types like std::filesystem::path whose iterator's value_type are themselves +// c.f. https://github.com/nlohmann/json/pull/3073 +!std::is_same>::value&& + is_complete_type < + detected_t>::value >> +{ + using value_type = range_value_t; + + static constexpr bool value = + std::is_same::value || + has_from_json::value || + has_non_default_from_json < + BasicJsonType, + value_type >::value; +}; + +template +struct is_constructible_array_type + : is_constructible_array_type_impl {}; + +template +struct is_compatible_integer_type_impl : std::false_type {}; + +template +struct is_compatible_integer_type_impl < + RealIntegerType, CompatibleNumberIntegerType, + enable_if_t < std::is_integral::value&& + std::is_integral::value&& + !std::is_same::value >> +{ + // is there an assert somewhere on overflows? + using RealLimits = std::numeric_limits; + using CompatibleLimits = std::numeric_limits; + + static constexpr auto value = + is_constructible::value && + CompatibleLimits::is_integer && + RealLimits::is_signed == CompatibleLimits::is_signed; +}; + +template +struct is_compatible_integer_type + : is_compatible_integer_type_impl {}; + +template +struct is_compatible_type_impl: std::false_type {}; + +template +struct is_compatible_type_impl < + BasicJsonType, CompatibleType, + enable_if_t::value >> +{ + static constexpr bool value = + has_to_json::value; +}; + +template +struct is_compatible_type + : is_compatible_type_impl {}; + +template +struct is_constructible_tuple : std::false_type {}; + +template +struct is_constructible_tuple> : conjunction...> {}; + +template +struct is_json_iterator_of : std::false_type {}; + +template +struct is_json_iterator_of : std::true_type {}; + +template +struct is_json_iterator_of : std::true_type +{}; + +// checks if a given type T is a template specialization of Primary +template