Skip to main content

ec_interpolate_register_func

Last updated March 2020

Name

ec_interpolate_register_func — Register a macro expansion function

Synopsis

#include "misc/expand_string.h"

| void **ec_interpolate_register_func** ( | macro, |   | |   | closure, |   | |   | func, |   | |   | flags); |   |

const char * <var class="pdparam">macro</var>; void * <var class="pdparam">closure</var>; ec_interpolator_func <var class="pdparam">func</var>; int <var class="pdparam">flags</var>;

Description

Register a macro expansion function. The macro string will be matched using a literal string comparison, unless the macro string contains the character ‘*’ which will match any sequence of 1 or more characters terminated by the character that follows it.

Consequently, "foo" will be a literal string match, but "foo:*" will match "%{foo:bar}" and "%{foo:baz}" but not "%{foo:}".

Parameters

macro

The macro to be matched.

closure

A pointer to the closure function. This parameter can be NULL.

func

The function to perform the expansion.

flags

Indicate function capabilities. This is typically 0.

If a macro is registered as a recursive macro, then it will be called again on its own output continually for as long as the output matches its own macro definition. The number of times that this happens is limited by the expansion infrastructure to a reasonable number to avoid infinitely recursing.

Return Value

This function returns void.

Threading

It is legal to call this function in the Scheduler thread.

Was this page helpful?