2
0
mirror of https://github.com/boostorg/build.git synced 2026-02-15 13:02:11 +00:00

Boost Jam code cleanup - minor stylistic changes.

[SVN r79442]
This commit is contained in:
Jurko Gospodnetić
2012-07-12 10:28:58 +00:00
parent 98a286ce6e
commit c94e5a36c6
4 changed files with 42 additions and 45 deletions

View File

@@ -336,7 +336,7 @@ static void file_archscan_small( int fd, char const * archive, scanback func,
}
}
/* 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,

View File

@@ -439,7 +439,7 @@ int main( int argc, char * * argv, char * * arg_environ )
/* 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 );

View File

@@ -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 @@ struct keyword
{ 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 yymode( int n )
}
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 @@ int yyanyerrors()
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 @@ void yyfparse( OBJECT * s )
int yyline()
{
struct include * i = incp;
include * const i = incp;
if ( !incp )
return EOF;
@@ -265,7 +258,7 @@ int yylex()
int notkeyword;
/* Eat white space. */
for ( ;; )
for ( ; ; )
{
/* Skip past white space. */
while ( ( c != EOF ) && isspace( c ) )
@@ -389,11 +382,11 @@ static char * symdump( YYSTYPE * s )
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;
}

View File

@@ -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 @@ typedef struct _YYSTYPE
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 yylex();
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 */