1
0

zconf.y 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733
  1. %{
  2. /*
  3. * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
  4. * Released under the terms of the GNU GPL v2.0.
  5. */
  6. #include <ctype.h>
  7. #include <stdarg.h>
  8. #include <stdio.h>
  9. #include <stdlib.h>
  10. #include <string.h>
  11. #include <stdbool.h>
  12. #include "lkc.h"
  13. #define printd(mask, fmt...) if (cdebug & (mask)) printf(fmt)
  14. #define PRINTD 0x0001
  15. #define DEBUG_PARSE 0x0002
  16. int cdebug = PRINTD;
  17. extern int zconflex(void);
  18. static void zconfprint(const char *err, ...);
  19. static void zconf_error(const char *err, ...);
  20. static void zconferror(const char *err);
  21. static bool zconf_endtoken(const struct kconf_id *id, int starttoken, int endtoken);
  22. struct symbol *symbol_hash[SYMBOL_HASHSIZE];
  23. static struct menu *current_menu, *current_entry;
  24. %}
  25. %expect 30
  26. %union
  27. {
  28. char *string;
  29. struct file *file;
  30. struct symbol *symbol;
  31. struct expr *expr;
  32. struct menu *menu;
  33. const struct kconf_id *id;
  34. }
  35. %token <id>T_MAINMENU
  36. %token <id>T_MENU
  37. %token <id>T_ENDMENU
  38. %token <id>T_SOURCE
  39. %token <id>T_CHOICE
  40. %token <id>T_ENDCHOICE
  41. %token <id>T_COMMENT
  42. %token <id>T_CONFIG
  43. %token <id>T_MENUCONFIG
  44. %token <id>T_HELP
  45. %token <string> T_HELPTEXT
  46. %token <id>T_IF
  47. %token <id>T_ENDIF
  48. %token <id>T_DEPENDS
  49. %token <id>T_OPTIONAL
  50. %token <id>T_PROMPT
  51. %token <id>T_TYPE
  52. %token <id>T_DEFAULT
  53. %token <id>T_SELECT
  54. %token <id>T_RANGE
  55. %token <id>T_VISIBLE
  56. %token <id>T_OPTION
  57. %token <id>T_ON
  58. %token <string> T_WORD
  59. %token <string> T_WORD_QUOTE
  60. %token T_UNEQUAL
  61. %token T_CLOSE_PAREN
  62. %token T_OPEN_PAREN
  63. %token T_EOL
  64. %left T_OR
  65. %left T_AND
  66. %left T_EQUAL T_UNEQUAL
  67. %nonassoc T_NOT
  68. %type <string> prompt
  69. %type <symbol> symbol
  70. %type <expr> expr
  71. %type <expr> if_expr
  72. %type <id> end
  73. %type <id> option_name
  74. %type <menu> if_entry menu_entry choice_entry
  75. %type <string> symbol_option_arg word_opt
  76. %destructor {
  77. fprintf(stderr, "%s:%d: missing end statement for this entry\n",
  78. $$->file->name, $$->lineno);
  79. if (current_menu == $$)
  80. menu_end_menu();
  81. } if_entry menu_entry choice_entry
  82. %{
  83. /* Include zconf.hash.c here so it can see the token constants. */
  84. #include "zconf.hash.c"
  85. %}
  86. %%
  87. input: nl start | start;
  88. start: mainmenu_stmt stmt_list | stmt_list;
  89. stmt_list:
  90. /* empty */
  91. | stmt_list common_stmt
  92. | stmt_list choice_stmt
  93. | stmt_list menu_stmt
  94. | stmt_list end { zconf_error("unexpected end statement"); }
  95. | stmt_list T_WORD error T_EOL { zconf_error("unknown statement \"%s\"", $2); }
  96. | stmt_list option_name error T_EOL
  97. {
  98. zconf_error("unexpected option \"%s\"", kconf_id_strings + $2->name);
  99. }
  100. | stmt_list error T_EOL { zconf_error("invalid statement"); }
  101. ;
  102. option_name:
  103. T_DEPENDS | T_PROMPT | T_TYPE | T_SELECT | T_OPTIONAL | T_RANGE | T_DEFAULT | T_VISIBLE
  104. ;
  105. common_stmt:
  106. T_EOL
  107. | if_stmt
  108. | comment_stmt
  109. | config_stmt
  110. | menuconfig_stmt
  111. | source_stmt
  112. ;
  113. option_error:
  114. T_WORD error T_EOL { zconf_error("unknown option \"%s\"", $1); }
  115. | error T_EOL { zconf_error("invalid option"); }
  116. ;
  117. /* config/menuconfig entry */
  118. config_entry_start: T_CONFIG T_WORD T_EOL
  119. {
  120. struct symbol *sym = sym_lookup($2, 0);
  121. sym->flags |= SYMBOL_OPTIONAL;
  122. menu_add_entry(sym);
  123. printd(DEBUG_PARSE, "%s:%d:config %s\n", zconf_curname(), zconf_lineno(), $2);
  124. };
  125. config_stmt: config_entry_start config_option_list
  126. {
  127. menu_end_entry();
  128. printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno());
  129. };
  130. menuconfig_entry_start: T_MENUCONFIG T_WORD T_EOL
  131. {
  132. struct symbol *sym = sym_lookup($2, 0);
  133. sym->flags |= SYMBOL_OPTIONAL;
  134. menu_add_entry(sym);
  135. printd(DEBUG_PARSE, "%s:%d:menuconfig %s\n", zconf_curname(), zconf_lineno(), $2);
  136. };
  137. menuconfig_stmt: menuconfig_entry_start config_option_list
  138. {
  139. if (current_entry->prompt)
  140. current_entry->prompt->type = P_MENU;
  141. else
  142. zconfprint("warning: menuconfig statement without prompt");
  143. menu_end_entry();
  144. printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno());
  145. };
  146. config_option_list:
  147. /* empty */
  148. | config_option_list config_option
  149. | config_option_list symbol_option
  150. | config_option_list depends
  151. | config_option_list help
  152. | config_option_list option_error
  153. | config_option_list T_EOL
  154. ;
  155. config_option: T_TYPE prompt_stmt_opt T_EOL
  156. {
  157. menu_set_type($1->stype);
  158. printd(DEBUG_PARSE, "%s:%d:type(%u)\n",
  159. zconf_curname(), zconf_lineno(),
  160. $1->stype);
  161. };
  162. config_option: T_PROMPT prompt if_expr T_EOL
  163. {
  164. menu_add_prompt(P_PROMPT, $2, $3);
  165. printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno());
  166. };
  167. config_option: T_DEFAULT expr if_expr T_EOL
  168. {
  169. menu_add_expr(P_DEFAULT, $2, $3);
  170. if ($1->stype != S_UNKNOWN)
  171. menu_set_type($1->stype);
  172. printd(DEBUG_PARSE, "%s:%d:default(%u)\n",
  173. zconf_curname(), zconf_lineno(),
  174. $1->stype);
  175. };
  176. config_option: T_SELECT T_WORD if_expr T_EOL
  177. {
  178. menu_add_symbol(P_SELECT, sym_lookup($2, 0), $3);
  179. printd(DEBUG_PARSE, "%s:%d:select\n", zconf_curname(), zconf_lineno());
  180. };
  181. config_option: T_RANGE symbol symbol if_expr T_EOL
  182. {
  183. menu_add_expr(P_RANGE, expr_alloc_comp(E_RANGE,$2, $3), $4);
  184. printd(DEBUG_PARSE, "%s:%d:range\n", zconf_curname(), zconf_lineno());
  185. };
  186. symbol_option: T_OPTION symbol_option_list T_EOL
  187. ;
  188. symbol_option_list:
  189. /* empty */
  190. | symbol_option_list T_WORD symbol_option_arg
  191. {
  192. const struct kconf_id *id = kconf_id_lookup($2, strlen($2));
  193. if (id && id->flags & TF_OPTION)
  194. menu_add_option(id->token, $3);
  195. else
  196. zconfprint("warning: ignoring unknown option %s", $2);
  197. free($2);
  198. };
  199. symbol_option_arg:
  200. /* empty */ { $$ = NULL; }
  201. | T_EQUAL prompt { $$ = $2; }
  202. ;
  203. /* choice entry */
  204. choice: T_CHOICE word_opt T_EOL
  205. {
  206. struct symbol *sym = sym_lookup($2, SYMBOL_CHOICE);
  207. sym->flags |= SYMBOL_AUTO;
  208. menu_add_entry(sym);
  209. menu_add_expr(P_CHOICE, NULL, NULL);
  210. printd(DEBUG_PARSE, "%s:%d:choice\n", zconf_curname(), zconf_lineno());
  211. };
  212. choice_entry: choice choice_option_list
  213. {
  214. $$ = menu_add_menu();
  215. };
  216. choice_end: end
  217. {
  218. if (zconf_endtoken($1, T_CHOICE, T_ENDCHOICE)) {
  219. menu_end_menu();
  220. printd(DEBUG_PARSE, "%s:%d:endchoice\n", zconf_curname(), zconf_lineno());
  221. }
  222. };
  223. choice_stmt: choice_entry choice_block choice_end
  224. ;
  225. choice_option_list:
  226. /* empty */
  227. | choice_option_list choice_option
  228. | choice_option_list depends
  229. | choice_option_list help
  230. | choice_option_list T_EOL
  231. | choice_option_list option_error
  232. ;
  233. choice_option: T_PROMPT prompt if_expr T_EOL
  234. {
  235. menu_add_prompt(P_PROMPT, $2, $3);
  236. printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno());
  237. };
  238. choice_option: T_TYPE prompt_stmt_opt T_EOL
  239. {
  240. if ($1->stype == S_BOOLEAN || $1->stype == S_TRISTATE) {
  241. menu_set_type($1->stype);
  242. printd(DEBUG_PARSE, "%s:%d:type(%u)\n",
  243. zconf_curname(), zconf_lineno(),
  244. $1->stype);
  245. } else
  246. YYERROR;
  247. };
  248. choice_option: T_OPTIONAL T_EOL
  249. {
  250. current_entry->sym->flags |= SYMBOL_OPTIONAL;
  251. printd(DEBUG_PARSE, "%s:%d:optional\n", zconf_curname(), zconf_lineno());
  252. };
  253. choice_option: T_DEFAULT T_WORD if_expr T_EOL
  254. {
  255. if ($1->stype == S_UNKNOWN) {
  256. menu_add_symbol(P_DEFAULT, sym_lookup($2, 0), $3);
  257. printd(DEBUG_PARSE, "%s:%d:default\n",
  258. zconf_curname(), zconf_lineno());
  259. } else
  260. YYERROR;
  261. };
  262. choice_block:
  263. /* empty */
  264. | choice_block common_stmt
  265. ;
  266. /* if entry */
  267. if_entry: T_IF expr nl
  268. {
  269. printd(DEBUG_PARSE, "%s:%d:if\n", zconf_curname(), zconf_lineno());
  270. menu_add_entry(NULL);
  271. menu_add_dep($2);
  272. $$ = menu_add_menu();
  273. };
  274. if_end: end
  275. {
  276. if (zconf_endtoken($1, T_IF, T_ENDIF)) {
  277. menu_end_menu();
  278. printd(DEBUG_PARSE, "%s:%d:endif\n", zconf_curname(), zconf_lineno());
  279. }
  280. };
  281. if_stmt: if_entry if_block if_end
  282. ;
  283. if_block:
  284. /* empty */
  285. | if_block common_stmt
  286. | if_block menu_stmt
  287. | if_block choice_stmt
  288. ;
  289. /* mainmenu entry */
  290. mainmenu_stmt: T_MAINMENU prompt nl
  291. {
  292. menu_add_prompt(P_MENU, $2, NULL);
  293. };
  294. /* menu entry */
  295. menu: T_MENU prompt T_EOL
  296. {
  297. menu_add_entry(NULL);
  298. menu_add_prompt(P_MENU, $2, NULL);
  299. printd(DEBUG_PARSE, "%s:%d:menu\n", zconf_curname(), zconf_lineno());
  300. };
  301. menu_entry: menu visibility_list depends_list
  302. {
  303. $$ = menu_add_menu();
  304. };
  305. menu_end: end
  306. {
  307. if (zconf_endtoken($1, T_MENU, T_ENDMENU)) {
  308. menu_end_menu();
  309. printd(DEBUG_PARSE, "%s:%d:endmenu\n", zconf_curname(), zconf_lineno());
  310. }
  311. };
  312. menu_stmt: menu_entry menu_block menu_end
  313. ;
  314. menu_block:
  315. /* empty */
  316. | menu_block common_stmt
  317. | menu_block menu_stmt
  318. | menu_block choice_stmt
  319. ;
  320. source_stmt: T_SOURCE prompt T_EOL
  321. {
  322. printd(DEBUG_PARSE, "%s:%d:source %s\n", zconf_curname(), zconf_lineno(), $2);
  323. zconf_nextfile($2);
  324. };
  325. /* comment entry */
  326. comment: T_COMMENT prompt T_EOL
  327. {
  328. menu_add_entry(NULL);
  329. menu_add_prompt(P_COMMENT, $2, NULL);
  330. printd(DEBUG_PARSE, "%s:%d:comment\n", zconf_curname(), zconf_lineno());
  331. };
  332. comment_stmt: comment depends_list
  333. {
  334. menu_end_entry();
  335. };
  336. /* help option */
  337. help_start: T_HELP T_EOL
  338. {
  339. printd(DEBUG_PARSE, "%s:%d:help\n", zconf_curname(), zconf_lineno());
  340. zconf_starthelp();
  341. };
  342. help: help_start T_HELPTEXT
  343. {
  344. current_entry->help = $2;
  345. };
  346. /* depends option */
  347. depends_list:
  348. /* empty */
  349. | depends_list depends
  350. | depends_list T_EOL
  351. | depends_list option_error
  352. ;
  353. depends: T_DEPENDS T_ON expr T_EOL
  354. {
  355. menu_add_dep($3);
  356. printd(DEBUG_PARSE, "%s:%d:depends on\n", zconf_curname(), zconf_lineno());
  357. };
  358. /* visibility option */
  359. visibility_list:
  360. /* empty */
  361. | visibility_list visible
  362. | visibility_list T_EOL
  363. ;
  364. visible: T_VISIBLE if_expr
  365. {
  366. menu_add_visibility($2);
  367. };
  368. /* prompt statement */
  369. prompt_stmt_opt:
  370. /* empty */
  371. | prompt if_expr
  372. {
  373. menu_add_prompt(P_PROMPT, $1, $2);
  374. };
  375. prompt: T_WORD
  376. | T_WORD_QUOTE
  377. ;
  378. end: T_ENDMENU T_EOL { $$ = $1; }
  379. | T_ENDCHOICE T_EOL { $$ = $1; }
  380. | T_ENDIF T_EOL { $$ = $1; }
  381. ;
  382. nl:
  383. T_EOL
  384. | nl T_EOL
  385. ;
  386. if_expr: /* empty */ { $$ = NULL; }
  387. | T_IF expr { $$ = $2; }
  388. ;
  389. expr: symbol { $$ = expr_alloc_symbol($1); }
  390. | symbol T_EQUAL symbol { $$ = expr_alloc_comp(E_EQUAL, $1, $3); }
  391. | symbol T_UNEQUAL symbol { $$ = expr_alloc_comp(E_UNEQUAL, $1, $3); }
  392. | T_OPEN_PAREN expr T_CLOSE_PAREN { $$ = $2; }
  393. | T_NOT expr { $$ = expr_alloc_one(E_NOT, $2); }
  394. | expr T_OR expr { $$ = expr_alloc_two(E_OR, $1, $3); }
  395. | expr T_AND expr { $$ = expr_alloc_two(E_AND, $1, $3); }
  396. ;
  397. symbol: T_WORD { $$ = sym_lookup($1, 0); free($1); }
  398. | T_WORD_QUOTE { $$ = sym_lookup($1, SYMBOL_CONST); free($1); }
  399. ;
  400. word_opt: /* empty */ { $$ = NULL; }
  401. | T_WORD
  402. %%
  403. void conf_parse(const char *name)
  404. {
  405. struct symbol *sym;
  406. int i;
  407. zconf_initscan(name);
  408. sym_init();
  409. _menu_init();
  410. rootmenu.prompt = menu_add_prompt(P_MENU, "Linux Kernel Configuration", NULL);
  411. if (getenv("ZCONF_DEBUG"))
  412. zconfdebug = 1;
  413. zconfparse();
  414. if (zconfnerrs)
  415. exit(1);
  416. if (!modules_sym)
  417. modules_sym = sym_find( "n" );
  418. rootmenu.prompt->text = _(rootmenu.prompt->text);
  419. rootmenu.prompt->text = sym_expand_string_value(rootmenu.prompt->text);
  420. menu_finalize(&rootmenu);
  421. for_all_symbols(i, sym) {
  422. if (sym_check_deps(sym))
  423. zconfnerrs++;
  424. }
  425. if (zconfnerrs)
  426. exit(1);
  427. sym_set_change_count(1);
  428. }
  429. static const char *zconf_tokenname(int token)
  430. {
  431. switch (token) {
  432. case T_MENU: return "menu";
  433. case T_ENDMENU: return "endmenu";
  434. case T_CHOICE: return "choice";
  435. case T_ENDCHOICE: return "endchoice";
  436. case T_IF: return "if";
  437. case T_ENDIF: return "endif";
  438. case T_DEPENDS: return "depends";
  439. case T_VISIBLE: return "visible";
  440. }
  441. return "<token>";
  442. }
  443. static bool zconf_endtoken(const struct kconf_id *id, int starttoken, int endtoken)
  444. {
  445. if (id->token != endtoken) {
  446. zconf_error("unexpected '%s' within %s block",
  447. kconf_id_strings + id->name, zconf_tokenname(starttoken));
  448. zconfnerrs++;
  449. return false;
  450. }
  451. if (current_menu->file != current_file) {
  452. zconf_error("'%s' in different file than '%s'",
  453. kconf_id_strings + id->name, zconf_tokenname(starttoken));
  454. fprintf(stderr, "%s:%d: location of the '%s'\n",
  455. current_menu->file->name, current_menu->lineno,
  456. zconf_tokenname(starttoken));
  457. zconfnerrs++;
  458. return false;
  459. }
  460. return true;
  461. }
  462. static void zconfprint(const char *err, ...)
  463. {
  464. va_list ap;
  465. fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno());
  466. va_start(ap, err);
  467. vfprintf(stderr, err, ap);
  468. va_end(ap);
  469. fprintf(stderr, "\n");
  470. }
  471. static void zconf_error(const char *err, ...)
  472. {
  473. va_list ap;
  474. zconfnerrs++;
  475. fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno());
  476. va_start(ap, err);
  477. vfprintf(stderr, err, ap);
  478. va_end(ap);
  479. fprintf(stderr, "\n");
  480. }
  481. static void zconferror(const char *err)
  482. {
  483. fprintf(stderr, "%s:%d: %s\n", zconf_curname(), zconf_lineno() + 1, err);
  484. }
  485. static void print_quoted_string(FILE *out, const char *str)
  486. {
  487. const char *p;
  488. int len;
  489. putc('"', out);
  490. while ((p = strchr(str, '"'))) {
  491. len = p - str;
  492. if (len)
  493. fprintf(out, "%.*s", len, str);
  494. fputs("\\\"", out);
  495. str = p + 1;
  496. }
  497. fputs(str, out);
  498. putc('"', out);
  499. }
  500. static void print_symbol(FILE *out, struct menu *menu)
  501. {
  502. struct symbol *sym = menu->sym;
  503. struct property *prop;
  504. if (sym_is_choice(sym))
  505. fprintf(out, "\nchoice\n");
  506. else
  507. fprintf(out, "\nconfig %s\n", sym->name);
  508. switch (sym->type) {
  509. case S_BOOLEAN:
  510. fputs(" boolean\n", out);
  511. break;
  512. case S_TRISTATE:
  513. fputs(" tristate\n", out);
  514. break;
  515. case S_STRING:
  516. fputs(" string\n", out);
  517. break;
  518. case S_INT:
  519. fputs(" integer\n", out);
  520. break;
  521. case S_HEX:
  522. fputs(" hex\n", out);
  523. break;
  524. default:
  525. fputs(" ???\n", out);
  526. break;
  527. }
  528. for (prop = sym->prop; prop; prop = prop->next) {
  529. if (prop->menu != menu)
  530. continue;
  531. switch (prop->type) {
  532. case P_PROMPT:
  533. fputs(" prompt ", out);
  534. print_quoted_string(out, prop->text);
  535. if (!expr_is_yes(prop->visible.expr)) {
  536. fputs(" if ", out);
  537. expr_fprint(prop->visible.expr, out);
  538. }
  539. fputc('\n', out);
  540. break;
  541. case P_DEFAULT:
  542. fputs( " default ", out);
  543. expr_fprint(prop->expr, out);
  544. if (!expr_is_yes(prop->visible.expr)) {
  545. fputs(" if ", out);
  546. expr_fprint(prop->visible.expr, out);
  547. }
  548. fputc('\n', out);
  549. break;
  550. case P_CHOICE:
  551. fputs(" #choice value\n", out);
  552. break;
  553. case P_SELECT:
  554. fputs( " select ", out);
  555. expr_fprint(prop->expr, out);
  556. fputc('\n', out);
  557. break;
  558. case P_RANGE:
  559. fputs( " range ", out);
  560. expr_fprint(prop->expr, out);
  561. fputc('\n', out);
  562. break;
  563. case P_MENU:
  564. fputs( " menu ", out);
  565. print_quoted_string(out, prop->text);
  566. fputc('\n', out);
  567. break;
  568. default:
  569. fprintf(out, " unknown prop %d!\n", prop->type);
  570. break;
  571. }
  572. }
  573. if (menu->help) {
  574. int len = strlen(menu->help);
  575. while (menu->help[--len] == '\n')
  576. menu->help[len] = 0;
  577. fprintf(out, " help\n%s\n", menu->help);
  578. }
  579. }
  580. void zconfdump(FILE *out)
  581. {
  582. struct property *prop;
  583. struct symbol *sym;
  584. struct menu *menu;
  585. menu = rootmenu.list;
  586. while (menu) {
  587. if ((sym = menu->sym))
  588. print_symbol(out, menu);
  589. else if ((prop = menu->prompt)) {
  590. switch (prop->type) {
  591. case P_COMMENT:
  592. fputs("\ncomment ", out);
  593. print_quoted_string(out, prop->text);
  594. fputs("\n", out);
  595. break;
  596. case P_MENU:
  597. fputs("\nmenu ", out);
  598. print_quoted_string(out, prop->text);
  599. fputs("\n", out);
  600. break;
  601. default:
  602. ;
  603. }
  604. if (!expr_is_yes(prop->visible.expr)) {
  605. fputs(" depends ", out);
  606. expr_fprint(prop->visible.expr, out);
  607. fputc('\n', out);
  608. }
  609. }
  610. if (menu->list)
  611. menu = menu->list;
  612. else if (menu->next)
  613. menu = menu->next;
  614. else while ((menu = menu->parent)) {
  615. if (menu->prompt && menu->prompt->type == P_MENU)
  616. fputs("\nendmenu\n", out);
  617. if (menu->next) {
  618. menu = menu->next;
  619. break;
  620. }
  621. }
  622. }
  623. }
  624. #include "zconf.lex.c"
  625. #include "util.c"
  626. #include "confdata.c"
  627. #include "expr.c"
  628. #include "symbol.c"
  629. #include "menu.c"