sorcery  Diff

Differences From Artifact [f9d9d412d5]:

To Artifact [c7cd728357]:


            1  +dofile'test/common.lua'
     1      2   local m = dofile"lib/marshal.lua"
     2      3   local car_t = m.g.struct {
     3      4   	brand = m.t.str;
     4      5   	year = m.t.u16;
     5      6   }
     6      7   local pack, unpack = m.transcoder {
     7      8   	version = m.t.u16;
................................................................................
    35     36   	cars = {
    36     37   		{brand = 'dodge', year = 2596};
    37     38   		{brand = 'subaru', year = 321};
    38     39   	};
    39     40   }
    40     41   if m.wrong(s) then print(s.exp) os.exit(1) end
    41     42   
    42         -local str = 'serialized:'
    43         -for i=1,#s do
    44         -	str = str ..' '.. string.format("%x",string.byte(str, i))
    45         -end
    46         -print(str)
           43  +print(hexdump(s))
    47     44   
    48     45   local v = unpack(s)
    49     46   
    50         -local function dump(o)
    51         -	if type(o) == "table" then
    52         -		local str = ''
    53         -		for k,p in pairs(o) do
    54         -			str = str .. (k .. ' = {' .. dump(p) ..'}\n')
    55         -		end
    56         -		return str
    57         -	else
    58         -		return tostring(o)
    59         -	end
    60         -end
    61         -
    62     47   print(dump(v))