86 |
} |
} |
87 |
|
|
88 |
|
|
89 |
/*---------------------------------------------------------------. |
/*-----------------------------------------------------------------. |
90 |
| Computes the macro name used to avoid double inclusion in the | |
| Computes the macro name used to avoid double inclusion in the | |
91 |
| header of the parser and store it in header_macro_name. | |
| header of the parser and store it in header_macro_name. Be sure | |
92 |
`---------------------------------------------------------------*/ |
| to produce valid CPP names (don't start with digit, remain | |
93 |
|
| alphanumerical + underscore). | |
94 |
|
`-----------------------------------------------------------------*/ |
95 |
|
|
96 |
static char * |
static char * |
97 |
compute_header_macro (void) |
compute_header_macro (void) |
98 |
{ |
{ |
99 |
|
const char *prefix = "BISON_"; |
100 |
char *macro_name, *cp; |
char *macro_name, *cp; |
101 |
|
|
102 |
if (spec_defines_file) |
if (spec_defines_file) |
103 |
macro_name = xstrdup (spec_defines_file); |
{ |
104 |
|
macro_name = XMALLOC (char, |
105 |
|
strlen (prefix) + |
106 |
|
strlen (spec_defines_file) + 1); |
107 |
|
cp = stpcpy (macro_name, prefix); |
108 |
|
cp = stpcpy (cp, spec_defines_file); |
109 |
|
} |
110 |
else |
else |
111 |
{ |
{ |
112 |
macro_name = XMALLOC (char, |
macro_name = XMALLOC (char, |
113 |
|
strlen (prefix) + |
114 |
strlen (base_name) + |
strlen (base_name) + |
115 |
strlen (header_extension) + 1); |
strlen (header_extension) + 1); |
116 |
|
cp = stpcpy (macro_name, prefix); |
117 |
stpcpy (macro_name, base_name); |
cp = stpcpy (cp, base_name); |
118 |
strcat (macro_name, header_extension); |
cp = stpcpy (cp, header_extension); |
119 |
} |
} |
120 |
|
|
121 |
for (cp = macro_name; *cp; ++cp) |
for (cp = macro_name; *cp; ++cp) |