Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Rename C++ only header files from .h to .hpp.
[simgrid.git] / src / bindings / lua / lua_utils.hpp
diff --git a/src/bindings/lua/lua_utils.hpp b/src/bindings/lua/lua_utils.hpp
new file mode 100644 (file)
index 0000000..a5e060f
--- /dev/null
@@ -0,0 +1,36 @@
+/* Copyright (c) 2010-2017. The SimGrid Team. All rights reserved.          */
+
+/* This program is free software; you can redistribute it and/or modify it
+ * under the terms of the license (GNU LGPL) which comes with this package. */
+
+/* SimGrid Lua helper functions                                             */
+
+#ifndef LUA_UTILS_HPP
+#define LUA_UTILS_HPP
+
+extern "C" {
+
+#include <lua.h>
+
+/**
+ * @brief A chunk of memory.
+ *
+ * This structure is used as the userdata parameter of lua_Writer.
+ */
+typedef struct s_sglua_buffer {
+  char* data;
+  size_t size;
+  size_t capacity;
+} s_sglua_buffer_t, *sglua_buffer_t;
+
+const char* sglua_tostring(lua_State* L, int index);
+const char* sglua_keyvalue_tostring(lua_State* L, int key_index, int value_index);
+void sglua_stack_dump(lua_State* L, const char *msg);
+static int sglua_dump_table(lua_State* L);
+void* sglua_checkudata_debug(lua_State* L, int ud, const char* tname);
+const char* sglua_get_spaces(int length);
+int sglua_memory_writer(lua_State* L, const void* source, size_t size, void* userdata);
+
+}
+
+#endif