zconf.tab.c_shipped 51 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866
  1. /* A Bison parser, made from zconf.y
  2. by GNU bison 1.35. */
  3. #define YYBISON 1 /* Identify Bison output. */
  4. #define yyparse zconfparse
  5. #define yylex zconflex
  6. #define yyerror zconferror
  7. #define yylval zconflval
  8. #define yychar zconfchar
  9. #define yydebug zconfdebug
  10. #define yynerrs zconfnerrs
  11. # define T_MAINMENU 257
  12. # define T_MENU 258
  13. # define T_ENDMENU 259
  14. # define T_SOURCE 260
  15. # define T_CHOICE 261
  16. # define T_ENDCHOICE 262
  17. # define T_COMMENT 263
  18. # define T_CONFIG 264
  19. # define T_HELP 265
  20. # define T_HELPTEXT 266
  21. # define T_IF 267
  22. # define T_ENDIF 268
  23. # define T_DEPENDS 269
  24. # define T_REQUIRES 270
  25. # define T_OPTIONAL 271
  26. # define T_PROMPT 272
  27. # define T_DEFAULT 273
  28. # define T_TRISTATE 274
  29. # define T_BOOLEAN 275
  30. # define T_INT 276
  31. # define T_HEX 277
  32. # define T_WORD 278
  33. # define T_STRING 279
  34. # define T_UNEQUAL 280
  35. # define T_EOF 281
  36. # define T_EOL 282
  37. # define T_CLOSE_PAREN 283
  38. # define T_OPEN_PAREN 284
  39. # define T_ON 285
  40. # define T_OR 286
  41. # define T_AND 287
  42. # define T_EQUAL 288
  43. # define T_NOT 289
  44. #line 1 "zconf.y"
  45. /*
  46. * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
  47. * Released under the terms of the GNU GPL v2.0.
  48. */
  49. #include <ctype.h>
  50. #include <stdarg.h>
  51. #include <stdio.h>
  52. #include <stdlib.h>
  53. #include <string.h>
  54. #include <stdbool.h>
  55. #define printd(mask, fmt...) if (cdebug & (mask)) printf(fmt)
  56. #define PRINTD 0x0001
  57. #define DEBUG_PARSE 0x0002
  58. int cdebug = PRINTD;
  59. extern int zconflex(void);
  60. static void zconfprint(const char *err, ...);
  61. static void zconferror(const char *err);
  62. static bool zconf_endtoken(int token, int starttoken, int endtoken);
  63. struct symbol *symbol_hash[257];
  64. #define YYERROR_VERBOSE
  65. #line 32 "zconf.y"
  66. #ifndef YYSTYPE
  67. typedef union
  68. {
  69. int token;
  70. char *string;
  71. struct symbol *symbol;
  72. struct expr *expr;
  73. struct menu *menu;
  74. } yystype;
  75. # define YYSTYPE yystype
  76. # define YYSTYPE_IS_TRIVIAL 1
  77. #endif
  78. #line 83 "zconf.y"
  79. #define LKC_DIRECT_LINK
  80. #include "lkc.h"
  81. #ifndef YYDEBUG
  82. # define YYDEBUG 1
  83. #endif
  84. #define YYFINAL 145
  85. #define YYFLAG -32768
  86. #define YYNTBASE 36
  87. /* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */
  88. #define YYTRANSLATE(x) ((unsigned)(x) <= 289 ? yytranslate[x] : 74)
  89. /* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */
  90. static const char yytranslate[] =
  91. {
  92. 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  93. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  94. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  95. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  96. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  97. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  98. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  99. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  100. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  101. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  102. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  103. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  104. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  105. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  106. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  107. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  108. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  109. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  110. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  111. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  112. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  113. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  114. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  115. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  116. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  117. 2, 2, 2, 2, 2, 2, 1, 3, 4, 5,
  118. 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
  119. 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
  120. 26, 27, 28, 29, 30, 31, 32, 33, 34, 35
  121. };
  122. #if YYDEBUG
  123. static const short yyprhs[] =
  124. {
  125. 0, 0, 1, 4, 6, 8, 10, 14, 16, 18,
  126. 20, 23, 25, 27, 29, 31, 33, 36, 40, 41,
  127. 45, 49, 52, 55, 58, 61, 64, 67, 70, 74,
  128. 78, 80, 84, 86, 91, 94, 95, 99, 103, 106,
  129. 109, 113, 115, 118, 119, 122, 125, 127, 133, 137,
  130. 138, 141, 144, 147, 150, 154, 156, 161, 164, 165,
  131. 168, 171, 174, 178, 181, 184, 187, 191, 194, 197,
  132. 198, 202, 205, 209, 212, 215, 216, 218, 222, 224,
  133. 226, 228, 230, 232, 234, 236, 237, 240, 242, 246,
  134. 250, 254, 257, 261, 265, 267
  135. };
  136. static const short yyrhs[] =
  137. {
  138. -1, 36, 37, 0, 38, 0, 46, 0, 57, 0,
  139. 3, 68, 70, 0, 5, 0, 14, 0, 8, 0,
  140. 1, 70, 0, 52, 0, 62, 0, 40, 0, 60,
  141. 0, 70, 0, 10, 24, 0, 39, 28, 41, 0,
  142. 0, 41, 42, 28, 0, 41, 66, 28, 0, 41,
  143. 64, 0, 41, 28, 0, 20, 67, 0, 21, 67,
  144. 0, 22, 67, 0, 23, 67, 0, 25, 67, 0,
  145. 18, 68, 71, 0, 19, 73, 71, 0, 7, 0,
  146. 43, 28, 47, 0, 69, 0, 44, 49, 45, 28,
  147. 0, 44, 49, 0, 0, 47, 48, 28, 0, 47,
  148. 66, 28, 0, 47, 64, 0, 47, 28, 0, 18,
  149. 68, 71, 0, 17, 0, 19, 73, 0, 0, 49,
  150. 38, 0, 13, 72, 0, 69, 0, 50, 28, 53,
  151. 51, 28, 0, 50, 28, 53, 0, 0, 53, 38,
  152. 0, 53, 57, 0, 53, 46, 0, 4, 68, 0,
  153. 54, 28, 65, 0, 69, 0, 55, 58, 56, 28,
  154. 0, 55, 58, 0, 0, 58, 38, 0, 58, 57,
  155. 0, 58, 46, 0, 58, 1, 28, 0, 6, 68,
  156. 0, 59, 28, 0, 9, 68, 0, 61, 28, 65,
  157. 0, 11, 28, 0, 63, 12, 0, 0, 65, 66,
  158. 28, 0, 65, 28, 0, 15, 31, 72, 0, 15,
  159. 72, 0, 16, 72, 0, 0, 68, 0, 68, 13,
  160. 72, 0, 24, 0, 25, 0, 5, 0, 8, 0,
  161. 14, 0, 28, 0, 27, 0, 0, 13, 72, 0,
  162. 73, 0, 73, 34, 73, 0, 73, 26, 73, 0,
  163. 30, 72, 29, 0, 35, 72, 0, 72, 32, 72,
  164. 0, 72, 33, 72, 0, 24, 0, 25, 0
  165. };
  166. #endif
  167. #if YYDEBUG
  168. /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
  169. static const short yyrline[] =
  170. {
  171. 0, 88, 89, 92, 93, 94, 95, 96, 97, 98,
  172. 99, 102, 104, 105, 106, 107, 113, 121, 127, 129,
  173. 130, 131, 132, 135, 141, 147, 153, 159, 165, 171,
  174. 179, 188, 194, 202, 204, 210, 212, 213, 214, 215,
  175. 218, 224, 230, 237, 239, 244, 254, 262, 264, 270,
  176. 272, 273, 274, 279, 286, 292, 300, 302, 308, 310,
  177. 311, 312, 313, 316, 322, 329, 336, 343, 349, 356,
  178. 357, 358, 361, 366, 371, 379, 381, 385, 390, 391,
  179. 394, 395, 396, 399, 400, 402, 403, 406, 407, 408,
  180. 409, 410, 411, 412, 415, 416
  181. };
  182. #endif
  183. #if (YYDEBUG) || defined YYERROR_VERBOSE
  184. /* YYTNAME[TOKEN_NUM] -- String name of the token TOKEN_NUM. */
  185. static const char *const yytname[] =
  186. {
  187. "$", "error", "$undefined.", "T_MAINMENU", "T_MENU", "T_ENDMENU",
  188. "T_SOURCE", "T_CHOICE", "T_ENDCHOICE", "T_COMMENT", "T_CONFIG",
  189. "T_HELP", "T_HELPTEXT", "T_IF", "T_ENDIF", "T_DEPENDS", "T_REQUIRES",
  190. "T_OPTIONAL", "T_PROMPT", "T_DEFAULT", "T_TRISTATE", "T_BOOLEAN",
  191. "T_INT", "T_HEX", "T_WORD", "T_STRING", "T_UNEQUAL", "T_EOF", "T_EOL",
  192. "T_CLOSE_PAREN", "T_OPEN_PAREN", "T_ON", "T_OR", "T_AND", "T_EQUAL",
  193. "T_NOT", "input", "block", "common_block", "config_entry_start",
  194. "config_stmt", "config_option_list", "config_option", "choice",
  195. "choice_entry", "choice_end", "choice_stmt", "choice_option_list",
  196. "choice_option", "choice_block", "if", "if_end", "if_stmt", "if_block",
  197. "menu", "menu_entry", "menu_end", "menu_stmt", "menu_block", "source",
  198. "source_stmt", "comment", "comment_stmt", "help_start", "help",
  199. "depends_list", "depends", "prompt_stmt_opt", "prompt", "end",
  200. "nl_or_eof", "if_expr", "expr", "symbol", 0
  201. };
  202. #endif
  203. /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
  204. static const short yyr1[] =
  205. {
  206. 0, 36, 36, 37, 37, 37, 37, 37, 37, 37,
  207. 37, 38, 38, 38, 38, 38, 39, 40, 41, 41,
  208. 41, 41, 41, 42, 42, 42, 42, 42, 42, 42,
  209. 43, 44, 45, 46, 46, 47, 47, 47, 47, 47,
  210. 48, 48, 48, 49, 49, 50, 51, 52, 52, 53,
  211. 53, 53, 53, 54, 55, 56, 57, 57, 58, 58,
  212. 58, 58, 58, 59, 60, 61, 62, 63, 64, 65,
  213. 65, 65, 66, 66, 66, 67, 67, 67, 68, 68,
  214. 69, 69, 69, 70, 70, 71, 71, 72, 72, 72,
  215. 72, 72, 72, 72, 73, 73
  216. };
  217. /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
  218. static const short yyr2[] =
  219. {
  220. 0, 0, 2, 1, 1, 1, 3, 1, 1, 1,
  221. 2, 1, 1, 1, 1, 1, 2, 3, 0, 3,
  222. 3, 2, 2, 2, 2, 2, 2, 2, 3, 3,
  223. 1, 3, 1, 4, 2, 0, 3, 3, 2, 2,
  224. 3, 1, 2, 0, 2, 2, 1, 5, 3, 0,
  225. 2, 2, 2, 2, 3, 1, 4, 2, 0, 2,
  226. 2, 2, 3, 2, 2, 2, 3, 2, 2, 0,
  227. 3, 2, 3, 2, 2, 0, 1, 3, 1, 1,
  228. 1, 1, 1, 1, 1, 0, 2, 1, 3, 3,
  229. 3, 2, 3, 3, 1, 1
  230. };
  231. /* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE
  232. doesn't specify something else to do. Zero means the default is an
  233. error. */
  234. static const short yydefact[] =
  235. {
  236. 1, 0, 0, 0, 0, 7, 0, 30, 9, 0,
  237. 0, 0, 8, 84, 83, 2, 3, 0, 13, 0,
  238. 43, 4, 0, 11, 0, 58, 5, 0, 14, 0,
  239. 12, 15, 10, 78, 79, 0, 53, 63, 65, 16,
  240. 94, 95, 0, 0, 45, 87, 18, 35, 34, 49,
  241. 69, 0, 64, 69, 6, 0, 91, 0, 0, 0,
  242. 0, 17, 31, 80, 81, 82, 44, 0, 32, 48,
  243. 54, 0, 59, 61, 0, 60, 55, 66, 90, 92,
  244. 93, 89, 88, 0, 0, 0, 0, 0, 75, 75,
  245. 75, 75, 75, 22, 0, 0, 21, 0, 41, 0,
  246. 0, 39, 0, 38, 0, 33, 50, 52, 0, 51,
  247. 46, 71, 0, 62, 56, 67, 0, 73, 74, 85,
  248. 85, 23, 76, 24, 25, 26, 27, 19, 68, 20,
  249. 85, 42, 36, 37, 47, 70, 72, 0, 28, 29,
  250. 0, 40, 86, 77, 0, 0
  251. };
  252. static const short yydefgoto[] =
  253. {
  254. 1, 15, 16, 17, 18, 61, 94, 19, 20, 67,
  255. 21, 62, 102, 48, 22, 108, 23, 69, 24, 25,
  256. 74, 26, 51, 27, 28, 29, 30, 95, 96, 70,
  257. 112, 121, 122, 68, 31, 138, 44, 45
  258. };
  259. static const short yypact[] =
  260. {
  261. -32768, 17, 41, 65, 65,-32768, 65,-32768,-32768, 65,
  262. -11, 40,-32768,-32768,-32768,-32768,-32768, 13,-32768, 23,
  263. -32768,-32768, 66,-32768, 72,-32768,-32768, 77,-32768, 81,
  264. -32768,-32768,-32768,-32768,-32768, 41,-32768,-32768,-32768,-32768,
  265. -32768,-32768, 40, 40, 64, 59,-32768,-32768, 98,-32768,
  266. -32768, 49,-32768,-32768,-32768, 7,-32768, 40, 40, 67,
  267. 67, 99, 117,-32768,-32768,-32768,-32768, 85,-32768, 74,
  268. 18, 88,-32768,-32768, 95,-32768,-32768, 18,-32768, 96,
  269. -32768,-32768,-32768, 102, 36, 40, 65, 67, 65, 65,
  270. 65, 65, 65,-32768, 103, 129,-32768, 114,-32768, 65,
  271. 67,-32768, 115,-32768, 116,-32768,-32768,-32768, 118,-32768,
  272. -32768,-32768, 119,-32768,-32768,-32768, 40, 64, 64, 135,
  273. 135,-32768, 136,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
  274. 135,-32768,-32768,-32768,-32768,-32768, 64, 40,-32768,-32768,
  275. 40,-32768, 64, 64, 150,-32768
  276. };
  277. static const short yypgoto[] =
  278. {
  279. -32768,-32768, -37,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
  280. -41,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
  281. -32768, -32,-32768,-32768,-32768,-32768,-32768,-32768, 89, 100,
  282. 11, 48, 0, -22, 3, -118, -42, -52
  283. };
  284. #define YYLAST 153
  285. static const short yytable[] =
  286. {
  287. 55, 56, 139, 35, 36, 32, 37, 81, 82, 38,
  288. 73, 66, 141, 39, 72, 79, 80, 144, 2, 75,
  289. 3, 4, 5, 6, 7, 8, 9, 10, 107, 76,
  290. 11, 12, 106, 84, 85, 120, 78, 109, 54, 57,
  291. 58, 46, 117, 118, 13, 14, 111, 110, 131, -57,
  292. 71, 47, -57, 4, 63, 6, 7, 64, 9, 10,
  293. 40, 41, 11, 65, 40, 41, 42, 116, 13, 14,
  294. 42, 43, 97, 104, 136, 43, 13, 14, 4, 63,
  295. 6, 7, 64, 9, 10, 59, 119, 11, 65, 33,
  296. 34, 40, 41, 60, 49, 142, 57, 58, 143, 130,
  297. 50, 13, 14, 63, 6, 52, 64, 9, 10, 53,
  298. 83, 11, 65, 105, 84, 85, 113, 86, 87, 88,
  299. 89, 90, 91, 114, 92, 13, 14, 93, 83, 58,
  300. 115, 127, 84, 85, 98, 99, 100, 123, 124, 125,
  301. 126, 128, 129, 132, 133, 101, 134, 135, 137, 140,
  302. 145, 103, 0, 77
  303. };
  304. static const short yycheck[] =
  305. {
  306. 42, 43, 120, 3, 4, 2, 6, 59, 60, 9,
  307. 51, 48, 130, 24, 51, 57, 58, 0, 1, 51,
  308. 3, 4, 5, 6, 7, 8, 9, 10, 69, 51,
  309. 13, 14, 69, 15, 16, 87, 29, 69, 35, 32,
  310. 33, 28, 84, 85, 27, 28, 28, 69, 100, 0,
  311. 1, 28, 3, 4, 5, 6, 7, 8, 9, 10,
  312. 24, 25, 13, 14, 24, 25, 30, 31, 27, 28,
  313. 30, 35, 61, 62, 116, 35, 27, 28, 4, 5,
  314. 6, 7, 8, 9, 10, 26, 86, 13, 14, 24,
  315. 25, 24, 25, 34, 28, 137, 32, 33, 140, 99,
  316. 28, 27, 28, 5, 6, 28, 8, 9, 10, 28,
  317. 11, 13, 14, 28, 15, 16, 28, 18, 19, 20,
  318. 21, 22, 23, 28, 25, 27, 28, 28, 11, 33,
  319. 28, 28, 15, 16, 17, 18, 19, 89, 90, 91,
  320. 92, 12, 28, 28, 28, 28, 28, 28, 13, 13,
  321. 0, 62, -1, 53
  322. };
  323. /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
  324. #line 3 "/usr/share/bison/bison.simple"
  325. /* Skeleton output parser for bison,
  326. Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software
  327. Foundation, Inc.
  328. This program is free software; you can redistribute it and/or modify
  329. it under the terms of the GNU General Public License as published by
  330. the Free Software Foundation; either version 2, or (at your option)
  331. any later version.
  332. This program is distributed in the hope that it will be useful,
  333. but WITHOUT ANY WARRANTY; without even the implied warranty of
  334. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  335. GNU General Public License for more details.
  336. You should have received a copy of the GNU General Public License
  337. along with this program; if not, write to the Free Software
  338. Foundation, Inc., 59 Temple Place - Suite 330,
  339. Boston, MA 02111-1307, USA. */
  340. /* As a special exception, when this file is copied by Bison into a
  341. Bison output file, you may use that output file without restriction.
  342. This special exception was added by the Free Software Foundation
  343. in version 1.24 of Bison. */
  344. /* This is the parser code that is written into each bison parser when
  345. the %semantic_parser declaration is not specified in the grammar.
  346. It was written by Richard Stallman by simplifying the hairy parser
  347. used when %semantic_parser is specified. */
  348. /* All symbols defined below should begin with yy or YY, to avoid
  349. infringing on user name space. This should be done even for local
  350. variables, as they might otherwise be expanded by user macros.
  351. There are some unavoidable exceptions within include files to
  352. define necessary library symbols; they are noted "INFRINGES ON
  353. USER NAME SPACE" below. */
  354. #if ! defined (yyoverflow) || defined (YYERROR_VERBOSE)
  355. /* The parser invokes alloca or malloc; define the necessary symbols. */
  356. # if YYSTACK_USE_ALLOCA
  357. # define YYSTACK_ALLOC alloca
  358. # else
  359. # ifndef YYSTACK_USE_ALLOCA
  360. # if defined (alloca) || defined (_ALLOCA_H)
  361. # define YYSTACK_ALLOC alloca
  362. # else
  363. # ifdef __GNUC__
  364. # define YYSTACK_ALLOC __builtin_alloca
  365. # endif
  366. # endif
  367. # endif
  368. # endif
  369. # ifdef YYSTACK_ALLOC
  370. /* Pacify GCC's `empty if-body' warning. */
  371. # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
  372. # else
  373. # if defined (__STDC__) || defined (__cplusplus)
  374. # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
  375. # define YYSIZE_T size_t
  376. # endif
  377. # define YYSTACK_ALLOC malloc
  378. # define YYSTACK_FREE free
  379. # endif
  380. #endif /* ! defined (yyoverflow) || defined (YYERROR_VERBOSE) */
  381. #if (! defined (yyoverflow) \
  382. && (! defined (__cplusplus) \
  383. || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
  384. /* A type that is properly aligned for any stack member. */
  385. union yyalloc
  386. {
  387. short yyss;
  388. YYSTYPE yyvs;
  389. # if YYLSP_NEEDED
  390. YYLTYPE yyls;
  391. # endif
  392. };
  393. /* The size of the maximum gap between one aligned stack and the next. */
  394. # define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1)
  395. /* The size of an array large to enough to hold all stacks, each with
  396. N elements. */
  397. # if YYLSP_NEEDED
  398. # define YYSTACK_BYTES(N) \
  399. ((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
  400. + 2 * YYSTACK_GAP_MAX)
  401. # else
  402. # define YYSTACK_BYTES(N) \
  403. ((N) * (sizeof (short) + sizeof (YYSTYPE)) \
  404. + YYSTACK_GAP_MAX)
  405. # endif
  406. /* Copy COUNT objects from FROM to TO. The source and destination do
  407. not overlap. */
  408. # ifndef YYCOPY
  409. # if 1 < __GNUC__
  410. # define YYCOPY(To, From, Count) \
  411. __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
  412. # else
  413. # define YYCOPY(To, From, Count) \
  414. do \
  415. { \
  416. register YYSIZE_T yyi; \
  417. for (yyi = 0; yyi < (Count); yyi++) \
  418. (To)[yyi] = (From)[yyi]; \
  419. } \
  420. while (0)
  421. # endif
  422. # endif
  423. /* Relocate STACK from its old location to the new one. The
  424. local variables YYSIZE and YYSTACKSIZE give the old and new number of
  425. elements in the stack, and YYPTR gives the new location of the
  426. stack. Advance YYPTR to a properly aligned location for the next
  427. stack. */
  428. # define YYSTACK_RELOCATE(Stack) \
  429. do \
  430. { \
  431. YYSIZE_T yynewbytes; \
  432. YYCOPY (&yyptr->Stack, Stack, yysize); \
  433. Stack = &yyptr->Stack; \
  434. yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX; \
  435. yyptr += yynewbytes / sizeof (*yyptr); \
  436. } \
  437. while (0)
  438. #endif
  439. #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
  440. # define YYSIZE_T __SIZE_TYPE__
  441. #endif
  442. #if ! defined (YYSIZE_T) && defined (size_t)
  443. # define YYSIZE_T size_t
  444. #endif
  445. #if ! defined (YYSIZE_T)
  446. # if defined (__STDC__) || defined (__cplusplus)
  447. # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
  448. # define YYSIZE_T size_t
  449. # endif
  450. #endif
  451. #if ! defined (YYSIZE_T)
  452. # define YYSIZE_T unsigned int
  453. #endif
  454. #define yyerrok (yyerrstatus = 0)
  455. #define yyclearin (yychar = YYEMPTY)
  456. #define YYEMPTY -2
  457. #define YYEOF 0
  458. #define YYACCEPT goto yyacceptlab
  459. #define YYABORT goto yyabortlab
  460. #define YYERROR goto yyerrlab1
  461. /* Like YYERROR except do call yyerror. This remains here temporarily
  462. to ease the transition to the new meaning of YYERROR, for GCC.
  463. Once GCC version 2 has supplanted version 1, this can go. */
  464. #define YYFAIL goto yyerrlab
  465. #define YYRECOVERING() (!!yyerrstatus)
  466. #define YYBACKUP(Token, Value) \
  467. do \
  468. if (yychar == YYEMPTY && yylen == 1) \
  469. { \
  470. yychar = (Token); \
  471. yylval = (Value); \
  472. yychar1 = YYTRANSLATE (yychar); \
  473. YYPOPSTACK; \
  474. goto yybackup; \
  475. } \
  476. else \
  477. { \
  478. yyerror ("syntax error: cannot back up"); \
  479. YYERROR; \
  480. } \
  481. while (0)
  482. #define YYTERROR 1
  483. #define YYERRCODE 256
  484. /* YYLLOC_DEFAULT -- Compute the default location (before the actions
  485. are run).
  486. When YYLLOC_DEFAULT is run, CURRENT is set the location of the
  487. first token. By default, to implement support for ranges, extend
  488. its range to the last symbol. */
  489. #ifndef YYLLOC_DEFAULT
  490. # define YYLLOC_DEFAULT(Current, Rhs, N) \
  491. Current.last_line = Rhs[N].last_line; \
  492. Current.last_column = Rhs[N].last_column;
  493. #endif
  494. /* YYLEX -- calling `yylex' with the right arguments. */
  495. #if YYPURE
  496. # if YYLSP_NEEDED
  497. # ifdef YYLEX_PARAM
  498. # define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM)
  499. # else
  500. # define YYLEX yylex (&yylval, &yylloc)
  501. # endif
  502. # else /* !YYLSP_NEEDED */
  503. # ifdef YYLEX_PARAM
  504. # define YYLEX yylex (&yylval, YYLEX_PARAM)
  505. # else
  506. # define YYLEX yylex (&yylval)
  507. # endif
  508. # endif /* !YYLSP_NEEDED */
  509. #else /* !YYPURE */
  510. # define YYLEX yylex ()
  511. #endif /* !YYPURE */
  512. /* Enable debugging if requested. */
  513. #if YYDEBUG
  514. # ifndef YYFPRINTF
  515. # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
  516. # define YYFPRINTF fprintf
  517. # endif
  518. # define YYDPRINTF(Args) \
  519. do { \
  520. if (yydebug) \
  521. YYFPRINTF Args; \
  522. } while (0)
  523. /* Nonzero means print parse trace. It is left uninitialized so that
  524. multiple parsers can coexist. */
  525. int yydebug;
  526. #else /* !YYDEBUG */
  527. # define YYDPRINTF(Args)
  528. #endif /* !YYDEBUG */
  529. /* YYINITDEPTH -- initial size of the parser's stacks. */
  530. #ifndef YYINITDEPTH
  531. # define YYINITDEPTH 200
  532. #endif
  533. /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
  534. if the built-in stack extension method is used).
  535. Do not make this value too large; the results are undefined if
  536. SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
  537. evaluated with infinite-precision integer arithmetic. */
  538. #if YYMAXDEPTH == 0
  539. # undef YYMAXDEPTH
  540. #endif
  541. #ifndef YYMAXDEPTH
  542. # define YYMAXDEPTH 10000
  543. #endif
  544. #ifdef YYERROR_VERBOSE
  545. # ifndef yystrlen
  546. # if defined (__GLIBC__) && defined (_STRING_H)
  547. # define yystrlen strlen
  548. # else
  549. /* Return the length of YYSTR. */
  550. static YYSIZE_T
  551. # if defined (__STDC__) || defined (__cplusplus)
  552. yystrlen (const char *yystr)
  553. # else
  554. yystrlen (yystr)
  555. const char *yystr;
  556. # endif
  557. {
  558. register const char *yys = yystr;
  559. while (*yys++ != '\0')
  560. continue;
  561. return yys - yystr - 1;
  562. }
  563. # endif
  564. # endif
  565. # ifndef yystpcpy
  566. # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
  567. # define yystpcpy stpcpy
  568. # else
  569. /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
  570. YYDEST. */
  571. static char *
  572. # if defined (__STDC__) || defined (__cplusplus)
  573. yystpcpy (char *yydest, const char *yysrc)
  574. # else
  575. yystpcpy (yydest, yysrc)
  576. char *yydest;
  577. const char *yysrc;
  578. # endif
  579. {
  580. register char *yyd = yydest;
  581. register const char *yys = yysrc;
  582. while ((*yyd++ = *yys++) != '\0')
  583. continue;
  584. return yyd - 1;
  585. }
  586. # endif
  587. # endif
  588. #endif
  589. #line 315 "/usr/share/bison/bison.simple"
  590. /* The user can define YYPARSE_PARAM as the name of an argument to be passed
  591. into yyparse. The argument should have type void *.
  592. It should actually point to an object.
  593. Grammar actions can access the variable by casting it
  594. to the proper pointer type. */
  595. #ifdef YYPARSE_PARAM
  596. # if defined (__STDC__) || defined (__cplusplus)
  597. # define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
  598. # define YYPARSE_PARAM_DECL
  599. # else
  600. # define YYPARSE_PARAM_ARG YYPARSE_PARAM
  601. # define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
  602. # endif
  603. #else /* !YYPARSE_PARAM */
  604. # define YYPARSE_PARAM_ARG
  605. # define YYPARSE_PARAM_DECL
  606. #endif /* !YYPARSE_PARAM */
  607. /* Prevent warning if -Wstrict-prototypes. */
  608. #ifdef __GNUC__
  609. # ifdef YYPARSE_PARAM
  610. int yyparse (void *);
  611. # else
  612. int yyparse (void);
  613. # endif
  614. #endif
  615. /* YY_DECL_VARIABLES -- depending whether we use a pure parser,
  616. variables are global, or local to YYPARSE. */
  617. #define YY_DECL_NON_LSP_VARIABLES \
  618. /* The lookahead symbol. */ \
  619. int yychar; \
  620. \
  621. /* The semantic value of the lookahead symbol. */ \
  622. YYSTYPE yylval; \
  623. \
  624. /* Number of parse errors so far. */ \
  625. int yynerrs;
  626. #if YYLSP_NEEDED
  627. # define YY_DECL_VARIABLES \
  628. YY_DECL_NON_LSP_VARIABLES \
  629. \
  630. /* Location data for the lookahead symbol. */ \
  631. YYLTYPE yylloc;
  632. #else
  633. # define YY_DECL_VARIABLES \
  634. YY_DECL_NON_LSP_VARIABLES
  635. #endif
  636. /* If nonreentrant, generate the variables here. */
  637. #if !YYPURE
  638. YY_DECL_VARIABLES
  639. #endif /* !YYPURE */
  640. int
  641. yyparse (YYPARSE_PARAM_ARG)
  642. YYPARSE_PARAM_DECL
  643. {
  644. /* If reentrant, generate the variables here. */
  645. #if YYPURE
  646. YY_DECL_VARIABLES
  647. #endif /* !YYPURE */
  648. register int yystate;
  649. register int yyn;
  650. int yyresult;
  651. /* Number of tokens to shift before error messages enabled. */
  652. int yyerrstatus;
  653. /* Lookahead token as an internal (translated) token number. */
  654. int yychar1 = 0;
  655. /* Three stacks and their tools:
  656. `yyss': related to states,
  657. `yyvs': related to semantic values,
  658. `yyls': related to locations.
  659. Refer to the stacks thru separate pointers, to allow yyoverflow
  660. to reallocate them elsewhere. */
  661. /* The state stack. */
  662. short yyssa[YYINITDEPTH];
  663. short *yyss = yyssa;
  664. register short *yyssp;
  665. /* The semantic value stack. */
  666. YYSTYPE yyvsa[YYINITDEPTH];
  667. YYSTYPE *yyvs = yyvsa;
  668. register YYSTYPE *yyvsp;
  669. #if YYLSP_NEEDED
  670. /* The location stack. */
  671. YYLTYPE yylsa[YYINITDEPTH];
  672. YYLTYPE *yyls = yylsa;
  673. YYLTYPE *yylsp;
  674. #endif
  675. #if YYLSP_NEEDED
  676. # define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
  677. #else
  678. # define YYPOPSTACK (yyvsp--, yyssp--)
  679. #endif
  680. YYSIZE_T yystacksize = YYINITDEPTH;
  681. /* The variables used to return semantic value and location from the
  682. action routines. */
  683. YYSTYPE yyval;
  684. #if YYLSP_NEEDED
  685. YYLTYPE yyloc;
  686. #endif
  687. /* When reducing, the number of symbols on the RHS of the reduced
  688. rule. */
  689. int yylen;
  690. YYDPRINTF ((stderr, "Starting parse\n"));
  691. yystate = 0;
  692. yyerrstatus = 0;
  693. yynerrs = 0;
  694. yychar = YYEMPTY; /* Cause a token to be read. */
  695. /* Initialize stack pointers.
  696. Waste one element of value and location stack
  697. so that they stay on the same level as the state stack.
  698. The wasted elements are never initialized. */
  699. yyssp = yyss;
  700. yyvsp = yyvs;
  701. #if YYLSP_NEEDED
  702. yylsp = yyls;
  703. #endif
  704. goto yysetstate;
  705. /*------------------------------------------------------------.
  706. | yynewstate -- Push a new state, which is found in yystate. |
  707. `------------------------------------------------------------*/
  708. yynewstate:
  709. /* In all cases, when you get here, the value and location stacks
  710. have just been pushed. so pushing a state here evens the stacks.
  711. */
  712. yyssp++;
  713. yysetstate:
  714. *yyssp = yystate;
  715. if (yyssp >= yyss + yystacksize - 1)
  716. {
  717. /* Get the current used size of the three stacks, in elements. */
  718. YYSIZE_T yysize = yyssp - yyss + 1;
  719. #ifdef yyoverflow
  720. {
  721. /* Give user a chance to reallocate the stack. Use copies of
  722. these so that the &'s don't force the real ones into
  723. memory. */
  724. YYSTYPE *yyvs1 = yyvs;
  725. short *yyss1 = yyss;
  726. /* Each stack pointer address is followed by the size of the
  727. data in use in that stack, in bytes. */
  728. # if YYLSP_NEEDED
  729. YYLTYPE *yyls1 = yyls;
  730. /* This used to be a conditional around just the two extra args,
  731. but that might be undefined if yyoverflow is a macro. */
  732. yyoverflow ("parser stack overflow",
  733. &yyss1, yysize * sizeof (*yyssp),
  734. &yyvs1, yysize * sizeof (*yyvsp),
  735. &yyls1, yysize * sizeof (*yylsp),
  736. &yystacksize);
  737. yyls = yyls1;
  738. # else
  739. yyoverflow ("parser stack overflow",
  740. &yyss1, yysize * sizeof (*yyssp),
  741. &yyvs1, yysize * sizeof (*yyvsp),
  742. &yystacksize);
  743. # endif
  744. yyss = yyss1;
  745. yyvs = yyvs1;
  746. }
  747. #else /* no yyoverflow */
  748. # ifndef YYSTACK_RELOCATE
  749. goto yyoverflowlab;
  750. # else
  751. /* Extend the stack our own way. */
  752. if (yystacksize >= YYMAXDEPTH)
  753. goto yyoverflowlab;
  754. yystacksize *= 2;
  755. if (yystacksize > YYMAXDEPTH)
  756. yystacksize = YYMAXDEPTH;
  757. {
  758. short *yyss1 = yyss;
  759. union yyalloc *yyptr =
  760. (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
  761. if (! yyptr)
  762. goto yyoverflowlab;
  763. YYSTACK_RELOCATE (yyss);
  764. YYSTACK_RELOCATE (yyvs);
  765. # if YYLSP_NEEDED
  766. YYSTACK_RELOCATE (yyls);
  767. # endif
  768. # undef YYSTACK_RELOCATE
  769. if (yyss1 != yyssa)
  770. YYSTACK_FREE (yyss1);
  771. }
  772. # endif
  773. #endif /* no yyoverflow */
  774. yyssp = yyss + yysize - 1;
  775. yyvsp = yyvs + yysize - 1;
  776. #if YYLSP_NEEDED
  777. yylsp = yyls + yysize - 1;
  778. #endif
  779. YYDPRINTF ((stderr, "Stack size increased to %lu\n",
  780. (unsigned long int) yystacksize));
  781. if (yyssp >= yyss + yystacksize - 1)
  782. YYABORT;
  783. }
  784. YYDPRINTF ((stderr, "Entering state %d\n", yystate));
  785. goto yybackup;
  786. /*-----------.
  787. | yybackup. |
  788. `-----------*/
  789. yybackup:
  790. /* Do appropriate processing given the current state. */
  791. /* Read a lookahead token if we need one and don't already have one. */
  792. /* yyresume: */
  793. /* First try to decide what to do without reference to lookahead token. */
  794. yyn = yypact[yystate];
  795. if (yyn == YYFLAG)
  796. goto yydefault;
  797. /* Not known => get a lookahead token if don't already have one. */
  798. /* yychar is either YYEMPTY or YYEOF
  799. or a valid token in external form. */
  800. if (yychar == YYEMPTY)
  801. {
  802. YYDPRINTF ((stderr, "Reading a token: "));
  803. yychar = YYLEX;
  804. }
  805. /* Convert token to internal form (in yychar1) for indexing tables with */
  806. if (yychar <= 0) /* This means end of input. */
  807. {
  808. yychar1 = 0;
  809. yychar = YYEOF; /* Don't call YYLEX any more */
  810. YYDPRINTF ((stderr, "Now at end of input.\n"));
  811. }
  812. else
  813. {
  814. yychar1 = YYTRANSLATE (yychar);
  815. #if YYDEBUG
  816. /* We have to keep this `#if YYDEBUG', since we use variables
  817. which are defined only if `YYDEBUG' is set. */
  818. if (yydebug)
  819. {
  820. YYFPRINTF (stderr, "Next token is %d (%s",
  821. yychar, yytname[yychar1]);
  822. /* Give the individual parser a way to print the precise
  823. meaning of a token, for further debugging info. */
  824. # ifdef YYPRINT
  825. YYPRINT (stderr, yychar, yylval);
  826. # endif
  827. YYFPRINTF (stderr, ")\n");
  828. }
  829. #endif
  830. }
  831. yyn += yychar1;
  832. if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
  833. goto yydefault;
  834. yyn = yytable[yyn];
  835. /* yyn is what to do for this token type in this state.
  836. Negative => reduce, -yyn is rule number.
  837. Positive => shift, yyn is new state.
  838. New state is final state => don't bother to shift,
  839. just return success.
  840. 0, or most negative number => error. */
  841. if (yyn < 0)
  842. {
  843. if (yyn == YYFLAG)
  844. goto yyerrlab;
  845. yyn = -yyn;
  846. goto yyreduce;
  847. }
  848. else if (yyn == 0)
  849. goto yyerrlab;
  850. if (yyn == YYFINAL)
  851. YYACCEPT;
  852. /* Shift the lookahead token. */
  853. YYDPRINTF ((stderr, "Shifting token %d (%s), ",
  854. yychar, yytname[yychar1]));
  855. /* Discard the token being shifted unless it is eof. */
  856. if (yychar != YYEOF)
  857. yychar = YYEMPTY;
  858. *++yyvsp = yylval;
  859. #if YYLSP_NEEDED
  860. *++yylsp = yylloc;
  861. #endif
  862. /* Count tokens shifted since error; after three, turn off error
  863. status. */
  864. if (yyerrstatus)
  865. yyerrstatus--;
  866. yystate = yyn;
  867. goto yynewstate;
  868. /*-----------------------------------------------------------.
  869. | yydefault -- do the default action for the current state. |
  870. `-----------------------------------------------------------*/
  871. yydefault:
  872. yyn = yydefact[yystate];
  873. if (yyn == 0)
  874. goto yyerrlab;
  875. goto yyreduce;
  876. /*-----------------------------.
  877. | yyreduce -- Do a reduction. |
  878. `-----------------------------*/
  879. yyreduce:
  880. /* yyn is the number of a rule to reduce with. */
  881. yylen = yyr2[yyn];
  882. /* If YYLEN is nonzero, implement the default value of the action:
  883. `$$ = $1'.
  884. Otherwise, the following line sets YYVAL to the semantic value of
  885. the lookahead token. This behavior is undocumented and Bison
  886. users should not rely upon it. Assigning to YYVAL
  887. unconditionally makes the parser a bit smaller, and it avoids a
  888. GCC warning that YYVAL may be used uninitialized. */
  889. yyval = yyvsp[1-yylen];
  890. #if YYLSP_NEEDED
  891. /* Similarly for the default location. Let the user run additional
  892. commands if for instance locations are ranges. */
  893. yyloc = yylsp[1-yylen];
  894. YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
  895. #endif
  896. #if YYDEBUG
  897. /* We have to keep this `#if YYDEBUG', since we use variables which
  898. are defined only if `YYDEBUG' is set. */
  899. if (yydebug)
  900. {
  901. int yyi;
  902. YYFPRINTF (stderr, "Reducing via rule %d (line %d), ",
  903. yyn, yyrline[yyn]);
  904. /* Print the symbols being reduced, and their result. */
  905. for (yyi = yyprhs[yyn]; yyrhs[yyi] > 0; yyi++)
  906. YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
  907. YYFPRINTF (stderr, " -> %s\n", yytname[yyr1[yyn]]);
  908. }
  909. #endif
  910. switch (yyn) {
  911. case 7:
  912. #line 96 "zconf.y"
  913. { zconfprint("unexpected 'endmenu' statement"); ;
  914. break;}
  915. case 8:
  916. #line 97 "zconf.y"
  917. { zconfprint("unexpected 'endif' statement"); ;
  918. break;}
  919. case 9:
  920. #line 98 "zconf.y"
  921. { zconfprint("unexpected 'endchoice' statement"); ;
  922. break;}
  923. case 10:
  924. #line 99 "zconf.y"
  925. { zconfprint("syntax error"); yyerrok; ;
  926. break;}
  927. case 16:
  928. #line 114 "zconf.y"
  929. {
  930. struct symbol *sym = sym_lookup(yyvsp[0].string, 0);
  931. sym->flags |= SYMBOL_OPTIONAL;
  932. menu_add_entry(sym);
  933. printd(DEBUG_PARSE, "%s:%d:config %s\n", zconf_curname(), zconf_lineno(), yyvsp[0].string);
  934. ;
  935. break;}
  936. case 17:
  937. #line 122 "zconf.y"
  938. {
  939. menu_end_entry();
  940. printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno());
  941. ;
  942. break;}
  943. case 22:
  944. #line 133 "zconf.y"
  945. { ;
  946. break;}
  947. case 23:
  948. #line 136 "zconf.y"
  949. {
  950. menu_set_type(S_TRISTATE);
  951. printd(DEBUG_PARSE, "%s:%d:tristate\n", zconf_curname(), zconf_lineno());
  952. ;
  953. break;}
  954. case 24:
  955. #line 142 "zconf.y"
  956. {
  957. menu_set_type(S_BOOLEAN);
  958. printd(DEBUG_PARSE, "%s:%d:boolean\n", zconf_curname(), zconf_lineno());
  959. ;
  960. break;}
  961. case 25:
  962. #line 148 "zconf.y"
  963. {
  964. menu_set_type(S_INT);
  965. printd(DEBUG_PARSE, "%s:%d:int\n", zconf_curname(), zconf_lineno());
  966. ;
  967. break;}
  968. case 26:
  969. #line 154 "zconf.y"
  970. {
  971. menu_set_type(S_HEX);
  972. printd(DEBUG_PARSE, "%s:%d:hex\n", zconf_curname(), zconf_lineno());
  973. ;
  974. break;}
  975. case 27:
  976. #line 160 "zconf.y"
  977. {
  978. menu_set_type(S_STRING);
  979. printd(DEBUG_PARSE, "%s:%d:string\n", zconf_curname(), zconf_lineno());
  980. ;
  981. break;}
  982. case 28:
  983. #line 166 "zconf.y"
  984. {
  985. menu_add_prop(P_PROMPT, yyvsp[-1].string, NULL, yyvsp[0].expr);
  986. printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno());
  987. ;
  988. break;}
  989. case 29:
  990. #line 172 "zconf.y"
  991. {
  992. menu_add_prop(P_DEFAULT, NULL, yyvsp[-1].symbol, yyvsp[0].expr);
  993. printd(DEBUG_PARSE, "%s:%d:default\n", zconf_curname(), zconf_lineno());
  994. ;
  995. break;}
  996. case 30:
  997. #line 180 "zconf.y"
  998. {
  999. struct symbol *sym = sym_lookup(NULL, 0);
  1000. sym->flags |= SYMBOL_CHOICE;
  1001. menu_add_entry(sym);
  1002. menu_add_prop(P_CHOICE, NULL, NULL, NULL);
  1003. printd(DEBUG_PARSE, "%s:%d:choice\n", zconf_curname(), zconf_lineno());
  1004. ;
  1005. break;}
  1006. case 31:
  1007. #line 189 "zconf.y"
  1008. {
  1009. menu_end_entry();
  1010. menu_add_menu();
  1011. ;
  1012. break;}
  1013. case 32:
  1014. #line 195 "zconf.y"
  1015. {
  1016. if (zconf_endtoken(yyvsp[0].token, T_CHOICE, T_ENDCHOICE)) {
  1017. menu_end_menu();
  1018. printd(DEBUG_PARSE, "%s:%d:endchoice\n", zconf_curname(), zconf_lineno());
  1019. }
  1020. ;
  1021. break;}
  1022. case 34:
  1023. #line 205 "zconf.y"
  1024. {
  1025. printf("%s:%d: missing 'endchoice' for this 'choice' statement\n", current_menu->file->name, current_menu->lineno);
  1026. zconfnerrs++;
  1027. ;
  1028. break;}
  1029. case 40:
  1030. #line 219 "zconf.y"
  1031. {
  1032. menu_add_prop(P_PROMPT, yyvsp[-1].string, NULL, yyvsp[0].expr);
  1033. printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno());
  1034. ;
  1035. break;}
  1036. case 41:
  1037. #line 225 "zconf.y"
  1038. {
  1039. current_entry->sym->flags |= SYMBOL_OPTIONAL;
  1040. printd(DEBUG_PARSE, "%s:%d:optional\n", zconf_curname(), zconf_lineno());
  1041. ;
  1042. break;}
  1043. case 42:
  1044. #line 231 "zconf.y"
  1045. {
  1046. menu_add_prop(P_DEFAULT, NULL, yyvsp[0].symbol, NULL);
  1047. //current_choice->prop->def = $2;
  1048. printd(DEBUG_PARSE, "%s:%d:default\n", zconf_curname(), zconf_lineno());
  1049. ;
  1050. break;}
  1051. case 45:
  1052. #line 245 "zconf.y"
  1053. {
  1054. printd(DEBUG_PARSE, "%s:%d:if\n", zconf_curname(), zconf_lineno());
  1055. menu_add_entry(NULL);
  1056. //current_entry->prompt = menu_add_prop(T_IF, NULL, NULL, $2);
  1057. menu_add_dep(yyvsp[0].expr);
  1058. menu_end_entry();
  1059. menu_add_menu();
  1060. ;
  1061. break;}
  1062. case 46:
  1063. #line 255 "zconf.y"
  1064. {
  1065. if (zconf_endtoken(yyvsp[0].token, T_IF, T_ENDIF)) {
  1066. menu_end_menu();
  1067. printd(DEBUG_PARSE, "%s:%d:endif\n", zconf_curname(), zconf_lineno());
  1068. }
  1069. ;
  1070. break;}
  1071. case 48:
  1072. #line 265 "zconf.y"
  1073. {
  1074. printf("%s:%d: missing 'endif' for this 'if' statement\n", current_menu->file->name, current_menu->lineno);
  1075. zconfnerrs++;
  1076. ;
  1077. break;}
  1078. case 53:
  1079. #line 280 "zconf.y"
  1080. {
  1081. menu_add_entry(NULL);
  1082. menu_add_prop(P_MENU, yyvsp[0].string, NULL, NULL);
  1083. printd(DEBUG_PARSE, "%s:%d:menu\n", zconf_curname(), zconf_lineno());
  1084. ;
  1085. break;}
  1086. case 54:
  1087. #line 287 "zconf.y"
  1088. {
  1089. menu_end_entry();
  1090. menu_add_menu();
  1091. ;
  1092. break;}
  1093. case 55:
  1094. #line 293 "zconf.y"
  1095. {
  1096. if (zconf_endtoken(yyvsp[0].token, T_MENU, T_ENDMENU)) {
  1097. menu_end_menu();
  1098. printd(DEBUG_PARSE, "%s:%d:endmenu\n", zconf_curname(), zconf_lineno());
  1099. }
  1100. ;
  1101. break;}
  1102. case 57:
  1103. #line 303 "zconf.y"
  1104. {
  1105. printf("%s:%d: missing 'endmenu' for this 'menu' statement\n", current_menu->file->name, current_menu->lineno);
  1106. zconfnerrs++;
  1107. ;
  1108. break;}
  1109. case 62:
  1110. #line 313 "zconf.y"
  1111. { zconfprint("invalid menu option"); yyerrok; ;
  1112. break;}
  1113. case 63:
  1114. #line 317 "zconf.y"
  1115. {
  1116. yyval.string = yyvsp[0].string;
  1117. printd(DEBUG_PARSE, "%s:%d:source %s\n", zconf_curname(), zconf_lineno(), yyvsp[0].string);
  1118. ;
  1119. break;}
  1120. case 64:
  1121. #line 323 "zconf.y"
  1122. {
  1123. zconf_nextfile(yyvsp[-1].string);
  1124. ;
  1125. break;}
  1126. case 65:
  1127. #line 330 "zconf.y"
  1128. {
  1129. menu_add_entry(NULL);
  1130. menu_add_prop(P_COMMENT, yyvsp[0].string, NULL, NULL);
  1131. printd(DEBUG_PARSE, "%s:%d:comment\n", zconf_curname(), zconf_lineno());
  1132. ;
  1133. break;}
  1134. case 66:
  1135. #line 337 "zconf.y"
  1136. {
  1137. menu_end_entry();
  1138. ;
  1139. break;}
  1140. case 67:
  1141. #line 344 "zconf.y"
  1142. {
  1143. printd(DEBUG_PARSE, "%s:%d:help\n", zconf_curname(), zconf_lineno());
  1144. zconf_starthelp();
  1145. ;
  1146. break;}
  1147. case 68:
  1148. #line 350 "zconf.y"
  1149. {
  1150. current_entry->sym->help = yyvsp[0].string;
  1151. ;
  1152. break;}
  1153. case 71:
  1154. #line 359 "zconf.y"
  1155. { ;
  1156. break;}
  1157. case 72:
  1158. #line 362 "zconf.y"
  1159. {
  1160. menu_add_dep(yyvsp[0].expr);
  1161. printd(DEBUG_PARSE, "%s:%d:depends on\n", zconf_curname(), zconf_lineno());
  1162. ;
  1163. break;}
  1164. case 73:
  1165. #line 367 "zconf.y"
  1166. {
  1167. menu_add_dep(yyvsp[0].expr);
  1168. printd(DEBUG_PARSE, "%s:%d:depends\n", zconf_curname(), zconf_lineno());
  1169. ;
  1170. break;}
  1171. case 74:
  1172. #line 372 "zconf.y"
  1173. {
  1174. menu_add_dep(yyvsp[0].expr);
  1175. printd(DEBUG_PARSE, "%s:%d:requires\n", zconf_curname(), zconf_lineno());
  1176. ;
  1177. break;}
  1178. case 76:
  1179. #line 382 "zconf.y"
  1180. {
  1181. menu_add_prop(P_PROMPT, yyvsp[0].string, NULL, NULL);
  1182. ;
  1183. break;}
  1184. case 77:
  1185. #line 386 "zconf.y"
  1186. {
  1187. menu_add_prop(P_PROMPT, yyvsp[-2].string, NULL, yyvsp[0].expr);
  1188. ;
  1189. break;}
  1190. case 80:
  1191. #line 394 "zconf.y"
  1192. { yyval.token = T_ENDMENU; ;
  1193. break;}
  1194. case 81:
  1195. #line 395 "zconf.y"
  1196. { yyval.token = T_ENDCHOICE; ;
  1197. break;}
  1198. case 82:
  1199. #line 396 "zconf.y"
  1200. { yyval.token = T_ENDIF; ;
  1201. break;}
  1202. case 85:
  1203. #line 402 "zconf.y"
  1204. { yyval.expr = NULL; ;
  1205. break;}
  1206. case 86:
  1207. #line 403 "zconf.y"
  1208. { yyval.expr = yyvsp[0].expr; ;
  1209. break;}
  1210. case 87:
  1211. #line 406 "zconf.y"
  1212. { yyval.expr = expr_alloc_symbol(yyvsp[0].symbol); ;
  1213. break;}
  1214. case 88:
  1215. #line 407 "zconf.y"
  1216. { yyval.expr = expr_alloc_comp(E_EQUAL, yyvsp[-2].symbol, yyvsp[0].symbol); ;
  1217. break;}
  1218. case 89:
  1219. #line 408 "zconf.y"
  1220. { yyval.expr = expr_alloc_comp(E_UNEQUAL, yyvsp[-2].symbol, yyvsp[0].symbol); ;
  1221. break;}
  1222. case 90:
  1223. #line 409 "zconf.y"
  1224. { yyval.expr = yyvsp[-1].expr; ;
  1225. break;}
  1226. case 91:
  1227. #line 410 "zconf.y"
  1228. { yyval.expr = expr_alloc_one(E_NOT, yyvsp[0].expr); ;
  1229. break;}
  1230. case 92:
  1231. #line 411 "zconf.y"
  1232. { yyval.expr = expr_alloc_two(E_OR, yyvsp[-2].expr, yyvsp[0].expr); ;
  1233. break;}
  1234. case 93:
  1235. #line 412 "zconf.y"
  1236. { yyval.expr = expr_alloc_two(E_AND, yyvsp[-2].expr, yyvsp[0].expr); ;
  1237. break;}
  1238. case 94:
  1239. #line 415 "zconf.y"
  1240. { yyval.symbol = sym_lookup(yyvsp[0].string, 0); free(yyvsp[0].string); ;
  1241. break;}
  1242. case 95:
  1243. #line 416 "zconf.y"
  1244. { yyval.symbol = sym_lookup(yyvsp[0].string, 1); free(yyvsp[0].string); ;
  1245. break;}
  1246. }
  1247. #line 705 "/usr/share/bison/bison.simple"
  1248. yyvsp -= yylen;
  1249. yyssp -= yylen;
  1250. #if YYLSP_NEEDED
  1251. yylsp -= yylen;
  1252. #endif
  1253. #if YYDEBUG
  1254. if (yydebug)
  1255. {
  1256. short *yyssp1 = yyss - 1;
  1257. YYFPRINTF (stderr, "state stack now");
  1258. while (yyssp1 != yyssp)
  1259. YYFPRINTF (stderr, " %d", *++yyssp1);
  1260. YYFPRINTF (stderr, "\n");
  1261. }
  1262. #endif
  1263. *++yyvsp = yyval;
  1264. #if YYLSP_NEEDED
  1265. *++yylsp = yyloc;
  1266. #endif
  1267. /* Now `shift' the result of the reduction. Determine what state
  1268. that goes to, based on the state we popped back to and the rule
  1269. number reduced by. */
  1270. yyn = yyr1[yyn];
  1271. yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
  1272. if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
  1273. yystate = yytable[yystate];
  1274. else
  1275. yystate = yydefgoto[yyn - YYNTBASE];
  1276. goto yynewstate;
  1277. /*------------------------------------.
  1278. | yyerrlab -- here on detecting error |
  1279. `------------------------------------*/
  1280. yyerrlab:
  1281. /* If not already recovering from an error, report this error. */
  1282. if (!yyerrstatus)
  1283. {
  1284. ++yynerrs;
  1285. #ifdef YYERROR_VERBOSE
  1286. yyn = yypact[yystate];
  1287. if (yyn > YYFLAG && yyn < YYLAST)
  1288. {
  1289. YYSIZE_T yysize = 0;
  1290. char *yymsg;
  1291. int yyx, yycount;
  1292. yycount = 0;
  1293. /* Start YYX at -YYN if negative to avoid negative indexes in
  1294. YYCHECK. */
  1295. for (yyx = yyn < 0 ? -yyn : 0;
  1296. yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
  1297. if (yycheck[yyx + yyn] == yyx)
  1298. yysize += yystrlen (yytname[yyx]) + 15, yycount++;
  1299. yysize += yystrlen ("parse error, unexpected ") + 1;
  1300. yysize += yystrlen (yytname[YYTRANSLATE (yychar)]);
  1301. yymsg = (char *) YYSTACK_ALLOC (yysize);
  1302. if (yymsg != 0)
  1303. {
  1304. char *yyp = yystpcpy (yymsg, "parse error, unexpected ");
  1305. yyp = yystpcpy (yyp, yytname[YYTRANSLATE (yychar)]);
  1306. if (yycount < 5)
  1307. {
  1308. yycount = 0;
  1309. for (yyx = yyn < 0 ? -yyn : 0;
  1310. yyx < (int) (sizeof (yytname) / sizeof (char *));
  1311. yyx++)
  1312. if (yycheck[yyx + yyn] == yyx)
  1313. {
  1314. const char *yyq = ! yycount ? ", expecting " : " or ";
  1315. yyp = yystpcpy (yyp, yyq);
  1316. yyp = yystpcpy (yyp, yytname[yyx]);
  1317. yycount++;
  1318. }
  1319. }
  1320. yyerror (yymsg);
  1321. YYSTACK_FREE (yymsg);
  1322. }
  1323. else
  1324. yyerror ("parse error; also virtual memory exhausted");
  1325. }
  1326. else
  1327. #endif /* defined (YYERROR_VERBOSE) */
  1328. yyerror ("parse error");
  1329. }
  1330. goto yyerrlab1;
  1331. /*--------------------------------------------------.
  1332. | yyerrlab1 -- error raised explicitly by an action |
  1333. `--------------------------------------------------*/
  1334. yyerrlab1:
  1335. if (yyerrstatus == 3)
  1336. {
  1337. /* If just tried and failed to reuse lookahead token after an
  1338. error, discard it. */
  1339. /* return failure if at end of input */
  1340. if (yychar == YYEOF)
  1341. YYABORT;
  1342. YYDPRINTF ((stderr, "Discarding token %d (%s).\n",
  1343. yychar, yytname[yychar1]));
  1344. yychar = YYEMPTY;
  1345. }
  1346. /* Else will try to reuse lookahead token after shifting the error
  1347. token. */
  1348. yyerrstatus = 3; /* Each real token shifted decrements this */
  1349. goto yyerrhandle;
  1350. /*-------------------------------------------------------------------.
  1351. | yyerrdefault -- current state does not do anything special for the |
  1352. | error token. |
  1353. `-------------------------------------------------------------------*/
  1354. yyerrdefault:
  1355. #if 0
  1356. /* This is wrong; only states that explicitly want error tokens
  1357. should shift them. */
  1358. /* If its default is to accept any token, ok. Otherwise pop it. */
  1359. yyn = yydefact[yystate];
  1360. if (yyn)
  1361. goto yydefault;
  1362. #endif
  1363. /*---------------------------------------------------------------.
  1364. | yyerrpop -- pop the current state because it cannot handle the |
  1365. | error token |
  1366. `---------------------------------------------------------------*/
  1367. yyerrpop:
  1368. if (yyssp == yyss)
  1369. YYABORT;
  1370. yyvsp--;
  1371. yystate = *--yyssp;
  1372. #if YYLSP_NEEDED
  1373. yylsp--;
  1374. #endif
  1375. #if YYDEBUG
  1376. if (yydebug)
  1377. {
  1378. short *yyssp1 = yyss - 1;
  1379. YYFPRINTF (stderr, "Error: state stack now");
  1380. while (yyssp1 != yyssp)
  1381. YYFPRINTF (stderr, " %d", *++yyssp1);
  1382. YYFPRINTF (stderr, "\n");
  1383. }
  1384. #endif
  1385. /*--------------.
  1386. | yyerrhandle. |
  1387. `--------------*/
  1388. yyerrhandle:
  1389. yyn = yypact[yystate];
  1390. if (yyn == YYFLAG)
  1391. goto yyerrdefault;
  1392. yyn += YYTERROR;
  1393. if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
  1394. goto yyerrdefault;
  1395. yyn = yytable[yyn];
  1396. if (yyn < 0)
  1397. {
  1398. if (yyn == YYFLAG)
  1399. goto yyerrpop;
  1400. yyn = -yyn;
  1401. goto yyreduce;
  1402. }
  1403. else if (yyn == 0)
  1404. goto yyerrpop;
  1405. if (yyn == YYFINAL)
  1406. YYACCEPT;
  1407. YYDPRINTF ((stderr, "Shifting error token, "));
  1408. *++yyvsp = yylval;
  1409. #if YYLSP_NEEDED
  1410. *++yylsp = yylloc;
  1411. #endif
  1412. yystate = yyn;
  1413. goto yynewstate;
  1414. /*-------------------------------------.
  1415. | yyacceptlab -- YYACCEPT comes here. |
  1416. `-------------------------------------*/
  1417. yyacceptlab:
  1418. yyresult = 0;
  1419. goto yyreturn;
  1420. /*-----------------------------------.
  1421. | yyabortlab -- YYABORT comes here. |
  1422. `-----------------------------------*/
  1423. yyabortlab:
  1424. yyresult = 1;
  1425. goto yyreturn;
  1426. /*---------------------------------------------.
  1427. | yyoverflowab -- parser overflow comes here. |
  1428. `---------------------------------------------*/
  1429. yyoverflowlab:
  1430. yyerror ("parser stack overflow");
  1431. yyresult = 2;
  1432. /* Fall through. */
  1433. yyreturn:
  1434. #ifndef yyoverflow
  1435. if (yyss != yyssa)
  1436. YYSTACK_FREE (yyss);
  1437. #endif
  1438. return yyresult;
  1439. }
  1440. #line 419 "zconf.y"
  1441. void conf_parse(const char *name)
  1442. {
  1443. zconf_initscan(name);
  1444. sym_init();
  1445. menu_init();
  1446. rootmenu.prompt = menu_add_prop(P_MENU, "uClibc Configuration", NULL, NULL);
  1447. //zconfdebug = 1;
  1448. zconfparse();
  1449. if (zconfnerrs)
  1450. exit(1);
  1451. menu_finalize(&rootmenu);
  1452. modules_sym = sym_lookup("MODULES", 0);
  1453. sym_change_count = 1;
  1454. }
  1455. const char *zconf_tokenname(int token)
  1456. {
  1457. switch (token) {
  1458. case T_MENU: return "menu";
  1459. case T_ENDMENU: return "endmenu";
  1460. case T_CHOICE: return "choice";
  1461. case T_ENDCHOICE: return "endchoice";
  1462. case T_IF: return "if";
  1463. case T_ENDIF: return "endif";
  1464. }
  1465. return "<token>";
  1466. }
  1467. static bool zconf_endtoken(int token, int starttoken, int endtoken)
  1468. {
  1469. if (token != endtoken) {
  1470. zconfprint("unexpected '%s' within %s block", zconf_tokenname(token), zconf_tokenname(starttoken));
  1471. zconfnerrs++;
  1472. return false;
  1473. }
  1474. if (current_menu->file != current_file) {
  1475. zconfprint("'%s' in different file than '%s'", zconf_tokenname(token), zconf_tokenname(starttoken));
  1476. zconfprint("location of the '%s'", zconf_tokenname(starttoken));
  1477. zconfnerrs++;
  1478. return false;
  1479. }
  1480. return true;
  1481. }
  1482. static void zconfprint(const char *err, ...)
  1483. {
  1484. va_list ap;
  1485. fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno());
  1486. va_start(ap, err);
  1487. vfprintf(stderr, err, ap);
  1488. va_end(ap);
  1489. fprintf(stderr, "\n");
  1490. }
  1491. static void zconferror(const char *err)
  1492. {
  1493. fprintf(stderr, "%s:%d: %s\n", zconf_curname(), zconf_lineno(), err);
  1494. }
  1495. void print_quoted_string(FILE *out, const char *str)
  1496. {
  1497. const char *p;
  1498. int len;
  1499. putc('"', out);
  1500. while ((p = strchr(str, '"'))) {
  1501. len = p - str;
  1502. if (len)
  1503. fprintf(out, "%.*s", len, str);
  1504. fputs("\\\"", out);
  1505. str = p + 1;
  1506. }
  1507. fputs(str, out);
  1508. putc('"', out);
  1509. }
  1510. void print_symbol(FILE *out, struct menu *menu)
  1511. {
  1512. struct symbol *sym = menu->sym;
  1513. struct property *prop;
  1514. //sym->flags |= SYMBOL_PRINTED;
  1515. if (sym_is_choice(sym))
  1516. fprintf(out, "choice\n");
  1517. else
  1518. fprintf(out, "config %s\n", sym->name);
  1519. switch (sym->type) {
  1520. case S_BOOLEAN:
  1521. fputs(" boolean\n", out);
  1522. break;
  1523. case S_TRISTATE:
  1524. fputs(" tristate\n", out);
  1525. break;
  1526. case S_STRING:
  1527. fputs(" string\n", out);
  1528. break;
  1529. case S_INT:
  1530. fputs(" integer\n", out);
  1531. break;
  1532. case S_HEX:
  1533. fputs(" hex\n", out);
  1534. break;
  1535. default:
  1536. fputs(" ???\n", out);
  1537. break;
  1538. }
  1539. #if 0
  1540. if (!expr_is_yes(sym->dep)) {
  1541. fputs(" depends ", out);
  1542. expr_fprint(sym->dep, out);
  1543. fputc('\n', out);
  1544. }
  1545. #endif
  1546. for (prop = sym->prop; prop; prop = prop->next) {
  1547. if (prop->menu != menu)
  1548. continue;
  1549. switch (prop->type) {
  1550. case P_PROMPT:
  1551. fputs(" prompt ", out);
  1552. print_quoted_string(out, prop->text);
  1553. if (prop->def) {
  1554. fputc(' ', out);
  1555. if (prop->def->flags & SYMBOL_CONST)
  1556. print_quoted_string(out, prop->def->name);
  1557. else
  1558. fputs(prop->def->name, out);
  1559. }
  1560. if (!expr_is_yes(E_EXPR(prop->visible))) {
  1561. fputs(" if ", out);
  1562. expr_fprint(E_EXPR(prop->visible), out);
  1563. }
  1564. fputc('\n', out);
  1565. break;
  1566. case P_DEFAULT:
  1567. fputs( " default ", out);
  1568. print_quoted_string(out, prop->def->name);
  1569. if (!expr_is_yes(E_EXPR(prop->visible))) {
  1570. fputs(" if ", out);
  1571. expr_fprint(E_EXPR(prop->visible), out);
  1572. }
  1573. fputc('\n', out);
  1574. break;
  1575. case P_CHOICE:
  1576. fputs(" #choice value\n", out);
  1577. break;
  1578. default:
  1579. fprintf(out, " unknown prop %d!\n", prop->type);
  1580. break;
  1581. }
  1582. }
  1583. if (sym->help) {
  1584. int len = strlen(sym->help);
  1585. while (sym->help[--len] == '\n')
  1586. sym->help[len] = 0;
  1587. fprintf(out, " help\n%s\n", sym->help);
  1588. }
  1589. fputc('\n', out);
  1590. }
  1591. void zconfdump(FILE *out)
  1592. {
  1593. //struct file *file;
  1594. struct property *prop;
  1595. struct symbol *sym;
  1596. struct menu *menu;
  1597. menu = rootmenu.list;
  1598. while (menu) {
  1599. if ((sym = menu->sym))
  1600. print_symbol(out, menu);
  1601. else if ((prop = menu->prompt)) {
  1602. switch (prop->type) {
  1603. //case T_MAINMENU:
  1604. // fputs("\nmainmenu ", out);
  1605. // print_quoted_string(out, prop->text);
  1606. // fputs("\n", out);
  1607. // break;
  1608. case P_COMMENT:
  1609. fputs("\ncomment ", out);
  1610. print_quoted_string(out, prop->text);
  1611. fputs("\n", out);
  1612. break;
  1613. case P_MENU:
  1614. fputs("\nmenu ", out);
  1615. print_quoted_string(out, prop->text);
  1616. fputs("\n", out);
  1617. break;
  1618. //case T_SOURCE:
  1619. // fputs("\nsource ", out);
  1620. // print_quoted_string(out, prop->text);
  1621. // fputs("\n", out);
  1622. // break;
  1623. //case T_IF:
  1624. // fputs("\nif\n", out);
  1625. default:
  1626. ;
  1627. }
  1628. if (!expr_is_yes(E_EXPR(prop->visible))) {
  1629. fputs(" depends ", out);
  1630. expr_fprint(E_EXPR(prop->visible), out);
  1631. fputc('\n', out);
  1632. }
  1633. fputs("\n", out);
  1634. }
  1635. if (menu->list)
  1636. menu = menu->list;
  1637. else if (menu->next)
  1638. menu = menu->next;
  1639. else while ((menu = menu->parent)) {
  1640. if (menu->prompt && menu->prompt->type == P_MENU)
  1641. fputs("\nendmenu\n", out);
  1642. if (menu->next) {
  1643. menu = menu->next;
  1644. break;
  1645. }
  1646. }
  1647. }
  1648. }
  1649. #include "lex.zconf.c"
  1650. #include "confdata.c"
  1651. #include "expr.c"
  1652. #include "symbol.c"
  1653. #include "menu.c"