aboutsummaryrefslogtreecommitdiff
path: root/ctemplate.h
blob: 4479141b59b5860eb6afb7940bd2762018dff9d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/*
 * C TemplateS Library 0.1 -
 * Forked from C Template Library 1.0 by Stephen C. Losen.
 *
 * Copyright 2017 Alexander M. Pickering  Distributed under the terms
 * of the GNU General Public License (GPL)
 */

#ifndef _CTEMPLATE_H
#define _CTEMPLATE_H

/*
 * TMPL_varlist is a variable list of simple variables and/or
 * loop variables
 */

/* Holdes all the data needed for a template*/
struct TMPL_templates;
struct TMPL_varlist;
struct TMPL_loop;



/*Things to do with varlists*/
extern struct TMPL_varlist* TMPL_alloc_varlist();
extern struct TMPL_loop*    TMPL_alloc_loop();
extern void                 TMPL_add_var_to_varlist(
		                                    struct TMPL_varlist* t,
		                                    char* varname,
					            char* value
			    );
extern void                 TMPL_add_loop_to_varlist(
		                                     struct TMPL_varlist* t,
						     char* name,
		                                     struct TMPL_loop* l
			    );
extern void                 TMPL_add_varlist_to_loop(
		                                     struct TMPL_loop* l,
						     struct TMPL_varlist* t
			    );
		                         
extern void                 TMPL_free_varlist(struct TMPL_varlist* t);
extern void                 TMPL_free_loop(struct TMPL_loop* l);




extern struct TMPL_templates* TMPL_alloc_template(char* t);
extern void                   TMPL_free_template(struct TMPL_templates* t);

extern char* TMPL_render(struct TMPL_templates* t,struct TMPL_varlist* varlist);

extern char* TMPL_get_error(struct TMPL_templates* t);


#endif