def formatContexts(contexts, declaration=True):
    """Given a list of context type names, generate a list of declarations
       for them as formal parameters (if 'declaration' is true), or
       as arguments to a function (if 'declaration' is false).
    """
    if declaration:
        s = "".join(", const {0}_t *{0}_ctx".format(c) for c in contexts)
    else:
        s = "".join(", {0}_ctx".format(c) for c in contexts)
    return s