line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
/* |
2
|
|
|
|
|
|
|
Copyright (C) 2016-2017 Alexander Borisov |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or |
5
|
|
|
|
|
|
|
modify it under the terms of the GNU Lesser General Public |
6
|
|
|
|
|
|
|
License as published by the Free Software Foundation; either |
7
|
|
|
|
|
|
|
version 2.1 of the License, or (at your option) any later version. |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
This library is distributed in the hope that it will be useful, |
10
|
|
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
11
|
|
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12
|
|
|
|
|
|
|
Lesser General Public License for more details. |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
You should have received a copy of the GNU Lesser General Public |
15
|
|
|
|
|
|
|
License along with this library; if not, write to the Free Software |
16
|
|
|
|
|
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
Author: lex.borisov@gmail.com (Alexander Borisov) |
19
|
|
|
|
|
|
|
*/ |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
#include "mycss/values/values.h" |
22
|
|
|
|
|
|
|
#include "mycss/entry.h" |
23
|
|
|
|
|
|
|
|
24
|
0
|
|
|
|
|
|
void * mycss_values_create(mycss_entry_t* entry, size_t size) |
25
|
|
|
|
|
|
|
{ |
26
|
0
|
|
|
|
|
|
void *value = mchar_async_malloc(entry->mchar, entry->mchar_value_node_id, size); |
27
|
0
|
|
|
|
|
|
memset(value, 0, size); |
28
|
|
|
|
|
|
|
|
29
|
0
|
|
|
|
|
|
return value; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
0
|
|
|
|
|
|
void * mycss_values_destroy(mycss_entry_t* entry, void* value) |
33
|
|
|
|
|
|
|
{ |
34
|
0
|
0
|
|
|
|
|
if(value == NULL) |
35
|
0
|
|
|
|
|
|
return NULL; |
36
|
|
|
|
|
|
|
|
37
|
0
|
|
|
|
|
|
mchar_async_free(entry->mchar, entry->mchar_value_node_id, value); |
38
|
0
|
|
|
|
|
|
return NULL; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
0
|
|
|
|
|
|
void * mycss_values_realloc(mycss_entry_t* entry, void* value, size_t old_size, size_t up_to) |
42
|
|
|
|
|
|
|
{ |
43
|
0
|
|
|
|
|
|
char *new_value = mchar_async_realloc(entry->mchar, entry->mchar_value_node_id, value, old_size, (up_to + old_size)); |
44
|
0
|
|
|
|
|
|
memset(&new_value[old_size], 0, up_to); |
45
|
|
|
|
|
|
|
|
46
|
0
|
|
|
|
|
|
return (void*)new_value; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
0
|
|
|
|
|
|
void * mycss_values_clone(mycss_entry_t* entry, void* value) |
50
|
|
|
|
|
|
|
{ |
51
|
0
|
|
|
|
|
|
size_t size = mchar_async_get_size_by_data(value); |
52
|
|
|
|
|
|
|
|
53
|
0
|
|
|
|
|
|
void *new_value = mycss_values_create(entry, size); |
54
|
0
|
|
|
|
|
|
memcpy(new_value, value, size); |
55
|
|
|
|
|
|
|
|
56
|
0
|
|
|
|
|
|
return new_value; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
0
|
|
|
|
|
|
void mycss_values_entry_set(mycss_entry_t* entry, void** value) |
60
|
|
|
|
|
|
|
{ |
61
|
0
|
|
|
|
|
|
entry->values = value; |
62
|
0
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
0
|
|
|
|
|
|
void * mycss_values_entry(mycss_entry_t* entry) |
65
|
|
|
|
|
|
|
{ |
66
|
0
|
|
|
|
|
|
return (*entry->values); |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
0
|
|
|
|
|
|
unsigned int * mycss_values_type_list_add_entry(mycss_entry_t* entry, mycss_values_type_list_t *list) |
70
|
|
|
|
|
|
|
{ |
71
|
0
|
0
|
|
|
|
|
if(list->entries == NULL) { |
72
|
0
|
|
|
|
|
|
list->entries = mycss_values_create(entry, sizeof(unsigned int)); |
73
|
0
|
|
|
|
|
|
list->entries_length = 0; |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
else { |
76
|
0
|
|
|
|
|
|
list->entries = mycss_values_realloc(entry, list->entries, |
77
|
0
|
|
|
|
|
|
list->entries_length * sizeof(unsigned int), |
78
|
|
|
|
|
|
|
sizeof(unsigned int)); |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
0
|
|
|
|
|
|
unsigned int *type = &list->entries[ list->entries_length ]; |
82
|
0
|
|
|
|
|
|
list->entries_length++; |
83
|
|
|
|
|
|
|
|
84
|
0
|
|
|
|
|
|
return type; |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
0
|
|
|
|
|
|
mycss_values_image_t * mycss_values_image_list_add_entry(mycss_entry_t* entry, mycss_values_image_list_t *bg_image) |
88
|
|
|
|
|
|
|
{ |
89
|
0
|
0
|
|
|
|
|
if(bg_image->images == NULL) { |
90
|
0
|
|
|
|
|
|
bg_image->images = mycss_values_create(entry, sizeof(mycss_values_image_t)); |
91
|
0
|
|
|
|
|
|
bg_image->images_length = 0; |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
else { |
94
|
0
|
|
|
|
|
|
bg_image->images = mycss_values_realloc(entry, bg_image->images, |
95
|
0
|
|
|
|
|
|
bg_image->images_length * sizeof(mycss_values_image_t), |
96
|
|
|
|
|
|
|
sizeof(mycss_values_image_t)); |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
|
99
|
0
|
|
|
|
|
|
mycss_values_image_t *image = &bg_image->images[ bg_image->images_length ]; |
100
|
0
|
|
|
|
|
|
bg_image->images_length++; |
101
|
|
|
|
|
|
|
|
102
|
0
|
|
|
|
|
|
return image; |
103
|
|
|
|
|
|
|
} |
104
|
|
|
|
|
|
|
|
105
|
0
|
|
|
|
|
|
mycss_values_background_repeat_t * mycss_values_background_repeat_list_add_entry(mycss_entry_t* entry, mycss_values_background_repeat_list_t *list) |
106
|
|
|
|
|
|
|
{ |
107
|
0
|
0
|
|
|
|
|
if(list->entries == NULL) { |
108
|
0
|
|
|
|
|
|
list->entries = mycss_values_create(entry, sizeof(mycss_values_background_repeat_t)); |
109
|
0
|
|
|
|
|
|
list->entries_length = 0; |
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
else { |
112
|
0
|
|
|
|
|
|
list->entries = mycss_values_realloc(entry, list->entries, |
113
|
0
|
|
|
|
|
|
list->entries_length * sizeof(mycss_values_background_repeat_t), |
114
|
|
|
|
|
|
|
sizeof(mycss_values_background_repeat_t)); |
115
|
|
|
|
|
|
|
} |
116
|
|
|
|
|
|
|
|
117
|
0
|
|
|
|
|
|
mycss_values_background_repeat_t *repeat = &list->entries[ list->entries_length ]; |
118
|
0
|
|
|
|
|
|
list->entries_length++; |
119
|
|
|
|
|
|
|
|
120
|
0
|
|
|
|
|
|
return repeat; |
121
|
|
|
|
|
|
|
} |
122
|
|
|
|
|
|
|
|
123
|
0
|
|
|
|
|
|
mycss_values_background_size_entry_t * mycss_values_background_size_list_add_entry(mycss_entry_t* entry, mycss_values_background_size_list_t *list) |
124
|
|
|
|
|
|
|
{ |
125
|
0
|
0
|
|
|
|
|
if(list->entries == NULL) { |
126
|
0
|
|
|
|
|
|
list->entries = mycss_values_create(entry, sizeof(mycss_values_background_size_entry_t)); |
127
|
0
|
|
|
|
|
|
list->entries_length = 0; |
128
|
|
|
|
|
|
|
} |
129
|
|
|
|
|
|
|
else { |
130
|
0
|
|
|
|
|
|
list->entries = mycss_values_realloc(entry, list->entries, |
131
|
0
|
|
|
|
|
|
list->entries_length * sizeof(mycss_values_background_size_entry_t), |
132
|
|
|
|
|
|
|
sizeof(mycss_values_background_size_entry_t)); |
133
|
|
|
|
|
|
|
} |
134
|
|
|
|
|
|
|
|
135
|
0
|
|
|
|
|
|
mycss_values_background_size_entry_t *size_entry = &list->entries[ list->entries_length ]; |
136
|
0
|
|
|
|
|
|
list->entries_length++; |
137
|
|
|
|
|
|
|
|
138
|
0
|
|
|
|
|
|
return size_entry; |
139
|
|
|
|
|
|
|
} |
140
|
|
|
|
|
|
|
|