-
Notifications
You must be signed in to change notification settings - Fork 10
chl_func_append
it4e edited this page Dec 12, 2016
·
5 revisions
<chl/chl.h>
chl_func_append, CHL function append
void chl_func_append(char * name, void (* function)(char *));
The chl_func_append() function is used to make a function [function] available to view and view component files, with the alias [name].
- 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.
No return value.
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