summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Zaoui <daniel.zaoui@samsung.com>2014-03-20 17:33:25 +0200
committerDaniel Zaoui <daniel.zaoui@samsung.com>2014-03-24 08:14:30 +0200
commit0987b31247b99fcd78eaaddd60072279a9dc9be4 (patch)
tree362950c5b61675cd43bff07fad5e513f10bb0a2d /src
parent2be615916a019b82f772203ffd35aed4ff21732e (diff)
Eolian/Generator: detach Eo1 from Legacy generator.
This step is needed to clean the code and to prepare the integration of Eo2 inside Eolian. Except the eo_do invocation, there is no reason why legacy has to know about Eo.
Diffstat (limited to 'src')
-rw-r--r--src/bin/eolian/eo1_generator.c46
-rw-r--r--src/bin/eolian/eo1_generator.h15
-rw-r--r--src/bin/eolian/legacy_generator.c121
-rw-r--r--src/bin/eolian/legacy_generator.h18
-rw-r--r--src/bin/eolian/main.c150
5 files changed, 102 insertions, 248 deletions
diff --git a/src/bin/eolian/eo1_generator.c b/src/bin/eolian/eo1_generator.c
index 6573d7f..b6f61ef 100644
--- a/src/bin/eolian/eo1_generator.c
+++ b/src/bin/eolian/eo1_generator.c
@@ -854,3 +854,49 @@ end:
854 return ret; 854 return ret;
855} 855}
856 856
857Eina_Bool
858eo_source_generate(const char *classname, int eo_version EINA_UNUSED, Eina_Strbuf *buf)
859{
860 Eina_Bool ret = EINA_FALSE;
861 const Eina_List *itr;
862 Eolian_Function fn;
863
864 Eina_Strbuf *str_bodyf = eina_strbuf_new();
865
866 if (!eo1_source_beginning_generate(classname, buf)) goto end;
867
868 //Properties
869 EINA_LIST_FOREACH(eolian_class_functions_list_get(classname, PROPERTY_FUNC), itr, fn)
870 {
871 const Eolian_Function_Type ftype = eolian_function_type_get(fn);
872
873 Eina_Bool prop_read = ( ftype == SET ) ? EINA_FALSE : EINA_TRUE;
874 Eina_Bool prop_write = ( ftype == GET ) ? EINA_FALSE : EINA_TRUE;
875
876 if (prop_write)
877 {
878 if (!eo1_bind_func_generate(classname, fn, SET, str_bodyf, NULL)) goto end;
879 }
880 if (prop_read)
881 {
882 if (!eo1_bind_func_generate(classname, fn, GET, str_bodyf, NULL)) goto end;
883 }
884 }
885
886 //Methods
887 EINA_LIST_FOREACH(eolian_class_functions_list_get(classname, METHOD_FUNC), itr, fn)
888 {
889 if (!eo1_bind_func_generate(classname, fn, UNRESOLVED, str_bodyf, NULL)) goto end;
890 }
891
892 eina_strbuf_append(buf, eina_strbuf_string_get(str_bodyf));
893 eina_strbuf_reset(str_bodyf);
894
895 if (!eo1_source_end_generate(classname, buf)) goto end;
896
897 ret = EINA_TRUE;
898end:
899 eina_strbuf_free(str_bodyf);
900 return ret;
901}
902
diff --git a/src/bin/eolian/eo1_generator.h b/src/bin/eolian/eo1_generator.h
index 5db237b..8fba677 100644
--- a/src/bin/eolian/eo1_generator.h
+++ b/src/bin/eolian/eo1_generator.h
@@ -4,6 +4,21 @@
4#include<Eina.h> 4#include<Eina.h>
5 5
6/* 6/*
7 * @brief Generate Eo source code for Eo class
8 *
9 * This function generates all the source code for Eo.
10 *
11 * @param[in] classname class name
12 * @param[in] eo_version Eo version to generate
13 * @param[inout] buf buffer to fill
14 *
15 * @return EINA_TRUE on success, EINA_FALSE on error.
16 *
17 */
18Eina_Bool
19eo_source_generate(const char *classname, int eo_version, Eina_Strbuf *buf);
20
21/*
7 * @brief Generate beginning of Eo1 source code for Eo class 22 * @brief Generate beginning of Eo1 source code for Eo class
8 * 23 *
9 * This function generates the base id definition and the list of events. 24 * This function generates the base id definition and the list of events.
diff --git a/src/bin/eolian/legacy_generator.c b/src/bin/eolian/legacy_generator.c
index 7284778..f1d209c 100644
--- a/src/bin/eolian/legacy_generator.c
+++ b/src/bin/eolian/legacy_generator.c
@@ -321,18 +321,6 @@ end:
321 eina_strbuf_free(eoparam); 321 eina_strbuf_free(eoparam);
322} 322}
323 323
324//TODO change replacement
325static char*
326_class_h_find(const char *classname, Eina_Strbuf *buf)
327{
328 Eina_Strbuf *classreal = eina_strbuf_new();
329 _template_fill(classreal, "@#OBJCLASS_CLASS", classname, "", EINA_FALSE);
330 char *ret = strstr(eina_strbuf_string_get(buf), eina_strbuf_string_get(classreal));
331 eina_strbuf_free(classreal);
332
333 return ret;
334}
335
336Eina_Bool 324Eina_Bool
337legacy_header_generate(const char *classname, int eo_version EINA_UNUSED, Eina_Strbuf *buf) 325legacy_header_generate(const char *classname, int eo_version EINA_UNUSED, Eina_Strbuf *buf)
338{ 326{
@@ -371,101 +359,11 @@ legacy_header_generate(const char *classname, int eo_version EINA_UNUSED, Eina_S
371} 359}
372 360
373Eina_Bool 361Eina_Bool
374legacy_header_append(const char *classname, int eo_version EINA_UNUSED, Eina_Strbuf *header) 362legacy_source_generate(const char *classname, int eo_version EINA_UNUSED, Eina_Strbuf *buf)
375{
376 const Eolian_Function_Type ftype_order[] = {CONSTRUCTOR, PROPERTY_FUNC, METHOD_FUNC};
377 char tmpstr[0xFF];
378
379 if (!eolian_class_exists(classname))
380 {
381 printf ("Class \"%s\" not found in database\n", classname);
382 return EINA_FALSE;
383 }
384
385 char *clsptr = _class_h_find(classname, header);
386
387 if (!clsptr)
388 {
389 printf ("Class %s not found - append all\n", classname);
390 eina_strbuf_append_char(header, '\n');
391 if (!eo1_header_generate(classname, header)) return EINA_FALSE;
392 return EINA_TRUE;
393 }
394
395 printf ("Class %s found - searching for functions...\n", classname);
396
397 char *funcdef_pos = _nextline(strstr(clsptr, "+ sub_id)"), 1);
398 char *subid_pos = _startline(clsptr, strstr(clsptr, "SUB_ID_LAST"));
399
400 if (!(funcdef_pos && subid_pos) || (subid_pos > funcdef_pos))
401 {
402 printf ("Bad insertion queues - update aborted\n");
403 return EINA_FALSE;
404 }
405
406 Eina_Strbuf *str_subid = eina_strbuf_new();
407 Eina_Strbuf *str_funcdef = eina_strbuf_new();
408
409 const Eina_List *l;
410 void *data;
411
412 int i;
413 for (i = 0; i < 3; i++)
414 EINA_LIST_FOREACH(eolian_class_functions_list_get(classname, ftype_order[i]), l, data)
415 {
416 const Eolian_Function_Type ftype = eolian_function_type_get((Eolian_Function)data);
417 const char *funcname = eolian_function_name_get((Eolian_Function)data);
418 Eina_Bool prop_read = (ftype == PROPERTY_FUNC || ftype == GET ) ? EINA_TRUE : EINA_FALSE ;
419 Eina_Bool prop_write = (ftype == PROPERTY_FUNC || ftype == SET ) ? EINA_TRUE : EINA_FALSE ;
420
421 if (!prop_read && !prop_write)
422 {
423 if (!strstr(eina_strbuf_string_get(header), funcname))
424 {
425 printf ("Appending eo function %s\n", funcname);
426 eo1_enum_append(classname, funcname, str_subid);
427 if (!eo1_fundef_generate(classname, (Eolian_Function)data, UNRESOLVED, str_funcdef)) return EINA_FALSE;
428 }
429 }
430 if (prop_write)
431 {
432 sprintf(tmpstr, "%s_set", funcname);
433 if (!strstr(eina_strbuf_string_get(header), tmpstr))
434 {
435 printf ("Appending eo function %s\n", tmpstr);
436 eo1_enum_append(classname, tmpstr, str_subid);
437 if (!eo1_fundef_generate(classname, (Eolian_Function)data, SET, str_funcdef)) return EINA_FALSE;
438 }
439 }
440 if (prop_read)
441 {
442 sprintf(tmpstr, "%s_get", funcname);
443 if (!strstr(eina_strbuf_string_get(header), tmpstr))
444 {
445 printf ("Appending eo function %s\n", tmpstr);
446 eo1_enum_append(classname, tmpstr, str_subid);
447 if (!eo1_fundef_generate(classname, (Eolian_Function)data, GET, str_funcdef)) return EINA_FALSE;
448 }
449 }
450 }
451
452 const char *hdstr = eina_strbuf_string_get(header);
453 unsigned enum_offs = subid_pos - hdstr;
454 unsigned defs_offs = funcdef_pos - hdstr + eina_strbuf_length_get(str_subid);
455 eina_strbuf_insert(header, eina_strbuf_string_get(str_subid), enum_offs);
456 eina_strbuf_insert(header, eina_strbuf_string_get(str_funcdef), defs_offs);
457
458 eina_strbuf_free(str_subid);
459 eina_strbuf_free(str_funcdef);
460
461 return EINA_TRUE;
462}
463
464Eina_Bool
465legacy_source_generate(const char *classname, Eina_Bool legacy, int eo_version EINA_UNUSED, Eina_Strbuf *buf)
466{ 363{
467 Eina_Bool ret = EINA_FALSE; 364 Eina_Bool ret = EINA_FALSE;
468 const Eina_List *itr; 365 const Eina_List *itr;
366 Eolian_Function fn;
469 367
470 if (!eolian_class_exists(classname)) 368 if (!eolian_class_exists(classname))
471 { 369 {
@@ -476,10 +374,7 @@ legacy_source_generate(const char *classname, Eina_Bool legacy, int eo_version E
476 Eina_Strbuf *tmpbuf = eina_strbuf_new(); 374 Eina_Strbuf *tmpbuf = eina_strbuf_new();
477 Eina_Strbuf *str_bodyf = eina_strbuf_new(); 375 Eina_Strbuf *str_bodyf = eina_strbuf_new();
478 376
479 if (!eo1_source_beginning_generate(classname, buf)) goto end;
480
481 //Properties 377 //Properties
482 Eolian_Function fn;
483 EINA_LIST_FOREACH(eolian_class_functions_list_get(classname, PROPERTY_FUNC), itr, fn) 378 EINA_LIST_FOREACH(eolian_class_functions_list_get(classname, PROPERTY_FUNC), itr, fn)
484 { 379 {
485 const Eolian_Function_Type ftype = eolian_function_type_get(fn); 380 const Eolian_Function_Type ftype = eolian_function_type_get(fn);
@@ -489,29 +384,23 @@ legacy_source_generate(const char *classname, Eina_Bool legacy, int eo_version E
489 384
490 if (prop_write) 385 if (prop_write)
491 { 386 {
492 if (!eo1_bind_func_generate(classname, fn, SET, str_bodyf, NULL)) goto end; 387 _eapi_func_generate(classname, fn, SET, str_bodyf);
493 if (legacy) _eapi_func_generate(classname, fn, SET, str_bodyf);
494 } 388 }
495 if (prop_read) 389 if (prop_read)
496 { 390 {
497 if (!eo1_bind_func_generate(classname, fn, GET, str_bodyf, NULL)) goto end; 391 _eapi_func_generate(classname, fn, GET, str_bodyf);
498 if (legacy) _eapi_func_generate(classname, fn, GET, str_bodyf);
499 } 392 }
500 } 393 }
501 394
502 //Methods 395 //Methods
503 EINA_LIST_FOREACH(eolian_class_functions_list_get(classname, METHOD_FUNC), itr, fn) 396 EINA_LIST_FOREACH(eolian_class_functions_list_get(classname, METHOD_FUNC), itr, fn)
504 { 397 {
505 if (!eo1_bind_func_generate(classname, fn, UNRESOLVED, str_bodyf, NULL)) goto end; 398 _eapi_func_generate(classname, fn, UNRESOLVED, str_bodyf);
506 if (legacy) _eapi_func_generate(classname, fn, UNRESOLVED, str_bodyf);
507 } 399 }
508 400
509 eina_strbuf_append(buf, eina_strbuf_string_get(str_bodyf)); 401 eina_strbuf_append(buf, eina_strbuf_string_get(str_bodyf));
510 402
511 if (!eo1_source_end_generate(classname, buf)) goto end;
512
513 ret = EINA_TRUE; 403 ret = EINA_TRUE;
514end:
515 eina_strbuf_free(tmpbuf); 404 eina_strbuf_free(tmpbuf);
516 eina_strbuf_free(str_bodyf); 405 eina_strbuf_free(str_bodyf);
517 406
diff --git a/src/bin/eolian/legacy_generator.h b/src/bin/eolian/legacy_generator.h
index 39445f3..6a3964f 100644
--- a/src/bin/eolian/legacy_generator.h
+++ b/src/bin/eolian/legacy_generator.h
@@ -20,35 +20,19 @@
20Eina_Bool legacy_header_generate(const char *classname, int eo_version, Eina_Strbuf *buf); 20Eina_Bool legacy_header_generate(const char *classname, int eo_version, Eina_Strbuf *buf);
21 21
22/* 22/*
23 * @brief Append legacy EAPI header for Eo class
24 *
25 * This function needs to be used in case we want to add new functions
26 * to an existing class.
27 *
28 * @param[in] classname class name
29 * @param[in] eo_version Eo version to generate
30 * @param[inout] buf buffer to fill
31 *
32 * @return EINA_TRUE on success, EINA_FALSE on error.
33 *
34 */
35Eina_Bool legacy_header_append(const char *classname, int eo_version, Eina_Strbuf *buf);
36
37/*
38 * @brief Generate C source code for Eo class 23 * @brief Generate C source code for Eo class
39 * 24 *
40 * This function needs to be used to generate C source code. It is generating 25 * This function needs to be used to generate C source code. It is generating
41 * code from scratch. 26 * code from scratch.
42 * 27 *
43 * @param[in] classname class name 28 * @param[in] classname class name
44 * @param[in] legacy indicates if the legacy has to be generated
45 * @param[in] eo_version Eo version to generate 29 * @param[in] eo_version Eo version to generate
46 * @param[inout] buf buffer to fill 30 * @param[inout] buf buffer to fill
47 * 31 *
48 * @return EINA_TRUE on success, EINA_FALSE on error. 32 * @return EINA_TRUE on success, EINA_FALSE on error.
49 * 33 *
50 */ 34 */
51Eina_Bool legacy_source_generate(const char *classname, Eina_Bool legacy, int eo_version, Eina_Strbuf *buf); 35Eina_Bool legacy_source_generate(const char *classname, int eo_version, Eina_Strbuf *buf);
52 36
53#endif 37#endif
54 38
diff --git a/src/bin/eolian/main.c b/src/bin/eolian/main.c
index 8530042..8e09133 100644
--- a/src/bin/eolian/main.c
+++ b/src/bin/eolian/main.c
@@ -45,35 +45,14 @@ _filename_get(const char *path)
45} 45}
46 46
47static Eina_Bool 47static Eina_Bool
48_generate_h_file(char *filename, const char *classname, Eina_Bool append) 48_generate_eo_h_file(char *filename, const char *classname)
49{ 49{
50 Eina_Bool ret = EINA_FALSE; 50 Eina_Bool ret = EINA_FALSE;
51 Eina_Strbuf *hfile = eina_strbuf_new(); 51 Eina_Strbuf *hfile = eina_strbuf_new();
52 if (append) 52 if (!eo1_header_generate(classname, hfile))
53 {
54 Eina_File *fn = eina_file_open(filename, EINA_FALSE);
55 if (!fn)
56 {
57 ERR ("Cant open file \"%s\" for updating.", filename);
58 goto end;
59 }
60
61 eina_strbuf_append(hfile, (char*)eina_file_map_all(fn, EINA_FILE_SEQUENTIAL));
62 eina_file_close(fn);
63
64 if (!legacy_header_append(classname, eo_version, hfile))
65 {
66 ERR("Failed to generate header for %s", classname);
67 goto end;
68 }
69 }
70 else
71 { 53 {
72 if (!eo1_header_generate(classname, hfile)) 54 ERR("Failed to generate header for %s", classname);
73 { 55 goto end;
74 ERR("Failed to generate header for %s", classname);
75 goto end;
76 }
77 } 56 }
78 57
79 const char *htext = eina_strbuf_string_get(hfile); 58 const char *htext = eina_strbuf_string_get(hfile);
@@ -103,65 +82,59 @@ end:
103} 82}
104 83
105static Eina_Bool 84static Eina_Bool
106_generate_c_file(char *filename, const char *classname, Eina_Bool append) 85_generate_c_file(char *filename, const char *classname)
107{ 86{
108 Eina_Bool ret = EINA_FALSE; 87 Eina_Bool ret = EINA_FALSE;
109 88
110 Eina_Strbuf *cfile = eina_strbuf_new(); 89 Eina_Strbuf *eo_buf = eina_strbuf_new();
111 if (!legacy_source_generate(classname, legacy_support, eo_version, cfile)) 90 Eina_Strbuf *legacy_buf = eina_strbuf_new();
91
92 if (!eo_source_generate(classname, eo_version, eo_buf))
112 { 93 {
113 ERR("Failed to generate source for %s", classname); 94 ERR("Failed to generate source for %s", classname);
114 goto end; 95 goto end;
115 } 96 }
116 97
117 FILE* fd = fopen(filename, (append) ? "a" : "w"); 98 if (legacy_support)
99 if (!legacy_source_generate(classname, eo_version, legacy_buf))
100 {
101 ERR("Failed to generate source for %s", classname);
102 goto end;
103 }
104
105 FILE* fd = fopen(filename, "w");
118 if (!fd) 106 if (!fd)
119 { 107 {
120 ERR("Couldnt open file %s for writing", filename); 108 ERR("Couldnt open file %s for writing", filename);
121 goto end; 109 goto end;
122 } 110 }
123 const char *ctext = eina_strbuf_string_get(cfile); 111
124 if (ctext) fputs(ctext, fd); 112 const char *text = eina_strbuf_string_get(eo_buf);
113 if (text) fputs(text, fd);
114 text = eina_strbuf_string_get(legacy_buf);
115 if (text) fputs(text, fd);
116
125 fclose(fd); 117 fclose(fd);
126 118
127 ret = EINA_TRUE; 119 ret = EINA_TRUE;
128end: 120end:
129 eina_strbuf_free(cfile); 121 eina_strbuf_free(legacy_buf);
122 eina_strbuf_free(eo_buf);
130 return ret; 123 return ret;
131} 124}
132 125
133// TODO join with header gen. 126// TODO join with header gen.
134static Eina_Bool 127static Eina_Bool
135_generate_legacy_header_file(char *filename, const char *classname, Eina_Bool append) 128_generate_legacy_header_file(char *filename, const char *classname)
136{ 129{
137 Eina_Bool ret = EINA_FALSE; 130 Eina_Bool ret = EINA_FALSE;
138 131
139 Eina_Strbuf *lfile = eina_strbuf_new(); 132 Eina_Strbuf *lfile = eina_strbuf_new();
140 133
141 if (append) 134 if (!legacy_header_generate(classname, eo_version, lfile))
142 {
143 Eina_File *fn = eina_file_open(filename, EINA_FALSE);
144 if (!fn)
145 {
146 ERR ("Cant open file \"%s\" for updating.", filename);
147 goto end;
148 }
149 eina_strbuf_append(lfile, (char*)eina_file_map_all(fn, EINA_FILE_SEQUENTIAL));
150 eina_file_close(fn);
151
152 if (!legacy_header_append(classname, eo_version, lfile))
153 {
154 ERR("Failed to generate header for %s", classname);
155 goto end;
156 }
157 }
158 else
159 { 135 {
160 if (!legacy_header_generate(classname, eo_version, lfile)) 136 ERR("Failed to generate header for %s", classname);
161 { 137 goto end;
162 ERR("Failed to generate header for %s", classname);
163 goto end;
164 }
165 } 138 }
166 139
167 FILE* fd = fopen(filename, "w"); 140 FILE* fd = fopen(filename, "w");
@@ -188,50 +161,11 @@ end:
188 return ret; 161 return ret;
189} 162}
190 163
191static Eina_Bool
192_generate_eo_and_legacy_h_file(char *filename, const char *classname)
193{
194 Eina_Bool ret = EINA_FALSE;
195
196 Eina_Strbuf *hfile = eina_strbuf_new();
197
198 if (!eo1_header_generate(classname, hfile))
199 {
200 ERR("Failed to generate header for %s", classname);
201 goto end;
202 }
203 if (!legacy_header_generate(classname, eo_version, hfile))
204 {
205 ERR("Failed to generate header for %s", classname);
206 goto end;
207 }
208
209 const char *htext = eina_strbuf_string_get(hfile);
210 FILE* fd = fopen(filename, "w");
211 if (!fd)
212 {
213 ERR ("Couldnt open file %s for writing", filename);
214 goto end;
215 }
216
217 if (htext) fputs(htext, fd);
218
219 fclose(fd);
220
221 ret = EINA_TRUE;
222end:
223 eina_strbuf_free(hfile);
224 return ret;
225}
226
227enum 164enum
228{ 165{
229 NO_WAY_GEN, 166 NO_WAY_GEN,
230 H_GEN, 167 H_GEN,
231 C_GEN, 168 C_GEN
232 H_EO_APP,
233 H_LEG_APP,
234 H_LEG_EO_GEN
235}; 169};
236int gen_opt = NO_WAY_GEN; 170int gen_opt = NO_WAY_GEN;
237 171
@@ -268,8 +202,6 @@ int main(int argc, char **argv)
268 {"help", no_argument, 0, 'h'}, 202 {"help", no_argument, 0, 'h'},
269 {"gh", no_argument, &gen_opt, H_GEN}, 203 {"gh", no_argument, &gen_opt, H_GEN},
270 {"gc", no_argument, &gen_opt, C_GEN}, 204 {"gc", no_argument, &gen_opt, C_GEN},
271 {"ah", no_argument, &gen_opt, H_EO_APP},
272 {"al", no_argument, &gen_opt, H_LEG_APP},
273 {"output", required_argument, 0, 'o'}, 205 {"output", required_argument, 0, 'o'},
274 {"legacy", no_argument, (int *)&legacy_support, EINA_TRUE}, 206 {"legacy", no_argument, (int *)&legacy_support, EINA_TRUE},
275 {"include", required_argument, 0, 'I'}, 207 {"include", required_argument, 0, 'I'},
@@ -380,31 +312,19 @@ int main(int argc, char **argv)
380 } 312 }
381 switch (gen_opt) 313 switch (gen_opt)
382 { 314 {
383 case H_GEN: case H_EO_APP: 315 case H_GEN:
384 { 316 {
385 INF("%s header file %s\n", (gen_opt == H_EO_APP) ? "Appending" : "Generating", output_filename); 317 INF("Generating header file %s\n", output_filename);
386 if (legacy_support) 318 if (legacy_support)
387 ret = ( _generate_legacy_header_file(output_filename, classname, EINA_FALSE) ? 0 : 1 ); 319 ret = ( _generate_legacy_header_file(output_filename, classname) ? 0 : 1 );
388 else 320 else
389 ret = ( _generate_h_file(output_filename, classname, EINA_FALSE) ? 0 : 1 ); 321 ret = ( _generate_eo_h_file(output_filename, classname) ? 0 : 1 );
390 break;
391 }
392 case H_LEG_APP:
393 {
394 INF("Appending legacy file %s\n", output_filename);
395 ret = _generate_legacy_header_file(output_filename, classname, EINA_TRUE)?0:1;
396 break;
397 }
398 case H_LEG_EO_GEN:
399 {
400 INF("Generating eo and legacy header file %s\n", output_filename);
401 ret = _generate_eo_and_legacy_h_file(output_filename, classname)?0:1;
402 break; 322 break;
403 } 323 }
404 case C_GEN: 324 case C_GEN:
405 { 325 {
406 INF("Generating source file %s\n", output_filename); 326 INF("Generating source file %s\n", output_filename);
407 ret = _generate_c_file(output_filename, classname, EINA_FALSE)?0:1; 327 ret = _generate_c_file(output_filename, classname)?0:1;
408 break; 328 break;
409 } 329 }
410 default: 330 default: