Compare commits
No commits in common. 'master' and 'StormFly-RTM' have entirely different histories.
master
...
StormFly-R
@ -1,44 +0,0 @@
|
||||
// ConsoleApplication1.cpp : 定义 DLL 应用程序的导出函数。
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "ConsoleApplication1.h"
|
||||
#include "../omp/modulesSDK.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
CMDOMP_MODULES int filelist(const KERNEL_INFO info,vector<string> &poll, char *data)
|
||||
{
|
||||
ifstream in;
|
||||
in.open(data);
|
||||
if (!in.is_open())
|
||||
return -2;
|
||||
if (info.debug_stat)
|
||||
while (!in.eof())
|
||||
{
|
||||
string temp;
|
||||
getline(in, temp);
|
||||
poll.push_back(temp);
|
||||
if (info.debug_stat)
|
||||
cout << "[MOD]Add:" << temp << endl;
|
||||
}
|
||||
in.close();
|
||||
return 0;
|
||||
}
|
||||
|
||||
CMDOMP_MODULES string ModulesInfo(MODULES_INFO &ret)
|
||||
{
|
||||
ret.BUILD_VER = 1;
|
||||
ret.RELEASE_VER = 0;
|
||||
return "FileSuppoert";
|
||||
}
|
||||
|
||||
CMDOMP_MODULES string ErrorProcess(int n)
|
||||
{
|
||||
switch (n)
|
||||
{
|
||||
case -2:
|
||||
return "File IO Except!" ;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1,7 +0,0 @@
|
||||
// 下列 ifdef 块是创建使从 DLL 导出更简单的
|
||||
// 宏的标准方法。此 DLL 中的所有文件都是用命令行上定义的 CONSOLEAPPLICATION1_EXPORTS
|
||||
// 符号编译的。在使用此 DLL 的
|
||||
// 任何其他项目上不应定义此符号。这样,源文件中包含此文件的任何其他项目都会将
|
||||
// CONSOLEAPPLICATION1_API 函数视为是从 DLL 导入的,而此 DLL 则将用此宏定义的
|
||||
// 符号视为是被导出的。
|
||||
#include "../omp/modulesSDK.h"
|
||||
@ -1,42 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="源文件">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="头文件">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="资源文件">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Text Include="ReadMe.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="stdafx.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="targetver.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="ConsoleApplication1.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ConsoleApplication1.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="dllmain.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@ -1,19 +0,0 @@
|
||||
// dllmain.cpp : 定义 DLL 应用程序的入口点。
|
||||
#include "stdafx.h"
|
||||
|
||||
BOOL APIENTRY DllMain( HMODULE hModule,
|
||||
DWORD ul_reason_for_call,
|
||||
LPVOID lpReserved
|
||||
)
|
||||
{
|
||||
switch (ul_reason_for_call)
|
||||
{
|
||||
case DLL_PROCESS_ATTACH:
|
||||
case DLL_THREAD_ATTACH:
|
||||
case DLL_THREAD_DETACH:
|
||||
case DLL_PROCESS_DETACH:
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -1,8 +0,0 @@
|
||||
// stdafx.cpp : 只包括标准包含文件的源文件
|
||||
// ConsoleApplication1.pch 将作为预编译头
|
||||
// stdafx.obj 将包含预编译类型信息
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
// TODO: 在 STDAFX.H 中
|
||||
// 引用任何所需的附加头文件,而不是在此文件中引用
|
||||
@ -1,16 +0,0 @@
|
||||
// stdafx.h : 标准系统包含文件的包含文件,
|
||||
// 或是经常使用但不常更改的
|
||||
// 特定于项目的包含文件
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "targetver.h"
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN // 从 Windows 头文件中排除极少使用的信息
|
||||
// Windows 头文件:
|
||||
#include <windows.h>
|
||||
|
||||
|
||||
|
||||
// TODO: 在此处引用程序需要的其他头文件
|
||||
@ -1,25 +0,0 @@
|
||||
fdfd
|
||||
fsd
|
||||
f
|
||||
asd
|
||||
fasdg
|
||||
asd
|
||||
g
|
||||
agf
|
||||
a
|
||||
fg
|
||||
adf
|
||||
g
|
||||
adfg
|
||||
adf
|
||||
g
|
||||
adf
|
||||
h
|
||||
adfh
|
||||
adf
|
||||
h
|
||||
adf
|
||||
g
|
||||
G
|
||||
A
|
||||
GF
|
||||
Binary file not shown.
Binary file not shown.
@ -1,26 +0,0 @@
|
||||
#pragma once
|
||||
#define CMDOMP_MODULES extern "C" __declspec(dllexport)
|
||||
#define SDK_VERSION 1.0
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
//typedef bool(*my_mod)(vector<string>*, char *);
|
||||
|
||||
#define MAX_BUFF_SIZE 4096
|
||||
|
||||
struct KERNEL_INFO{
|
||||
char API = SDK_VERSION;
|
||||
bool debug_stat = false;
|
||||
|
||||
};
|
||||
|
||||
struct MODULES_INFO{
|
||||
char API = SDK_VERSION;
|
||||
char BUILD_VER = 1;
|
||||
char RELEASE_VER = 1;
|
||||
char name[MAX_BUFF_SIZE];
|
||||
};
|
||||
|
||||
@ -1,241 +0,0 @@
|
||||
// omp.cpp : 定义控制台应用程序的入口点。
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <omp.h>
|
||||
using namespace std;
|
||||
|
||||
#define VER "0.1"
|
||||
#define NAME "CMD-OMP"
|
||||
const char list[] = { ' ', ',', ';' };
|
||||
|
||||
#include <vector>
|
||||
#include <Windows.h>
|
||||
vector<string> poll;
|
||||
|
||||
#include "modulesSDK.h"
|
||||
|
||||
KERNEL_INFO kernel;
|
||||
|
||||
enum WORKMODE{
|
||||
STRING_LIST,
|
||||
INT_ADD,
|
||||
FILE_READ,
|
||||
MOD_LOAD,
|
||||
};
|
||||
string mod;
|
||||
WORKMODE wmode=STRING_LIST;
|
||||
int int_start;
|
||||
int int_stop;
|
||||
int int_step;
|
||||
bool info_get = false;
|
||||
bool multi_line = false;
|
||||
|
||||
typedef int(*my_mod)(const KERNEL_INFO,vector<string>&, char *);
|
||||
typedef string(*mod_info)(MODULES_INFO &);
|
||||
typedef string(*err_process)(int);
|
||||
|
||||
inline string replace(const char *data, const char *replcae, const char *tar_re)
|
||||
{
|
||||
//cout << "Replace " << data << " in " << replcae << " to " << tar_re << endl;
|
||||
string ret;
|
||||
for (int n = 0; n < strlen(data); n++)
|
||||
{
|
||||
bool stat = false;
|
||||
if (data[n] == replcae[0])
|
||||
{
|
||||
stat = true;
|
||||
for (int x = 0; x < strlen(replcae); x++)
|
||||
if (data[n + x] != replcae[x])
|
||||
stat = false;
|
||||
|
||||
}
|
||||
if (stat)
|
||||
{
|
||||
//cout << "Replace at" << n << endl;
|
||||
string cpy = tar_re;
|
||||
ret += cpy;
|
||||
n += strlen(replcae);
|
||||
}
|
||||
else
|
||||
ret += data[n];
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void main(int argc, char* argv[])
|
||||
{
|
||||
kernel.debug_stat = true;
|
||||
int start = 0;
|
||||
for (int n = 0; n < argc; n++)
|
||||
{
|
||||
if (!strcmp(argv[n], "-tn"))
|
||||
{
|
||||
cout << "MaxThread:" << omp_get_max_threads() << endl;
|
||||
return;
|
||||
}
|
||||
if (!strcmp(argv[n], "-l"))
|
||||
{
|
||||
n++;
|
||||
wmode = INT_ADD;
|
||||
int_start = atoi(argv[n]);
|
||||
n++;
|
||||
int_step = atoi(argv[n]);
|
||||
n++;
|
||||
int_stop = atoi(argv[n]);
|
||||
continue;
|
||||
}
|
||||
if (!strcmp(argv[n], "-v"))
|
||||
{
|
||||
cout << "Windows Command Line OpenMP Simple Support!" << endl << "Version:" << VER << endl << "MOD API:" << SDK_VERSION << endl;
|
||||
exit(-1);
|
||||
}
|
||||
if (!strcmp(argv[n], "-m"))
|
||||
{
|
||||
n++;
|
||||
wmode = MOD_LOAD;
|
||||
mod = argv[n];
|
||||
continue;
|
||||
}
|
||||
if (!strcmp(argv[n], "-mi"))
|
||||
{
|
||||
n++;
|
||||
wmode = MOD_LOAD;
|
||||
mod = argv[n];
|
||||
info_get = true;
|
||||
continue;
|
||||
}
|
||||
if (!strcmp(argv[n], "-n"))
|
||||
{
|
||||
n++;
|
||||
omp_set_num_threads(atoi(argv[n]));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (argc < 3)
|
||||
{
|
||||
cout << "HELP::" << endl << argv[0] << "[option] [parallel list] [command]" << endl << "使用##OMP来带来被替换的内容" << endl;
|
||||
return;
|
||||
}
|
||||
string mod_file;
|
||||
string mod_link;
|
||||
HINSTANCE load;
|
||||
my_mod link;
|
||||
mod_info info;
|
||||
MODULES_INFO modx;
|
||||
string name;
|
||||
switch (wmode)
|
||||
{
|
||||
case INT_ADD:
|
||||
for (int n = int_start; n < int_stop; n += int_step)
|
||||
{
|
||||
char buff[4096] = { 0 };
|
||||
_itoa(n, buff, 10);
|
||||
poll.push_back(buff);
|
||||
}
|
||||
break;
|
||||
case MOD_LOAD:
|
||||
|
||||
for (int n = 0; n < mod.size(); n++)
|
||||
{
|
||||
if (mod[n] == ',')
|
||||
{
|
||||
mod_file = mod.substr(0, n);
|
||||
mod_link = mod.substr(n + 1);
|
||||
}
|
||||
}
|
||||
if (info_get)
|
||||
mod_file = mod;
|
||||
load = LoadLibraryA(mod_file.data());
|
||||
|
||||
|
||||
if (load == NULL)
|
||||
{
|
||||
cout << "Load Modules:" << mod_file << " faild!" << endl;
|
||||
return;
|
||||
}
|
||||
info = (mod_info)GetProcAddress(load, "ModulesInfo");
|
||||
if (info == NULL)
|
||||
{
|
||||
cout << "Read Modules Faild! or API mismatch!" << endl;
|
||||
return;
|
||||
}
|
||||
|
||||
name=info(modx);
|
||||
|
||||
if (modx.API > SDK_VERSION)
|
||||
{
|
||||
cout << "API MisMatch!" << endl;
|
||||
return;
|
||||
}
|
||||
if (info_get)
|
||||
{
|
||||
cout << "Command Link simple OpenMP Modules Utils" << endl;
|
||||
cout << "Name:" << name << endl;
|
||||
cout << "Version:" << (int)modx.BUILD_VER << "." << (int)modx.RELEASE_VER << endl;
|
||||
cout << "FILE:" << mod_file << endl;
|
||||
return;
|
||||
}
|
||||
link = (my_mod)GetProcAddress(load, mod_link.data());
|
||||
if (link == NULL)
|
||||
{
|
||||
cout << "Get Mod Link Faild! \"" << mod_link << "\"" << endl;
|
||||
return;
|
||||
}
|
||||
int err;
|
||||
err = -99;
|
||||
err=link(kernel,poll, argv[argc - 2]);
|
||||
if (err!=0)
|
||||
{
|
||||
cout << "SUBMOD REPORT A ERROR!" << endl;
|
||||
err_process err_link = (err_process)GetProcAddress(load,"ErrorProcess");
|
||||
if (err_link != NULL)
|
||||
{
|
||||
cout << "Report Notice:" << err_link(err) << endl;
|
||||
}
|
||||
cout << "Return Error:" << err << endl;
|
||||
exit(-1);
|
||||
}
|
||||
break;
|
||||
case STRING_LIST:
|
||||
default:
|
||||
int last=0;
|
||||
for (int n = 0; n < strlen(argv[argc - 2]); n++)
|
||||
{
|
||||
bool stat = false;
|
||||
for (int x = 0; x < sizeof(list); x++)
|
||||
if (list[x] ==argv[argc-2][n])
|
||||
stat = true;
|
||||
if (stat)
|
||||
{
|
||||
if (last == n - 1)
|
||||
{
|
||||
string temp = argv[argc - 2];
|
||||
poll.push_back(temp.substr(start, n - start));
|
||||
start = n + 1;
|
||||
last = n;
|
||||
}
|
||||
else
|
||||
{
|
||||
last = n;
|
||||
}
|
||||
}
|
||||
}
|
||||
string temp = argv[argc - 2];
|
||||
poll.push_back(temp.substr(start));
|
||||
break;
|
||||
}
|
||||
#pragma omp parallel for
|
||||
for (int n = 0; n < poll.size(); n++)
|
||||
{
|
||||
string exec = "cmd.exe /C \"";
|
||||
exec = exec + replace(argv[argc - 1], "##OMP", poll.at(n).data());
|
||||
exec += "\"";
|
||||
//cout << "exec:" << exec << endl;
|
||||
system(exec.data());
|
||||
}
|
||||
}
|
||||
@ -1,39 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="源文件">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="头文件">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="资源文件">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Text Include="ReadMe.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="stdafx.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="targetver.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="modulesSDK.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="omp.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@ -1,7 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LocalDebuggerCommandArguments>-m fstream.dll,filelist "list.txt" "echo ##OMP"</LocalDebuggerCommandArguments>
|
||||
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@ -1,8 +0,0 @@
|
||||
// stdafx.cpp : 只包括标准包含文件的源文件
|
||||
// omp.pch 将作为预编译头
|
||||
// stdafx.obj 将包含预编译类型信息
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
// TODO: 在 STDAFX.H 中
|
||||
// 引用任何所需的附加头文件,而不是在此文件中引用
|
||||
@ -1,15 +0,0 @@
|
||||
// stdafx.h : 标准系统包含文件的包含文件,
|
||||
// 或是经常使用但不常更改的
|
||||
// 特定于项目的包含文件
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "targetver.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <tchar.h>
|
||||
|
||||
|
||||
|
||||
// TODO: 在此处引用程序需要的其他头文件
|
||||
Binary file not shown.
Binary file not shown.
@ -1 +0,0 @@
|
||||
return_name=Git Project Manager
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue