-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathpla.h
127 lines (105 loc) · 3.2 KB
/
pla.h
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
123
124
125
126
127
/*
* Copyright 2011-2015 Thierry FOURNIER
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License.
*
*/
#ifndef __PLA_H__
#define __PLA_H__
#include <time.h>
#include "list.h"
enum language {
french = 0,
english = 1,
};
struct disp {
time_t start;
unsigned int duration;
int w;
int h;
int h1;
int rs;
int h2;
struct list_head *base;
struct list_head *res;
int display_res;
int display_id;
double margin;
};
struct color {
double r;
double g;
double b;
double a;
};
struct res {
/* chain */
struct list_head c;
/* name */
char *name;
};
struct task {
/* chain */
struct list_head c;
/* task */
char *id;
char *name;
struct color color;
struct color bg;
int bg_isset;
/* durée */
time_t start;
unsigned int duration;
/* avancement */
unsigned int percent;
/* dependances */
int ndep;
struct task **deps;
/* resources */
int nres;
struct res **res;
/* fils */
struct task *parent;
struct list_head _child;
struct list_head childs;
};
/* resource */
struct res *pla_res_new(struct list_head *base, const char *name);
void pla_res_set_name(struct res *res, const char *name);
struct res *pla_res_get_by_name(struct list_head *base, const char *name);
void pla_res_sort(struct list_head *base);
/* planning */
struct task *pla_task_new(struct list_head *base, const char *name, const char *color,
time_t start, unsigned int duration);
void pla_task_set_start(struct task *task, time_t start);
int pla_task_set_start_ymd(struct task *task, const char *start);
int pla_task_set_start_ymdd(struct task *task, const char *start);
int pla_task_set_start_ymdh(struct task *task, const char *start);
int pla_task_set_start_ymdhh(struct task *task, const char *start);
void pla_task_set_duration(struct task *task, unsigned int duration);
void pla_task_set_duration_h(struct task *task, unsigned int duration);
int pla_task_set_duration_sh(struct task *task, const char *duration);
void pla_task_set_duration_d(struct task *task, unsigned int duration);
int pla_task_set_duration_sd(struct task *task, const char *duration);
void pla_task_set_color(struct task *task, const char *color);
void pla_task_set_bg(struct task *task, const char *color);
void pla_task_set_percent(struct task *task, unsigned int percent);
int pla_task_set_percent_s(struct task *task, const char *percent);
void pla_task_add_child(struct task *task, struct task *child);
void pla_task_add_dep(struct task *task, struct task *dep);
void pla_task_add_res(struct task *task, struct res *res);
void pla_task_del_child(struct task *child);
void pla_task_del_dep(struct task *dep);
int pla_task_get_level(struct task *task);
int pla_task_get_order(struct list_head *base, struct task *t);
void pla_task_update_date(struct task *task);
struct task *pla_task_get_by_id(struct list_head *base, const char *id);
struct task *pla_task_get_by_id_n(struct list_head *base, const char *id, int len);
struct task *pla_has_cycle(struct list_head *base);
/* int pla_get_first_id(struct list_head *base); */
/* utils */
int conv(const char *in, int len);
#endif /* __PLA_H__ */