diff options
author | Karl Berry <karl@freefriends.org> | 2019-04-04 20:55:44 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2019-04-04 20:55:44 +0000 |
commit | acab24042d34dd439e1d074820d1da2fa1d591cd (patch) | |
tree | 32881f869e20a69711c5fe86134aa48143d9b1e8 /Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/tools/make_gd_wrap.lua | |
parent | 93f5c4643a3d0a596d220ff14756ce68d99afe33 (diff) |
pgf (4apr19)
git-svn-id: svn://tug.org/texlive/trunk@50758 c570f23f-e606-0410-a88d-b1316a301751
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.lua | 88 |
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 b13dcb9abb4..a0aee6501cc 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 --- wraper. +-- wrapper. @@ -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 + |