Release synfig_0_61_04
[synfig.git] / synfig-core / tags / synfig_0_61_04 / synfig-core / src / synfig / proto / proto.m4
diff --git a/synfig-core/tags/synfig_0_61_04/synfig-core/src/synfig/proto/proto.m4 b/synfig-core/tags/synfig_0_61_04/synfig-core/src/synfig/proto/proto.m4
new file mode 100644 (file)
index 0000000..91800eb
--- /dev/null
@@ -0,0 +1,37 @@
+dnl
+
+ define(`forloop',
+               `pushdef(`$1', `$2')_forloop(`$1', `$2', `$3', `$4')popdef(`$1')')
+ define(`_forloop',
+               `$4`'ifelse($1, `$3', ,
+                          `define(`$1', incr($1))_forloop(`$1', `$2', `$3', `$4')')')
+
+define(`_PRINT_ARGS',`dnl
+ifelse($#,1,,`$2 v$1`'ifelse($#,2,,`, _PRINT_ARGS(incr($1), shift(shift($@)))')')dnl
+')dnl
+
+define(`_PRINT_ARGS2',`dnl
+ifelse($#,1,,`v$1`'ifelse($#,2,,`, _PRINT_ARGS2(incr($1), shift(shift($@)))')')dnl
+')dnl
+
+dnl PX_DEFINE_FUNC(func_name, ret_type, args...)
+define(`PX_DEFINE_FUNC',`
+       sigc::slot< $2`'ifelse($#,2,,`, shift(shift($@))') > _slot_$1;
+       $2 $1(ifelse($#,2,,`_PRINT_ARGS(1,shift(shift($@)))')) {
+               return _slot_$1(ifelse($#,2,,`_PRINT_ARGS2(1,shift(shift($@)))'));
+       }
+')dnl
+
+dnl PX_DEFINE_FUNC_CONST(func_name, ret_type, args...)
+define(`PX_DEFINE_FUNC_CONST',`
+       sigc::slot< $2`'ifelse($#,2,,`, shift(shift($@))') > _slot_$1_const;
+       $2 $1(ifelse($#,2,,`_PRINT_ARGS(1,shift(shift($@)))'))const {
+               return _slot_$1_const(ifelse($#,2,,`_PRINT_ARGS2(1,shift(shift($@)))'));
+       }
+')dnl
+
+define(`PX_DEFINE_DATA', `dnl
+PX_DEFINE_FUNC_CONST(get_$1, $2)
+PX_DEFINE_FUNC(set_$1, void, $2)
+')dnl
+