Variable argument lists in m4

Posted by waffleman on Stack Overflow See other posts from Stack Overflow or by waffleman
Published on 2010-06-14T10:31:11Z Indexed on 2010/06/14 10:32 UTC
Read the original article Hit count: 320

Filed under:

Anyone know how to write an m4 macro to accepts an arbitrary list of parameters?

Here is an example for what I want to implement:

ADD_OBJECTS_TO_LAYOUT(`LAYOUT_1', (`OBJ_ID_SQUARE', `COLOR_ID_RED'))
ADD_OBJECTS_TO_LAYOUT(`LAYOUT_2', (`OBJ_ID_SQUARE', `COLOR_ID_RED'), (`OBJ_ID_CIRCLE', `COLOR_ID_GREEN'))
ADD_OBJECTS_TO_LAYOUT(`LAYOUT_3', (`OBJ_ID_CIRCLE', `COLOR_ID_GREEN'), (`OBJ_ID_CIRCLE', `COLOR_ID_BLUE'), (`OBJ_ID_TIRANGLE', `COLOR_ID_RED'))

© Stack Overflow or respective owner

Related posts about m4