From: darco Date: Mon, 18 Apr 2005 01:19:33 +0000 (+0000) Subject: more updates X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=6e89dfb3f07b7de0c01c954088c7e0ced8d24105;p=synfig.git more updates git-svn-id: http://svn.voria.com/code@18 1f10aa63-cdf2-0310-b900-c93c546f37ac --- diff --git a/synfig-core/trunk/src/sinfg/proto/Makefile b/synfig-core/trunk/src/sinfg/proto/Makefile new file mode 100644 index 0000000..68ce978 --- /dev/null +++ b/synfig-core/trunk/src/sinfg/proto/Makefile @@ -0,0 +1,18 @@ + +M4=m4 + +PROTO_PP=$(M4) proto.m4 + +FILES=nodebase.h + +all: $(FILES) + +clean: + $(RM) $(FILES) + +SUFFIXES=.px .h + +.SUFFIXES: $(SUFFIXES) + +.px.h: proto.m4 + $(PROTO_PP) $< > $@ diff --git a/synfig-core/trunk/src/sinfg/proto/nodebase.px b/synfig-core/trunk/src/sinfg/proto/nodebase.px new file mode 100644 index 0000000..77559c8 --- /dev/null +++ b/synfig-core/trunk/src/sinfg/proto/nodebase.px @@ -0,0 +1,101 @@ +/* === S I N F G =========================================================== */ +/*! \file nodebase.h +** \brief Template Header +** +** $Id: template.h,v 1.1.1.1 2005/01/04 01:23:09 darco Exp $ +** +** \legal +** Copyright (c) 2002 Robert B. Quattlebaum Jr. +** +** This software and associated documentation +** are CONFIDENTIAL and PROPRIETARY property of +** the above-mentioned copyright holder. +** +** You may not copy, print, publish, or in any +** other way distribute this software without +** a prior written agreement with +** the copyright holder. +** \endlegal +*/ +/* ========================================================================= */ + +/* === S T A R T =========================================================== */ + +#ifndef __SINFG_NODEBASE_H +#define __SINFG_NODEBASE_H + +/* === H E A D E R S ======================================================= */ + +#include "../protocol.h" +#include "../string.h" +#include "../guid.h" +#include + +/* === M A C R O S ========================================================= */ + +/* + +#define DEFINE_SIMPLE_FUNC(func_name, ret_type) \ + private: sigc::slot slot_##func_name; \ + public: ret_type func_name() { return slot_##func_name(); } + +#define DEFINE_SIMPLE_FUNC_CONST(func_name, ret_type) \ + private: sigc::slot slotconst_##func_name; \ + public: ret_type func_name()const { return slotconst_##func_name(); } + +#define DECLARE_FUNC(func_name, ret_type, ...) \ + private: sigc::slot slot_##func_name; +// public: ret_type func_name(__VA_ARGS__) + +#define DECLARE_FUNC_CONST(func_name, ret_type, ...) \ + private: sigc::slot slotconst_##func_name; + +// public: ret_type func_name(__VA_ARGS__)const + +#define DEFINE_FUNC(func_name, ret_type, arg_list, ...) \ + public: ret_type func_name(__VA_ARGS__) { return slot_##func_name arg_list; } + +#define DEFINE_FUNC_CONST(func_name, ret_type, arg_list, ...) \ + public: ret_type func_name(__VA_ARGS__)const { return slotconst_##func_name arg_list; } + +#define DEFINE_DATA(data_name, data_type) \ + DEFINE_SIMPLE_FUNC_CONST(get_ ## data_name, data_type); \ + DECLARE_FUNC(set_ ## data_name, void, data_type); \ + DEFINE_FUNC(set_ ## data_name, void, (x), data_type x) +*/ + +/* === T Y P E D E F S ===================================================== */ + +/* === C L A S S E S & S T R U C T S ======================================= */ + +namespace sinfg { +namespace Proto { + +class NodeBase : public Protocol +{ +public: + + PX_DEFINE_DATA(guid, GUID) + + PX_DEFINE_FUNC(func_test, float, int, int) + + PX_DEFINE_DATA(id, String) + + PX_DEFINE_DATA(root, NodeHandle) + + PX_DEFINE_FUNC(signal_changed, sigc::signal) + PX_DEFINE_FUNC(signal_deleted, sigc::signal) + + PX_DEFINE_FUNC_CONST(get_parents, const NodeList) + PX_DEFINE_FUNC_CONST(get_children, const NodeList) + + PX_DEFINE_FUNC(query_children, NodeList, Query) + +}; // END of class Proto::NodeBase + +}; // END of namespace Proto +}; // END of namespace sinfg + +/* === E N D =============================================================== */ + +#endif diff --git a/synfig-core/trunk/src/sinfg/proto/proto.m4 b/synfig-core/trunk/src/sinfg/proto/proto.m4 new file mode 100644 index 0000000..70c5299 --- /dev/null +++ b/synfig-core/trunk/src/sinfg/proto/proto.m4 @@ -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',` + private: sigc::slot< $2`'ifelse($#,2,,`, shift(shift($@))') > slot_$1; + public: $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',` + private: sigc::slot< $2`'ifelse($#,2,,`, shift(shift($@))') > slotconst_$1; + public: $2 $1(ifelse($#,2,,`_PRINT_ARGS(1,shift(shift($@)))'))const { + return slotconst_$1(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 +