mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-20 11:30:18 +00:00
some fix
This commit is contained in:
parent
426993552c
commit
2ea64ce41f
@ -2,3 +2,5 @@
|
|||||||
BasedOnStyle: Google
|
BasedOnStyle: Google
|
||||||
IndentWidth: 4
|
IndentWidth: 4
|
||||||
UseTab: Never
|
UseTab: Never
|
||||||
|
|
||||||
|
IndentPPDirectives: BeforeHash
|
||||||
|
@ -15,7 +15,8 @@ def get_all_files(root: str):
|
|||||||
yield fullpath
|
yield fullpath
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
files = list(get_all_files('src'))
|
files = []
|
||||||
|
# files.extend(get_all_files('include'))
|
||||||
|
# files.extend(get_all_files('src'))
|
||||||
files.extend(get_all_files('src2'))
|
files.extend(get_all_files('src2'))
|
||||||
files.extend(get_all_files('include'))
|
subprocess.run(['clang-format', '-i'] + files, check=True)
|
||||||
subprocess.run(['clang-format-15', '-i'] + files, check=True)
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#include <fstream>
|
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
|
#include <fstream>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
@ -24,10 +24,13 @@ std::string pkpy_platform_getline(bool* eof){
|
|||||||
wss << buf;
|
wss << buf;
|
||||||
}
|
}
|
||||||
std::wstring wideInput = wss.str();
|
std::wstring wideInput = wss.str();
|
||||||
int length = WideCharToMultiByte(CP_UTF8, 0, wideInput.c_str(), (int)wideInput.length(), NULL, 0, NULL, NULL);
|
int length =
|
||||||
|
WideCharToMultiByte(CP_UTF8, 0, wideInput.c_str(),
|
||||||
|
(int)wideInput.length(), NULL, 0, NULL, NULL);
|
||||||
std::string output;
|
std::string output;
|
||||||
output.resize(length);
|
output.resize(length);
|
||||||
WideCharToMultiByte(CP_UTF8, 0, wideInput.c_str(), (int)wideInput.length(), &output[0], length, NULL, NULL);
|
WideCharToMultiByte(CP_UTF8, 0, wideInput.c_str(), (int)wideInput.length(),
|
||||||
|
&output[0], length, NULL, NULL);
|
||||||
if (!output.empty() && output.back() == '\r') output.pop_back();
|
if (!output.empty() && output.back() == '\r') output.pop_back();
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
@ -97,12 +100,14 @@ int main(int argc, char** argv){
|
|||||||
std::cerr << "Failed to open file: " << argv_1 << std::endl;
|
std::cerr << "Failed to open file: " << argv_1 << std::endl;
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
std::string src((std::istreambuf_iterator<char>(file)), std::istreambuf_iterator<char>());
|
std::string src((std::istreambuf_iterator<char>(file)),
|
||||||
|
std::istreambuf_iterator<char>());
|
||||||
file.close();
|
file.close();
|
||||||
|
|
||||||
pkpy_set_main_argv(vm, argc, argv);
|
pkpy_set_main_argv(vm, argc, argv);
|
||||||
|
|
||||||
bool ok = pkpy_exec_2(vm, src.c_str(), filepath.filename().string().c_str(), 0, NULL);
|
bool ok = pkpy_exec_2(vm, src.c_str(),
|
||||||
|
filepath.filename().string().c_str(), 0, NULL);
|
||||||
if (!ok) pkpy_clear_error(vm, NULL);
|
if (!ok) pkpy_clear_error(vm, NULL);
|
||||||
pkpy_delete_vm(vm);
|
pkpy_delete_vm(vm);
|
||||||
return ok ? 0 : 1;
|
return ok ? 0 : 1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user