summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'portrait/global.m4.conf')
-rw-r--r--portrait/global.m4.conf35
1 files changed, 35 insertions, 0 deletions
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