Use GCC 4 -fvisibility to control exported symbols.
1 #ifndef _RAZOR_INTERNAL_H_
2 #define _RAZOR_INTERNAL_H_
8 #if defined(__GNUC__) && __GNUC__ >= 4
9 #define RAZOR_EXPORT __attribute__ ((visibility("default")))
15 void *zalloc(size_t size);
22 void array_init(struct array *array);
23 void array_release(struct array *array);
24 void *array_add(struct array *array, int size);
28 uint32_t list_ptr : 24;
37 void list_set_empty(struct list_head *head);
38 void list_set_ptr(struct list_head *head, uint32_t ptr);
39 void list_set_array(struct list_head *head, struct array *pool, struct array *items, int force_indirect);
41 struct list *list_first(struct list_head *head, struct array *pool);
42 struct list *list_next(struct list *list);
44 void list_remap_pool(struct array *pool, uint32_t *map);
45 void list_remap_head(struct list_head *list, uint32_t *map);
53 void hashtable_init(struct hashtable *table, struct array *pool);
54 void hashtable_release(struct hashtable *table);
55 uint32_t hashtable_insert(struct hashtable *table, const char *key);
56 uint32_t hashtable_lookup(struct hashtable *table, const char *key);
57 uint32_t hashtable_tokenize(struct hashtable *table, const char *string);
60 struct razor_set_section {
66 struct razor_set_header {
69 struct razor_set_section sections[0];
72 #define RAZOR_MAGIC 0x7a7a7a7a
73 #define RAZOR_DETAILS_MAGIC 0x7a7a7a7b
74 #define RAZOR_FILES_MAGIC 0x7a7a7a7c
75 #define RAZOR_VERSION 1
77 #define RAZOR_STRING_POOL 0
78 #define RAZOR_PACKAGES 1
79 #define RAZOR_PROPERTIES 2
80 #define RAZOR_PACKAGE_POOL 3
81 #define RAZOR_PROPERTY_POOL 4
83 #define RAZOR_DETAILS_STRING_POOL 0
86 #define RAZOR_FILE_POOL 1
87 #define RAZOR_FILE_STRING_POOL 2
89 struct razor_package {
98 struct list_head properties;
99 struct list_head files;
103 struct razor_property {
107 struct list_head packages;
114 struct list_head packages;
117 #define RAZOR_ENTRY_LAST 0x80
120 struct array string_pool;
121 struct array packages;
122 struct array properties;
124 struct array package_pool;
125 struct array property_pool;
126 struct array file_pool;
127 struct array file_string_pool;
128 struct array details_string_pool;
129 struct razor_set_header *header;
130 struct razor_set_header *details_header;
131 struct razor_set_header *files_header;
134 struct import_entry {
139 struct import_directory {
140 uint32_t name, count;
142 struct array packages;
143 struct import_directory *last;
146 struct razor_importer {
147 struct razor_set *set;
148 struct hashtable table;
149 struct hashtable file_table;
150 struct hashtable details_table;
151 struct razor_package *package;
152 struct array properties;
154 struct array file_requires;
157 struct razor_package_iterator {
158 struct razor_set *set;
159 struct razor_package *package, *end;
165 razor_package_iterator_init_for_property(struct razor_package_iterator *pi,
166 struct razor_set *set,
167 struct razor_property *property);
169 struct razor_property_iterator {
170 struct razor_set *set;
171 struct razor_property *property, *end;
175 #define ALIGN(value, base) (((value) + (base - 1)) & ~((base) - 1))
178 razor_set_find_entry(struct razor_set *set,
179 struct razor_entry *dir, const char *pattern);
181 struct razor_merger *
182 razor_merger_create(struct razor_set *set1, struct razor_set *set2);
184 razor_merger_add_package(struct razor_merger *merger,
185 struct razor_package *package);
187 razor_merger_finish(struct razor_merger *merger);
189 /* Utility functions */
191 int razor_create_dir(const char *root, const char *path);
192 int razor_write(int fd, const void *data, size_t size);
195 typedef int (*razor_compare_with_data_func_t)(const void *p1,
199 razor_qsort_with_data(void *base, size_t nelem, size_t size,
200 razor_compare_with_data_func_t compare, void *data);
202 #endif /* _RAZOR_INTERNAL_H_ */