bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 06/11] skeletons: renamings after knr removal


From: Akim Demaille
Subject: [PATCH 06/11] skeletons: renamings after knr removal
Date: Fri, 3 Aug 2012 10:39:56 +0200

* data/c.m4 (b4_c_comment_, b4_c_args, b4_c_function_def)
(b4_c_function_decl, b4_c_formals, b4_c_call, b4_c_arg): Rename as...
(b4_comment, b4_args, b4_function_define, b4_function_declare,
b4_formals, b4_function_call, b4_arg): these.
* data/glr.c, data/glr.cc, data/lalr1.cc, data/yacc.c: Adjust.
---
 data/c.m4     | 66 +++++++++++++++++++++++++++--------------------------------
 data/glr.c    | 18 ++++++++--------
 data/glr.cc   |  6 +++---
 data/lalr1.cc |  6 +++---
 data/yacc.c   | 46 ++++++++++++++++++++---------------------
 5 files changed, 68 insertions(+), 74 deletions(-)

diff --git a/data/c.m4 b/data/c.m4
index 906f12a..745260d 100644
--- a/data/c.m4
+++ b/data/c.m4
@@ -50,7 +50,7 @@ m4_define([b4_cpp_guard_close],
 ## ---------------- ##
 
 # b4_comment_(TEXT, OPEN, CONTINUE, END)
-# -------------------------------------
+# --------------------------------------
 # Put TEXT in comment.  Avoid trailing spaces: don't indent empty lines.
 # Avoid adding indentation to the first line, as the indentation comes
 # from OPEN.  That's why we don't patsubst([$1], [^\(.\)], [   \1]).
@@ -61,23 +61,17 @@ m4_define([b4_comment_], [$2[]m4_bpatsubst([$1], [
 $3\1])$4])
 
 
-# b4_c_comment(TEXT, [PREFIX])
-# ----------------------------
+# b4_comment(TEXT, [PREFIX])
+# --------------------------
 # Put TEXT in comment.  Avoid trailing spaces: don't indent empty lines.
 # Avoid adding indentation to the first line, as the indentation comes
 # from "/*".  That's why we don't patsubst([$1], [^\(.\)], [   \1]).
 #
 # Prefix all the output lines with PREFIX.
-m4_define([b4_c_comment],
+m4_define([b4_comment],
 [b4_comment_([$1], [$2/* ], [$2   ], [$2  */])])
 
 
-# b4_comment(TEXT, [PREFIX])
-# --------------------------
-# By default, C comments.
-m4_define([b4_comment], [b4_c_comment($@)])
-
-
 # b4_identification
 # -----------------
 # Depends on individual skeletons to define b4_pure_flag, b4_push_flag, or
@@ -134,7 +128,7 @@ m4_define_default([b4_union_name], [b4_api_PREFIX[]STYPE])
 # b4_user_args
 # ------------
 m4_define([b4_user_args],
-[m4_ifset([b4_parse_param], [, b4_c_args(b4_parse_param)])])
+[m4_ifset([b4_parse_param], [, b4_args(b4_parse_param)])])
 
 
 # b4_parse_param
@@ -239,7 +233,7 @@ m4_define([b4_null], [YY_NULL])
 # -------------------------------------------------------------
 # Define "yy<TABLE-NAME>" which contents is CONTENT.
 m4_define([b4_integral_parser_table_define],
-[m4_ifvaln([$3], [b4_c_comment([$3], [  ])])dnl
+[m4_ifvaln([$3], [b4_comment([$3], [  ])])dnl
 static const b4_int_type_for([$2]) yy$1[[]] =
 {
   $2
@@ -322,24 +316,24 @@ m4_define([b4_symbol_value],
 ## ---------------------- ##
 
 
-# b4_c_function_def(NAME, RETURN-VALUE, [DECL1, NAME1], ...)
-# ----------------------------------------------------------
+# b4_function_define(NAME, RETURN-VALUE, [DECL1, NAME1], ...)
+# -----------------------------------------------------------
 # Declare the function NAME in C.
-m4_define([b4_c_function_def],
+m4_define([b4_function_define],
 [$2
-$1 (b4_c_formals(m4_shift2($@)))[]dnl
+$1 (b4_formals(m4_shift2($@)))[]dnl
 ])
 
 
-# b4_c_formals([DECL1, NAME1], ...)
-# ---------------------------------
+# b4_formals([DECL1, NAME1], ...)
+# -------------------------------
 # The formal arguments of a C function definition.
-m4_define([b4_c_formals],
+m4_define([b4_formals],
 [m4_if([$#], [0], [void],
        [$#$1], [1], [void],
-               [m4_map_sep([b4_c_formal], [, ], address@hidden)])])
+               [m4_map_sep([b4_formal], [, ], address@hidden)])])
 
-m4_define([b4_c_formal],
+m4_define([b4_formal],
 [$1])
 
 
@@ -349,11 +343,11 @@ m4_define([b4_c_formal],
 ## ----------------------- ##
 
 
-# b4_c_function_decl(NAME, RETURN-VALUE, [DECL1, NAME1], ...)
-# -----------------------------------------------------------
+# b4_function_declare(NAME, RETURN-VALUE, [DECL1, NAME1], ...)
+# ------------------------------------------------------------
 # Declare the function NAME.
-m4_define([b4_c_function_decl],
-[$2 $1 (b4_c_formals(m4_shift2($@)));[]dnl
+m4_define([b4_function_declare],
+[$2 $1 (b4_formals(m4_shift2($@)));[]dnl
 ])
 
 
@@ -364,21 +358,21 @@ m4_define([b4_c_function_decl],
 ## --------------------- ##
 
 
-# b4_c_function_call(NAME, RETURN-VALUE, [DECL1, NAME1], ...)
+# b4_function_call(NAME, RETURN-VALUE, [DECL1, NAME1], ...)
 # -----------------------------------------------------------
 # Call the function NAME with arguments NAME1, NAME2 etc.
-m4_define([b4_c_function_call],
-[$1 (b4_c_args(m4_shift2($@)))[]dnl
+m4_define([b4_function_call],
+[$1 (b4_args(m4_shift2($@)))[]dnl
 ])
 
 
-# b4_c_args([DECL1, NAME1], ...)
-# ------------------------------
+# b4_args([DECL1, NAME1], ...)
+# ----------------------------
 # Output the arguments NAME1, NAME2...
-m4_define([b4_c_args],
-[m4_map_sep([b4_c_arg], [, ], address@hidden)])
+m4_define([b4_args],
+[m4_map_sep([b4_arg], [, ], address@hidden)])
 
-m4_define([b4_c_arg],
+m4_define([b4_arg],
 [$2])
 
 
@@ -387,7 +381,7 @@ m4_define([b4_c_arg],
 ## ----------- ##
 
 # b4_sync_start(LINE, FILE)
-# -----------------------
+# -------------------------
 m4_define([b4_sync_start], [[#]line $1 $2])
 
 
@@ -416,7 +410,7 @@ b4_syncline(address@hidden@], address@hidden@])
 # b4_yydestruct_generate(FUNCTION-DECLARATOR)
 # -------------------------------------------
 # Generate the "yydestruct" function, which declaration is issued using
-# FUNCTION-DECLARATOR, which may be "b4_c_function_def".
+# FUNCTION-DECLARATOR, which may be "b4_function_define".
 m4_define_default([b4_yydestruct_generate],
 [[/*-----------------------------------------------.
 | Release the memory associated to this symbol.  |
@@ -449,7 +443,7 @@ m4_ifset([b4_parse_param], [, b4_parse_param]))[
 # b4_yy_symbol_print_generate(FUNCTION-DECLARATOR)
 # ------------------------------------------------
 # Generate the "yy_symbol_print" function, which declaration is issued using
-# FUNCTION-DECLARATOR, which may be "b4_c_function_def".
+# FUNCTION-DECLARATOR, which may be "b4_function_define".
 m4_define_default([b4_yy_symbol_print_generate],
 [[
 /*--------------------------------.
diff --git a/data/glr.c b/data/glr.c
index 94127d9..4ceb2bc 100644
--- a/data/glr.c
+++ b/data/glr.c
@@ -52,7 +52,7 @@ m4_ifndef([b4_pure_flag],
 # This is not shared with yacc.c in c.m4 because  GLR relies on ISO C
 # formal argument declarations.
 m4_define([b4_user_formals],
-[m4_ifset([b4_parse_param], [, b4_c_formals(b4_parse_param)])])
+[m4_ifset([b4_parse_param], [, b4_formals(b4_parse_param)])])
 
 
 # b4_lex_param
@@ -71,7 +71,7 @@ m4_ifdef([b4_lex_param], [, ]b4_lex_param)))
 # a trailing comma.
 m4_define([b4_yyerror_args],
 [b4_pure_if([b4_locations_if([yylocp, ])])dnl
-m4_ifset([b4_parse_param], [b4_c_args(b4_parse_param), ])])
+m4_ifset([b4_parse_param], [b4_args(b4_parse_param), ])])
 
 
 # b4_lyyerror_args
@@ -79,7 +79,7 @@ m4_ifset([b4_parse_param], [b4_c_args(b4_parse_param), ])])
 # Same as above, but on the lookahead, hence &yylloc instead of yylocp.
 m4_define([b4_lyyerror_args],
 [b4_pure_if([b4_locations_if([&yylloc, ])])dnl
-m4_ifset([b4_parse_param], [b4_c_args(b4_parse_param), ])])
+m4_ifset([b4_parse_param], [b4_args(b4_parse_param), ])])
 
 
 # b4_pure_args
@@ -178,7 +178,7 @@ m4_define([b4_shared_declarations],
 ]b4_percent_code_get([[requires]])[
 ]b4_token_enums[
 ]b4_declare_yylstype[
-]b4_c_function_decl(b4_prefix[parse], [int], b4_parse_param)[
+]b4_function_declare(b4_prefix[parse], [int], b4_parse_param)[
 ]b4_percent_code_get([[provides]])[]dnl
 ])
 
@@ -268,7 +268,7 @@ b4_percent_code_get[]dnl
 #ifndef lint
 # define YYID(n) (n)
 #else
-]b4_c_function_def([YYID], [static int], [[int i], [i]])[
+]b4_function_define([YYID], [static int], [[int i], [i]])[
 {
   return i;
 }
@@ -444,7 +444,7 @@ dnl We probably ought to introduce a type for confl.
 #endif
 
 /* YYLEX -- calling `yylex' with the right arguments.  */
-#define YYLEX ]b4_c_function_call([yylex], [int], b4_lex_param)[
+#define YYLEX ]b4_function_call([yylex], [int], b4_lex_param)[
 
 ]b4_pure_if(
 [
@@ -491,7 +491,7 @@ typedef enum { yyok, yyaccept, yyabort, yyerr } YYRESULTTAG;
       YYFPRINTF Args;                           \
   } while (YYID (0))
 
-]b4_yy_symbol_print_generate([b4_c_function_def])[
+]b4_yy_symbol_print_generate([b4_function_define])[
 
 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)                  \
   do {                                                                  \
@@ -872,7 +872,7 @@ yyuserMerge (int yyn, YYSTYPE* yy0, YYSTYPE* yy1)
 
                               /* Bison grammar-table manipulation.  */
 
-]b4_yydestruct_generate([b4_c_function_def])[
+]b4_yydestruct_generate([b4_function_define])[
 
 /** Number of symbols composing the right hand side of rule #RULE.  */
 static inline int
@@ -2276,7 +2276,7 @@ yyrecoverSyntaxError (yyGLRStack* 
yystackp]b4_user_formals[)
 | yyparse.  |
 `----------*/
 
-]b4_c_function_def([yyparse], [int], b4_parse_param)[
+]b4_function_define([yyparse], [int], b4_parse_param)[
 {
   int yyresult;
   yyGLRStack yystack;
diff --git a/data/glr.cc b/data/glr.cc
index 917b6d5..8da5a99 100644
--- a/data/glr.cc
+++ b/data/glr.cc
@@ -71,7 +71,7 @@ m4_define([b4_yy_symbol_print_generate],
 | Print this symbol.  |
 `--------------------*/
 
-]b4_c_function_def([yy_symbol_print],
+]b4_function_define([yy_symbol_print],
     [static void],
     [[FILE *],      []],
     [[int yytype],  [yytype]],
@@ -94,7 +94,7 @@ m4_append([b4_post_prologue],
 [b4_syncline(address@hidden@], address@hidden@])[
 ]b4_yylloc_default_define[
 #define YYRHSLOC(Rhs, K) ((Rhs)[K].yystate.yyloc)
-]b4_c_function_decl([yyerror],
+]b4_function_declare([yyerror],
     [static void],b4_locations_if([
     [[const ]b4_namespace_ref::b4_parser_class_name[::location_type 
*yylocationp],
                         [yylocationp]],])
@@ -110,7 +110,7 @@ m4_append([b4_epilogue],
 | Report an error.  |
 `------------------*/
 
-]b4_c_function_def([yyerror],
+]b4_function_define([yyerror],
     [static void],b4_locations_if([
     [[const ]b4_namespace_ref::b4_parser_class_name[::location_type 
*yylocationp],
                         [yylocationp]],])
diff --git a/data/lalr1.cc b/data/lalr1.cc
index b3e46e9..d6ea50b 100644
--- a/data/lalr1.cc
+++ b/data/lalr1.cc
@@ -22,7 +22,7 @@ m4_include(b4_pkgdatadir/[c++.m4])
 # --------------------------------------------------------------
 # Declare "parser::yy<TABLE-NAME>_" which contents is CONTENT.
 m4_define([b4_integral_parser_table_declare],
-[m4_ifval([$3], [b4_c_comment([$3], [  ])
+[m4_ifval([$3], [b4_comment([$3], [  ])
 ])dnl
   static const b4_int_type_for([$2]) yy$1_[[]];dnl
 ])
@@ -723,9 +723,9 @@ b4_dollar_popdef])[]dnl
         try
         {
 ]b4_lex_symbol_if(
-[          yyla = b4_c_function_call([yylex], [symbol_type],
+[          yyla = b4_function_call([yylex], [symbol_type],
                                      m4_ifdef([b4_lex_param], b4_lex_param));],
-[          yyla.type = yytranslate_ (b4_c_function_call([yylex], [int],
+[          yyla.type = yytranslate_ (b4_function_call([yylex], [int],
                                      [b4_api_PREFIX[STYPE*], 
[&yyla.value]][]dnl
 b4_locations_if([, [[location*], [&yyla.location]]])dnl
 m4_ifdef([b4_lex_param], [, ]b4_lex_param)));])[
diff --git a/data/yacc.c b/data/yacc.c
index d15f150..9234cc4 100644
--- a/data/yacc.c
+++ b/data/yacc.c
@@ -85,7 +85,7 @@ m4_define([b4_yacc_pure_if],
 # Arguments passed to yyerror: user args plus yylloc.
 m4_define([b4_yyerror_args],
 [b4_yacc_pure_if([b4_locations_if([&yylloc, ])])dnl
-m4_ifset([b4_parse_param], [b4_c_args(b4_parse_param), ])])
+m4_ifset([b4_parse_param], [b4_args(b4_parse_param), ])])
 
 
 # b4_lex_param
@@ -239,19 +239,19 @@ enum { YYPUSH_MORE = 4 };
 
 typedef struct ]b4_prefix[pstate ]b4_prefix[pstate;
 
-]b4_pull_if([b4_c_function_decl([b4_prefix[parse]], [[int]], b4_parse_param)
-])b4_c_function_decl([b4_prefix[push_parse]], [[int]],
+]b4_pull_if([b4_function_declare([b4_prefix[parse]], [[int]], b4_parse_param)
+])b4_function_declare([b4_prefix[push_parse]], [[int]],
   [[b4_prefix[pstate *ps]], [[ps]]]b4_pure_if([,
   [[[int pushed_char]], [[pushed_char]]],
   [[b4_api_PREFIX[STYPE const *pushed_val]], [[pushed_val]]]b4_locations_if([,
   [[b4_api_PREFIX[LTYPE const *pushed_loc]], 
[[pushed_loc]]]])])m4_ifset([b4_parse_param], [,
   b4_parse_param]))
-b4_pull_if([b4_c_function_decl([b4_prefix[pull_parse]], [[int]],
+b4_pull_if([b4_function_declare([b4_prefix[pull_parse]], [[int]],
   [[b4_prefix[pstate *ps]], [[ps]]]m4_ifset([b4_parse_param], [,
   b4_parse_param]))])
-b4_c_function_decl([b4_prefix[pstate_new]], [b4_prefix[pstate *]],
+b4_function_declare([b4_prefix[pstate_new]], [b4_prefix[pstate *]],
                     [[[void]], []])
-b4_c_function_decl([b4_prefix[pstate_delete]], [[void]],
+b4_function_declare([b4_prefix[pstate_delete]], [[void]],
                    [[b4_prefix[pstate *ps]], [[ps]]])dnl
 ])
 
@@ -259,7 +259,7 @@ b4_c_function_decl([b4_prefix[pstate_delete]], [[void]],
 # -------------------
 # When not the push parser.
 m4_define([b4_declare_yyparse_],
-[b4_c_function_decl(b4_prefix[parse], [int], b4_parse_param)])
+[b4_function_declare(b4_prefix[parse], [int], b4_parse_param)])
 
 
 # b4_declare_yyparse
@@ -414,7 +414,7 @@ typedef short int yytype_int16;
 #ifndef lint
 # define YYID(n) (n)
 #else
-]b4_c_function_def([YYID], [static int], [[int yyi], [yyi]])[
+]b4_function_define([YYID], [static int], [[int yyi], [yyi]])[
 {
   return yyi;
 }
@@ -686,7 +686,7 @@ while (YYID (0))
 #ifdef YYLEX_PARAM
 # define YYLEX yylex (]b4_pure_if([&yylval[]b4_locations_if([, &yylloc]), 
])[YYLEX_PARAM)
 #else
-# define YYLEX ]b4_c_function_call([yylex], [int], b4_lex_param)[
+# define YYLEX ]b4_function_call([yylex], [int], b4_lex_param)[
 #endif
 
 /* Enable debugging if requested.  */
@@ -714,14 +714,14 @@ do {                                                      
                \
     }                                                                     \
 } while (YYID (0))
 
-]b4_yy_symbol_print_generate([b4_c_function_def])[
+]b4_yy_symbol_print_generate([b4_function_define])[
 
 /*------------------------------------------------------------------.
 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
 | TOP (included).                                                   |
 `------------------------------------------------------------------*/
 
-]b4_c_function_def([yy_stack_print], [static void],
+]b4_function_define([yy_stack_print], [static void],
                    [[yytype_int16 *yybottom], [yybottom]],
                    [[yytype_int16 *yytop],    [yytop]])[
 {
@@ -745,7 +745,7 @@ do {                                                        
    \
 | Report that the YYRULE is going to be reduced.  |
 `------------------------------------------------*/
 
-]b4_c_function_def([yy_reduce_print], [static void],
+]b4_function_define([yy_reduce_print], [static void],
                    [[yytype_int16 *yyssp], [yyssp]],
                    [[YYSTYPE *yyvsp], [yyvsp]],
     b4_locations_if([[[YYLTYPE *yylsp], [yylsp]],
@@ -1047,7 +1047,7 @@ yy_lac (yytype_int16 *yyesa, yytype_int16 **yyes,
 #   define yystrlen strlen
 #  else
 /* Return the length of YYSTR.  */
-]b4_c_function_def([yystrlen], [static YYSIZE_T],
+]b4_function_define([yystrlen], [static YYSIZE_T],
    [[const char *yystr], [yystr]])[
 {
   YYSIZE_T yylen;
@@ -1064,7 +1064,7 @@ yy_lac (yytype_int16 *yyesa, yytype_int16 **yyes,
 #  else
 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
    YYDEST.  */
-]b4_c_function_def([yystpcpy], [static char *],
+]b4_function_define([yystpcpy], [static char *],
    [[char *yydest], [yydest]], [[const char *yysrc], [yysrc]])[
 {
   char *yyd = yydest;
@@ -1284,7 +1284,7 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
 }
 #endif /* YYERROR_VERBOSE */
 
-]b4_yydestruct_generate([b4_c_function_def])[
+]b4_yydestruct_generate([b4_function_define])[
 
 ]b4_pure_if([], [
 
@@ -1299,13 +1299,13 @@ struct yypstate
 
 static char yypstate_allocated = 0;]])b4_pull_if([
 
-b4_c_function_def([[yyparse]], [[int]], b4_parse_param)[
+b4_function_define([[yyparse]], [[int]], b4_parse_param)[
 {
   return yypull_parse (YY_NULL]m4_ifset([b4_parse_param],
-                                  [[, ]b4_c_args(b4_parse_param)])[);
+                                  [[, ]b4_args(b4_parse_param)])[);
 }
 
-]b4_c_function_def([[yypull_parse]], [[int]],
+]b4_function_define([[yypull_parse]], [[int]],
   [[[yypstate *yyps]], [[yyps]]]m4_ifset([b4_parse_param], [,
   b4_parse_param]))[
 {
@@ -1330,7 +1330,7 @@ b4_c_function_def([[yyparse]], [[int]], b4_parse_param)[
   do {
     yychar = YYLEX;
     yystatus =
-      yypush_parse (yyps_local]b4_pure_if([[, yychar, 
&yylval]b4_locations_if([[, &yylloc]])])m4_ifset([b4_parse_param], [, 
b4_c_args(b4_parse_param)])[);
+      yypush_parse (yyps_local]b4_pure_if([[, yychar, 
&yylval]b4_locations_if([[, &yylloc]])])m4_ifset([b4_parse_param], [, 
b4_args(b4_parse_param)])[);
   } while (yystatus == YYPUSH_MORE);
   if (!yyps)
     yypstate_delete (yyps_local);
@@ -1338,7 +1338,7 @@ b4_c_function_def([[yyparse]], [[int]], b4_parse_param)[
 }]])[
 
 /* Initialize the parser data structure.  */
-]b4_c_function_def([[yypstate_new]], [[yypstate *]])[
+]b4_function_define([[yypstate_new]], [[yypstate *]])[
 {
   yypstate *yyps;]b4_pure_if([], [[
   if (yypstate_allocated)
@@ -1351,7 +1351,7 @@ b4_c_function_def([[yyparse]], [[int]], b4_parse_param)[
   return yyps;
 }
 
-]b4_c_function_def([[yypstate_delete]], [[void]],
+]b4_function_define([[yypstate_delete]], [[void]],
                    [[[yypstate *yyps]], [[yyps]]])[
 {
 #ifndef yyoverflow
@@ -1389,7 +1389,7 @@ b4_c_function_def([[yyparse]], [[int]], b4_parse_param)[
 | yypush_parse.  |
 `---------------*/
 
-]b4_c_function_def([[yypush_parse]], [[int]],
+]b4_function_define([[yypush_parse]], [[int]],
   [[[yypstate *yyps]], [[yyps]]]b4_pure_if([,
   [[[int yypushed_char]], [[yypushed_char]]],
   [[[YYSTYPE const *yypushed_val]], [[yypushed_val]]]b4_locations_if([,
@@ -1401,7 +1401,7 @@ b4_c_function_def([[yyparse]], [[int]], b4_parse_param)[
 | yyparse.  |
 `----------*/
 
-]b4_c_function_def([yyparse], [int], b4_parse_param)])[
+]b4_function_define([yyparse], [int], b4_parse_param)])[
 {]b4_pure_if([b4_declare_scanner_communication_variables
 ])b4_push_if([b4_pure_if([], [[
   int yypushed_char = yychar;
-- 
1.7.11.3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]