Commit 55c8c423 authored by Jason Pleau's avatar Jason Pleau

New upstream version 0.5.2

parents d4c3a1ef 0ea10224
/site
/bed
/public
/MANIFEST
/README.html
/*.tar
......@@ -7,4 +8,7 @@
/*.tar.gz
/*.rock
*.out
luacov.*
/lua-messagepack-*
image: python:alpine
before_script:
- pip install mkdocs
pages:
script:
- mkdocs build -d public
artifacts:
paths:
- public
only:
- master
......@@ -38,9 +38,6 @@ script:
- make luacheck
- make test $SRC53
after_success:
- make coveralls $SRC53
branches:
only:
- master
......
Revision history for lua-MessagePack
0.5.2 Tue Aug 27 19:30:00 2019
improve speed of unpack integers
0.5.1 Sat Jan 20 19:30:00 2018
fix extra bytes detection (see PR #26)
allows ipairs(mp.packers) (see PR #27)
......
......@@ -5,7 +5,7 @@ lua-MessagePack is licensed under the terms of the MIT/X11 license reproduced be
===============================================================================
Copyright (C) 2012-2018 Francois Perrad.
Copyright (C) 2012-2019 Francois Perrad.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
......
ifeq ($(wildcard bed),bed)
LUA := $(CURDIR)/bed/bin/lua
else
LUA := lua
VERSION := $(shell cd src && $(LUA) -e "m = require [[MessagePack]]; print(m._VERSION)")
endif
VERSION := $(shell LUA_PATH=";;src/?.lua" $(LUA) -e "m = require [[MessagePack]]; print(m._VERSION)")
TARBALL := lua-messagepack-$(VERSION).tar.gz
REV := 1
......@@ -16,6 +20,8 @@ else
SRC := src
endif
BED_OPTS:= --lua latest
all:
@echo "Nothing to build here, you can just make install"
......@@ -83,36 +89,46 @@ rock:
luarocks pack rockspec/lua-messagepack-$(VERSION)-$(REV).rockspec
luarocks pack rockspec/lua-messagepack-lua53-$(VERSION)-$(REV).rockspec
bed:
hererocks bed $(BED_OPTS) --no-readline --luarocks latest --verbose
bed/bin/luarocks install lua-testmore
bed/bin/luarocks install lua-coat
bed/bin/luarocks install lbc
bed/bin/luarocks install luacov
hererocks bed --show
bed/bin/luarocks list
check: test
test:
cd $(SRC) && prove --exec=$(LUA) ../test/*.t
LUA_PATH=";;$(CURDIR)/$(SRC)/?.lua" \
prove --exec=$(LUA) test/*.lua
luacheck:
luacheck --std=max --codes src --ignore 211/_ENV 212 213 311/j 631
luacheck --std=max --codes src5.3 --ignore 211/_ENV 212 213 311/j
luacheck --std=max --config .test.luacheckrc test/*.t
luacheck --std=max --config .test.luacheckrc test
coverage:
rm -f src/luacov.stats.out src/luacov.report.out
cd $(SRC) && prove --exec="$(LUA) -lluacov" ../test/*.t
cd $(SRC) && luacov
coveralls:
rm -f src/luacov.stats.out src/luacov.report.out
cd $(SRC) && prove --exec="$(LUA) -lluacov" ../test/*.t
cd $(SRC) && luacov-coveralls -e /HERE/ -e %.t$
rm -f luacov.*
-LUA_PATH=";;$(CURDIR)/$(SRC)/?.lua" \
prove --exec="$(LUA) -lluacov" test/*.lua
luacov-console $(CURDIR)/src
luacov-console -s $(CURDIR)/src
luacov-console test
luacov-console -s test
README.html: README.md
Markdown.pl README.md > README.html
gh-pages:
mkdocs gh-deploy --clean
pages:
mkdocs build -d public
clean:
rm -f MANIFEST *.bak src/luacov.*.out README.html
rm -f MANIFEST *.bak luacov.* README.html
realclean: clean
rm -rf bed
.PHONY: test rockspec CHANGES
lua-MessagePack : a pure Lua implementation (spec v5)
=====================================================
[![Build Status](https://travis-ci.org/fperrad/lua-MessagePack.png?branch=master)](https://travis-ci.org/fperrad/lua-MessagePack)
[![Coverage Status](https://coveralls.io/repos/fperrad/lua-MessagePack/badge.png?branch=master)](https://coveralls.io/r/fperrad/lua-MessagePack?branch=master)
[![Licence](http://img.shields.io/badge/Licence-MIT-brightgreen.svg)](COPYRIGHT)
Introduction
------------
......@@ -19,13 +15,13 @@ And it's really fast with [LuaJIT](http://luajit.org).
Links
-----
The homepage is at <http://fperrad.github.io/lua-MessagePack/>,
and the sources are hosted at <http://github.com/fperrad/lua-MessagePack/>.
The homepage is at <https://fperrad.frama.io/lua-MessagePack/>,
and the sources are hosted at <https://framagit.org/fperrad/lua-MessagePack/>.
Copyright and License
---------------------
Copyright (c) 2012-2018 Francois Perrad
Copyright (c) 2012-2019 Francois Perrad
This library is licensed under the terms of the MIT/X11 license, like Lua itself.
name = lua-messagepack
abstract = a pure Lua implementation of the MessagePack serialization format
author = Francois Perrad
is_original = yes
license = mit
lib_dir = src
doc_dir = docs
repo_link = https://framagit.org/fperrad/lua-MessagePack
main_module = src/MessagePack.lua
......@@ -32,7 +32,7 @@ It's developed for Lua 5.1, 5.2 & 5.3. There are 2 variants:
## Download
The sources are hosted on [GitHub](http://github.com/fperrad/lua-MessagePack).
The sources are hosted on [Framagit](https://framagit.org/fperrad/lua-MessagePack).
## Installation
......@@ -43,6 +43,12 @@ luarocks install lua-messagepack
# luarocks install lua-messagepack-lua53
```
lua-MessagePack is available via opm:
```sh
opm get fperrad/lua-messagepack
```
or manually, with:
```sh
......@@ -52,7 +58,7 @@ make install LUAVER=5.2
## Test
The test suite requires the module
[lua-TestMore](http://fperrad.github.io/lua-TestMore/).
[lua-TestMore](https://fperrad.frama.io/lua-TestMore/).
```sh
make test
......@@ -60,9 +66,7 @@ make test
## Copyright and License
Copyright &copy; 2012-2018 Fran&ccedil;ois Perrad
[![OpenHUB](http://www.openhub.net/accounts/4780/widgets/account_rank.gif)](http://www.openhub.net/accounts/4780?ref=Rank)
[![LinkedIn](http://www.linkedin.com/img/webpromo/btn_liprofile_blue_80x15.gif)](http://www.linkedin.com/in/fperrad)
Copyright &copy; 2012-2019 Fran&ccedil;ois Perrad
This library is licensed under the terms of the MIT/X11 license,
like Lua itself.
site_name: lua-MessagePack
site_description: a pure Lua implementation (spec v5)
site_author: François Perrad
repo_url: https://github.com/fperrad/lua-MessagePack
repo_url: https://framagit.org/fperrad/lua-MessagePack
pages:
- Home: index.md
- API: messagepack.md
theme: mkdocs
copyright: Copyright &copy; 2012-2018 Fran&ccedil;ois Perrad
copyright: Copyright &copy; 2012-2019 Fran&ccedil;ois Perrad
MessagePack for Lua (spec v5)
=============================
[![Build Status](https://travis-ci.org/fperrad/lua-MessagePack.png?branch=master)](https://travis-ci.org/fperrad/lua-MessagePack)
[![Coverage Status](https://coveralls.io/repos/fperrad/lua-MessagePack/badge.png?branch=master)](https://coveralls.io/r/fperrad/lua-MessagePack?branch=master)
[![Licence](http://img.shields.io/badge/Licence-MIT-brightgreen.svg)](COPYRIGHT)
[![Dependencies](http://img.shields.io/badge/Dependencies-none-brightgreen.svg)](COPYRIGHT)
......@@ -32,12 +30,12 @@ It is a pure Lua implementation, without any dependency.
Links
-----
* [Github](http://github.com/fperrad/lua-MessagePack/)
* [API reference](http://fperrad.github.io/lua-MessagePack/messagepack/)
* [Framagit](https://framagit.org/fperrad/lua-MessagePack/)
* [API reference](https://fperrad.frama.io/lua-MessagePack/messagepack/)
Copyright and License
---------------------
Copyright (c) 2012-2018 Francois Perrad [![rank](https://www.openhub.net/accounts/4780/widgets/account_rank.gif)](https://www.openhub.net/accounts/4780)
Copyright (c) 2012-2019 Francois Perrad
This library is licensed under the terms of the MIT/X11 license, like Lua itself.
package = 'lua-MessagePack'
version = '@version@-@rev@'
source = {
url = 'http://github.com/fperrad/lua-MessagePack/raw/releases/lua-messagepack-@version@.tar.gz',
url = 'https://framagit.org/fperrad/lua-MessagePack/raw/releases/lua-messagepack-@version@.tar.gz',
md5 = '@md5@',
dir = 'lua-MessagePack-@version@',
}
......@@ -12,7 +12,7 @@ description = {
It lets you exchange data among multiple languages like JSON but it's faster and smaller.
]],
homepage = 'http://fperrad.github.io/lua-MessagePack/',
homepage = 'https://fperrad.frama.io/lua-MessagePack/',
maintainer = 'Francois Perrad',
license = 'MIT/X11'
}
......
package = 'lua-MessagePack-lua53'
version = '@version@-@rev@'
source = {
url = 'http://github.com/fperrad/lua-MessagePack/raw/releases/lua-messagepack-@version@.tar.gz',
url = 'https://framagit.org/fperrad/lua-MessagePack/raw/releases/lua-messagepack-@version@.tar.gz',
md5 = '@md5@',
dir = 'lua-MessagePack-@version@',
}
......@@ -12,7 +12,7 @@ description = {
It lets you exchange data among multiple languages like JSON but it's faster and smaller.
]],
homepage = 'http://fperrad.github.io/lua-MessagePack/',
homepage = 'https://fperrad.frama.io/lua-MessagePack/',
maintainer = 'Francois Perrad',
license = 'MIT/X11'
}
......
package = 'lua-MessagePack'
version = '0.5.1-2'
source = {
url = 'https://framagit.org/fperrad/lua-MessagePack/raw/releases/lua-messagepack-0.5.1.tar.gz',
md5 = 'd7f524b174b8baa822442b11421ff3ac',
dir = 'lua-MessagePack-0.5.1',
}
description = {
summary = "a pure Lua implementation of the MessagePack serialization format",
detailed = [[
MessagePack is an efficient binary serialization format.
It lets you exchange data among multiple languages like JSON but it's faster and smaller.
]],
homepage = 'http://fperrad.frama.io/lua-MessagePack/',
maintainer = 'Francois Perrad',
license = 'MIT/X11'
}
dependencies = {
'lua >= 5.1',
}
build = {
type = 'builtin',
modules = {
['MessagePack'] = 'src/MessagePack.lua',
},
copy_directories = { 'docs', 'test' },
}
package = 'lua-MessagePack'
version = '0.5.2-1'
source = {
url = 'https://framagit.org/fperrad/lua-MessagePack/raw/releases/lua-messagepack-0.5.2.tar.gz',
md5 = '471b0bc4cc868aecfcf170c1bf89fea1',
dir = 'lua-MessagePack-0.5.2',
}
description = {
summary = "a pure Lua implementation of the MessagePack serialization format",
detailed = [[
MessagePack is an efficient binary serialization format.
It lets you exchange data among multiple languages like JSON but it's faster and smaller.
]],
homepage = 'https://fperrad.frama.io/lua-MessagePack/',
maintainer = 'Francois Perrad',
license = 'MIT/X11'
}
dependencies = {
'lua >= 5.1',
}
build = {
type = 'builtin',
modules = {
['MessagePack'] = 'src/MessagePack.lua',
},
copy_directories = { 'docs', 'test' },
}
package = 'lua-MessagePack-lua53'
version = '0.5.1-2'
source = {
url = 'https://framagit.org/fperrad/lua-MessagePack/raw/releases/lua-messagepack-0.5.1.tar.gz',
md5 = 'd7f524b174b8baa822442b11421ff3ac',
dir = 'lua-MessagePack-0.5.1',
}
description = {
summary = "a pure Lua implementation of the MessagePack serialization format",
detailed = [[
MessagePack is an efficient binary serialization format.
It lets you exchange data among multiple languages like JSON but it's faster and smaller.
]],
homepage = 'http://fperrad.frama.io/lua-MessagePack/',
maintainer = 'Francois Perrad',
license = 'MIT/X11'
}
dependencies = {
'lua >= 5.3',
}
build = {
type = 'builtin',
modules = {
['MessagePack'] = 'src5.3/MessagePack.lua',
},
copy_directories = { 'docs', 'test' },
}
package = 'lua-MessagePack-lua53'
version = '0.5.2-1'
source = {
url = 'https://framagit.org/fperrad/lua-MessagePack/raw/releases/lua-messagepack-0.5.2.tar.gz',
md5 = '471b0bc4cc868aecfcf170c1bf89fea1',
dir = 'lua-MessagePack-0.5.2',
}
description = {
summary = "a pure Lua implementation of the MessagePack serialization format",
detailed = [[
MessagePack is an efficient binary serialization format.
It lets you exchange data among multiple languages like JSON but it's faster and smaller.
]],
homepage = 'https://fperrad.frama.io/lua-MessagePack/',
maintainer = 'Francois Perrad',
license = 'MIT/X11'
}
dependencies = {
'lua >= 5.3',
}
build = {
type = 'builtin',
modules = {
['MessagePack'] = 'src5.3/MessagePack.lua',
},
copy_directories = { 'docs', 'test' },
}
--
-- lua-MessagePack : <http://fperrad.github.io/lua-MessagePack/>
-- lua-MessagePack : <https://fperrad.frama.io/lua-MessagePack/>
--
local r, jit = pcall(require, 'jit')
......@@ -14,7 +14,7 @@ if not jit and _VERSION < 'Lua 5.3' then
-- Lua 5.1 & 5.2
local loadstring = loadstring or load
local luac = string.dump(loadstring "a = 1")
local header = { luac:sub(1, 12):byte(1, 12) }
local header = { luac:byte(1, 12) }
SIZEOF_NUMBER = header[11]
end
......@@ -529,7 +529,7 @@ local function unpack_cursor (c)
c:underflow(i)
s, i, j = c.s, c.i, c.j
end
local val = s:sub(i, i):byte()
local val = s:byte(i)
c.i = i+1
return unpackers[val](c, val)
end
......@@ -576,7 +576,7 @@ local function unpack_float (c)
c:underflow(i+3)
s, i, j = c.s, c.i, c.j
end
local b1, b2, b3, b4 = s:sub(i, i+3):byte(1, 4)
local b1, b2, b3, b4 = s:byte(i, i+3)
local sign = b1 > 0x7F
local expo = (b1 % 0x80) * 0x2 + floor(b2 / 0x80)
local mant = ((b2 % 0x80) * 0x100 + b3) * 0x100 + b4
......@@ -607,7 +607,7 @@ local function unpack_double (c)
c:underflow(i+7)
s, i, j = c.s, c.i, c.j
end
local b1, b2, b3, b4, b5, b6, b7, b8 = s:sub(i, i+7):byte(1, 8)
local b1, b2, b3, b4, b5, b6, b7, b8 = s:byte(i, i+7)
local sign = b1 > 0x7F
local expo = (b1 % 0x80) * 0x10 + floor(b2 / 0x10)
local mant = ((((((b2 % 0x10) * 0x100 + b3) * 0x100 + b4) * 0x100 + b5) * 0x100 + b6) * 0x100 + b7) * 0x100 + b8
......@@ -638,7 +638,7 @@ local function unpack_uint8 (c)
c:underflow(i)
s, i, j = c.s, c.i, c.j
end
local b1 = s:sub(i, i):byte()
local b1 = s:byte(i)
c.i = i+1
return b1
end
......@@ -649,7 +649,7 @@ local function unpack_uint16 (c)
c:underflow(i+1)
s, i, j = c.s, c.i, c.j
end
local b1, b2 = s:sub(i, i+1):byte(1, 2)
local b1, b2 = s:byte(i, i+1)
c.i = i+2
return b1 * 0x100 + b2
end
......@@ -660,7 +660,7 @@ local function unpack_uint32 (c)
c:underflow(i+3)
s, i, j = c.s, c.i, c.j
end
local b1, b2, b3, b4 = s:sub(i, i+3):byte(1, 4)
local b1, b2, b3, b4 = s:byte(i, i+3)
c.i = i+4
return ((b1 * 0x100 + b2) * 0x100 + b3) * 0x100 + b4
end
......@@ -671,7 +671,7 @@ local function unpack_uint64 (c)
c:underflow(i+7)
s, i, j = c.s, c.i, c.j
end
local b1, b2, b3, b4, b5, b6, b7, b8 = s:sub(i, i+7):byte(1, 8)
local b1, b2, b3, b4, b5, b6, b7, b8 = s:byte(i, i+7)
c.i = i+8
return ((((((b1 * 0x100 + b2) * 0x100 + b3) * 0x100 + b4) * 0x100 + b5) * 0x100 + b6) * 0x100 + b7) * 0x100 + b8
end
......@@ -682,7 +682,7 @@ local function unpack_int8 (c)
c:underflow(i)
s, i, j = c.s, c.i, c.j
end
local b1 = s:sub(i, i):byte()
local b1 = s:byte(i)
c.i = i+1
if b1 < 0x80 then
return b1
......@@ -697,7 +697,7 @@ local function unpack_int16 (c)
c:underflow(i+1)
s, i, j = c.s, c.i, c.j
end
local b1, b2 = s:sub(i, i+1):byte(1, 2)
local b1, b2 = s:byte(i, i+1)
c.i = i+2
if b1 < 0x80 then
return b1 * 0x100 + b2
......@@ -712,7 +712,7 @@ local function unpack_int32 (c)
c:underflow(i+3)
s, i, j = c.s, c.i, c.j
end
local b1, b2, b3, b4 = s:sub(i, i+3):byte(1, 4)
local b1, b2, b3, b4 = s:byte(i, i+3)
c.i = i+4
if b1 < 0x80 then
return ((b1 * 0x100 + b2) * 0x100 + b3) * 0x100 + b4
......@@ -727,7 +727,7 @@ local function unpack_int64 (c)
c:underflow(i+7)
s, i, j = c.s, c.i, c.j
end
local b1, b2, b3, b4, b5, b6, b7, b8 = s:sub(i, i+7):byte(1, 8)
local b1, b2, b3, b4, b5, b6, b7, b8 = s:byte(i, i+7)
c.i = i+8
if b1 < 0x80 then
return ((((((b1 * 0x100 + b2) * 0x100 + b3) * 0x100 + b4) * 0x100 + b5) * 0x100 + b6) * 0x100 + b7) * 0x100 + b8
......@@ -890,9 +890,9 @@ else
end
set_array'without_hole'
m._VERSION = '0.5.1'
m._VERSION = '0.5.2'
m._DESCRIPTION = "lua-MessagePack : a pure Lua implementation"
m._COPYRIGHT = "Copyright (c) 2012-2018 Francois Perrad"
m._COPYRIGHT = "Copyright (c) 2012-2019 Francois Perrad"
return m
--
-- This library is licensed under the terms of the MIT/X11 license,
......
--
-- lua-MessagePack : <http://fperrad.github.io/lua-MessagePack/>
-- lua-MessagePack : <https://fperrad.frama.io/lua-MessagePack/>
--
local assert = assert
......@@ -346,7 +346,7 @@ local function unpack_cursor (c)
c:underflow(i)
s, i, j = c.s, c.i, c.j
end
local val = s:sub(i, i):byte()
local val = s:byte(i)
c.i = i+1
return unpackers[val](c, val)
end
......@@ -638,9 +638,9 @@ else
end
set_array'without_hole'
m._VERSION = '0.5.1'
m._VERSION = '0.5.2'
m._DESCRIPTION = "lua-MessagePack : a pure Lua 5.3 implementation"
m._COPYRIGHT = "Copyright (c) 2012-2018 Francois Perrad"
m._COPYRIGHT = "Copyright (c) 2012-2019 Francois Perrad"
return m
--
-- This library is licensed under the terms of the MIT/X11 license,
......
......@@ -12,6 +12,7 @@ local mp = require 'MessagePack'
local bc = require 'bc'
local EXT_BC = 42
bc.digits(65)
local number = bc.number or bc.new
mp.packers['userdata'] = function (buffer, u)
if getmetatable(u) == bc then
......@@ -23,7 +24,7 @@ end
mp.build_ext = function (tag, data)
if tag == EXT_BC then
return bc.number(data)
return number(data)
end
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment