MCPcopy Create free account
hub / github.com/PlotJuggler/PlotJuggler / inferTransformBackend

Function inferTransformBackend

pj_runtime/src/DataProcessorService.cpp:281–295  ·  view source on GitHub ↗

Infer the backend from the payload's leading bytes / first-line directive (data-only ABI: nothing executable crosses, so the host picks the backend from the bytes). WASM/Python are recognized but diagnosed as unavailable in this build.

Source from the content-addressed store, hash-verified

279// (data-only ABI: nothing executable crosses, so the host picks the backend from
280// the bytes). WASM/Python are recognized but diagnosed as unavailable in this build.
281Expected<std::string> inferTransformBackend(const std::string& script) {
282 if (script.size() >= 4 && script.compare(0, 4, "\0asm", 4) == 0) {
283 return PJ::unexpected("pj.data_processors: WASM backend is reserved for a future host build");
284 }
285 const std::size_t nl = script.find('\n');
286 const std::string first = script.substr(0, nl == std::string::npos ? script.size() : nl);
287 if (first.find("pj-script: luau") != std::string::npos || first.find("pj-script: lua") != std::string::npos) {
288 return std::string("luau");
289 }
290 if (first.find("pj-script: python") != std::string::npos) {
291 return std::string("python");
292 }
293 return PJ::unexpected(
294 "pj.data_processors: unrecognized script backend directive (expected '-- pj-script: <lang>' on line 1)");
295}
296} // namespace
297
298std::string DataProcessorService::makeTransformKey(std::string_view plugin_id, std::string_view id) {

Callers 1

installTransformMethod · 0.85

Calls 3

compareMethod · 0.80
sizeMethod · 0.45
findMethod · 0.45

Tested by

no test coverage detected