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/property/init.h" |
22
|
|
|
|
|
|
|
#include "mycss/property/resources.h" |
23
|
|
|
|
|
|
|
#include "mycore/utils/resources.h" |
24
|
|
|
|
|
|
|
|
25
|
0
|
|
|
|
|
|
const mycss_property_index_static_entry_t * mycss_property_index_entry_by_name(const char* name, size_t length) |
26
|
|
|
|
|
|
|
{ |
27
|
0
|
0
|
|
|
|
|
if(length == 0) |
28
|
0
|
|
|
|
|
|
return NULL; |
29
|
|
|
|
|
|
|
|
30
|
0
|
|
|
|
|
|
size_t idx = ((mycore_string_chars_lowercase_map[ (const unsigned char)name[0] ] * |
31
|
0
|
|
|
|
|
|
mycore_string_chars_lowercase_map[ (const unsigned char)name[(length - 1)] ] * |
32
|
|
|
|
|
|
|
length) |
33
|
0
|
|
|
|
|
|
% MyCSS_PROPERTY_STATIC_INDEX_FOR_SEARCH_SIZE) + 1; |
34
|
|
|
|
|
|
|
|
35
|
0
|
0
|
|
|
|
|
while (mycss_property_index_static_for_search[idx].name) |
36
|
|
|
|
|
|
|
{ |
37
|
0
|
0
|
|
|
|
|
if(mycss_property_index_static_for_search[idx].name_length == length) { |
38
|
0
|
0
|
|
|
|
|
if(mycore_strncasecmp(mycss_property_index_static_for_search[idx].name, name, length) == 0) |
39
|
0
|
|
|
|
|
|
return &mycss_property_index_static_for_search[idx]; |
40
|
|
|
|
|
|
|
|
41
|
0
|
0
|
|
|
|
|
if(mycss_property_index_static_for_search[idx].next) |
42
|
0
|
|
|
|
|
|
idx = mycss_property_index_static_for_search[idx].next; |
43
|
|
|
|
|
|
|
else |
44
|
0
|
|
|
|
|
|
return NULL; |
45
|
|
|
|
|
|
|
} |
46
|
0
|
0
|
|
|
|
|
else if(mycss_property_index_static_for_search[idx].name_length > length) { |
47
|
0
|
|
|
|
|
|
return NULL; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
else { |
50
|
0
|
|
|
|
|
|
idx = mycss_property_index_static_for_search[idx].next; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
0
|
|
|
|
|
|
return NULL; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
0
|
|
|
|
|
|
mycss_property_type_t mycss_property_type_by_name(const char *name, size_t length) |
58
|
|
|
|
|
|
|
{ |
59
|
0
|
|
|
|
|
|
const mycss_property_index_static_entry_t *entry = mycss_property_index_entry_by_name(name, length); |
60
|
|
|
|
|
|
|
|
61
|
0
|
0
|
|
|
|
|
if(entry) |
62
|
0
|
|
|
|
|
|
return entry->type; |
63
|
|
|
|
|
|
|
|
64
|
0
|
|
|
|
|
|
return MyCSS_PROPERTY_TYPE_UNDEF; |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
0
|
|
|
|
|
|
const mycss_property_value_index_static_entry_t * mycss_property_value_index_entry_by_name(const char* name, size_t length) |
68
|
|
|
|
|
|
|
{ |
69
|
0
|
0
|
|
|
|
|
if(length == 0) |
70
|
0
|
|
|
|
|
|
return NULL; |
71
|
|
|
|
|
|
|
|
72
|
0
|
|
|
|
|
|
size_t idx = ((mycore_string_chars_lowercase_map[ (const unsigned char)name[0] ] * |
73
|
0
|
|
|
|
|
|
mycore_string_chars_lowercase_map[ (const unsigned char)name[(length - 1)] ] * |
74
|
|
|
|
|
|
|
length) |
75
|
0
|
|
|
|
|
|
% MyCSS_PROPERTY_VALUE_STATIC_INDEX_FOR_SEARCH_SIZE) + 1; |
76
|
|
|
|
|
|
|
|
77
|
0
|
0
|
|
|
|
|
while (mycss_property_value_index_static_for_search[idx].name) |
78
|
|
|
|
|
|
|
{ |
79
|
0
|
0
|
|
|
|
|
if(mycss_property_value_index_static_for_search[idx].name_length == length) { |
80
|
0
|
0
|
|
|
|
|
if(mycore_strncasecmp(mycss_property_value_index_static_for_search[idx].name, name, length) == 0) |
81
|
0
|
|
|
|
|
|
return &mycss_property_value_index_static_for_search[idx]; |
82
|
|
|
|
|
|
|
|
83
|
0
|
0
|
|
|
|
|
if(mycss_property_value_index_static_for_search[idx].next) |
84
|
0
|
|
|
|
|
|
idx = mycss_property_value_index_static_for_search[idx].next; |
85
|
|
|
|
|
|
|
else |
86
|
0
|
|
|
|
|
|
return NULL; |
87
|
|
|
|
|
|
|
} |
88
|
0
|
0
|
|
|
|
|
else if(mycss_property_value_index_static_for_search[idx].name_length > length) { |
89
|
0
|
|
|
|
|
|
return NULL; |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
else { |
92
|
0
|
|
|
|
|
|
idx = mycss_property_value_index_static_for_search[idx].next; |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
|
96
|
0
|
|
|
|
|
|
return NULL; |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
|
99
|
0
|
|
|
|
|
|
mycss_property_value_t mycss_property_value_type_by_name(const char *name, size_t length) |
100
|
|
|
|
|
|
|
{ |
101
|
0
|
|
|
|
|
|
const mycss_property_value_index_static_entry_t *entry = mycss_property_value_index_entry_by_name(name, length); |
102
|
|
|
|
|
|
|
|
103
|
0
|
0
|
|
|
|
|
if(entry) |
104
|
0
|
|
|
|
|
|
return entry->type; |
105
|
|
|
|
|
|
|
|
106
|
0
|
|
|
|
|
|
return MyCSS_PROPERTY_VALUE_UNDEF; |
107
|
|
|
|
|
|
|
} |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
|