62 std::string clean = line;
63 clean.erase(std::remove(clean.begin(), clean.end(),
';'), clean.end());
65 size_t paren = clean.find(
'(');
66 if (paren == std::string::npos)
69 std::string retAndName = clean.substr(0, paren);
70 std::string paramStr = clean.substr(paren + 1, clean.find(
')') - paren - 1);
72 std::istringstream iss(retAndName);
75 paramStr =
trim(paramStr);
76 if (paramStr.empty() || paramStr ==
"void")
79 std::istringstream pstream(paramStr);
81 while (std::getline(pstream, param,
','))
87 std::istringstream ps(param);
174 std::string inputFile =
"winapi.h";
175 std::string outputFile =
"phasor_winapi.cpp";
179 if (argc >= 4 && std::string(argv[2]) ==
"-o")
180 outputFile = argv[3];
182 std::ifstream infile(inputFile);
183 std::ofstream outfile(outputFile);
185 outfile <<
"#define PHASOR_FFI_BUILD_DLL\n";
186 outfile <<
"#include <PhasorFFI.h>\n";
187 outfile <<
"#include <windows.h>\n";
188 outfile <<
"#include \"../src/Bindings/win32/handle.hpp\"\n\n";
189 outfile <<
"// =====BEGIN PATCHES=====\n";
190 for (
const auto& patch :
PATCHES)
192 outfile << patch <<
"\n";
194 outfile <<
"// ======END PATCHES======\n\n";
198 std::vector<Function> funcs;
200 while (std::getline(infile, line))
211 for (
const auto& f : funcs)
214 outfile <<
"PHASOR_FFI_EXPORT void phasor_plugin_entry(const PhasorAPI* api, PhasorVM* vm) {\n";
215 for (
const auto& f : funcs)
217 outfile <<
" api->register_function(vm, \"win32_" << f.name
218 <<
"\", win32_" << f.name <<
");\n";