summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
29e8831)
as...
(long_option_table_new): this, with a clearer prototype.
(percent_table): Remove, unused,
* src/getargs.c (getargs): Adjust.
+2001-12-29 Akim Demaille <akim@epita.fr>
+
+ * src/options.h, src/options.c (create_long_option_table): Rename
+ as...
+ (long_option_table_new): this, with a clearer prototype.
+ (percent_table): Remove, unused,
+ * src/getargs.c (getargs): Adjust.
+
+
2001-12-29 Akim Demaille <akim@epita.fr>
* src/LR0.c, src/conflicts.c, src/lalr.c, src/lalr.h, src/output.c
2001-12-29 Akim Demaille <akim@epita.fr>
* src/LR0.c, src/conflicts.c, src/lalr.c, src/lalr.h, src/output.c
- create_long_option_table ();
+ struct option *longopts = long_option_table_new ();
while ((c = getopt_long (argc, argv, shortopts, longopts, NULL)) != EOF)
switch (c)
{
while ((c = getopt_long (argc, argv, shortopts, longopts, NULL)) != EOF)
switch (c)
{
if (optind == argc)
{
fprintf (stderr, _("%s: no grammar file given\n"), program_name);
if (optind == argc)
{
fprintf (stderr, _("%s: no grammar file given\n"), program_name);
/* Shorts options. */
const char *shortopts = "yvegdhrltknVo:b:p:S:";
/* Shorts options. */
const char *shortopts = "yvegdhrltknVo:b:p:S:";
-/* Long options. */
-struct option *longopts = NULL;
-
-struct percent_table_struct *percent_table = NULL;
-
/* A CLI option only.
Arguments is the policy: `no', `optional', `required'.
OptionChar is the value given to the Var if the latter is specified. */
/* A CLI option only.
Arguments is the policy: `no', `optional', `required'.
OptionChar is the value given to the Var if the latter is specified. */
/*--------------------------------------------------------.
| Create the longoptions structure from the option_table, |
| for the getopt file. |
`--------------------------------------------------------*/
/*--------------------------------------------------------.
| Create the longoptions structure from the option_table, |
| for the getopt file. |
`--------------------------------------------------------*/
-void
-create_long_option_table ()
+
+struct option *
+long_option_table_new ()
+ struct option *res = NULL;
int i = 0;
int j = 0;
int number_options;
int i = 0;
int j = 0;
int number_options;
|| option_table[i].access == opt_both)
++number_options;
|| option_table[i].access == opt_both)
++number_options;
- longopts = XMALLOC (struct option, number_options + 1);
+ res = XMALLOC (struct option, number_options + 1);
for (i = 0; option_table[i].name; i++)
if (option_table[i].access == opt_cmd_line
|| option_table[i].access == opt_both)
{
/* Copy the struct information in the longoptions. */
for (i = 0; option_table[i].name; i++)
if (option_table[i].access == opt_cmd_line
|| option_table[i].access == opt_both)
{
/* Copy the struct information in the longoptions. */
- longopts[j].name = option_table[i].name;
- longopts[j].has_arg = option_table[i].has_arg;
+ res[j].name = option_table[i].name;
+ res[j].has_arg = option_table[i].has_arg;
/* When an options is declared having 'optional_argument' and
a flag is specified to be set, the option is skipped on
command line. So we never use a flag when a command line
option is declared 'optional_argument. */
/* When an options is declared having 'optional_argument' and
a flag is specified to be set, the option is skipped on
command line. So we never use a flag when a command line
option is declared 'optional_argument. */
- if (longopts[j].has_arg == optional_argument)
- longopts[j].flag = NULL;
+ if (res[j].has_arg == optional_argument)
+ res[j].flag = NULL;
- longopts[j].flag = option_table[i].set_flag;
- longopts[j++].val = option_table[i].val;
+ res[j].flag = option_table[i].set_flag;
+ res[j++].val = option_table[i].val;
- longopts[number_options].name = NULL;
- longopts[number_options].has_arg = 0;
- longopts[number_options].flag = NULL;
- longopts[number_options].val = 0;
+ res[number_options].name = NULL;
+ res[number_options].has_arg = 0;
+ res[number_options].flag = NULL;
+ res[number_options].val = 0;
+
+ return res;
};
extern const char *shortopts;
};
extern const char *shortopts;
-extern struct option *longopts;
/* Table which contain all options. */
extern const struct option_table_struct option_table[];
/* Set the longopts variable from option_table. */
/* Table which contain all options. */
extern const struct option_table_struct option_table[];
/* Set the longopts variable from option_table. */
-void create_long_option_table PARAMS ((void));
+struct option *long_option_table_new PARAMS ((void));
nonterminals_reduce (void)
{
int i, n;
nonterminals_reduce (void)
{
int i, n;
/* Map the nonterminals to their new index: useful first, useless
afterwards. Kept for later report. */
/* Map the nonterminals to their new index: useful first, useless
afterwards. Kept for later report. */