remove unused wget menuconfig option; make the package autorebuild optional (but...
[openwrt.git] / scripts / config / symbol.c
1 /*
2 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
3 * Released under the terms of the GNU GPL v2.0.
4 */
5
6 #include <ctype.h>
7 #include <stdlib.h>
8 #include <string.h>
9 #include <regex.h>
10 #include <sys/utsname.h>
11
12 #define LKC_DIRECT_LINK
13 #include "lkc.h"
14
15 struct symbol symbol_yes = {
16 .name = "y",
17 .curr = { "y", yes },
18 .flags = SYMBOL_YES|SYMBOL_VALID,
19 }, symbol_mod = {
20 .name = "m",
21 .curr = { "m", mod },
22 .flags = SYMBOL_MOD|SYMBOL_VALID,
23 }, symbol_no = {
24 .name = "n",
25 .curr = { "n", no },
26 .flags = SYMBOL_NO|SYMBOL_VALID,
27 }, symbol_empty = {
28 .name = "",
29 .curr = { "", no },
30 .flags = SYMBOL_VALID,
31 };
32
33 int sym_change_count;
34 struct symbol *modules_sym;
35 tristate modules_val;
36
37 void sym_add_default(struct symbol *sym, const char *def)
38 {
39 struct property *prop = prop_alloc(P_DEFAULT, sym);
40
41 prop->expr = expr_alloc_symbol(sym_lookup(def, 1));
42 }
43
44 void sym_init(void)
45 {
46 struct symbol *sym;
47 struct utsname uts;
48 char *p;
49 static bool inited = false;
50
51 if (inited)
52 return;
53 inited = true;
54
55 uname(&uts);
56
57 sym = sym_lookup("ARCH", 0);
58 sym->type = S_STRING;
59 sym->flags |= SYMBOL_AUTO;
60 p = getenv("ARCH");
61 if (p)
62 sym_add_default(sym, p);
63
64 sym = sym_lookup("OPENWRTVERSION", 0);
65 sym->type = S_STRING;
66 sym->flags |= SYMBOL_AUTO;
67 p = getenv("OPENWRTVERSION");
68 if (p)
69 sym_add_default(sym, p);
70
71 sym = sym_lookup("UNAME_RELEASE", 0);
72 sym->type = S_STRING;
73 sym->flags |= SYMBOL_AUTO;
74 sym_add_default(sym, uts.release);
75 }
76
77 enum symbol_type sym_get_type(struct symbol *sym)
78 {
79 enum symbol_type type = sym->type;
80
81 if (type == S_TRISTATE) {
82 if (sym_is_choice_value(sym) && sym->visible == yes)
83 type = S_BOOLEAN;
84 /* tristate always enabled */
85 #if 0
86 else if (modules_val == no)
87 type = S_BOOLEAN;
88 #endif
89 }
90 return type;
91 }
92
93 const char *sym_type_name(enum symbol_type type)
94 {
95 switch (type) {
96 case S_BOOLEAN:
97 return "boolean";
98 case S_TRISTATE:
99 return "tristate";
100 case S_INT:
101 return "integer";
102 case S_HEX:
103 return "hex";
104 case S_STRING:
105 return "string";
106 case S_UNKNOWN:
107 return "unknown";
108 case S_OTHER:
109 break;
110 }
111 return "???";
112 }
113
114 struct property *sym_get_choice_prop(struct symbol *sym)
115 {
116 struct property *prop;
117
118 for_all_choices(sym, prop)
119 return prop;
120 return NULL;
121 }
122
123 struct property *sym_get_default_prop(struct symbol *sym)
124 {
125 struct property *prop;
126
127 for_all_defaults(sym, prop) {
128 prop->visible.tri = expr_calc_value(prop->visible.expr);
129 if (prop->visible.tri != no)
130 return prop;
131 }
132 return NULL;
133 }
134
135 struct property *sym_get_range_prop(struct symbol *sym)
136 {
137 struct property *prop;
138
139 for_all_properties(sym, prop, P_RANGE) {
140 prop->visible.tri = expr_calc_value(prop->visible.expr);
141 if (prop->visible.tri != no)
142 return prop;
143 }
144 return NULL;
145 }
146
147 static int sym_get_range_val(struct symbol *sym, int base)
148 {
149 sym_calc_value(sym);
150 switch (sym->type) {
151 case S_INT:
152 base = 10;
153 break;
154 case S_HEX:
155 base = 16;
156 break;
157 default:
158 break;
159 }
160 return strtol(sym->curr.val, NULL, base);
161 }
162
163 static void sym_validate_range(struct symbol *sym)
164 {
165 struct property *prop;
166 int base, val, val2;
167 char str[64];
168
169 switch (sym->type) {
170 case S_INT:
171 base = 10;
172 break;
173 case S_HEX:
174 base = 16;
175 break;
176 default:
177 return;
178 }
179 prop = sym_get_range_prop(sym);
180 if (!prop)
181 return;
182 val = strtol(sym->curr.val, NULL, base);
183 val2 = sym_get_range_val(prop->expr->left.sym, base);
184 if (val >= val2) {
185 val2 = sym_get_range_val(prop->expr->right.sym, base);
186 if (val <= val2)
187 return;
188 }
189 if (sym->type == S_INT)
190 sprintf(str, "%d", val2);
191 else
192 sprintf(str, "0x%x", val2);
193 sym->curr.val = strdup(str);
194 }
195
196 static void sym_calc_visibility(struct symbol *sym)
197 {
198 struct property *prop;
199 tristate tri;
200
201 /* any prompt visible? */
202 tri = no;
203 for_all_prompts(sym, prop) {
204 prop->visible.tri = expr_calc_value(prop->visible.expr);
205 tri = E_OR(tri, prop->visible.tri);
206 }
207 /* tristate always enabled */
208 #if 0
209 if (tri == mod && (sym->type != S_TRISTATE || modules_val == no))
210 #else
211 if (tri == mod && (sym->type != S_TRISTATE))
212 #endif
213 tri = yes;
214 if (sym->visible != tri) {
215 sym->visible = tri;
216 sym_set_changed(sym);
217 }
218 if (sym_is_choice_value(sym))
219 return;
220 tri = no;
221 if (sym->rev_dep.expr)
222 tri = expr_calc_value(sym->rev_dep.expr);
223 if (tri == mod && sym_get_type(sym) == S_BOOLEAN)
224 tri = yes;
225 if (sym->rev_dep.tri != tri) {
226 sym->rev_dep.tri = tri;
227 sym_set_changed(sym);
228 }
229 }
230
231 static struct symbol *sym_calc_choice(struct symbol *sym)
232 {
233 struct symbol *def_sym;
234 struct property *prop;
235 struct expr *e;
236
237 /* is the user choice visible? */
238 def_sym = sym->user.val;
239 if (def_sym) {
240 sym_calc_visibility(def_sym);
241 if (def_sym->visible != no)
242 return def_sym;
243 }
244
245 /* any of the defaults visible? */
246 for_all_defaults(sym, prop) {
247 prop->visible.tri = expr_calc_value(prop->visible.expr);
248 if (prop->visible.tri == no)
249 continue;
250 def_sym = prop_get_symbol(prop);
251 sym_calc_visibility(def_sym);
252 if (def_sym->visible != no)
253 return def_sym;
254 }
255
256 /* just get the first visible value */
257 prop = sym_get_choice_prop(sym);
258 for (e = prop->expr; e; e = e->left.expr) {
259 def_sym = e->right.sym;
260 sym_calc_visibility(def_sym);
261 if (def_sym->visible != no)
262 return def_sym;
263 }
264
265 /* no choice? reset tristate value */
266 sym->curr.tri = no;
267 return NULL;
268 }
269
270 void sym_calc_value(struct symbol *sym)
271 {
272 struct symbol_value newval, oldval;
273 struct property *prop;
274 struct expr *e;
275
276 if (!sym)
277 return;
278
279 if (sym->flags & SYMBOL_VALID)
280 return;
281 sym->flags |= SYMBOL_VALID;
282
283 oldval = sym->curr;
284
285 switch (sym->type) {
286 case S_INT:
287 case S_HEX:
288 case S_STRING:
289 newval = symbol_empty.curr;
290 break;
291 case S_BOOLEAN:
292 case S_TRISTATE:
293 newval = symbol_no.curr;
294 break;
295 default:
296 sym->curr.val = sym->name;
297 sym->curr.tri = no;
298 return;
299 }
300 if (!sym_is_choice_value(sym))
301 sym->flags &= ~SYMBOL_WRITE;
302
303 sym_calc_visibility(sym);
304
305 /* set default if recursively called */
306 sym->curr = newval;
307
308 switch (sym_get_type(sym)) {
309 case S_BOOLEAN:
310 case S_TRISTATE:
311 if (sym_is_choice_value(sym) && sym->visible == yes) {
312 prop = sym_get_choice_prop(sym);
313 newval.tri = (prop_get_symbol(prop)->curr.val == sym) ? yes : no;
314 } else if (E_OR(sym->visible, sym->rev_dep.tri) != no) {
315 sym->flags |= SYMBOL_WRITE;
316 if (sym_has_value(sym))
317 newval.tri = sym->user.tri;
318 else if (!sym_is_choice(sym)) {
319 prop = sym_get_default_prop(sym);
320 if (prop)
321 newval.tri = expr_calc_value(prop->expr);
322 }
323 newval.tri = E_OR(E_AND(newval.tri, sym->visible), sym->rev_dep.tri);
324 } else if (!sym_is_choice(sym)) {
325 prop = sym_get_default_prop(sym);
326 if (prop) {
327 sym->flags |= SYMBOL_WRITE;
328 newval.tri = expr_calc_value(prop->expr);
329 }
330 }
331 if (newval.tri == mod && sym_get_type(sym) == S_BOOLEAN)
332 newval.tri = yes;
333 break;
334 case S_STRING:
335 case S_HEX:
336 case S_INT:
337 if (sym->visible != no) {
338 sym->flags |= SYMBOL_WRITE;
339 if (sym_has_value(sym)) {
340 newval.val = sym->user.val;
341 break;
342 }
343 }
344 prop = sym_get_default_prop(sym);
345 if (prop) {
346 struct symbol *ds = prop_get_symbol(prop);
347 if (ds) {
348 sym->flags |= SYMBOL_WRITE;
349 sym_calc_value(ds);
350 newval.val = ds->curr.val;
351 }
352 }
353 break;
354 default:
355 ;
356 }
357
358 sym->curr = newval;
359 if (sym_is_choice(sym) && newval.tri == yes)
360 sym->curr.val = sym_calc_choice(sym);
361 sym_validate_range(sym);
362
363 if (memcmp(&oldval, &sym->curr, sizeof(oldval)))
364 sym_set_changed(sym);
365
366 if (modules_sym == sym)
367 modules_val = modules_sym->curr.tri;
368
369 if (sym_is_choice(sym)) {
370 int flags = sym->flags & (SYMBOL_CHANGED | SYMBOL_WRITE);
371 prop = sym_get_choice_prop(sym);
372 for (e = prop->expr; e; e = e->left.expr) {
373 e->right.sym->flags |= flags;
374 if (flags & SYMBOL_CHANGED)
375 sym_set_changed(e->right.sym);
376 }
377 }
378 }
379
380 void sym_clear_all_valid(void)
381 {
382 struct symbol *sym;
383 int i;
384
385 for_all_symbols(i, sym)
386 sym->flags &= ~SYMBOL_VALID;
387 sym_change_count++;
388 if (modules_sym)
389 sym_calc_value(modules_sym);
390 }
391
392 void sym_set_changed(struct symbol *sym)
393 {
394 struct property *prop;
395
396 sym->flags |= SYMBOL_CHANGED;
397 for (prop = sym->prop; prop; prop = prop->next) {
398 if (prop->menu)
399 prop->menu->flags |= MENU_CHANGED;
400 }
401 }
402
403 void sym_set_all_changed(void)
404 {
405 struct symbol *sym;
406 int i;
407
408 for_all_symbols(i, sym)
409 sym_set_changed(sym);
410 }
411
412 bool sym_tristate_within_range(struct symbol *sym, tristate val)
413 {
414 int type = sym_get_type(sym);
415
416 if (sym->visible == no)
417 return false;
418
419 if (type != S_BOOLEAN && type != S_TRISTATE)
420 return false;
421
422 if (type == S_BOOLEAN && val == mod)
423 return false;
424 if (sym->visible <= sym->rev_dep.tri)
425 return false;
426 if (sym_is_choice_value(sym) && sym->visible == yes)
427 return val == yes;
428 return val >= sym->rev_dep.tri && val <= sym->visible;
429 }
430
431 bool sym_set_tristate_value(struct symbol *sym, tristate val)
432 {
433 tristate oldval = sym_get_tristate_value(sym);
434
435 if (oldval != val && !sym_tristate_within_range(sym, val))
436 return false;
437
438 if (sym->flags & SYMBOL_NEW) {
439 sym->flags &= ~SYMBOL_NEW;
440 sym_set_changed(sym);
441 }
442 /*
443 * setting a choice value also resets the new flag of the choice
444 * symbol and all other choice values.
445 */
446 if (sym_is_choice_value(sym) && val == yes) {
447 struct symbol *cs = prop_get_symbol(sym_get_choice_prop(sym));
448 struct property *prop;
449 struct expr *e;
450
451 cs->user.val = sym;
452 cs->flags &= ~SYMBOL_NEW;
453 prop = sym_get_choice_prop(cs);
454 for (e = prop->expr; e; e = e->left.expr) {
455 if (e->right.sym->visible != no)
456 e->right.sym->flags &= ~SYMBOL_NEW;
457 }
458 }
459
460 sym->user.tri = val;
461 if (oldval != val) {
462 sym_clear_all_valid();
463 if (sym == modules_sym)
464 sym_set_all_changed();
465 }
466
467 return true;
468 }
469
470 tristate sym_toggle_tristate_value(struct symbol *sym)
471 {
472 tristate oldval, newval;
473
474 oldval = newval = sym_get_tristate_value(sym);
475 do {
476 switch (newval) {
477 case no:
478 newval = mod;
479 break;
480 case mod:
481 newval = yes;
482 break;
483 case yes:
484 newval = no;
485 break;
486 }
487 if (sym_set_tristate_value(sym, newval))
488 break;
489 } while (oldval != newval);
490 return newval;
491 }
492
493 bool sym_string_valid(struct symbol *sym, const char *str)
494 {
495 signed char ch;
496
497 switch (sym->type) {
498 case S_STRING:
499 return true;
500 case S_INT:
501 ch = *str++;
502 if (ch == '-')
503 ch = *str++;
504 if (!isdigit(ch))
505 return false;
506 if (ch == '0' && *str != 0)
507 return false;
508 while ((ch = *str++)) {
509 if (!isdigit(ch))
510 return false;
511 }
512 return true;
513 case S_HEX:
514 if (str[0] == '0' && (str[1] == 'x' || str[1] == 'X'))
515 str += 2;
516 ch = *str++;
517 do {
518 if (!isxdigit(ch))
519 return false;
520 } while ((ch = *str++));
521 return true;
522 case S_BOOLEAN:
523 case S_TRISTATE:
524 switch (str[0]) {
525 case 'y': case 'Y':
526 case 'm': case 'M':
527 case 'n': case 'N':
528 return true;
529 }
530 return false;
531 default:
532 return false;
533 }
534 }
535
536 bool sym_string_within_range(struct symbol *sym, const char *str)
537 {
538 struct property *prop;
539 int val;
540
541 switch (sym->type) {
542 case S_STRING:
543 return sym_string_valid(sym, str);
544 case S_INT:
545 if (!sym_string_valid(sym, str))
546 return false;
547 prop = sym_get_range_prop(sym);
548 if (!prop)
549 return true;
550 val = strtol(str, NULL, 10);
551 return val >= sym_get_range_val(prop->expr->left.sym, 10) &&
552 val <= sym_get_range_val(prop->expr->right.sym, 10);
553 case S_HEX:
554 if (!sym_string_valid(sym, str))
555 return false;
556 prop = sym_get_range_prop(sym);
557 if (!prop)
558 return true;
559 val = strtol(str, NULL, 16);
560 return val >= sym_get_range_val(prop->expr->left.sym, 16) &&
561 val <= sym_get_range_val(prop->expr->right.sym, 16);
562 case S_BOOLEAN:
563 case S_TRISTATE:
564 switch (str[0]) {
565 case 'y': case 'Y':
566 return sym_tristate_within_range(sym, yes);
567 case 'm': case 'M':
568 return sym_tristate_within_range(sym, mod);
569 case 'n': case 'N':
570 return sym_tristate_within_range(sym, no);
571 }
572 return false;
573 default:
574 return false;
575 }
576 }
577
578 bool sym_set_string_value(struct symbol *sym, const char *newval)
579 {
580 const char *oldval;
581 char *val;
582 int size;
583
584 switch (sym->type) {
585 case S_BOOLEAN:
586 case S_TRISTATE:
587 switch (newval[0]) {
588 case 'y': case 'Y':
589 return sym_set_tristate_value(sym, yes);
590 case 'm': case 'M':
591 return sym_set_tristate_value(sym, mod);
592 case 'n': case 'N':
593 return sym_set_tristate_value(sym, no);
594 }
595 return false;
596 default:
597 ;
598 }
599
600 if (!sym_string_within_range(sym, newval))
601 return false;
602
603 if (sym->flags & SYMBOL_NEW) {
604 sym->flags &= ~SYMBOL_NEW;
605 sym_set_changed(sym);
606 }
607
608 oldval = sym->user.val;
609 size = strlen(newval) + 1;
610 if (sym->type == S_HEX && (newval[0] != '0' || (newval[1] != 'x' && newval[1] != 'X'))) {
611 size += 2;
612 sym->user.val = val = malloc(size);
613 *val++ = '0';
614 *val++ = 'x';
615 } else if (!oldval || strcmp(oldval, newval))
616 sym->user.val = val = malloc(size);
617 else
618 return true;
619
620 strcpy(val, newval);
621 free((void *)oldval);
622 sym_clear_all_valid();
623
624 return true;
625 }
626
627 const char *sym_get_string_value(struct symbol *sym)
628 {
629 tristate val;
630
631 switch (sym->type) {
632 case S_BOOLEAN:
633 case S_TRISTATE:
634 val = sym_get_tristate_value(sym);
635 switch (val) {
636 case no:
637 return "n";
638 case mod:
639 return "m";
640 case yes:
641 return "y";
642 }
643 break;
644 default:
645 ;
646 }
647 return (const char *)sym->curr.val;
648 }
649
650 bool sym_is_changable(struct symbol *sym)
651 {
652 return sym->visible > sym->rev_dep.tri;
653 }
654
655 struct symbol *sym_lookup(const char *name, int isconst)
656 {
657 struct symbol *symbol;
658 const char *ptr;
659 char *new_name;
660 int hash = 0;
661
662 if (name) {
663 if (name[0] && !name[1]) {
664 switch (name[0]) {
665 case 'y': return &symbol_yes;
666 case 'm': return &symbol_mod;
667 case 'n': return &symbol_no;
668 }
669 }
670 for (ptr = name; *ptr; ptr++)
671 hash += *ptr;
672 hash &= 0xff;
673
674 for (symbol = symbol_hash[hash]; symbol; symbol = symbol->next) {
675 if (!strcmp(symbol->name, name)) {
676 if ((isconst && symbol->flags & SYMBOL_CONST) ||
677 (!isconst && !(symbol->flags & SYMBOL_CONST)))
678 return symbol;
679 }
680 }
681 new_name = strdup(name);
682 } else {
683 new_name = NULL;
684 hash = 256;
685 }
686
687 symbol = malloc(sizeof(*symbol));
688 memset(symbol, 0, sizeof(*symbol));
689 symbol->name = new_name;
690 symbol->type = S_UNKNOWN;
691 symbol->flags = SYMBOL_NEW;
692 if (isconst)
693 symbol->flags |= SYMBOL_CONST;
694
695 symbol->next = symbol_hash[hash];
696 symbol_hash[hash] = symbol;
697
698 return symbol;
699 }
700
701 struct symbol *sym_find(const char *name)
702 {
703 struct symbol *symbol = NULL;
704 const char *ptr;
705 int hash = 0;
706
707 if (!name)
708 return NULL;
709
710 if (name[0] && !name[1]) {
711 switch (name[0]) {
712 case 'y': return &symbol_yes;
713 case 'm': return &symbol_mod;
714 case 'n': return &symbol_no;
715 }
716 }
717 for (ptr = name; *ptr; ptr++)
718 hash += *ptr;
719 hash &= 0xff;
720
721 for (symbol = symbol_hash[hash]; symbol; symbol = symbol->next) {
722 if (!strcmp(symbol->name, name) &&
723 !(symbol->flags & SYMBOL_CONST))
724 break;
725 }
726
727 return symbol;
728 }
729
730 struct symbol **sym_re_search(const char *pattern)
731 {
732 struct symbol *sym, **sym_arr = NULL;
733 int i, cnt, size;
734 regex_t re;
735
736 cnt = size = 0;
737 /* Skip if empty */
738 if (strlen(pattern) == 0)
739 return NULL;
740 if (regcomp(&re, pattern, REG_EXTENDED|REG_NOSUB|REG_ICASE))
741 return NULL;
742
743 for_all_symbols(i, sym) {
744 if (sym->flags & SYMBOL_CONST || !sym->name)
745 continue;
746 if (regexec(&re, sym->name, 0, NULL, 0))
747 continue;
748 if (cnt + 1 >= size) {
749 void *tmp = sym_arr;
750 size += 16;
751 sym_arr = realloc(sym_arr, size * sizeof(struct symbol *));
752 if (!sym_arr) {
753 free(tmp);
754 return NULL;
755 }
756 }
757 sym_arr[cnt++] = sym;
758 }
759 if (sym_arr)
760 sym_arr[cnt] = NULL;
761 regfree(&re);
762
763 return sym_arr;
764 }
765
766
767 struct symbol *sym_check_deps(struct symbol *sym);
768
769 static struct symbol *sym_check_expr_deps(struct expr *e)
770 {
771 struct symbol *sym;
772
773 if (!e)
774 return NULL;
775 switch (e->type) {
776 case E_OR:
777 case E_AND:
778 sym = sym_check_expr_deps(e->left.expr);
779 if (sym)
780 return sym;
781 return sym_check_expr_deps(e->right.expr);
782 case E_NOT:
783 return sym_check_expr_deps(e->left.expr);
784 case E_EQUAL:
785 case E_UNEQUAL:
786 sym = sym_check_deps(e->left.sym);
787 if (sym)
788 return sym;
789 return sym_check_deps(e->right.sym);
790 case E_SYMBOL:
791 return sym_check_deps(e->left.sym);
792 default:
793 break;
794 }
795 printf("Oops! How to check %d?\n", e->type);
796 return NULL;
797 }
798
799 struct symbol *sym_check_deps(struct symbol *sym)
800 {
801 struct symbol *sym2;
802 struct property *prop;
803
804 if (sym->flags & SYMBOL_CHECK) {
805 printf("Warning! Found recursive dependency: %s", sym->name);
806 return sym;
807 }
808 if (sym->flags & SYMBOL_CHECKED)
809 return NULL;
810
811 sym->flags |= (SYMBOL_CHECK | SYMBOL_CHECKED);
812 sym2 = sym_check_expr_deps(sym->rev_dep.expr);
813 if (sym2)
814 goto out;
815
816 for (prop = sym->prop; prop; prop = prop->next) {
817 if (prop->type == P_CHOICE || prop->type == P_SELECT)
818 continue;
819 sym2 = sym_check_expr_deps(prop->visible.expr);
820 if (sym2)
821 goto out;
822 if (prop->type != P_DEFAULT || sym_is_choice(sym))
823 continue;
824 sym2 = sym_check_expr_deps(prop->expr);
825 if (sym2)
826 goto out;
827 }
828 out:
829 if (sym2) {
830 printf(" %s", sym->name);
831 if (sym2 == sym) {
832 printf("\n");
833 sym2 = NULL;
834 }
835 }
836 sym->flags &= ~SYMBOL_CHECK;
837 return sym2;
838 }
839
840 struct property *prop_alloc(enum prop_type type, struct symbol *sym)
841 {
842 struct property *prop;
843 struct property **propp;
844
845 prop = malloc(sizeof(*prop));
846 memset(prop, 0, sizeof(*prop));
847 prop->type = type;
848 prop->sym = sym;
849 prop->file = current_file;
850 prop->lineno = zconf_lineno();
851
852 /* append property to the prop list of symbol */
853 if (sym) {
854 for (propp = &sym->prop; *propp; propp = &(*propp)->next)
855 ;
856 *propp = prop;
857 }
858
859 return prop;
860 }
861
862 struct symbol *prop_get_symbol(struct property *prop)
863 {
864 if (prop->expr && (prop->expr->type == E_SYMBOL ||
865 prop->expr->type == E_CHOICE))
866 return prop->expr->left.sym;
867 return NULL;
868 }
869
870 const char *prop_get_type_name(enum prop_type type)
871 {
872 switch (type) {
873 case P_PROMPT:
874 return "prompt";
875 case P_COMMENT:
876 return "comment";
877 case P_MENU:
878 return "menu";
879 case P_DEFAULT:
880 return "default";
881 case P_CHOICE:
882 return "choice";
883 case P_SELECT:
884 return "select";
885 case P_RANGE:
886 return "range";
887 case P_UNKNOWN:
888 break;
889 }
890 return "unknown";
891 }
This page took 0.099666 seconds and 5 git commands to generate.