aboutsummaryrefslogtreecommitdiffstats
path: root/src/blogc-make/ctx.h
blob: 3e18048a7dd16783b6f65136d22d58ce9f4c221f (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
/*
 * blogc: A blog compiler.
 * Copyright (C) 2016 Rafael G. Martins <rafael@rafaelmartins.eng.br>
 *
 * This program can be distributed under the terms of the BSD License.
 * See the file LICENSE.
 */

#ifndef _MAKE_CTX_H
#define _MAKE_CTX_H

#include <stdbool.h>
#include <time.h>
#include "settings.h"

typedef struct {
    char *path;
    char *short_path;
    struct timespec timestamp;
    bool readable;
} bm_filectx_t;

typedef struct {
    bm_settings_t *settings;

    char *root_dir;
    char *output_dir;

    bm_filectx_t *main_template_fctx;
    bm_filectx_t *atom_template_fctx;
    bm_filectx_t *settings_fctx;

    bc_slist_t *posts_fctx;
    bc_slist_t *pages_fctx;
    bc_slist_t *copy_files_fctx;
} bm_ctx_t;

bm_filectx_t* bm_filectx_new(bm_ctx_t *ctx, const char *filename);
void bm_filectx_free(bm_filectx_t *fctx);
bm_ctx_t* bm_ctx_new(const char *filename, bc_error_t **err);
void bm_ctx_free(bm_ctx_t *ctx);

#endif /* _MAKE_CTX_H */