STASIS
A pipeline delivery generator
Loading...
Searching...
No Matches
template.h
Go to the documentation of this file.
1
2#ifndef STASIS_TEMPLATE_H
3#define STASIS_TEMPLATE_H
4
5#include "core.h"
6
13void tpl_register(char *key, char **ptr);
14
18void tpl_free();
19
25char *tpl_getval(char *key);
26
33char *tpl_render(char *str);
34
41int tpl_render_to_file(char *str, const char *filename);
42
43struct tplfunc_frame;
44
45typedef int tplfunc(struct tplfunc_frame *frame, void *data_out);
46
48 char *key;
49 tplfunc *func;
50 void *data_in;
51 int argc;
52 union {
54 char *t_char_ptr;
55 void *t_void_ptr;
56 int *t_int_ptr;
57 unsigned *t_uint_ptr;
58 float *t_float_ptr;
59 double *t_double_ptr;
60 char t_char;
61 int t_int;
62 unsigned t_uint;
63 float t_float;
64 double t_double;
65 } argv[10]; // accept up to 10 arguments
66};
67
75void tpl_register_func(char *key, tplfunc *tplfunc_ptr, int argc, void *data_in);
76
82struct tplfunc_frame *tpl_getfunc(char *key);
83
84#endif //STASIS_TEMPLATE_H
Definition template.h:47
double t_double
type of double
Definition template.h:64
char * t_char_ptr
pointer
Definition template.h:54
char ** t_char_refptr
&pointer
Definition template.h:53
int argc
Maximum number of arguments to accept.
Definition template.h:51
int t_int
type of int
Definition template.h:61
float t_float
type of float
Definition template.h:63
unsigned t_uint
type of unsigned int
Definition template.h:62
tplfunc * func
Pointer to the function.
Definition template.h:49
void * data_in
Pointer to internal data (can be NULL)
Definition template.h:50
char t_char
type of char
Definition template.h:60
int * t_int_ptr
pointer to int
Definition template.h:56
char * key
Name of the function.
Definition template.h:48
float * t_float_ptr
pointer to float
Definition template.h:58
double * t_double_ptr
pointer to double
Definition template.h:59
unsigned * t_uint_ptr
pointer to unsigned int
Definition template.h:57
void * t_void_ptr
pointer to void
Definition template.h:55
char * tpl_getval(char *key)
Definition template.c:129
void tpl_register(char *key, char **ptr)
Definition template.c:64
void tpl_register_func(char *key, tplfunc *tplfunc_ptr, int argc, void *data_in)
Definition template.c:29
struct tplfunc_frame * tpl_getfunc(char *key)
Definition template.c:143
void tpl_free()
Definition template.c:107
char * tpl_render(char *str)
Definition template.c:157
int tpl_render_to_file(char *str, const char *filename)
Definition template.c:311