3 # Common code for C-like languages (C, C++, Java, etc.)
5 # Copyright (C) 2012 Free Software Foundation, Inc.
7 # This program is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation, either version 3 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
20 # b4_dollar_dollar_(VALUE, FIELD, DEFAULT-FIELD)
21 # ----------------------------------------------
22 # If FIELD (or DEFAULT-FIELD) is non-null, return "VALUE.FIELD",
23 # otherwise just VALUE. Be sure to pass "(VALUE)" is VALUE is a
25 m4_define([b4_dollar_dollar_],
27 [m4_ifval([$3], [($1.$3)],
31 # b4_dollar_pushdef(VALUE-POINTER, DEFAULT-FIELD, LOCATION)
33 # ---------------------------------------------------------
34 # Define b4_dollar_dollar for VALUE and DEFAULT-FIELD,
35 # and b4_at_dollar for LOCATION.
36 m4_define([b4_dollar_pushdef],
37 [m4_pushdef([b4_dollar_dollar],
38 [b4_dollar_dollar_([$1], m4_dquote($][1), [$2])])dnl
39 m4_pushdef([b4_at_dollar], [$3])dnl
41 m4_define([b4_dollar_popdef],
42 [m4_popdef([b4_at_dollar])dnl
43 m4_popdef([b4_dollar_dollar])dnl