package = 'yaml' version = '0.2-2' source = { url = 'http://files.luaforge.net/releases/yaml/yaml/0.2/yaml-0.2.tar.gz', md5 = '18c25a2a6609b2862e3485952cf73634', dir = 'yaml-0.2', } description = { summary = "Lua YAML serialization using LibYAML", detailed = [[ This module is a Lua binding for Kirill Siminov's excellent LibYAML. LibYAML is generally considered to be the best C YAML 1.1 implementation. ]], homepage = 'http://yaml.luaforge.net/', maintainer = 'Francois Perrad', -- only of the rockspec -- the author and copyright holder of this module is Andrew Danforth license = 'MIT', } dependencies = { 'lua >= 5.1', } external_dependencies = { -- yaml-0.2.tar.gz contains a copy of LibYAML 0.1.3 -- but, we build with the latest version installed -- with the package libyaml-dev (0.1.4 at this time) YAML = { header = "yaml.h", library = "yaml", }, } build = { type = "builtin", modules = { yaml = { sources = { "lyaml.c", "b64.c", }, libraries = "yaml", }, }, patches = { ["strict51.patch"] = [[ --- old/lyaml.c +++ new/lyaml.c @@ -350,7 +350,7 @@ yaml_parser_initialize(&loader.parser); yaml_parser_set_input_string(&loader.parser, - (const unsigned char *)lua_tostring(L, 1), lua_strlen(L, 1)); + (const unsigned char *)lua_tostring(L, 1), lua_objlen(L, 1)); load(&loader); delete_event(&loader); @@ -470,7 +470,7 @@ } static int dump_array(struct lua_yaml_dumper *dumper) { - int i, n = luaL_getn(dumper->L, -1); + int i, n = lua_objlen(dumper->L, -1); yaml_event_t ev; yaml_char_t *anchor = get_yaml_anchor(dumper); @@ -533,7 +533,7 @@ type = figure_table_type(dumper->L); if (type == LUAYAML_KIND_UNKNOWN && Dump_Auto_Array && - luaL_getn(dumper->L, -1) > 0) { + lua_objlen(dumper->L, -1) > 0) { type = LUAYAML_KIND_SEQUENCE; } @@ -717,6 +717,6 @@ { NULL, NULL} }; - luaL_openlib(L, "yaml", yamllib, 0); + luaL_register(L, "yaml", yamllib); return 1; } ]], ["compat52.patch"] = [[ --- old/lyaml.c +++ new/lyaml.c @@ -36,6 +36,12 @@ #include "yaml.h" #include "b64.h" +#if LUA_VERSION_NUM >= 502 +#define luaL_reg luaL_Reg +#define lua_objlen lua_rawlen +#define luaL_register(L,n,l) luaL_newlib(L,(l)) +#endif + /* configurable flags */ static char Dump_Auto_Array = 1; static char Dump_Error_on_Unsupported = 0; ]], ["warnings64bits.patch"] = [[ --- old/lyaml.c +++ new/lyaml.c @@ -98,7 +98,7 @@ luaL_addstring(&b, buf); if (loader->parser.problem_mark.line || loader->parser.problem_mark.column) { - snprintf(buf, sizeof(buf), ", line: %d, column: %d\n", + snprintf(buf, sizeof(buf), ", line: %zu, column: %zu\n", loader->parser.problem_mark.line + 1, loader->parser.problem_mark.column + 1); luaL_addstring(&b, buf); @@ -107,7 +107,7 @@ } if (loader->parser.context) { - snprintf(buf, sizeof(buf), "%s at line: %d, column: %d\n", + snprintf(buf, sizeof(buf), "%s at line: %zu, column: %zu\n", loader->parser.context, loader->parser.context_mark.line + 1, loader->parser.context_mark.column + 1); @@ -575,7 +575,7 @@ yaml_emitter_emit(&dumper->emitter, &ev); } -static int append_output(void *arg, unsigned char *buf, unsigned int len) { +static int append_output(void *arg, unsigned char *buf, size_t len) { struct lua_yaml_dumper *dumper = (struct lua_yaml_dumper *)arg; luaL_addlstring(&dumper->yamlbuf, (char *)buf, len); return 1; ]], }, }