Skip to content
Snippets Groups Projects
Commit b197ba40 authored by Roman Tsisyk's avatar Roman Tsisyk
Browse files

Convert third_party/lua-yaml/lyaml.c to C++ (to use try-catch block)

parent ae638499
No related branches found
No related tags found
No related merge requests found
#
# A macro to build the bundled liblua-yaml
macro(libyaml_build)
set(yaml_src ${PROJECT_SOURCE_DIR}/third_party/lua-yaml/lyaml.c
set(yaml_src ${PROJECT_SOURCE_DIR}/third_party/lua-yaml/lyaml.cc
${PROJECT_SOURCE_DIR}/third_party/lua-yaml/api.c
${PROJECT_SOURCE_DIR}/third_party/lua-yaml/dumper.c
${PROJECT_SOURCE_DIR}/third_party/lua-yaml/emitter.c
......@@ -14,6 +14,10 @@ macro(libyaml_build)
set_source_files_properties(${yaml_src} PROPERTIES COMPILE_FLAGS
"-std=c99")
set_source_files_properties(
${PROJECT_SOURCE_DIR}/third_party/lua-yaml/lyaml.cc
PROPERTIES COMPILE_FLAGS
"-std=gnu++0x -D__STDC_FORMAT_MACROS=1 -D__STDC_LIMIT_MACROS=1")
add_library(yaml STATIC ${yaml_src})
......
......@@ -31,6 +31,7 @@
#include <stdbool.h>
#include <inttypes.h>
extern "C" {
#include <lauxlib.h>
#include <lua.h>
#include <lualib.h>
......@@ -42,6 +43,7 @@
#include "yaml.h"
#include "b64.h"
} /* extern "C" */
#include "lua/utils.h"
/* configurable flags */
......@@ -845,7 +847,7 @@ static int l_null(lua_State *L) {
return 1;
}
LUALIB_API int luaopen_yaml(lua_State *L) {
extern "C" int luaopen_yaml(lua_State *L) {
const luaL_reg yamllib[] = {
{ "decode", l_load },
{ "encode", l_dump },
......@@ -858,6 +860,6 @@ LUALIB_API int luaopen_yaml(lua_State *L) {
return 1;
}
LUALIB_API int yamlL_encode(lua_State *L) {
extern "C" int yamlL_encode(lua_State *L) {
return l_dump(L);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment