Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/make Cosmetic: declare types before variables, group...
details: https://anonhg.NetBSD.org/src/rev/cddfe5be8f60
branches: trunk
changeset: 759574:cddfe5be8f60
user: dholland <dholland%NetBSD.org@localhost>
date: Mon Dec 13 03:32:25 2010 +0000
description:
Cosmetic: declare types before variables, group variables by role,
update some comments, format comments properly, etc. No functional
change intended.
diffstat:
usr.bin/make/parse.c | 117 +++++++++++++++++++++++++++++++++++---------------
1 files changed, 81 insertions(+), 36 deletions(-)
diffs (186 lines):
diff -r 313e8eec068c -r cddfe5be8f60 usr.bin/make/parse.c
--- a/usr.bin/make/parse.c Mon Dec 13 01:48:50 2010 +0000
+++ b/usr.bin/make/parse.c Mon Dec 13 03:32:25 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: parse.c,v 1.165 2010/09/13 15:36:57 sjg Exp $ */
+/* $NetBSD: parse.c,v 1.166 2010/12/13 03:32:25 dholland Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
*/
#ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: parse.c,v 1.165 2010/09/13 15:36:57 sjg Exp $";
+static char rcsid[] = "$NetBSD: parse.c,v 1.166 2010/12/13 03:32:25 dholland Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)parse.c 8.3 (Berkeley) 3/19/94";
#else
-__RCSID("$NetBSD: parse.c,v 1.165 2010/09/13 15:36:57 sjg Exp $");
+__RCSID("$NetBSD: parse.c,v 1.166 2010/12/13 03:32:25 dholland Exp $");
#endif
#endif /* not lint */
#endif
@@ -136,24 +136,14 @@
#include "buf.h"
#include "pathnames.h"
+extern int maxJobs;
+
+////////////////////////////////////////////////////////////
+// types and constants
+
/*
- * These values are returned by ParseEOF to tell Parse_File whether to
- * CONTINUE parsing, i.e. it had only reached the end of an include file,
- * or if it's DONE.
+ * Structure for a file being read ("included file")
*/
-#define CONTINUE 1
-#define DONE 0
-static Lst targets; /* targets we're working on */
-#ifdef CLEANUP
-static Lst targCmds; /* command lines for targets */
-#endif
-static Boolean inLine; /* true if currently in a dependency
- * line or its commands */
-static int fatals = 0;
-
-static GNode *mainNode; /* The main target to create. This is the
- * first target on the first dependency
- * line in the first makefile */
typedef struct IFile {
const char *fname; /* name of file */
int lineno; /* current line number in file */
@@ -169,23 +159,17 @@
} IFile;
#define IFILE_BUFLEN 0x8000
-static IFile *curFile;
-
/*
- * Definitions for handling #include specifications
+ * These values are returned by ParseEOF to tell Parse_File whether to
+ * CONTINUE parsing, i.e. it had only reached the end of an include file,
+ * or if it's DONE.
*/
+#define CONTINUE 1
+#define DONE 0
-static Lst includes; /* stack of IFiles generated by .includes */
-Lst parseIncPath; /* list of directories for "..." includes */
-Lst sysIncPath; /* list of directories for <...> includes */
-Lst defIncPath; /* default directories for <...> includes */
-
-/*-
- * specType contains the SPECial TYPE of the current target. It is
- * Not if the target is unspecial. If it *is* special, however, the children
- * are linked as children of the parent but not vice versa. This variable is
- * set in ParseDoDependency
+/*
+ * Tokens for target attributes
*/
typedef enum {
Begin, /* .BEGIN */
@@ -224,16 +208,74 @@
Attribute /* Generic attribute */
} ParseSpecial;
+/*
+ * Other tokens
+ */
+#define LPAREN '('
+#define RPAREN ')'
+
+
+////////////////////////////////////////////////////////////
+// result data
+
+/*
+ * The main target to create. This is the first target on the first
+ * dependency line in the first makefile.
+ */
+static GNode *mainNode;
+
+////////////////////////////////////////////////////////////
+// eval state
+
+/* targets we're working on */
+static Lst targets;
+
+#ifdef CLEANUP
+/* command lines for targets */
+static Lst targCmds;
+#endif
+
+/*
+ * specType contains the SPECial TYPE of the current target. It is
+ * Not if the target is unspecial. If it *is* special, however, the children
+ * are linked as children of the parent but not vice versa. This variable is
+ * set in ParseDoDependency
+ */
static ParseSpecial specType;
-#define LPAREN '('
-#define RPAREN ')'
/*
* Predecessor node for handling .ORDER. Initialized to NULL when .ORDER
* seen, then set to each successive source on the line.
*/
static GNode *predecessor;
+////////////////////////////////////////////////////////////
+// parser state
+
+/* true if currently in a dependency line or its commands */
+static Boolean inLine;
+
+/* number of fatal errors */
+static int fatals = 0;
+
+/*
+ * Variables for doing includes
+ */
+
+/* current file being read */
+static IFile *curFile;
+
+/* stack of IFiles generated by .includes */
+static Lst includes;
+
+/* include paths (lists of directories) */
+Lst parseIncPath; /* dirs for "..." includes */
+Lst sysIncPath; /* dirs for <...> includes */
+Lst defIncPath; /* default for sysIncPath */
+
+////////////////////////////////////////////////////////////
+// parser tables
+
/*
* The parseKeywords table is searched using binary search when deciding
* if a target or source is special. The 'spec' field is the ParseSpecial
@@ -290,6 +332,9 @@
{ ".WAIT", Wait, 0 },
};
+////////////////////////////////////////////////////////////
+// local functions
+
static int ParseIsEscaped(const char *, const char *);
static void ParseErrorInternal(const char *, size_t, int, const char *, ...)
__attribute__((__format__(__printf__, 4, 5)));
@@ -315,8 +360,8 @@
static void ParseFinishLine(void);
static void ParseMark(GNode *);
-extern int maxJobs;
-
+////////////////////////////////////////////////////////////
+// code
/*-
*----------------------------------------------------------------------
Home |
Main Index |
Thread Index |
Old Index