summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/tools/make_gd_wrap.lua
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/tools/make_gd_wrap.lua')
-rw-r--r--Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/tools/make_gd_wrap.lua88
1 files changed, 44 insertions, 44 deletions
diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/tools/make_gd_wrap.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/tools/make_gd_wrap.lua
index a0aee6501cc..b13dcb9abb4 100644
--- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/tools/make_gd_wrap.lua
+++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/tools/make_gd_wrap.lua
@@ -17,7 +17,7 @@
-- algorithm implemented in C and wish to invoke it from Lua, you need
-- a wrapper that manages the translation between Lua and C. This
-- program is intended to make it (reasonably) easy to produce such a
--- wrapper.
+-- wraper.
@@ -29,7 +29,7 @@ Usage: make_gd_wrap library1 library2 ... libraryn template library_name target_
This program will read all of the graph drawing library files using
Lua's require. Then, it will iterate over all declared algorithm keys
-(declared using declare { algorithm_written_in_c = ... }) and will
+(declared using declare { algorithm_written_in_c = ... }) and will
produce the code for library for the required target C files based on
the template.
"]])
@@ -82,79 +82,79 @@ local factories = {}
local factories_reg = {}
for _,k in ipairs(keys) do
-
+
if k.algorithm_written_in_c and k.code then
local library, fun_name = k.algorithm_written_in_c:match("(.*)%.(.*)")
-
- if target == library then
+
+ if target == library then
-- First, gather the includes:
if type(k.includes) == "string" then
- if not includes[k.includes] then
- includes[#includes + 1] = k.includes
- includes[k.includes] = true
- end
+ if not includes[k.includes] then
+ includes[#includes + 1] = k.includes
+ includes[k.includes] = true
+ end
elseif type(k.includes) == "table" then
- for _,i in ipairs(k.includes) do
- if not includes[i] then
- includes[#includes + 1] = i
- includes[i] = true
- end
- end
+ for _,i in ipairs(k.includes) do
+ if not includes[i] then
+ includes[#includes + 1] = i
+ includes[i] = true
+ end
+ end
end
-
+
-- Second, create a code block:
functions[#functions+1] = functions_dec:gsub("%$([%w_]-)%b{}",
- {
- function_name = fun_name,
- function_body = k.code
- })
-
+ {
+ function_name = fun_name,
+ function_body = k.code
+ })
+
-- Third, create functions_registry entry
functions_registry[#functions_registry + 1] = functions_reg_dec:gsub("%$([%w_]-)%b{}",
- {
- function_name = fun_name,
- function_body = k.code
- })
+ {
+ function_name = fun_name,
+ function_body = k.code
+ })
end
end
-
+
if k.module_class then
-
+
-- First, gather the includes:
if type(k.includes) == "string" then
if not includes[k.includes] then
- includes[#includes + 1] = k.includes
- includes[k.includes] = true
+ includes[#includes + 1] = k.includes
+ includes[k.includes] = true
end
elseif type(k.includes) == "table" then
for _,i in ipairs(k.includes) do
- if not includes[i] then
- includes[#includes + 1] = i
- includes[i] = true
- end
+ if not includes[i] then
+ includes[#includes + 1] = i
+ includes[i] = true
+ end
end
end
-
+
-- Second, create a code block:
factories[#factories+1] = factories_dec:gsub(
"%$([%w_]-)%b{}",
{
- factory_class = k.module_class,
- factory_code = k.code,
- factory_base = k.module_base,
- factory_name = k.module_class .. '_factory'
+ factory_class = k.module_class,
+ factory_code = k.code,
+ factory_base = k.module_base,
+ factory_name = k.module_class .. '_factory'
})
-
+
-- Third, create factories_registry entry
factories_reg[#factories_reg + 1] = factories_reg_dec:gsub(
"%$([%w_]-)%b{}",
{
- factory_class = k.module_class,
- factory_code = k.code,
- factory_base = k.module_base,
- factory_name = k.module_class .. '_factory'
+ factory_class = k.module_class,
+ factory_code = k.code,
+ factory_base = k.module_base,
+ factory_name = k.module_class .. '_factory'
})
end
end
@@ -180,4 +180,4 @@ file:write ((template:gsub(
})))
file:close()
-
+ \ No newline at end of file