# ctl

Static template generator for C

## Usage

```html
% #include "src/ctl_macro.h" %

% CTL_TEMPLDEF(
  example,
  char *title;
) %

<!DOCTYPE html>
<html lang="en">
  <head>
    <title>% STRING(ctx->title) %</title>
  </head>
</html>

% CTL_ENDTEMPL %
```

```bash
ctl -h example.html > ctl_example.h
ctl -o example.html > ctl_example.so
```

```c
#include <so/ctl.h>
#include "ctl/ctl_example.h"

#define CTL_DL_PATH($name) "./ctl_" #$name ".so"

char *__out = NULL;

void __ctl_write(const char *str) {
  str_append(&__out, (char *) str);
}

ctl_t __ctl = {
  .write = __ctl_write,
};

HTTP_GET("/example", example_page)
  example_t example = {
    .title = title,
  };
  return ctl_serve(&example, example_render, CTL_DL_PATH(example));
}
```

```c
#define STRING(x) ctl->write(x);
```
