Harden LinuxCNC wasm and native probe workflows
This commit is contained in:
4
core/wasm_shims/boost/python/dict.hpp
Normal file
4
core/wasm_shims/boost/python/dict.hpp
Normal file
@@ -0,0 +1,4 @@
|
||||
#pragma once
|
||||
|
||||
#include "boost/python/object.hpp"
|
||||
|
||||
4
core/wasm_shims/boost/python/extract.hpp
Normal file
4
core/wasm_shims/boost/python/extract.hpp
Normal file
@@ -0,0 +1,4 @@
|
||||
#pragma once
|
||||
|
||||
#include "boost/python/object.hpp"
|
||||
|
||||
4
core/wasm_shims/boost/python/import.hpp
Normal file
4
core/wasm_shims/boost/python/import.hpp
Normal file
@@ -0,0 +1,4 @@
|
||||
#pragma once
|
||||
|
||||
#include "boost/python/object.hpp"
|
||||
|
||||
4
core/wasm_shims/boost/python/list.hpp
Normal file
4
core/wasm_shims/boost/python/list.hpp
Normal file
@@ -0,0 +1,4 @@
|
||||
#pragma once
|
||||
|
||||
#include "boost/python/object.hpp"
|
||||
|
||||
211
core/wasm_shims/boost/python/object.hpp
Normal file
211
core/wasm_shims/boost/python/object.hpp
Normal file
@@ -0,0 +1,211 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
extern "C" {
|
||||
|
||||
struct _typeobject {
|
||||
const char *tp_name;
|
||||
};
|
||||
using PyTypeObject = _typeobject;
|
||||
|
||||
struct _object {
|
||||
PyTypeObject *ob_type;
|
||||
};
|
||||
using PyObject = _object;
|
||||
|
||||
struct _inittab {
|
||||
const char *name;
|
||||
PyObject *(*initfunc)(void);
|
||||
};
|
||||
|
||||
int Py_IsInitialized(void);
|
||||
PyObject *PyErr_Occurred(void);
|
||||
void PyErr_Clear(void);
|
||||
int PyErr_ExceptionMatches(PyObject *);
|
||||
int PyCallable_Check(PyObject *);
|
||||
void PyErr_Fetch(PyObject **, PyObject **, PyObject **);
|
||||
void PyErr_NormalizeException(PyObject **, PyObject **, PyObject **);
|
||||
void PyErr_Print(void);
|
||||
int PyUnicode_Check(PyObject *);
|
||||
int PyLong_Check(PyObject *);
|
||||
int PyFloat_Check(PyObject *);
|
||||
int PyGen_Check(PyObject *);
|
||||
PyObject *PyObject_Str(PyObject *);
|
||||
const char *PyUnicode_AsUTF8(PyObject *);
|
||||
void Py_DecRef(PyObject *);
|
||||
extern PyObject *PyExc_KeyError;
|
||||
extern PyObject *PyExc_StopIteration;
|
||||
extern PyObject *_Py_NoneStructPtr;
|
||||
|
||||
#define Py_None (_Py_NoneStructPtr)
|
||||
#define Py_TYPE(ob) ((ob)->ob_type)
|
||||
#define Py_XDECREF(ob) \
|
||||
do { \
|
||||
if (ob) { \
|
||||
Py_DecRef(ob); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
}
|
||||
|
||||
namespace boost {
|
||||
|
||||
template <typename T>
|
||||
const T &cref(const T &value) {
|
||||
return value;
|
||||
}
|
||||
|
||||
namespace python {
|
||||
|
||||
class error_already_set {};
|
||||
|
||||
class object {
|
||||
public:
|
||||
object() = default;
|
||||
template <typename T>
|
||||
object(const T &) {
|
||||
}
|
||||
~object() = default;
|
||||
|
||||
class attr_proxy {
|
||||
public:
|
||||
template <typename T>
|
||||
attr_proxy &operator=(const T &) {
|
||||
return *this;
|
||||
}
|
||||
|
||||
operator object() const {
|
||||
return object();
|
||||
}
|
||||
};
|
||||
|
||||
attr_proxy attr(const char *) const {
|
||||
return {};
|
||||
}
|
||||
|
||||
object operator[](const char *) const {
|
||||
return {};
|
||||
}
|
||||
|
||||
object operator[](const std::string &) const {
|
||||
return {};
|
||||
}
|
||||
|
||||
object operator[](int) const {
|
||||
return {};
|
||||
}
|
||||
|
||||
PyObject *ptr() const {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
template <typename... Args>
|
||||
object operator()(Args &&...) const {
|
||||
return {};
|
||||
}
|
||||
};
|
||||
|
||||
inline object getattr(const object &, const char *) {
|
||||
return {};
|
||||
}
|
||||
|
||||
class list : public object {
|
||||
public:
|
||||
template <typename T>
|
||||
void append(const T &) {
|
||||
}
|
||||
};
|
||||
|
||||
class dict : public object {
|
||||
public:
|
||||
list keys() const {
|
||||
return {};
|
||||
}
|
||||
};
|
||||
|
||||
class tuple : public object {
|
||||
public:
|
||||
tuple() = default;
|
||||
tuple(const list &) {
|
||||
}
|
||||
};
|
||||
|
||||
class scope {
|
||||
public:
|
||||
explicit scope(const object &) {
|
||||
}
|
||||
|
||||
object::attr_proxy attr(const char *) const {
|
||||
return {};
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct extract {
|
||||
explicit extract(const object &) {
|
||||
}
|
||||
|
||||
operator T() const {
|
||||
return T();
|
||||
}
|
||||
};
|
||||
|
||||
inline object import(const char *) {
|
||||
return {};
|
||||
}
|
||||
|
||||
inline int len(const list &) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline void handle_exception() {
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
struct borrowed_result {
|
||||
explicit borrowed_result(T *) {
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct allow_null_result {
|
||||
explicit allow_null_result(T *) {
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
borrowed_result<T> borrowed(T *value) {
|
||||
return borrowed_result<T>(value);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
allow_null_result<T> allow_null(T *value) {
|
||||
return allow_null_result<T>(value);
|
||||
}
|
||||
|
||||
template <typename T = void>
|
||||
class handle {
|
||||
public:
|
||||
template <typename U>
|
||||
explicit handle(const U &) {
|
||||
}
|
||||
|
||||
explicit operator bool() const {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
class str : public object {
|
||||
public:
|
||||
template <typename T>
|
||||
explicit str(const T &) {
|
||||
}
|
||||
|
||||
object join(const object &) const {
|
||||
return {};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace python
|
||||
} // namespace boost
|
||||
10
core/wasm_shims/boost/python/object_fwd.hpp
Normal file
10
core/wasm_shims/boost/python/object_fwd.hpp
Normal file
@@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
namespace boost {
|
||||
namespace python {
|
||||
|
||||
class object;
|
||||
|
||||
} // namespace python
|
||||
} // namespace boost
|
||||
|
||||
4
core/wasm_shims/boost/python/scope.hpp
Normal file
4
core/wasm_shims/boost/python/scope.hpp
Normal file
@@ -0,0 +1,4 @@
|
||||
#pragma once
|
||||
|
||||
#include "boost/python/object.hpp"
|
||||
|
||||
3
core/wasm_shims/boost/python/str.hpp
Normal file
3
core/wasm_shims/boost/python/str.hpp
Normal file
@@ -0,0 +1,3 @@
|
||||
#pragma once
|
||||
|
||||
#include "boost/python/object.hpp"
|
||||
3
core/wasm_shims/boost/python/tuple.hpp
Normal file
3
core/wasm_shims/boost/python/tuple.hpp
Normal file
@@ -0,0 +1,3 @@
|
||||
#pragma once
|
||||
|
||||
#include "boost/python/object.hpp"
|
||||
Reference in New Issue
Block a user