8 Commits f061223641 ... c87cd1cd6b

Autor SHA1 Mensagem Data
  Darren Bane c87cd1cd6b And port back to WSL 7 anos atrás
  Darren Bane 960cd8d294 .astylerc 7 anos atrás
  Darren Bane 3e0b1d38fd Indent 7 anos atrás
  Darren Bane e6faef33fc Indent 7 anos atrás
  Darren Bane b78e51efb7 Indent 7 anos atrás
  Darren Bane a8764c0894 Some indenting required after merge 7 anos atrás
  Darren Bane 78219dbe2d Merge branch 'master' into darwin 7 anos atrás
  Darren Bane e3040fbfa6 Darwin customisations 8 anos atrás
10 arquivos alterados com 52 adições e 47 exclusões
  1. 4 0
      astylerc
  2. 1 1
      hdr/build.h
  3. 11 11
      hdr/externs.h
  4. 2 2
      hdr/lbl.h
  5. 1 1
      hdr/scan.h
  6. 15 15
      hdr/types.h
  7. 7 7
      hooks/pre-commit
  8. 8 7
      src/Makefile
  9. 3 3
      src/actions.cpp
  10. 0 0
      src/build.cpp

+ 4 - 0
astylerc

@@ -0,0 +1,4 @@
+style=stroustrup
+break-closing-braces
+attach-closing-while
+indent=tab=5

+ 1 - 1
hdr/build.h

@@ -7,7 +7,7 @@
 
 /**
  * @brief Copy a string to a new block of memory.
- * 
+ *
  * If we run out of memory, the process exits.
  * @param str the string to copy
  * @return a pointer to the copy

+ 11 - 11
hdr/externs.h

@@ -17,38 +17,38 @@
 
 /** @brief Delimiter used to insert label references.
  * Defaults to '@'. */
-extern char	delimiter;
+extern char delimiter;
 
 /** @brief 2-char macro used to define a label.
  * Defaults to "L=". */
-extern char	macroname[];
+extern char macroname[];
 
 /** @brief Name of temporary file used across passes. */
-extern char	tempname[];
+extern char tempname[];
 
 /** @brief Printing format for a label reference.
  * Can be changed by "L= format". */
-extern char   *def_format;
+extern char *def_format;
 
 /** @brief argv[0] */
-extern char   *progname;
+extern char *progname;
 
 /** @brief Name of input file */
-extern char   *filename;
+extern char *filename;
 
 /** @brief Was "-l" given as a command-line option? */
-extern int	lflag;
+extern int lflag;
 
 /** @brief Was "-s" given as a command-line option? */
-extern int	sflag;
+extern int sflag;
 
 /** @brief Handle for temporary file used between passes */
-extern FILE   *tempfile;
+extern FILE *tempfile;
 
 /** @brief Current line in input file, so that we can print line where defined for "-l" */
-extern long	fileline;
+extern long fileline;
 
 /** @brief List of label types */
-extern std::list<Type> typehead;
+extern	std::list<Type> typehead;
 
 #endif

+ 2 - 2
hdr/lbl.h

@@ -1,6 +1,6 @@
 /** @file
  * @brief Config settings & misc. utilities.
- * 
+ *
  * These are bundled in with the main program for now.
  */
 /* (C) C.D.F. Miller, Heriot-Watt University, March 1984
@@ -35,7 +35,7 @@
 
 /**
  * @brief Get the current location in the input file.
- * 
+ *
  * If we're not processing an input file, the result is an empty string.
  * @return a string describing the current location
  */

+ 1 - 1
hdr/scan.h

@@ -1,6 +1,6 @@
 /** @file
  * @brief Scan an input file, recording label-definitions, etc.
- * 
+ *
  * All special actions are introduced by a line starting
  * @verbatim
 .<macro>

+ 15 - 15
hdr/types.h

@@ -1,6 +1,6 @@
 /** @file
  * @brief Concrete data types.
- * 
+ *
  * On the one hand, having these all in the same file isn't
  * good modularity. On the other hand, I don't want to write
  * loads of setters and getters.
@@ -31,25 +31,25 @@ typedef int levels[NLEVELS];
 /** Header format */
 typedef char *format;
 
-typedef struct Type Type;       /**< Type type */
-typedef struct Label Label;     /**< Label type */
-typedef struct Keyword Keyword; /**< Keyword type */
+typedef struct Type Type;		/**< Type type */
+typedef struct Label Label;		/**< Label type */
+typedef struct Keyword Keyword;		/**< Keyword type */
 
 /** Label type */
 struct Type {
-	char   *t_name;	/**< name */
-	levels	t_levels;	/**< current header levels */
-	format	t_format;   /**< format */
-	std::list<Label> labelhead;   /**< list of labels of this type */
+	char   *t_name;			/**< name */
+	levels	t_levels;		/**< current header levels */
+	format	t_format;		/**< format */
+	std::list<Label> labelhead;	/**< list of labels of this type */
 };
 
 /** Label definition */
 struct Label {
-	char   *l_name; /**< Name */
-	Type   *l_type; /**< Back-reference to label type */
+	char   *l_name;			/**< Name */
+	Type   *l_type;			/**< Back-reference to label type */
 	char   *l_file;			/**< File where defined */
 	long	l_line;			/**< line where defined */
-	levels	l_levels;   /**< Counter for label no. at different levels */
+	levels	l_levels;		/**< Counter for label no. at different levels */
 	int	l_bottom;		/**< Last significant level */
 	unsigned char padding[4];
 };
@@ -59,10 +59,10 @@ typedef int (*func) ();
 
 /** Command keyword, to come after ".L=" at the start of an input line */
 struct Keyword {
-	char   *k_name; /**< How is the keyword spelt */
-	func	k_action;   /**< Function pointer for action to take */
-	us int	k_minargs;  /**< Min no. of args for k_action */
-	us int	k_maxargs;  /**< Max no. of args for k_action */
+	char   *k_name;			/**< How is the keyword spelt */
+	func	k_action;		/**< Function pointer for action to take */
+	us int	k_minargs;		/**< Min no. of args for k_action */
+	us int	k_maxargs;		/**< Max no. of args for k_action */
 };
 
 #endif

+ 7 - 7
hooks/pre-commit

@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright 2013 Darren Bane. All rights reserved.
+# Copyright 2013,2017 Darren Bane. All rights reserved.
 # Use of this source code is governed by the
 # license that can be found in the NOTICE file.
 
@@ -10,12 +10,12 @@
 #
 # This script does not handle file names that contain spaces.
 
-cfiles=$(git diff --cached --name-only --diff-filter=ACM | grep '.[ch]$')
-[ -z "$cfiles" ] && exit 0
+cppfiles=$(git diff --cached --name-only --diff-filter=ACM | grep -E '\.(cpp|h)$')
+[ -z "$cppfiles" ] && exit 0
 
 unformatted=""
-for fn in $cfiles; do
-	indent -orig $fn -o /tmp/indent.$$
+for fn in $cppfiles; do
+	astyle < $fn > /tmp/indent.$$
 	if ! diff $fn /tmp/indent.$$ > /dev/null; then
 		unformatted="$unformatted $fn";
 	fi
@@ -25,9 +25,9 @@ rm /tmp/indent.$$
 
 # Some files are not indented. Print message and fail.
 
-echo >&2 "C files must be formatted with indent. Please run:"
+echo >&2 "C++ files must be formatted with astyle. Please run:"
 for fn in $unformatted; do
-	echo >&2 "  indent -orig $PWD/$fn"
+	echo >&2 "  astyle $PWD/$fn"
 done
 
 exit 1

+ 8 - 7
src/Makefile

@@ -1,20 +1,21 @@
 .POSIX:
 
 BINOWN= dbane
-BINGRP= dbane
+BINGRP= staff
 SHAREOWN= dbane
-SHAREGRP= dbane
+SHAREGRP= staff
 .include <bsd.own.mk>
 
-PREFIX?= /home/dbane
+PREFIX?= /Users/dbane
 BINDIR= $(PREFIX)/bin
-MANDIR= $(PREFIX)/man
+MANDIR= $(PREFIX)/man/man
 PROG= lbl
 
 # Need _DARWIN_C_SOURCE for strlcpy/strlcat
-#CFLAGS+= -I../hdr -Wall -std=c11 -D_XOPEN_SOURCE=600 -D_DARWIN_C_SOURCE
-CXXFLAGS+= -I../hdr -Wall -Wextra -Weffc++ -std=c++14 -D_XOPEN_SOURCE=600
-LDADD+= -lbsd
+CXXFLAGS+= -I../hdr -Wall -Wextra -Weffc++ -std=c++14 -D_XOPEN_SOURCE=600 -D_DARWIN_C_SOURCE
+#CXXFLAGS+= -I../hdr -Wall -Wextra -Weffc++ -std=c++14 -D_XOPEN_SOURCE=600
+#CFLAGS+= -I../hdr -Wall -Wextra -std=c11 -D_XOPEN_SOURCE=600
+#LDADD+= -lbsd
 
 MAN= lbl.1
 SRCS= lbl.cpp actions.cpp build.cpp externs.cpp find.cpp keyword.cpp list.cpp \

+ 3 - 3
src/actions.cpp

@@ -28,7 +28,7 @@ void a_delimiter(int nargs, char *argvec[]);
 void
 a_delimiter(int nargs, char *argvec[])
 {
-        (void)nargs;
+	(void)nargs;
 	if (strcmp(argvec[1], "off") == 0) {
 		if (!sflag)
 			fprintf(tempfile, "%c%c%c\n", MAGIC1, MAGIC2, M_DELIM);
@@ -44,7 +44,7 @@ a_delimiter(int nargs, char *argvec[])
 	}
 	if (!sflag)
 		fprintf(tempfile, "%c%c%c%c\n", MAGIC1, MAGIC2,
-		    M_DELIM, argvec[1][0]);
+		        M_DELIM, argvec[1][0]);
 }
 
 void a_format(int nargs, char *argvec[]);
@@ -54,7 +54,7 @@ a_format(int nargs, char *argvec[])
 {
 	Type *tp = findtype(argvec[1], 1);
 
-        (void)nargs;
+	(void)nargs;
 	if (tp->t_format != def_format)
 		warnx("%s[warning] format for %s redefined", maybe_loc(), tp->t_name);
 	tp->t_format = copy(argvec[2]);

+ 0 - 0
src/build.cpp


Alguns arquivos não foram mostrados porque muitos arquivos mudaram nesse diff