diff options
author | David Walter Seikel | 2013-01-13 17:29:19 +1000 |
---|---|---|
committer | David Walter Seikel | 2013-01-13 17:29:19 +1000 |
commit | 07274513e984f0b5544586c74508ccd16e7dcafa (patch) | |
tree | b32ff2a9136fbc1a4a6a0ed1e4d79cde0f5f16d9 /libraries/edje/src/bin/edje_cc_sources.c | |
parent | Added Irrlicht 1.8, but without all the Windows binaries. (diff) | |
download | SledjHamr-07274513e984f0b5544586c74508ccd16e7dcafa.zip SledjHamr-07274513e984f0b5544586c74508ccd16e7dcafa.tar.gz SledjHamr-07274513e984f0b5544586c74508ccd16e7dcafa.tar.bz2 SledjHamr-07274513e984f0b5544586c74508ccd16e7dcafa.tar.xz |
Remove EFL, since it's been released now.
Diffstat (limited to 'libraries/edje/src/bin/edje_cc_sources.c')
-rw-r--r-- | libraries/edje/src/bin/edje_cc_sources.c | 259 |
1 files changed, 0 insertions, 259 deletions
diff --git a/libraries/edje/src/bin/edje_cc_sources.c b/libraries/edje/src/bin/edje_cc_sources.c deleted file mode 100644 index d9cd0c1..0000000 --- a/libraries/edje/src/bin/edje_cc_sources.c +++ /dev/null | |||
@@ -1,259 +0,0 @@ | |||
1 | #ifdef HAVE_CONFIG_H | ||
2 | # include "config.h" | ||
3 | #endif | ||
4 | |||
5 | #include <string.h> | ||
6 | #include <ctype.h> | ||
7 | #include <limits.h> | ||
8 | |||
9 | #include "edje_cc.h" | ||
10 | |||
11 | static Eet_Data_Descriptor *_srcfile_edd = NULL; | ||
12 | static Eet_Data_Descriptor *_srcfile_list_edd = NULL; | ||
13 | |||
14 | static Eet_Data_Descriptor *_external_edd = NULL; | ||
15 | static Eet_Data_Descriptor *_external_list_edd = NULL; | ||
16 | |||
17 | static Eet_Data_Descriptor *_font_edd = NULL; | ||
18 | static Eet_Data_Descriptor *_font_list_edd = NULL; | ||
19 | |||
20 | static SrcFile_List srcfiles = {NULL}; | ||
21 | |||
22 | void | ||
23 | source_edd(void) | ||
24 | { | ||
25 | Eet_Data_Descriptor_Class eddc; | ||
26 | |||
27 | eet_eina_stream_data_descriptor_class_set(&eddc, sizeof (eddc), "srcfile", sizeof (SrcFile)); | ||
28 | _srcfile_edd = eet_data_descriptor_stream_new(&eddc); | ||
29 | EET_DATA_DESCRIPTOR_ADD_BASIC(_srcfile_edd, SrcFile, "name", name, EET_T_INLINED_STRING); | ||
30 | EET_DATA_DESCRIPTOR_ADD_BASIC(_srcfile_edd, SrcFile, "file", file, EET_T_INLINED_STRING); | ||
31 | |||
32 | eet_eina_stream_data_descriptor_class_set(&eddc, sizeof (eddc), "srcfile_list", sizeof (SrcFile_List)); | ||
33 | _srcfile_list_edd = eet_data_descriptor_stream_new(&eddc); | ||
34 | EET_DATA_DESCRIPTOR_ADD_LIST(_srcfile_list_edd, SrcFile_List, "list", list, _srcfile_edd); | ||
35 | |||
36 | eet_eina_stream_data_descriptor_class_set(&eddc, sizeof (eddc), "external", sizeof (External)); | ||
37 | _external_edd = eet_data_descriptor_stream_new(&eddc); | ||
38 | EET_DATA_DESCRIPTOR_ADD_BASIC(_external_edd, External, "name", name, EET_T_INLINED_STRING); | ||
39 | |||
40 | eet_eina_stream_data_descriptor_class_set(&eddc, sizeof (eddc), "external_list", sizeof (External_List)); | ||
41 | _external_list_edd = eet_data_descriptor_stream_new(&eddc); | ||
42 | EET_DATA_DESCRIPTOR_ADD_LIST(_external_list_edd, External_List, "list", list, _external_edd); | ||
43 | |||
44 | eet_eina_stream_data_descriptor_class_set(&eddc, sizeof (eddc), "font", sizeof (Font)); | ||
45 | _font_edd = eet_data_descriptor_stream_new(&eddc); | ||
46 | EET_DATA_DESCRIPTOR_ADD_BASIC(_font_edd, Font, "file", file, EET_T_INLINED_STRING); | ||
47 | EET_DATA_DESCRIPTOR_ADD_BASIC(_font_edd, Font, "name", name, EET_T_INLINED_STRING); | ||
48 | |||
49 | eet_eina_stream_data_descriptor_class_set(&eddc, sizeof (eddc), "font_list", sizeof (Font_List)); | ||
50 | _font_list_edd = eet_data_descriptor_stream_new(&eddc); | ||
51 | EET_DATA_DESCRIPTOR_ADD_LIST(_font_list_edd, Font_List, "list", list, _font_edd); | ||
52 | } | ||
53 | |||
54 | static void source_fetch_file(const char *fil, const char *filname); | ||
55 | |||
56 | static void | ||
57 | source_fetch_file(const char *fil, const char *filname) | ||
58 | { | ||
59 | FILE *f; | ||
60 | char buf[16 * 1024], *dir = NULL; | ||
61 | long sz; | ||
62 | size_t tmp; | ||
63 | ssize_t dir_len = 0; | ||
64 | SrcFile *sf; | ||
65 | |||
66 | f = fopen(fil, "rb"); | ||
67 | if (!f) | ||
68 | { | ||
69 | ERR("%s: Warning. Cannot open file '%s'", | ||
70 | progname, fil); | ||
71 | exit(-1); | ||
72 | } | ||
73 | |||
74 | fseek(f, 0, SEEK_END); | ||
75 | sz = ftell(f); | ||
76 | fseek(f, 0, SEEK_SET); | ||
77 | sf = mem_alloc(SZ(SrcFile)); | ||
78 | sf->name = mem_strdup(filname); | ||
79 | sf->file = mem_alloc(sz + 1); | ||
80 | if (sz > 0) | ||
81 | { | ||
82 | tmp = fread(sf->file, sz, 1, f); | ||
83 | if (tmp != 1) | ||
84 | { | ||
85 | ERR("%s: Warning file length for (%s) doesn't match !", | ||
86 | progname, filname); | ||
87 | exit(-1); | ||
88 | } | ||
89 | } | ||
90 | |||
91 | sf->file[sz] = '\0'; | ||
92 | fseek(f, 0, SEEK_SET); | ||
93 | srcfiles.list = eina_list_append(srcfiles.list, sf); | ||
94 | |||
95 | while (fgets(buf, sizeof(buf), f)) | ||
96 | { | ||
97 | char *p, *pp; | ||
98 | int got_hash = 0; | ||
99 | int forgetit = 0; | ||
100 | int haveinclude = 0; | ||
101 | char *file = NULL, *fname = NULL; | ||
102 | |||
103 | p = buf; | ||
104 | while ((!forgetit) && (*p)) | ||
105 | { | ||
106 | if (!got_hash) | ||
107 | { | ||
108 | if (!isspace(*p)) | ||
109 | { | ||
110 | if (*p == '#') | ||
111 | got_hash = 1; | ||
112 | else | ||
113 | forgetit = 1; | ||
114 | } | ||
115 | p++; | ||
116 | } | ||
117 | |||
118 | if (!haveinclude) | ||
119 | { | ||
120 | if (!isspace(*p)) | ||
121 | { | ||
122 | if (!strncmp(p, "include", 7)) | ||
123 | { | ||
124 | haveinclude = 1; | ||
125 | p += 7; | ||
126 | } | ||
127 | /* HACK! the logic above should be fixed so | ||
128 | * preprocessor statements don't have to begin | ||
129 | * in column 0. | ||
130 | * otoh, edje_cc should print a warning in that case, | ||
131 | * since according to the standard, preprocessor | ||
132 | * statements need to be put in column 0. | ||
133 | */ | ||
134 | else if (!strncmp(p, "#include", 8)) | ||
135 | { | ||
136 | haveinclude = 1; | ||
137 | p += 8; | ||
138 | } | ||
139 | else | ||
140 | forgetit = 1; | ||
141 | } | ||
142 | } | ||
143 | else | ||
144 | { | ||
145 | if (!isspace(*p)) | ||
146 | { | ||
147 | char end = '\0'; | ||
148 | |||
149 | if (*p == '"') end = '"'; | ||
150 | else if (*p == '<') end = '>'; | ||
151 | |||
152 | if (end) | ||
153 | { | ||
154 | pp = strchr(p + 1, end); | ||
155 | if (!pp) | ||
156 | forgetit = 1; | ||
157 | else | ||
158 | { | ||
159 | char *slash; | ||
160 | ssize_t l = 0; | ||
161 | |||
162 | /* get the directory of the current file | ||
163 | * if we haven't already done so | ||
164 | */ | ||
165 | if ((!dir) && (strrchr(fil, '/'))) | ||
166 | { | ||
167 | dir = mem_strdup(fil); | ||
168 | slash = strrchr(dir, '/'); | ||
169 | *slash = '\0'; | ||
170 | dir_len = strlen(dir); | ||
171 | } | ||
172 | |||
173 | l = pp - p + dir_len + 1; | ||
174 | file = mem_alloc(l); | ||
175 | |||
176 | if (!dir_len) | ||
177 | { | ||
178 | snprintf(file, l - 1, "%s", p + 1); | ||
179 | file[l - 2] = 0; | ||
180 | } | ||
181 | else | ||
182 | { | ||
183 | snprintf(file, l, "%s/%s", dir, p + 1); | ||
184 | file[l - 1] = 0; | ||
185 | } | ||
186 | |||
187 | |||
188 | fname = strdup(p + 1); | ||
189 | pp = strrchr(fname, end); | ||
190 | if (pp) *pp = 0; | ||
191 | forgetit = 1; | ||
192 | } | ||
193 | } | ||
194 | else | ||
195 | forgetit = 1; | ||
196 | } | ||
197 | else | ||
198 | p++; | ||
199 | } | ||
200 | |||
201 | got_hash = 0; | ||
202 | } | ||
203 | if ((file) && (fname)) | ||
204 | { | ||
205 | source_fetch_file(file, fname); | ||
206 | free(file); | ||
207 | free(fname); | ||
208 | } | ||
209 | } | ||
210 | free(dir); | ||
211 | fclose(f); | ||
212 | } | ||
213 | |||
214 | void | ||
215 | source_fetch(void) | ||
216 | { | ||
217 | char buf[PATH_MAX] = {0}, *ptr; | ||
218 | |||
219 | ptr = strrchr(file_in, '/'); | ||
220 | if (ptr) | ||
221 | { | ||
222 | snprintf(buf, sizeof (buf), "%s", ptr + 1); | ||
223 | } | ||
224 | |||
225 | source_fetch_file(file_in, buf[0] ? buf : file_in); | ||
226 | } | ||
227 | |||
228 | int | ||
229 | source_append(Eet_File *ef) | ||
230 | { | ||
231 | return eet_data_write(ef, _srcfile_list_edd, "edje_sources", &srcfiles, 1); | ||
232 | } | ||
233 | |||
234 | SrcFile_List * | ||
235 | source_load(Eet_File *ef) | ||
236 | { | ||
237 | SrcFile_List *s; | ||
238 | |||
239 | s = eet_data_read(ef, _srcfile_list_edd, "edje_sources"); | ||
240 | return s; | ||
241 | } | ||
242 | |||
243 | int | ||
244 | source_fontmap_save(Eet_File *ef, Eina_List *font_list) | ||
245 | { | ||
246 | Font_List fl; | ||
247 | |||
248 | fl.list = font_list; | ||
249 | return eet_data_write(ef, _font_list_edd, "edje_source_fontmap", &fl, 1); | ||
250 | } | ||
251 | |||
252 | Font_List * | ||
253 | source_fontmap_load(Eet_File *ef) | ||
254 | { | ||
255 | Font_List *fl; | ||
256 | |||
257 | fl = eet_data_read(ef, _font_list_edd, "edje_source_fontmap"); | ||
258 | return fl; | ||
259 | } | ||