2014-05-23 23:49:43 +00:00
|
|
|
local NumThreads=4
|
|
|
|
|
|
|
|
function mod_name(midx)
|
|
|
|
return tostring("mod5_mod" .. tostring(midx))
|
|
|
|
end
|
|
|
|
|
|
|
|
function const_name(midx)
|
|
|
|
return "mod" .. tostring(midx) .. "C"
|
|
|
|
end
|
|
|
|
|
|
|
|
function mk_module(midx, imports)
|
|
|
|
local imp_names = {}
|
|
|
|
for i = 1, #imports do
|
|
|
|
imp_names[#imp_names + 1] = mod_name(imports[i])
|
|
|
|
end
|
2014-05-29 18:03:44 +00:00
|
|
|
local env = import_modules(imp_names, {num_threads=NumThreads})
|
2014-05-23 23:49:43 +00:00
|
|
|
if #imports == 0 then
|
2014-07-22 16:43:18 +00:00
|
|
|
env = add_decl(env, mk_var_decl(const_name(midx), Prop))
|
|
|
|
env = add_decl(env, mk_var_decl("and", mk_arrow(Prop, Prop, Prop)))
|
2014-05-23 23:49:43 +00:00
|
|
|
elseif #imports == 1 then
|
2014-07-22 16:43:18 +00:00
|
|
|
env = add_decl(env, mk_definition(const_name(midx), Prop, Const(const_name(imports[1]))))
|
2014-05-23 23:49:43 +00:00
|
|
|
else
|
|
|
|
local And = Const("and")
|
2014-07-22 16:43:18 +00:00
|
|
|
env = add_decl(env, mk_definition(const_name(midx), Prop, And(Const(const_name(imports[1])), Const(const_name(imports[2])))))
|
2014-05-23 23:49:43 +00:00
|
|
|
end
|
|
|
|
env:export(tostring(mod_name(midx)) .. ".olean")
|
|
|
|
end
|
|
|
|
|
|
|
|
local NumMods = 100
|
|
|
|
|
|
|
|
function mk_modules()
|
|
|
|
mk_module(0, {})
|
|
|
|
local i = 1
|
|
|
|
local j = 1
|
|
|
|
while i <= NumMods do
|
|
|
|
if j % 2 == 0 then
|
|
|
|
mk_module(i, {i-1, i-2})
|
|
|
|
i = i + 1
|
|
|
|
else
|
|
|
|
mk_module(i, {i-1})
|
|
|
|
mk_module(i+1, {i-i})
|
|
|
|
i = i + 2
|
|
|
|
end
|
|
|
|
j = j + 1
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
mk_modules()
|
|
|
|
local env = import_modules(mod_name(NumMods))
|
2014-06-13 15:26:05 +00:00
|
|
|
env:for_each_decl(function(d)
|
|
|
|
print(d:name())
|
|
|
|
end
|
2014-05-23 23:49:43 +00:00
|
|
|
)
|
|
|
|
for i = 1, NumMods do
|
|
|
|
assert(env:get(const_name(i)):is_definition())
|
|
|
|
end
|