summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornsensfel <SpamShield0@noot-noot.org>2018-10-02 16:23:27 +0200
committernsensfel <SpamShield0@noot-noot.org>2018-10-02 16:23:27 +0200
commitc6483e4e04af1500e4d328a6b4482c8507823d27 (patch)
tree8b5c1892dd845c79f1e508f2a7b3f44116ac453a
parent4833abcc8883cc9701b90be3af70c9354547431c (diff)
Adds portraits as a data listing.
-rw-r--r--portrait/basic.m4d5
-rw-r--r--portrait/global.m4.conf35
2 files changed, 40 insertions, 0 deletions
diff --git a/portrait/basic.m4d b/portrait/basic.m4d
new file mode 100644
index 0000000..ca56b28
--- /dev/null
+++ b/portrait/basic.m4d
@@ -0,0 +1,5 @@
+__PORTRAIT(cat, Black Cat, mammal, cat)m4_dnl
+__PORTRAIT(grey_cat, Grey Cat, mammal, grey_cat)m4_dnl
+__PORTRAIT(orange_cat, Orange Cat, mammal, orange_cat)m4_dnl
+__PORTRAIT(hermine, Stoat, mammal, hermine)m4_dnl
+__PORTRAIT(crow, Crow, bird, crow)m4_dnl
diff --git a/portrait/global.m4.conf b/portrait/global.m4.conf
new file mode 100644
index 0000000..a99f0db
--- /dev/null
+++ b/portrait/global.m4.conf
@@ -0,0 +1,35 @@
+m4_define(`__PORTRAIT_CHOOSE_STYLE',
+ `m4_define(`__PORTRAIT',m4_defn(`$1'))m4_undefine(`$1')')m4_dnl
+m4_dnl
+m4_dnl
+m4_dnl
+m4_define(`__PORTRAIT_ERLANG_STYLE',`from_id (`$1') ->
+ #portrait
+ {
+ id = <<"$1">>,
+ name = <<"$2">>,
+ body_id = <<"$3">>,
+ icon_id = <<"$4">>
+ };
+')m4_dnl
+m4_define(`__PORTRAIT_USE_ERLANG_STYLE',
+ `__PORTRAIT_CHOOSE_STYLE(`__PORTRAIT_ERLANG_STYLE')')m4_dnl
+m4_dnl
+m4_dnl
+m4_dnl
+m4_define(`__PORTRAIT_JSON_STYLE',` {
+ "msg": "add_portrait",
+ "id": "$1",
+ "nam": "$2",
+ "bid": "$3",
+ "iid": "$4"
+ },
+')m4_dnl
+m4_define(`__PORTRAIT_USE_JSON_STYLE',
+ `__PORTRAIT_CHOOSE_STYLE(`__PORTRAIT_JSON_STYLE')')m4_dnl
+m4_dnl
+m4_dnl
+m4_dnl
+m4_ifelse(__CODE_STYLE(),
+ erlang, `__PORTRAIT_USE_ERLANG_STYLE()',
+ __CODE_STYLE(), json, `__PORTRAIT_USE_JSON_STYLE()')m4_dnl