Extend the front-end API for %define variables to more completely

mirror the back-end.  This will be useful in the future.
* data/bison.m4 (b4_percent_define_get, b4_percent_define_ifdef):
Update comments to mention the new front-end counterparts of these
macros.
* src/muscle_tab.c (MUSCLE_COMMON_DECODE): New macro with common code
for muscle_string_decode and muscle_location_decode.
(muscle_string_decode): New static function.
(muscle_location_decode): Use MUSCLE_COMMON_DECODE.
(muscle_percent_define_get, muscle_percent_define_ifdef): New
functions.
(muscle_percent_define_flag_if): Use muscle_percent_define_ifdef and
muscle_percent_define_get to mimic the b4_percent_define_flag_if
implementation more closely.
(muscle_percent_define_invalid_value): New function.
* src/muscle_tab.h (muscle_percent_define_get,
muscle_percent_define_ifdef, muscle_percent_define_invalid_value):
Prototype.
This commit is contained in:
Joel E. Denny
2007-05-20 05:01:53 +00:00
parent 75ad86eebd
commit f124d4233f
4 changed files with 141 additions and 24 deletions

View File

@@ -338,7 +338,8 @@ m4_popdef([b4_end])dnl
# b4_percent_define_get(VARIABLE)
# -------------------------------
# If the %define variable VARIABLE is defined, emit its value. Also, record
# Mimic muscle_percent_define_get in ../src/muscle_tab.h exactly. That is, if
# the %define variable VARIABLE is defined, emit its value. Also, record
# Bison's usage of VARIABLE by defining
# b4_percent_define_bison_variables(VARIABLE).
#
@@ -351,7 +352,8 @@ m4_ifdef([b4_percent_define(]$1[)], [m4_indir([b4_percent_define(]$1[)])])])
# b4_percent_define_ifdef(VARIABLE, IF-TRUE, [IF-FALSE])
# ------------------------------------------------------
# If the %define variable VARIABLE is defined, expand IF-TRUE, else expand
# Mimic muscle_percent_define_ifdef in ../src/muscle_tab.h exactly. That is,
# if the %define variable VARIABLE is defined, expand IF-TRUE, else expand
# IF-FALSE. Also, record Bison's usage of VARIABLE by defining
# b4_percent_define_bison_variables(VARIABLE).
#