-
Notifications
You must be signed in to change notification settings - Fork 0
/
status-info.jl
39 lines (33 loc) · 1.04 KB
/
status-info.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#######################################################################
# Macros for printing information depending on verbosity
#
# ASSUMPTION: the package defines variable `VERBOSE`
#######################################################################
const STATUS_BEGIN = "..."
const STATUS_END = " completed"
# If verbose, prints information about the start and completion of
# of `action` named `name`
macro status(name, action)
quote
@statusb $(esc(name))
tmp = $(esc(action))
@statuse $(esc(name))
tmp
end
end
# if verbose, prints information `name`
macro status(name)
:(if VERBOSE ; @info($(esc(name))) end)
end
# If verbose, prints information about the start of `name`
macro statusb(name)
:(if VERBOSE ; @info($(esc(name)) * $STATUS_BEGIN) end)
end
# If verbose, prints information about the completion of `name`
macro statuse(name)
:(if VERBOSE ; @info($(esc(name)) * $STATUS_END) end)
end
# If debug mode, performs action
macro debugonly(action)
:(if DEBUG ; $(esc(action)) end)
end