bison-patches
[Top][All Lists]
Advanced

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

[Main] Norming.


From: Pascal Bart
Subject: [Main] Norming.
Date: Fri, 31 Aug 2001 00:19:27 +0000 (GMT)

Hello,

        This is a little patch to standardize some code according Bison uses.
If nobody sees problem, I'll apply it.

Index: ChangeLog
===================================================================
RCS file: /cvsroot/bison/bison/ChangeLog,v
retrieving revision 1.197
diff -u -r1.197 ChangeLog
--- ChangeLog   2001/08/30 18:51:56     1.197
+++ ChangeLog   2001/08/30 19:20:43
@@ -1,5 +1,13 @@
 2001-08-30  Pascal Bart  <address@hidden>

+       * src/main.c (main): Standardize.
+       * src/output.c (output_table_data): Standardize.
+       (output_parser): Standardize.
+       * src/macrotab.h, src/macrotab.c, src/print_graph.c: Standardize.
+       * src/bison.simple (yytname): Standardize.
+
+2001-08-30  Pascal Bart  <address@hidden>
+
        * src/main.c: Include macrotab.h.
        * src/macrotab.h (macro_entry_s): Constify fields.
        Adjust functions prototypes.
Index: src/bison.simple
===================================================================
RCS file: /cvsroot/bison/bison/src/bison.simple,v
retrieving revision 1.59
diff -u -r1.59 bison.simple
--- src/bison.simple    2001/08/29 14:17:00     1.59
+++ src/bison.simple    2001/08/30 19:20:44
@@ -118,7 +118,7 @@
 # define YYERROR_VERBOSE %%verbose
 #endif

-/* Tokens. */
+/* Tokens.  */
 %%tokendef

 #define YYFINAL                %%final
@@ -160,8 +160,8 @@
 #endif

 #if YYDEBUG || YYERROR_VERBOSE
-/* YYTNAME[TOKEN_NUM] -- String name of the token TOKEN_NUM. */
-static const char* const yytname[] =
+/* YYTNAME[TOKEN_NUM] -- String name of the token TOKEN_NUM.  */
+static const char *const yytname[] =
 {
   %%tname
 };
@@ -390,7 +390,7 @@
 /* The lookahead symbol.  */                           \
 int %%yychar;                                          \
                                                        \
-/* The semantic value of the lookahead symbol. */      \
+/* The semantic value of the lookahead symbol.  */     \
 YYSTYPE %%yylval;                                      \
                                                        \
 /* Number of parse errors so far.  */                  \
@@ -407,7 +407,7 @@
 _YY_DECL_VARIABLES
 #endif

-/* If nonreentrant, generate the variables here. */
+/* If nonreentrant, generate the variables here.  */

 #if !YYPURE
 YY_DECL_VARIABLES
@@ -417,7 +417,7 @@
 %%yyparse (YYPARSE_PARAM_ARG)
      YYPARSE_PARAM_DECL
 {
-  /* If reentrant, generate the variables here. */
+  /* If reentrant, generate the variables here.  */
 #if YYPURE
   YY_DECL_VARIABLES
 #endif  /* !YYPURE */
@@ -437,7 +437,7 @@
      Refer to the stacks thru separate pointers, to allow yyoverflow
      to reallocate them elsewhere.  */

-  /* The state stack. */
+  /* The state stack.  */
   short        yyssa[YYINITDEPTH];
   short *yyss = yyssa;
   register short *yyssp;
@@ -471,7 +471,7 @@
 # endif

   /* When reducing, the number of symbols on the RHS of the reduced
-     rule. */
+     rule.  */
   int yylen;

   YYDPRINTF ((stderr, "Starting parse\n"));
@@ -619,7 +619,7 @@

   /* Convert token to internal form (in yychar1) for indexing tables with */

-  if (%%yychar <= 0)           /* This means end of input. */
+  if (%%yychar <= 0)           /* This means end of input.  */
     {
       yychar1 = 0;
       %%yychar = YYEOF;                /* Don't call YYLEX any more */
@@ -745,7 +745,7 @@
 #endif
   switch (yyn)
     {
-      %%action /* The action file replaces this line. */
+      %%action /* The action file replaces this line.  */
     }
 #line %%line "%%filename"

Index: src/macrotab.c
===================================================================
RCS file: /cvsroot/bison/bison/src/macrotab.c,v
retrieving revision 1.4
diff -u -r1.4 macrotab.c
--- src/macrotab.c      2001/08/30 18:51:56     1.4
+++ src/macrotab.c      2001/08/30 19:20:44
@@ -29,19 +29,19 @@
 struct hash_table macro_table;

 static unsigned long
-mhash1 (const void* item)
+mhash1 (const void *item)
 {
   return_STRING_HASH_1 (((macro_entry_t*) item)->key);
 }

 static unsigned long
-mhash2 (const void* item)
+mhash2 (const void *item)
 {
   return_STRING_HASH_2 (((macro_entry_t*) item)->key);
 }

 static int
-mcmp (const void* x, const void* y)
+mcmp (const void *x, const void *y)
 {
   return strcmp (((macro_entry_t*) x)->key, ((macro_entry_t*) y)->key);
 }
@@ -51,18 +51,18 @@
 {
   hash_init (&macro_table, MTABSIZE, &mhash1, &mhash2, &mcmp);

-  /* Version and input file. */
+  /* Version and input file.  */
   macro_insert ("version", VERSION);
   macro_insert ("filename", "a.y");

-  /* Types. */
+  /* Types.  */
   macro_insert ("stype", "int");
   macro_insert ("ltype", "yyltype");

-  /* Tokens. */
+  /* Tokens.  */
   macro_insert ("tokendef", "");

-  /* Tables. */
+  /* Tables.  */
   macro_insert ("rhs", "0");
   macro_insert ("pact", "0");
   macro_insert ("prhs", "0");
@@ -76,7 +76,7 @@
   macro_insert ("defgoto", "0");
   macro_insert ("translate", "0");

-  /* Various macros. */
+  /* Various macros.  */
   macro_insert ("flag", "0");
   macro_insert ("last", "0");
   macro_insert ("pure", "0");
@@ -87,7 +87,7 @@
   macro_insert ("ntbase", "0");
   macro_insert ("verbose", "0");

-  /* Variable prefix names. */
+  /* Variable prefix names.  */
   macro_insert ("yyparse", "yyparse");
   macro_insert ("yylex", "yylex");
   macro_insert ("yyerror", "yyerror");
@@ -96,24 +96,24 @@
   macro_insert ("yydebug", "yydebug");
   macro_insert ("yynerrs", "yynerrs");

-  /* No parser macros. */
+  /* No parser macros.  */
   macro_insert ("nnts", "0");
   macro_insert ("nrules", "0");
   macro_insert ("nstates", "0");
   macro_insert ("ntokens", "0");

-  /* Stack parameters. */
+  /* Stack parameters.  */
   macro_insert ("maxdepth", "10000");
   macro_insert ("initdepth", "200");

-  /* C++ macros. */
+  /* C++ macros.  */
   macro_insert ("name", "Parser");
 }

 void
 macro_insert (const char *key, const char *value)
 {
-  macro_entry_t* pair = XMALLOC (macro_entry_t, 1);
+  macro_entry_t *pair = XMALLOC (macro_entry_t, 1);
   pair->key = key;
   pair->value = value;
   hash_insert (&macro_table, pair);
@@ -123,6 +123,6 @@
 macro_find (const char *key)
 {
   macro_entry_t pair = { key, 0 };
-  macro_entry_t* result = hash_find_item (&macro_table, &pair);
+  macro_entry_t *result = hash_find_item (&macro_table, &pair);
   return result ? result->value : 0;
 }
Index: src/macrotab.h
===================================================================
RCS file: /cvsroot/bison/bison/src/macrotab.h,v
retrieving revision 1.4
diff -u -r1.4 macrotab.h
--- src/macrotab.h      2001/08/30 18:51:56     1.4
+++ src/macrotab.h      2001/08/30 19:20:44
@@ -25,12 +25,12 @@

 typedef struct macro_entry_s
 {
-  const char* key;
-  const char* value;
+  const char *key;
+  const char *value;
 } macro_entry_t;

 void macro_init PARAMS ((void));
 void macro_insert PARAMS ((const char *key, const char *value));
-const char* macro_find PARAMS ((const char *key));
+const char *macro_find PARAMS ((const char *key));

 #endif /* not MACROTAB_H_ */
Index: src/main.c
===================================================================
RCS file: /cvsroot/bison/bison/src/main.c,v
retrieving revision 1.34
diff -u -r1.34 main.c
--- src/main.c  2001/08/30 18:51:56     1.34
+++ src/main.c  2001/08/30 19:20:44
@@ -86,7 +86,7 @@
   /* Print information about results, if requested.  */
   print_results ();

-  /* Output the VCG graph. */
+  /* Output the VCG graph.  */
   print_graph ();

   /* Output the tables and the parser to ftable.  In file output.  */
Index: src/output.c
===================================================================
RCS file: /cvsroot/bison/bison/src/output.c,v
retrieving revision 1.48
diff -u -r1.48 output.c
--- src/output.c        2001/08/30 18:51:56     1.48
+++ src/output.c        2001/08/30 19:20:45
@@ -129,8 +129,8 @@
 /* FIXME. */

 static inline void
-output_table_data (struct obstack* oout,
-                  short* table_data,
+output_table_data (struct obstack *oout,
+                  short *table_data,
                   short first,
                   short begin,
                   short end)
@@ -969,7 +969,7 @@
     }
   fskel = xfopen (skeleton, "r");

-  /* New output code. */
+  /* New output code.  */
   line = 1;
   c = getc (fskel);
   while (c != EOF)
@@ -983,14 +983,14 @@
        }
       else if ((c = getc (fskel)) == '%')
        {
-         /* Read the macro. */
-         const char* macro_key = 0;
-         const char* macro_value = 0;
+         /* Read the macro.  */
+         const char *macro_key = 0;
+         const char *macro_value = 0;
          while (isalnum (c = getc (fskel)) || c == '_')
            obstack_1grow (&macro_obstack, c);
          obstack_1grow (&macro_obstack, 0);

-         /* Output the right value, or see if it's something special. */
+         /* Output the right value, or see if it's something special.  */
          macro_key = obstack_finish (&macro_obstack);
          macro_value = macro_find (macro_key);
          if (macro_value)
@@ -1013,7 +1013,7 @@
        obstack_1grow (&table_obstack, '%');
     }

-  /* End. */
+  /* End.  */
   xfclose (fskel);
 }

Index: src/print_graph.c
===================================================================
RCS file: /cvsroot/bison/bison/src/print_graph.c,v
retrieving revision 1.6
diff -u -r1.6 print_graph.c
--- src/print_graph.c   2001/08/08 20:31:21     1.6
+++ src/print_graph.c   2001/08/30 19:20:45
@@ -46,7 +46,7 @@
   return quotearg_n_style (0, escape_quoting_style, name);
 }

-/* This part will construct the label of nodes. */
+/* This part will construct the label of nodes.  */
 static void
 print_core (int state, struct obstack *node_obstack)
 {
@@ -143,7 +143,7 @@
            edge.targetname = buff;
            edge.color = (symbol == 0) ? red : blue;
            /* FIXME: Be aware that quote uses static memory.  The string
-              must be output immediately (which is the case here). */
+              must be output immediately (which is the case here).  */
            edge.label = tags[symbol] ? quote (tags[symbol]) : NULL;
            output_edge (&edge, &graph_obstack);
            close_edge (&graph_obstack);
@@ -228,7 +228,7 @@
   output_node (&node, &node_obstack);

   {
-    /* Here we begin to compute the node label. */
+    /* Here we begin to compute the node label.  */
     obstack_sgrow (&node_obstack, "\t\tlabel:\t\"");   /* Open Label  */

     /* Keep the size of NODE_OBSTACK before computing the label. It is
@@ -278,14 +278,14 @@

   graph.crossing_weight = median;

-  /* Output graph options. */
+  /* Output graph options.  */
   open_graph (&graph_obstack);
   output_graph (&graph, &graph_obstack);

   for (i = 0; i < nstates; i++)
-    /* Output nodes & edges. */
+    /* Output nodes & edges.  */
     print_state (i);

-  /* Close graph. */
+  /* Close graph.  */
   close_graph (&graph, &graph_obstack);
 }

Pascal Bart (address@hidden)
 LocalWords:  src




reply via email to

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