51 |
char *attrsfile = NULL; |
char *attrsfile = NULL; |
52 |
|
|
53 |
static char *base_name = NULL; |
static char *base_name = NULL; |
54 |
static char *short_base_name = NULL; |
char *short_base_name = NULL; |
55 |
|
|
56 |
/* C source file extension (the parser source). */ |
/* C source file extension (the parser source). */ |
57 |
const char *src_extension = NULL; |
const char *src_extension = NULL; |
58 |
/* Header file extension (if option ``-d'' is specified). */ |
/* Header file extension (if option ``-d'' is specified). */ |
59 |
const char *header_extension = NULL; |
const char *header_extension = NULL; |
60 |
|
|
61 |
|
/* Should we insert '.tab' in yacc-compatible parsers? */ |
62 |
|
int tab_extension = 0; |
63 |
|
|
64 |
|
|
65 |
/*--------------------------. |
/*--------------------------. |
66 |
| Is SUFFIX ending STRING? | |
| Is SUFFIX ending STRING? | |
67 |
`--------------------------*/ |
`--------------------------*/ |
68 |
|
|
69 |
static int |
int |
70 |
strsuffix (const char *string, const char *suffix) |
strsuffix (const char *string, const char *suffix) |
71 |
{ |
{ |
72 |
size_t string_len = strlen (string); |
size_t string_len = strlen (string); |
83 |
| STRING1, and STRING2. | |
| STRING1, and STRING2. | |
84 |
`-----------------------------------------------------------------*/ |
`-----------------------------------------------------------------*/ |
85 |
|
|
86 |
static char * |
char* |
87 |
stringappend (const char *string1, const char *string2) |
stringappend (const char *string1, const char *string2) |
88 |
{ |
{ |
89 |
size_t len = strlen (string1) + strlen (string2); |
size_t len = strlen (string1) + strlen (string2); |
337 |
short_base_length -= 4; |
short_base_length -= 4; |
338 |
short_base_name = strndup (spec_outfile, short_base_length); |
short_base_name = strndup (spec_outfile, short_base_length); |
339 |
|
|
340 |
|
/* FIXME: This is a quick and dirty way for me to find out if we |
341 |
|
should .tab or not, using the computations above. */ |
342 |
|
if (strcmp (base_name, short_base_name)) |
343 |
|
tab_extension = 1; |
344 |
|
|
345 |
return; |
return; |
346 |
} |
} |
347 |
|
|
368 |
if (ext_index) |
if (ext_index) |
369 |
compute_exts_from_gf (infile + ext_index); |
compute_exts_from_gf (infile + ext_index); |
370 |
|
|
371 |
|
/* It seems that when only a prefix is given, '.tab' should always be |
372 |
|
used. */ |
373 |
|
tab_extension = 1; |
374 |
|
|
375 |
return; |
return; |
376 |
} |
} |
377 |
|
|
405 |
strlen (short_base_name) + strlen (EXT_TAB) + 1); |
strlen (short_base_name) + strlen (EXT_TAB) + 1); |
406 |
stpcpy (stpcpy (base_name, short_base_name), EXT_TAB); |
stpcpy (stpcpy (base_name, short_base_name), EXT_TAB); |
407 |
|
|
408 |
|
/* By default, Bison should insert '.tab' were needed. */ |
409 |
|
tab_extension = 1; |
410 |
|
|
411 |
return; |
return; |
412 |
} |
} |
413 |
} |
} |