Skip to content

Commit

Permalink
Изменено название файла раннера на coreas_runner_c.
Browse files Browse the repository at this point in the history
Добавлен неконсольный раннер coreas_runner_w.
  • Loading branch information
orefkov committed Jun 29, 2021
1 parent 727e043 commit 23ee46d
Show file tree
Hide file tree
Showing 18 changed files with 482 additions and 11 deletions.
24 changes: 17 additions & 7 deletions core_as_loader.sln
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "starter", "src\starter\star
{3EA60EEE-C38D-4650-AD6A-3E094AFAE8A0} = {3EA60EEE-C38D-4650-AD6A-3E094AFAE8A0}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "all", "all.vcxproj", "{EB77756E-50DF-4F3E-99C8-02B5AC384DA9}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "all", "all.vcxproj", "{363AA861-656E-4A55-A94B-FABC518D9C14}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "runner", "src\runner\runner.vcxproj", "{D09F3BF2-0234-4737-B91E-53998B28CE47}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "inject", "src\inject\inject.vcxproj", "{3EA60EEE-C38D-4650-AD6A-3E094AFAE8A0}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wrunner", "src\wrunner\wrunner.vcxproj", "{ABF9D301-B602-4E55-A6DA-6032D0887A8B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Expand All @@ -28,12 +30,12 @@ Global
{6BA093C5-A0F1-4BC4-9A55-4EF8323570DA}.Release|x64.ActiveCfg = Release|x64
{6BA093C5-A0F1-4BC4-9A55-4EF8323570DA}.Release|x86.ActiveCfg = Release|Win32
{6BA093C5-A0F1-4BC4-9A55-4EF8323570DA}.Release|x86.Build.0 = Release|Win32
{EB77756E-50DF-4F3E-99C8-02B5AC384DA9}.Debug|x64.ActiveCfg = Release|Win32
{EB77756E-50DF-4F3E-99C8-02B5AC384DA9}.Debug|x86.ActiveCfg = Release|Win32
{EB77756E-50DF-4F3E-99C8-02B5AC384DA9}.Release|x64.ActiveCfg = Release|Win32
{EB77756E-50DF-4F3E-99C8-02B5AC384DA9}.Release|x64.Build.0 = Release|Win32
{EB77756E-50DF-4F3E-99C8-02B5AC384DA9}.Release|x86.ActiveCfg = Release|Win32
{EB77756E-50DF-4F3E-99C8-02B5AC384DA9}.Release|x86.Build.0 = Release|Win32
{363AA861-656E-4A55-A94B-FABC518D9C14}.Debug|x64.ActiveCfg = Release|Win32
{363AA861-656E-4A55-A94B-FABC518D9C14}.Debug|x86.ActiveCfg = Release|Win32
{363AA861-656E-4A55-A94B-FABC518D9C14}.Release|x64.ActiveCfg = Release|Win32
{363AA861-656E-4A55-A94B-FABC518D9C14}.Release|x64.Build.0 = Release|Win32
{363AA861-656E-4A55-A94B-FABC518D9C14}.Release|x86.ActiveCfg = Release|Win32
{363AA861-656E-4A55-A94B-FABC518D9C14}.Release|x86.Build.0 = Release|Win32
{D09F3BF2-0234-4737-B91E-53998B28CE47}.Debug|x64.ActiveCfg = Debug|x64
{D09F3BF2-0234-4737-B91E-53998B28CE47}.Debug|x64.Build.0 = Debug|x64
{D09F3BF2-0234-4737-B91E-53998B28CE47}.Debug|x86.ActiveCfg = Debug|Win32
Expand All @@ -50,6 +52,14 @@ Global
{3EA60EEE-C38D-4650-AD6A-3E094AFAE8A0}.Release|x64.Build.0 = Release|x64
{3EA60EEE-C38D-4650-AD6A-3E094AFAE8A0}.Release|x86.ActiveCfg = Release|Win32
{3EA60EEE-C38D-4650-AD6A-3E094AFAE8A0}.Release|x86.Build.0 = Release|Win32
{ABF9D301-B602-4E55-A6DA-6032D0887A8B}.Debug|x64.ActiveCfg = Debug|x64
{ABF9D301-B602-4E55-A6DA-6032D0887A8B}.Debug|x64.Build.0 = Debug|x64
{ABF9D301-B602-4E55-A6DA-6032D0887A8B}.Debug|x86.ActiveCfg = Debug|Win32
{ABF9D301-B602-4E55-A6DA-6032D0887A8B}.Debug|x86.Build.0 = Debug|Win32
{ABF9D301-B602-4E55-A6DA-6032D0887A8B}.Release|x64.ActiveCfg = Release|x64
{ABF9D301-B602-4E55-A6DA-6032D0887A8B}.Release|x64.Build.0 = Release|x64
{ABF9D301-B602-4E55-A6DA-6032D0887A8B}.Release|x86.ActiveCfg = Release|Win32
{ABF9D301-B602-4E55-A6DA-6032D0887A8B}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
4 changes: 2 additions & 2 deletions src/include/core_as/version.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#define F_VERSION 1,0,0,8
#define P_VERSION "1.0.0.8"
#define F_VERSION 1,0,0,9
#define P_VERSION "1.0.0.9"
#define COPY_RIGHT "© Àëåêñàíäð Îðåôêîâ, 2021"
Binary file modified src/lib/core_as/Debug/x64/core_as.exp
Binary file not shown.
Binary file modified src/lib/core_as/Debug/x64/core_as.lib
Binary file not shown.
Binary file modified src/lib/core_as/Debug/x86/core_as.exp
Binary file not shown.
Binary file modified src/lib/core_as/Debug/x86/core_as.lib
Binary file not shown.
Binary file modified src/lib/core_as/Release/x64/core_as.exp
Binary file not shown.
Binary file modified src/lib/core_as/Release/x64/core_as.lib
Binary file not shown.
Binary file modified src/lib/core_as/Release/x86/core_as.exp
Binary file not shown.
Binary file modified src/lib/core_as/Release/x86/core_as.lib
Binary file not shown.
2 changes: 1 addition & 1 deletion src/runner/runner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ api <ИмяМодуля> [параметры] - Вывод API модуля
Параметры с пробелами заключайте в кавычки. Кавычки внутри параметров удваивайте.
Например:
runner run sendfile /c -subj "Мой корабль плывёт как ""Титаник"""
coreas_runner_c run sendfile /c -subj "Мой корабль плывёт как ""Титаник"""
Также модуль может сам получать дополнительные настройки из переменных окружения
вида COREAS_ИмяНастройки=значение настройки
Expand Down
2 changes: 2 additions & 0 deletions src/runner/runner.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
<LinkIncremental>false</LinkIncremental>
<OutDir>$(SolutionDir)_build\$(Configuration)\lib\$(PlatformTarget)\</OutDir>
<IntDir>$(SolutionDir)_build\objs\$(Configuration)\$(PlatformTarget)\$(ProjectName)\</IntDir>
<TargetName>coreas_$(ProjectName)_c</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
Expand All @@ -89,6 +90,7 @@
<LinkIncremental>false</LinkIncremental>
<OutDir>$(SolutionDir)_build\$(Configuration)\lib\$(PlatformTarget)\</OutDir>
<IntDir>$(SolutionDir)_build\objs\$(Configuration)\$(PlatformTarget)\$(ProjectName)\</IntDir>
<TargetName>coreas_$(ProjectName)_c</TargetName>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
Expand Down
2 changes: 1 addition & 1 deletion src/starter/starter.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ exit 0
</PostBuildEvent>
<CustomBuildStep>
<Command>robocopy ..\modules\starter "$(OutDir)modules\starter" /mir /im /NJH /NJS /NP
runner check starter
coreas_runner_c check starter
exit 0
</Command>
</CustomBuildStep>
Expand Down
16 changes: 16 additions & 0 deletions src/wrunner/resource.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by runner.rc
//
#define VS_VERSION_INFO1 2

// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 101
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
113 changes: 113 additions & 0 deletions src/wrunner/wrunner.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
/*
* (c) Проект "Core.As", Александр Орефков [email protected]
* Отдельно выполняемый gui запускальщик модулей Core.As
*
*/
//#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
// std
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <atomic>
#include <locale>
#include <clocale>
#include <cwchar>
using namespace std;

#include "core_as/core_as.h"
void* operator new(size_t size) {
return core_as_malloc(size);
}

void operator delete(void* ptr) {
core_as_free(ptr);
}

int showUsage() {
MessageBox(0, LR"aaa(Core.As Runner. Программа для запуска модулей Core.As.
Используйте одну из команд:
run <ИмяМодуля> [параметры] - Запуск модуля
check <ИмяМодуля> [параметры] - Проверка модуля
Параметры передаются запускаемому модулю в виде:
Параметр /f - задаёт папку с модулем
Каждый аргумент '/d строка' или '-d строка' передается как определение
для препроцессора модуля, например:
/d IDE=1 /d USECOOLFEATURE -D "POWER = 100"
Все параметры после /c или -c - передаются модулю как аргументы его запуска.
Параметры с пробелами заключайте в кавычки. Кавычки внутри параметров удваивайте.
Например:
coreas_runner_w run sendfile /c -subj "Мой корабль плывёт как ""Титаник"""
Также модуль может сам получать дополнительные настройки из переменных окружения
вида COREAS_ИмяНастройки=значение настройки
и аргументов командной строки вида -coreas-ИмяНастройки "значение настройки"
Имена настроек регистронезависимые.
)aaa", L"Core.As", MB_OK);

return 1;
}

// Выяснилось, что процедура разбора командных аргументов штатного консольного cruntime при наличии слэша перед
// закрывающей кавычкой "проглатывает" её и прихватывает соседние аргументы. Это, во-первых, отличается
// от поведения моих разборщиков командной строки в других частях программы, во-вторых, делает неудобным
// передачу директорий в командной строке. Поэтому будем разбирать командную строку сами.
void processArgs(lstringw<300>& defines, lstringw<300>& commands, lstringw<MAX_PATH>& folder, const vector<ssw>& argv) {
uint argc = uint(argv.size());
vector<ssw> vdef, vcmd;
if (argc > 4) {
vdef.reserve((argc - 3) / 2);
vcmd.reserve(argc - 4);
}
for (uint i = 3; i < argc - 1; i++) {
if (argv[i].isEqualia(L"/d") || argv[i].isEqualia(L"-d"))
vdef.emplace_back(argv[++i]);
else if (argv[i].isEqualia(L"/f") || argv[i].isEqualia(L"-f"))
folder = argv[++i];
else if (argv[i].isEqualia(L"/c") || argv[i].isEqualia(L"-c")) {
while (++i < argc)
vcmd.emplace_back(argv[i]);
}
}
defines.s_join(vdef, L"\v").s_replace(L"\"\"", L"\"");
commands.s_join(vcmd, L"\v").s_replace(L"\"\"", L"\"");
}

int run(const vector<ssw>& argv, HINSTANCE hInst, int nCmdShow) {
lstringw<300> defines, commands;
lstringw<MAX_PATH> folder;
processArgs(defines, commands, folder, argv);
lstringw<MAX_PATH> modName(argv[2]);
CoreAsModule* pModule = core_as_getModule(modName, folder);
if (!pModule)
return 2;
commands.s_append(+L" hInst "_ss & size_t(hInst) & L" nCmdShow " & nCmdShow);
return pModule->run(commands, defines, GetStdHandle(STD_OUTPUT_HANDLE)) ? 0 : 1;
}

int check(const vector<ssw>& argv) {
lstringw<300> defines, commands;
lstringw<MAX_PATH> folder;
processArgs(defines, commands, folder, argv);
lstringw<MAX_PATH> modName(argv[2]);
CoreAsModule* pModule = core_as_getModule(modName, folder);
if (!pModule)
return 2;
return pModule->check(defines, GetStdHandle(STD_OUTPUT_HANDLE)) ? 0 : 1;
}

int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE, PWSTR lpCmdLine, int nShowCmd) {
setlocale(LC_ALL, "ru_RU.utf8");
vector<ssw> argv = core_as_parseArguments(e_s(lpCmdLine));
if (argv.size() > 2) {
if (argv[1] == L"run") {
return run(argv, hInstance, nShowCmd);
} else if (argv[1]== L"check") {
return check(argv);
}
}
return showUsage();
}
101 changes: 101 additions & 0 deletions src/wrunner/wrunner.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"

#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "winres.h"

/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS

/////////////////////////////////////////////////////////////////////////////
// Russian (Russia) resources

#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_RUS)
LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT
#pragma code_page(1251)

#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//

1 TEXTINCLUDE
BEGIN
"resource.h\0"
END

2 TEXTINCLUDE
BEGIN
"#include ""winres.h""\r\n"
"\0"
END

3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END

#endif // APSTUDIO_INVOKED

#include "../include/core_as/version.h"

/////////////////////////////////////////////////////////////////////////////
//
// Version
//

VS_VERSION_INFO VERSIONINFO
FILEVERSION F_VERSION
PRODUCTVERSION F_VERSION
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x40004L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "041904b0"
BEGIN
VALUE "CompanyName", "��������� �������"
VALUE "FileDescription", "���������� ������� Core.As"
VALUE "FileVersion", P_VERSION
VALUE "InternalName", "runner.exe"
VALUE "LegalCopyright", COPY_RIGHT
VALUE "OriginalFilename", "runner.exe"
VALUE "ProductName", "������ ""Core.As"""
VALUE "ProductVersion", P_VERSION
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x419, 1200
END
END

#endif // Russian (Russia) resources
/////////////////////////////////////////////////////////////////////////////



#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//


/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

Loading

0 comments on commit 23ee46d

Please sign in to comment.