Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
21d3294c
Commit
21d3294c
authored
Apr 30, 2011
by
antirez
Browse files
makefile adapted to link against lua lib and to pass the 32bit flag to Lua building system
parent
efc34087
Changes
105
Show whitespace changes
Inline
Side-by-side
deps/lua/test/table.lua
0 → 100644
View file @
21d3294c
-- make table, grouping all data for the same item
-- input is 2 columns (item, data)
local
A
while
1
do
local
l
=
io.read
()
if
l
==
nil
then
break
end
local
_
,
_
,
a
,
b
=
string.find
(
l
,
'"?([_%w]+)"?%s*(.*)$'
)
if
a
~=
A
then
A
=
a
io.write
(
"
\n
"
,
a
,
":"
)
end
io.write
(
" "
,
b
)
end
io.write
(
"
\n
"
)
deps/lua/test/trace-calls.lua
0 → 100644
View file @
21d3294c
-- trace calls
-- example: lua -ltrace-calls bisect.lua
local
level
=
0
local
function
hook
(
event
)
local
t
=
debug.getinfo
(
3
)
io.write
(
level
,
" >>> "
,
string.rep
(
" "
,
level
))
if
t
~=
nil
and
t
.
currentline
>=
0
then
io.write
(
t
.
short_src
,
":"
,
t
.
currentline
,
" "
)
end
t
=
debug.getinfo
(
2
)
if
event
==
"call"
then
level
=
level
+
1
else
level
=
level
-
1
if
level
<
0
then
level
=
0
end
end
if
t
.
what
==
"main"
then
if
event
==
"call"
then
io.write
(
"begin "
,
t
.
short_src
)
else
io.write
(
"end "
,
t
.
short_src
)
end
elseif
t
.
what
==
"Lua"
then
-- table.foreach(t,print)
io.write
(
event
,
" "
,
t
.
name
or
"(Lua)"
,
" <"
,
t
.
linedefined
,
":"
,
t
.
short_src
,
">"
)
else
io.write
(
event
,
" "
,
t
.
name
or
"(C)"
,
" ["
,
t
.
what
,
"] "
)
end
io.write
(
"
\n
"
)
end
debug.sethook
(
hook
,
"cr"
)
level
=
0
deps/lua/test/trace-globals.lua
0 → 100644
View file @
21d3294c
-- trace assigments to global variables
do
-- a tostring that quotes strings. note the use of the original tostring.
local
_tostring
=
tostring
local
tostring
=
function
(
a
)
if
type
(
a
)
==
"string"
then
return
string.format
(
"%q"
,
a
)
else
return
_tostring
(
a
)
end
end
local
log
=
function
(
name
,
old
,
new
)
local
t
=
debug.getinfo
(
3
,
"Sl"
)
local
line
=
t
.
currentline
io.write
(
t
.
short_src
)
if
line
>=
0
then
io.write
(
":"
,
line
)
end
io.write
(
": "
,
name
,
" is now "
,
tostring
(
new
),
" (was "
,
tostring
(
old
),
")"
,
"
\n
"
)
end
local
g
=
{}
local
set
=
function
(
t
,
name
,
value
)
log
(
name
,
g
[
name
],
value
)
g
[
name
]
=
value
end
setmetatable
(
getfenv
(),{
__index
=
g
,
__newindex
=
set
})
end
-- an example
a
=
1
b
=
2
a
=
10
b
=
20
b
=
nil
b
=
200
print
(
a
,
b
,
c
)
deps/lua/test/xd.lua
0 → 100644
View file @
21d3294c
-- hex dump
-- usage: lua xd.lua < file
local
offset
=
0
while
true
do
local
s
=
io.read
(
16
)
if
s
==
nil
then
return
end
io.write
(
string.format
(
"%08X "
,
offset
))
string.gsub
(
s
,
"(.)"
,
function
(
c
)
io.write
(
string.format
(
"%02X "
,
string.byte
(
c
)))
end
)
io.write
(
string.rep
(
" "
,
3
*
(
16
-
string.len
(
s
))))
io.write
(
" "
,
string.gsub
(
s
,
"%c"
,
"."
),
"
\n
"
)
offset
=
offset
+
16
end
src/Makefile
View file @
21d3294c
...
...
@@ -137,9 +137,11 @@ dependencies:
@
cd
../deps/hiredis
&&
$(MAKE)
static
ARCH
=
"
$(ARCH)
"
@
echo
$(MAKECOLOR)
MAKE
$(ENDCOLOR)
$(BINCOLOR)
linenoise
$(ENDCOLOR)
@
cd
../deps/linenoise
&&
$(MAKE)
ARCH
=
"
$(ARCH)
"
@
echo
$(MAKECOLOR)
MAKE
$(ENDCOLOR)
$(BINCOLOR)
Lua ansi
$(ENDCOLOR)
@
cd
../deps/lua
&&
$(MAKE)
ARCH
=
"
$(ARCH)
"
ansi
redis-server
:
$(OBJ)
@
$(CC)
-o
$(PRGNAME)
$(CCOPT)
$(DEBUG)
$(OBJ)
@
$(CC)
-o
$(PRGNAME)
$(CCOPT)
$(DEBUG)
$(OBJ)
../deps/lua/src/liblua.a
@
echo
$(LINKCOLOR)
LINK
$(ENDCOLOR)
$(BINCOLOR)
$
(
@
)
$(ENDCOLOR)
redis-benchmark
:
dependencies $(BENCHOBJ)
...
...
@@ -168,7 +170,7 @@ redis-check-aof: $(CHECKAOFOBJ)
@
echo
$(LINKCOLOR)
LINK
$(ENDCOLOR)
$(BINCOLOR)
$
(
@
)
$(ENDCOLOR)
.c.o
:
@
$(CC)
-c
$(CFLAGS)
$(DEBUG)
$(COMPILE_TIME)
$<
@
$(CC)
-c
$(CFLAGS)
$(DEBUG)
$(COMPILE_TIME)
-I
../deps/lua/src
$<
@
echo
$(CCCOLOR)
CC
$(ENDCOLOR)
$(SRCCOLOR)
$
(
<
)
$(ENDCOLOR)
clean
:
...
...
Prev
1
2
3
4
5
6
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment