From 921db62f5055b8b77ae1d8c677e43f11371d90c4 Mon Sep 17 00:00:00 2001 From: Nathanael Sensfelder Date: Mon, 19 Aug 2019 23:19:44 +0200 Subject: ... --- src/shared/struct/shr_omnimods.erl | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 'src/shared/struct/shr_omnimods.erl') diff --git a/src/shared/struct/shr_omnimods.erl b/src/shared/struct/shr_omnimods.erl index ae8ba44..f452e34 100644 --- a/src/shared/struct/shr_omnimods.erl +++ b/src/shared/struct/shr_omnimods.erl @@ -80,7 +80,8 @@ -export ( [ - encode/1 + encode/1, + export/1 ] ). @@ -114,6 +115,22 @@ encode_mods (Mods) -> dict:to_list(Mods) ). +-spec mod_list_to_string_list (mods()) -> list(). +mod_list_to_string_list (Mods) -> + ( + "__MOD_LIST(" + ++ + lists:map + ( + fun ({Name, Value}) -> + io_lib:format("__MOD_~p(~p),", [Name, Value]) + end, + Mods + ) + ++ + ")" + ). + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% EXPORTED FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -351,3 +368,13 @@ encode (Omnimods) -> {<<"defm">>, encode_mods(Omnimods#omnimods.defmods)} ] }. + +-spec export (type()) -> list(). +export (Omnimods) -> + ( + mod_list_to_string_list(dict:to_list(Omnimods#omnimods.attmods)) + ++ "\n" + ++ mod_list_to_string_list(dict:to_list(Omnimods#omnimods.atkmods)) + ++ "\n" + ++ mod_list_to_string_list(dict:to_list(Omnimods#omnimods.defmods)) + ). -- cgit v1.2.3-70-g09d2