aboutsummaryrefslogtreecommitdiff
path: root/include/vars.h
blob: f7eeda9855b94cf59e733079298831cdca3b8588 (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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#ifndef VARS_H
#define VARS_H

#include <stdbool.h>
#include <stddef.h>

#define MAX_REPOS 100
#define MAX_DIRS 10
#define MAX_PATH_LEN 1024

typedef struct {
    char *key;
    char *value;
} KeyValue;

typedef struct {
    char *key;
    char *value;
} MapItem;

typedef struct {
    MapItem *items;
    size_t size;
    size_t capacity;
} Map;

typedef struct {
    char *url;
    char *version;
} Dependency;

typedef struct {
    char *source_key;
    char *source_value;
    char *version;
    Dependency *dependencies;
    size_t dep_count;
    int build_ref;
    int pre_install_ref;
    int install_ref;
    int post_install_ref;
} Repo;

typedef struct {
    char *url;
    char *name;
    const char *target;
    char *ver;
    char src[MAX_PATH_LEN];
    bool is_local;
} Pkg;

extern bool is_symlink_install;
extern bool is_verbose;
extern bool is_auto_installed;
extern bool config_exists;

extern char home_dir[MAX_PATH_LEN];

extern char root_config[MAX_PATH_LEN];
extern bool is_root_config;
extern char config_dir[MAX_PATH_LEN];
extern char config_file[MAX_PATH_LEN];
extern char repo_file[MAX_PATH_LEN];

extern char bin[MAX_PATH_LEN];
extern char lib[MAX_PATH_LEN];
extern char inc[MAX_PATH_LEN];
extern char src[MAX_PATH_LEN];

extern char *install_directories[5];

extern const char *version;

extern const char *red;
extern const char *green;
extern const char *yellow;
extern const char *blue;
extern const char *magenta;
extern const char *cyan;
extern const char *gray;
extern const char *bright_red;
extern const char *bright_green;
extern const char *bright_yellow;
extern const char *bright_blue;
extern const char *bright_magenta;
extern const char *bright_cyan;
extern const char *bright_gray;
extern const char *bold_red;
extern const char *bold_green;
extern const char *bold_yellow;
extern const char *bold_blue;
extern const char *bold_magenta;
extern const char *bold_cyan;
extern const char *bold_gray;
extern const char *bold_white;
extern const char *bold_bright_red;
extern const char *bold_bright_green;
extern const char *bold_bright_yellow;
extern const char *bold_bright_blue;
extern const char *bold_bright_magenta;
extern const char *bold_bright_cyan;
extern const char *bold_bright_gray;
extern const char *italic;
extern const char *color_reset;

extern const char *print_pkgit;
extern const char *print_skipped;
extern const char *print_warning;
extern const char *print_error;

void init_vars();
const char* get_install_dir(const char *key);
bool file_exists(const char *path);
bool is_directory(const char *path);
int mkdir_p(const char *path);

void map_init(Map *map);
void map_put(Map *map, char *key, char *value);
char* map_get(Map *map, const char *key);

#endif