lyx_mirror/sigc++/macros
Jean-Marc Lasgouttes f3850c0c5f More small fixes
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1058 a592a061-630c-0410-9148-cb99ea01b6c8
2000-09-29 13:58:45 +00:00
..
.cvsignore more FILMagain stuff 2000-06-12 11:55:12 +00:00
basic_signal.h.m4 More small fixes 2000-09-29 13:58:45 +00:00
bind.h.m4 Signal3 now supported 2000-08-10 04:54:00 +00:00
class_slot.h.m4 Signal3 now supported 2000-08-10 04:54:00 +00:00
convert.h.m4 Signal3 now supported 2000-08-10 04:54:00 +00:00
func_slot.h.m4 Signal3 now supported 2000-08-10 04:54:00 +00:00
Makefile.am more FILMagain stuff 2000-06-12 11:55:12 +00:00
object_slot.h.m4 Signal3 now supported 2000-08-10 04:54:00 +00:00
README more FILMagain stuff 2000-06-12 11:55:12 +00:00
retbind.h.m4 Signal3 now supported 2000-08-10 04:54:00 +00:00
rettype.h.m4 Signal3 now supported 2000-08-10 04:54:00 +00:00
slot.h.m4 Signal3 now supported 2000-08-10 04:54:00 +00:00
template.macros.m4 more FILMagain stuff 2000-06-12 11:55:12 +00:00

This directory contains files associated with building large numbers
of templates needed to represent different numbers of parameters.
The file signal.macros.m4 defines all necessary macros for construction
of templates with variable arguments.

These files will be placed in $(INCLUDE_DIR)/sigc++/macros for
reuse.

Requires: 
  Gnu M4 (others m4 may work)

Macros of particular interest:

  IF(arg1,arg2[,arg3]) - if arg1 non-zero length print arg2, else arg3
  LIST(arg0,cond0 [,arg1,cond1]) - generates comma seperated list with 
    conditions for each argument
  ARG_CLASS([P1,P2, ... ]) - generates string "class P1,class P2"
  ARG_BOTH([P1,P2, ... ])  - generates string "P1 p1,P2 p2"
  ARG_TYPE([P1,P2, ... ])  - generates string "P1,P2"
  ARG_NAME([P1,P2, ... ])  - generates string "p1,p2"
  [name]NUM(arg)           - prints name#, where # is items in arg
  ARGS(P,n)                - generates string [P1,P2,...Pn]

example:

  To generalize this...

    template<class P1,class P2>  // needs to be inline for zero arguments
      void Foo::func2(int (*f)(P1,P2),P1 p1,P2 p2)
        {func(p1,p2);
        }

  Use this... 

    include(template.macros.m4)
    define([FOO_FUNC],
    [
    IF([$1],template<ARG_CLASS($1)>,inline) 
      void Foo::[func]NUM($1)(LIST(int (*f)(ARG_TYPE($1)),1,ARG_BOTH($1),[$1]))
        {func(ARG_NAME($1));
        }
    ])

    FOO_FUNC(ARGS(P,0))
    FOO_FUNC(ARGS(P,1))
    FOO_FUNC(ARGS(P,2))

  (to prove it m4 this README file.  Honest!)