# translate-c: add framework for special-casing macros · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/dc4fa83dd767096595ae4e84c3a7dbfd80cbf115)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: dc4fa83dd767096595ae4e84c3a7dbfd80cbf115

Requested commit: dc4fa83dd767096595ae4e84c3a7dbfd80cbf115

Commit: dc4fa83dd767096595ae4e84c3a7dbfd80cbf115

Tree: ee5da4ef9d5ca57c8f7d3181bd17a6feebec8762

Author: Evan Haas

Committer: Evan Haas

## Message

````
translate-c: add framework for special-casing macros

Some macros (for example any macro that uses token pasting) cannot be
directly translated to Zig, but may nevertheless still admit a Zig
implementation. This provides a mechanism for matching macros against
templates and mapping them to functions implemented in c_translation.zig.

A macro matches a template if it contains the same sequence of tokens, except
that the name and parameters may be renamed. No attempt is made to
semantically analyze the macro. For example the following two macros are
considered equivalent:

```C
```

But the following two are not:

```C
```

````

## Parents

- [18b8738069268cc913bbae9580d2d170618a2ae9](https://git.cafe/gitcafe/zig/commit/18b8738069268cc913bbae9580d2d170618a2ae9?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/dc4fa83dd767096595ae4e84c3a7dbfd80cbf115?format=markdown)
