diff options
author | David Walter Seikel | 2014-04-21 20:59:39 +1000 |
---|---|---|
committer | David Walter Seikel | 2014-04-21 20:59:39 +1000 |
commit | 9621add2918cc4943e6693b74ae85d51dd264fcf (patch) | |
tree | fff1edf2c69d7a08a0e12885eecc9b96ed847a6a /LuaSL/testLua/yueliang-0.4.1/orig-5.1.3/test/test_ldump.lua | |
parent | LuaSL_test's window doesn't need to be so huge. (diff) | |
download | SledjHamr-9621add2918cc4943e6693b74ae85d51dd264fcf.zip SledjHamr-9621add2918cc4943e6693b74ae85d51dd264fcf.tar.gz SledjHamr-9621add2918cc4943e6693b74ae85d51dd264fcf.tar.bz2 SledjHamr-9621add2918cc4943e6693b74ae85d51dd264fcf.tar.xz |
We don't need the testlua directory any more.
Diffstat (limited to 'LuaSL/testLua/yueliang-0.4.1/orig-5.1.3/test/test_ldump.lua')
-rw-r--r-- | LuaSL/testLua/yueliang-0.4.1/orig-5.1.3/test/test_ldump.lua | 99 |
1 files changed, 0 insertions, 99 deletions
diff --git a/LuaSL/testLua/yueliang-0.4.1/orig-5.1.3/test/test_ldump.lua b/LuaSL/testLua/yueliang-0.4.1/orig-5.1.3/test/test_ldump.lua deleted file mode 100644 index 2d113dd..0000000 --- a/LuaSL/testLua/yueliang-0.4.1/orig-5.1.3/test/test_ldump.lua +++ /dev/null | |||
@@ -1,99 +0,0 @@ | |||
1 | --[[-------------------------------------------------------------------- | ||
2 | |||
3 | test_ldump.lua | ||
4 | Test for ldump.lua | ||
5 | This file is part of Yueliang. | ||
6 | |||
7 | Copyright (c) 2006 Kein-Hong Man <khman@users.sf.net> | ||
8 | The COPYRIGHT file describes the conditions | ||
9 | under which this software may be distributed. | ||
10 | |||
11 | See the ChangeLog for more information. | ||
12 | |||
13 | ----------------------------------------------------------------------]] | ||
14 | |||
15 | ------------------------------------------------------------------------ | ||
16 | -- test dump chunkwriter style | ||
17 | ------------------------------------------------------------------------ | ||
18 | |||
19 | dofile("../lopcodes.lua") | ||
20 | dofile("../ldump.lua") | ||
21 | |||
22 | -- Original typedef: | ||
23 | --int (*lua_Chunkwriter) (lua_State *L, const void* p, size_t sz, void* ud); | ||
24 | |||
25 | local MyWriter, MyBuff = luaU:make_setS() | ||
26 | if not MyWriter then | ||
27 | error("failed to initialize using make_setS") | ||
28 | end | ||
29 | MyWriter("hello, ", MyBuff) | ||
30 | MyWriter("world!", MyBuff) | ||
31 | print(MyBuff.data) | ||
32 | |||
33 | local MyWriter, MyBuff = luaU:make_setF("try.txt") | ||
34 | if not MyWriter then | ||
35 | error("failed to initialize using make_setF") | ||
36 | end | ||
37 | MyWriter("hello, ", MyBuff) | ||
38 | MyWriter("world!", MyBuff) | ||
39 | MyWriter(nil, MyBuff) | ||
40 | |||
41 | ------------------------------------------------------------------------ | ||
42 | -- test output of a function prototype | ||
43 | -- * data can be copied from a ChunkSpy listing output | ||
44 | ------------------------------------------------------------------------ | ||
45 | -- local a = 47 | ||
46 | -- local b = "hello, world!" | ||
47 | -- print(a, b) | ||
48 | ------------------------------------------------------------------------ | ||
49 | |||
50 | local F = {} | ||
51 | F.source = "sample.lua" | ||
52 | F.lineDefined = 0 | ||
53 | F.lastlinedefined = 0 | ||
54 | F.nups = 0 | ||
55 | F.numparams = 0 | ||
56 | F.is_vararg = 2 | ||
57 | F.maxstacksize = 5 | ||
58 | F.sizecode = 7 | ||
59 | F.code = {} | ||
60 | F.code[0] = { OP = 1, A = 0, Bx = 0 } | ||
61 | F.code[1] = { OP = 1, A = 1, Bx = 1 } | ||
62 | F.code[2] = { OP = 5, A = 2, Bx = 2 } | ||
63 | F.code[3] = { OP = 0, A = 3, B = 0, C = 0 } | ||
64 | F.code[4] = { OP = 0, A = 4, B = 1, C = 0 } | ||
65 | F.code[5] = { OP = 28, A = 2, B = 3, C = 1 } | ||
66 | F.code[6] = { OP = 30, A = 0, B = 1, C = 0 } | ||
67 | F.sizek = 3 | ||
68 | F.k = {} | ||
69 | F.k[0] = { value = 47 } | ||
70 | F.k[1] = { value = "hello, world!" } | ||
71 | F.k[2] = { value = "print" } | ||
72 | F.sizep = 0 | ||
73 | F.p = {} | ||
74 | F.sizelineinfo = 7 | ||
75 | F.lineinfo = {} | ||
76 | F.lineinfo[0] = 1 | ||
77 | F.lineinfo[1] = 2 | ||
78 | F.lineinfo[2] = 3 | ||
79 | F.lineinfo[3] = 3 | ||
80 | F.lineinfo[4] = 3 | ||
81 | F.lineinfo[5] = 3 | ||
82 | F.lineinfo[6] = 3 | ||
83 | F.sizelocvars = 2 | ||
84 | F.locvars = {} | ||
85 | F.locvars[0] = { varname = "a", startpc = 1, endpc = 6 } | ||
86 | F.locvars[1] = { varname = "b", startpc = 2, endpc = 6 } | ||
87 | F.sizeupvalues = 0 | ||
88 | F.upvalues = {} | ||
89 | |||
90 | local L = {} | ||
91 | --[[ | ||
92 | local Writer, Buff = luaU:make_setS() | ||
93 | luaU:dump(L, F, Writer, Buff) | ||
94 | for i = 1, string.len(Buff.data) do | ||
95 | io.stdout:write(string.byte(string.sub(Buff.data, i, i)).." ") | ||
96 | end | ||
97 | --]] | ||
98 | local Writer, Buff = luaU:make_setF("try.out") | ||
99 | luaU:dump(L, F, Writer, Buff) | ||