Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
sanitize the OOP of kernel::profile
[simgrid.git] / src / bindings / lua / lua_utils.hpp
1 /* Copyright (c) 2010-2019. The SimGrid Team. All rights reserved.          */
2
3 /* This program is free software; you can redistribute it and/or modify it
4  * under the terms of the license (GNU LGPL) which comes with this package. */
5
6 /* SimGrid Lua helper functions                                             */
7
8 #ifndef LUA_UTILS_HPP
9 #define LUA_UTILS_HPP
10
11 #include <lua.h>
12
13 /**
14  * @brief A chunk of memory.
15  *
16  * This structure is used as the userdata parameter of lua_Writer.
17  */
18 struct s_sglua_buffer_t {
19   char* data;
20   size_t size;
21   size_t capacity;
22 };
23 typedef s_sglua_buffer_t* sglua_buffer_t;
24
25 const char* sglua_tostring(lua_State* L, int index);
26 const char* sglua_keyvalue_tostring(lua_State* L, int key_index, int value_index);
27 void sglua_stack_dump(lua_State* L, const char* msg);
28 static int sglua_dump_table(lua_State* L);
29 void* sglua_checkudata_debug(lua_State* L, int ud, const char* tname);
30 const char* sglua_get_spaces(int length);
31 int sglua_memory_writer(lua_State* L, const void* source, size_t size, void* userdata);
32
33 #endif