-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathprotect.lua
34 lines (28 loc) · 960 Bytes
/
protect.lua
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
function protect_handler(state, params)
-- we expect a single parameter that is an expression.
if (#params ~= 0) then
error("error: .PROTECT directive accepts no parameters.")
end
-- output a symbol for the memory protection.
state:add_symbol("protection:start");
end
function endprotect_handler(state, params)
-- we expect a single parameter that is an expression.
if (#params ~= 0) then
error("error: .ENDPROTECT directive accepts no parameters.")
end
-- output a symbol for the memory protection.
state:add_symbol("protection:end");
end
function setup()
-- perform setup
add_preprocessor_directive("PROTECT", protect_handler)
add_preprocessor_directive("ENDPROTECT", endprotect_handler)
end
MODULE = {
Type = "Preprocessor",
Name = ".PROTECT / .ENDPROTECT directive",
Version = "1.0",
SDescription = "The .PROTECT and .ENDPROTECT directives",
URL = "http://dcputoolcha.in/docs/modules/list/protect.html"
};