3 * Copyright (c) 2000, Red Hat, Inc.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * A copy of the GNU General Public License can be found at
13 * Written by DJ Delorie <dj@cygnus.com>
17 /* Parse the setup.ini files. inilex.l provides the tokens for this. */
29 #define YYERROR_VERBOSE 1
34 extern unsigned int setup_timestamp;
35 extern char *setup_version;
37 extern int CDECL yyerror (char *s, ...);
39 #define cpt (cp->info+trust)
44 %token SETUP_TIMESTAMP SETUP_VERSION VERSION INSTALL SOURCE SDESC LDESC TYPE
45 %token T_PREV T_CURR T_TEST T_UNKNOWN
50 : setup_headers packages
54 : setup_header setup_headers
59 : SETUP_TIMESTAMP STRING '\n' { setup_timestamp = strtoul ($2, 0, 0); }
60 | SETUP_VERSION STRING '\n' { setup_version = strdup ($2); }
62 | error { yyerror ("unrecognized line in setup.ini headers (do you have the latest setup?)"); } '\n'
71 : '@' STRING '\n' { new_package($2); }
76 : simple_line '\n' lines
81 : VERSION STRING { cpt->version = $2; }
82 | SDESC STRING { cp->sdesc = $2; }
83 | LDESC STRING { cp->ldesc = $2; }
84 | INSTALL STRING STRING { cpt->install = $2;
85 cpt->install_size = atoi($3); }
86 | SOURCE STRING STRING { cpt->source = $2;
87 cpt->source_size = atoi($3); }
88 | TYPE STRING { if (!strcmp ($2, "cygwin"))
90 else if (!strcmp ($2, "native"))
93 cp->type = TY_GENERIC; }
94 | T_PREV { trust = TRUST_PREV; }
95 | T_CURR { trust = TRUST_CURR; }
96 | T_TEST { trust = TRUST_TEST; }
97 | T_UNKNOWN { trust = TRUST_UNKNOWN; }
99 | error '\n' { yylineno --;
100 yyerror ("unrecognized line in package %s (do you have the latest setup?)", cp->name);
107 Package *package = 0;
108 Package *xemacs_package = 0;
110 static int maxpackages = 0;
113 new_package (char *name)
116 maxpackages = npackages = 0;
117 if (npackages >= maxpackages)
121 package = (Package *) realloc (package, maxpackages * sizeof (Package));
123 package = (Package *) malloc (maxpackages * sizeof (Package));
125 cp = package + npackages;
128 memset (cp, 0, sizeof (Package));