Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r79442 - trunk/tools/build/v2/engine
From: jurko.gospodnetic_at_[hidden]
Date: 2012-07-12 06:28:59


Author: jurko
Date: 2012-07-12 06:28:58 EDT (Thu, 12 Jul 2012)
New Revision: 79442
URL: http://svn.boost.org/trac/boost/changeset/79442

Log:
Boost Jam code cleanup - minor stylistic changes.
Text files modified:
   trunk/tools/build/v2/engine/fileunix.c | 2
   trunk/tools/build/v2/engine/jam.c | 2
   trunk/tools/build/v2/engine/scan.c | 67 +++++++++++++++++----------------------
   trunk/tools/build/v2/engine/scan.h | 16 +++++---
   4 files changed, 42 insertions(+), 45 deletions(-)

Modified: trunk/tools/build/v2/engine/fileunix.c
==============================================================================
--- trunk/tools/build/v2/engine/fileunix.c (original)
+++ trunk/tools/build/v2/engine/fileunix.c 2012-07-12 06:28:58 EDT (Thu, 12 Jul 2012)
@@ -336,7 +336,7 @@
     }
 }
 
-/* Check for OS version which supports the big variant. */
+/* Check for OS versions supporting the big variant. */
 #ifdef AR_HSZ_BIG
 
 static void file_archscan_big( int fd, char const * archive, scanback func,

Modified: trunk/tools/build/v2/engine/jam.c
==============================================================================
--- trunk/tools/build/v2/engine/jam.c (original)
+++ trunk/tools/build/v2/engine/jam.c 2012-07-12 06:28:58 EDT (Thu, 12 Jul 2012)
@@ -439,7 +439,7 @@
         /* Load up variables set on command line. */
         for ( n = 0; ( s = getoptval( optv, 's', n ) ); ++n )
         {
- char *symv[ 2 ];
+ char * symv[ 2 ];
             symv[ 0 ] = s;
             symv[ 1 ] = 0;
             var_defines( root_module(), symv, 1 );

Modified: trunk/tools/build/v2/engine/scan.c
==============================================================================
--- trunk/tools/build/v2/engine/scan.c (original)
+++ trunk/tools/build/v2/engine/scan.c 2012-07-12 06:28:58 EDT (Thu, 12 Jul 2012)
@@ -4,28 +4,19 @@
  * This file is part of Jam - see jam.c for Copyright information.
  */
 
-#include "jam.h"
-#include "lists.h"
-#include "parse.h"
-#include "scan.h"
-#include "jamgram.h"
-#include "jambase.h"
-#include "object.h"
-#include "constants.h"
-
 /*
  * scan.c - the jam yacc scanner
  *
- * 12/26/93 (seiwald) - bump buf in yylex to 10240 - yuk.
- * 09/16/94 (seiwald) - check for overflows, unmatched {}'s, etc.
- * Also handle tokens abutting EOF by remembering
- * to return EOF now matter how many times yylex()
- * reinvokes yyline().
- * 02/11/95 (seiwald) - honor only punctuation keywords if SCAN_PUNCT.
- * 07/27/95 (seiwald) - Include jamgram.h after scan.h, so that YYSTYPE is
- * defined before Linux's yacc tries to redefine it.
  */
 
+#include "jam.h"
+#include "scan.h"
+
+#include "constants.h"
+#include "jambase.h"
+#include "jamgram.h"
+
+
 struct keyword
 {
     char * word;
@@ -36,18 +27,19 @@
     { 0, 0 }
 };
 
+typedef struct include include;
 struct include
 {
- struct include * next; /* next serial include file */
- char * string; /* pointer into current line */
- char * * strings; /* for yyfparse() -- text to parse */
- FILE * file; /* for yyfparse() -- file being read */
- OBJECT * fname; /* for yyfparse() -- file name */
- int line; /* line counter for error messages */
- char buf[ 512 ]; /* for yyfparse() -- line buffer */
+ include * next; /* next serial include file */
+ char * string; /* pointer into current line */
+ char * * strings; /* for yyfparse() -- text to parse */
+ FILE * file; /* for yyfparse() -- file being read */
+ OBJECT * fname; /* for yyfparse() -- file name */
+ int line; /* line counter for error messages */
+ char buf[ 512 ]; /* for yyfparse() -- line buffer */
 };
 
-static struct include * incp = 0; /* current file; head of chain */
+static include * incp = 0; /* current file; head of chain */
 
 static int scanmode = SCAN_NORMAL;
 static int anyerrors = 0;
@@ -68,22 +60,23 @@
 }
 
 
-void yyerror( const char * s )
+void yyerror( char const * s )
 {
     /* We use yylval instead of incp to access the error location information as
      * the incp pointer will already be reset to 0 in case the error occurred at
      * EOF.
      *
- * The two may differ only if we get an error while reading a lexical token
- * spanning muliple lines, e.g. a multi-line string literal or action body,
- * in which case yylval location information will hold the information about
- * where this token started while incp will hold the information about where
- * reading it broke.
+ * The two may differ only if ran into an unexpected EOF or we get an error
+ * while reading a lexical token spanning multiple lines, e.g. a multi-line
+ * string literal or action body, in which case yylval location information
+ * will hold the information about where the token started while incp will
+ * hold the information about where reading it broke.
      *
      * TODO: Test the theory about when yylval and incp location information are
      * the same and when they differ.
      */
- printf( "%s:%d: %s at %s\n", object_str( yylval.file ), yylval.line, s, symdump( &yylval ) );
+ printf( "%s:%d: %s at %s\n", object_str( yylval.file ), yylval.line, s,
+ symdump( &yylval ) );
     ++anyerrors;
 }
 
@@ -96,7 +89,7 @@
 
 void yyfparse( OBJECT * s )
 {
- struct include * i = (struct include *)BJAM_MALLOC( sizeof( *i ) );
+ include * i = (include *)BJAM_MALLOC( sizeof( *i ) );
 
     /* Push this onto the incp chain. */
     i->string = "";
@@ -122,7 +115,7 @@
 
 int yyline()
 {
- struct include * i = incp;
+ include * const i = incp;
 
     if ( !incp )
         return EOF;
@@ -265,7 +258,7 @@
         int notkeyword;
 
         /* Eat white space. */
- for ( ;; )
+ for ( ; ; )
         {
             /* Skip past white space. */
             while ( ( c != EOF ) && isspace( c ) )
@@ -389,11 +382,11 @@
     static char buf[ BIGGEST_TOKEN + 20 ];
     switch ( s->type )
     {
- case EOF : sprintf( buf, "EOF" ); break;
+ case EOF : sprintf( buf, "EOF" ); break;
         case 0 : sprintf( buf, "unknown symbol %s", object_str( s->string ) ); break;
         case ARG : sprintf( buf, "argument %s" , object_str( s->string ) ); break;
         case STRING: sprintf( buf, "string \"%s\"" , object_str( s->string ) ); break;
- default : sprintf( buf, "keyword %s" , s->keyword ); break;
+ default : sprintf( buf, "keyword %s" , s->keyword ); break;
     }
     return buf;
 }

Modified: trunk/tools/build/v2/engine/scan.h
==============================================================================
--- trunk/tools/build/v2/engine/scan.h (original)
+++ trunk/tools/build/v2/engine/scan.h 2012-07-12 06:28:58 EDT (Thu, 12 Jul 2012)
@@ -8,7 +8,6 @@
  * scan.h - the jam yacc scanner
  *
  * External functions:
- *
  * yyerror( char *s ) - print a parsing error message.
  * yyfparse( char *s ) - scan include file s.
  * yylex() - parse the next token, returning its type.
@@ -23,6 +22,11 @@
  * lists without quoting.
  */
 
+#include "lists.h"
+#include "object.h"
+#include "parse.h"
+
+
 /*
  * YYSTYPE - value of a lexical token
  */
@@ -38,13 +42,13 @@
     int number;
     OBJECT * file;
     int line;
- const char * keyword;
+ char const * keyword;
 } YYSTYPE;
 
 extern YYSTYPE yylval;
 
 void yymode( int n );
-void yyerror( const char * s );
+void yyerror( char const * s );
 int yyanyerrors();
 void yyfparse( OBJECT * s );
 int yyline();
@@ -52,6 +56,6 @@
 int yyparse();
 void yyinput_stream( OBJECT * * name, int * line );
 
-# define SCAN_NORMAL 0 /* normal parsing */
-# define SCAN_STRING 1 /* look only for matching } */
-# define SCAN_PUNCT 2 /* only punctuation keywords */
+#define SCAN_NORMAL 0 /* normal parsing */
+#define SCAN_STRING 1 /* look only for matching } */
+#define SCAN_PUNCT 2 /* only punctuation keywords */


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk