Skip to content
it4e edited this page Dec 12, 2016 · 5 revisions

Name

<chl/chl.h>

chl_func_append, CHL function append

Declaration

void chl_func_append(char * name, void (* function)(char *));

Description

The chl_func_append() function is used to make a function [function] available to view and view component files, with the alias [name].

Arguments

  • name: the alias for the function that will be used in view.
  • function: a pointer to a function taking a single *char ** argument and returning void.

Return value

No return value.


Examples

main.c

#include <chl/chl.h>
#include <stdio.h>

void print(char * args) {
    char * arg = chl_next_arg(args);
    fputs(arg, stdout);
}

int main() {
    chl_func_append("print", print);
    chl_view("view.vw");
}

view.vw

<{ print("Hello"); }>

Output: Hello

As CHL is open-source, people are able to contribute with their own APIs, plugins and code which means that CHL is constantly upgraded and provided with new features. Do you have an idea for a new CHL feature and want to contribute?

See contribute.

Setup. API. Tutorial. Examples. FastCGI.

Clone this wiki locally