1 diff -c -r bsd_indent/Makefile pg_bsd_indent/Makefile
2 *** bsd_indent/Makefile Wed Oct 26 17:13:34 2011
3 --- pg_bsd_indent/Makefile Wed Oct 12 12:17:12 2011
10 XFLAGS = -Wall -D__RCSID="static char *rcsid=" -D__COPYRIGHT="static char *copyright="
14 $(TARGET) : args.o indent.o io.o lexi.o parse.o pr_comment.o
19 ! TARGET = pg_bsd_indent
20 XFLAGS = -Wall -D__RCSID="static char *rcsid=" -D__COPYRIGHT="static char *copyright="
24 $(TARGET) : args.o indent.o io.o lexi.o parse.o pr_comment.o
28 rm -f *.o $(TARGET) log core
33 install -s -o bin -g bin $(TARGET) /usr/local/bin
36 rm -f *.o $(TARGET) log core
39 install -s -o bin -g bin $(TARGET) /usr/local/bin
40 diff -c -r bsd_indent/README pg_bsd_indent/README
41 *** bsd_indent/README Wed Oct 26 17:13:34 2011
42 --- pg_bsd_indent/README Mon Nov 14 19:30:24 2005
47 + This patch is from NetBSD current, 2005-11-14. It contains all the
48 + patches need for its use in PostgreSQL.
52 + ---------------------------------------------------------------------------
56 This is the C indenter, it originally came from the University of Illinois
57 via some distribution tape for PDP-11 Unix. It has subsequently been
58 hacked upon by James Gosling @ CMU. It isn't very pretty, and really needs
59 diff -c -r bsd_indent/args.c pg_bsd_indent/args.c
60 *** bsd_indent/args.c Wed Oct 26 17:13:34 2011
61 --- pg_bsd_indent/args.c Wed Oct 26 17:16:56 2011
66 #include "indent_globs.h"
68 + #define INDENT_PG_VERSION "1.1"
71 #define PRO_SPECIAL 1 /* special case */
72 #define PRO_BOOL 2 /* boolean */
76 #define STDIN 3 /* use stdin */
77 #define KEY 4 /* type (keyword) */
79 + #define KEY_FILE 5 /* only used for args */
80 + #define VERSION 6 /* only used for args */
82 char *option_source = "?";
84 + void add_typedefs_from_file(char *str);
87 * N.B.: because of the way the table here is scanned, options whose names are
88 * substrings of other options must occur later; that is, with -lp vs -l, -lp
92 "T", PRO_SPECIAL, 0, KEY, 0
95 + "U", PRO_SPECIAL, 0, KEY_FILE, 0
98 + "V", PRO_SPECIAL, 0, VERSION, 0
101 "bacc", PRO_BOOL, false, ON, &blanklines_around_conditional_compilation
111 + if (*param_start == 0)
113 + add_typedefs_from_file(param_start);
118 + printf("pg_bsd_indent %s\n", INDENT_PG_VERSION);
125 indent: set_option: internal error: p_special %d\n", p->p_special);
135 + add_typedefs_from_file(char *str)
140 + if ((file = fopen(param_start, "r")) == NULL)
142 + fprintf(stderr, "indent: cannot open file %s\n", str);
145 + while ((fgets(line, BUFSIZ, file)) != NULL)
147 + /* Remove trailing whitespace */
148 + *(line + strcspn(line, " \t\n\r")) = '\0';
149 + addkey(strdup(line), 4);
153 Only in pg_bsd_indent: args.o
154 Only in pg_bsd_indent: indent.bsd.patch
155 Only in pg_bsd_indent: indent.o
156 diff -c -r bsd_indent/indent_globs.h pg_bsd_indent/indent_globs.h
157 *** bsd_indent/indent_globs.h Wed Oct 26 17:13:34 2011
158 --- pg_bsd_indent/indent_globs.h Mon Nov 14 19:30:24 2005
161 scomf, /* Same line comment font */
162 bodyf; /* major body font */
164 ! #define STACK_SIZE 150
166 EXTERN struct parser_state {
169 scomf, /* Same line comment font */
170 bodyf; /* major body font */
173 ! * This controls the maximum number of 'else if' clauses supported.
174 ! * If it is exceeded, comments are placed in column 100.
176 ! #define STACK_SIZE 1000
178 EXTERN struct parser_state {
180 Only in pg_bsd_indent: io.o
181 diff -c -r bsd_indent/lexi.c pg_bsd_indent/lexi.c
182 *** bsd_indent/lexi.c Wed Oct 26 17:13:34 2011
183 --- pg_bsd_indent/lexi.c Mon Nov 14 19:30:24 2005
189 ! struct templ specials[1000] =
197 ! struct templ specials[16384] =
205 if (p >= specials + sizeof specials / sizeof specials[0])
206 ! return; /* For now, table overflows are silently
214 if (p >= specials + sizeof specials / sizeof specials[0])
216 ! fprintf(stderr, "indent: typedef table overflow\n");
223 Only in pg_bsd_indent: lexi.o
224 diff -c -r bsd_indent/parse.c pg_bsd_indent/parse.c
225 *** bsd_indent/parse.c Wed Oct 26 17:13:34 2011
226 --- pg_bsd_indent/parse.c Mon Nov 14 19:30:24 2005
231 } /* end of switch */
233 + if (ps.tos >= STACK_SIZE) {
234 + fprintf(stderr, "indent: stack size overflow\n");
238 reduce(); /* see if any reduction can be done */
241 Only in pg_bsd_indent: parse.o
242 diff -c -r bsd_indent/pr_comment.c pg_bsd_indent/pr_comment.c
243 *** bsd_indent/pr_comment.c Wed Oct 26 17:13:34 2011
244 --- pg_bsd_indent/pr_comment.c Mon Nov 14 19:30:24 2005
250 ! if (*buf_ptr == '-' || *buf_ptr == '*' || *buf_ptr == '\n') {
251 ps.box_com = true; /* a comment with a '-', '*'
252 * or newline immediately
253 * after the start comment is
259 ! * Don't process '\n' or every comment is treated as a
260 ! * block comment, meaning there is no wrapping.
262 ! if (*buf_ptr == '-' || *buf_ptr == '*') {
263 ps.box_com = true; /* a comment with a '-', '*'
264 * or newline immediately
265 * after the start comment is
271 } while (*buf_ptr == ' ' || *buf_ptr == '\t');
274 + * If there is a blank comment line, we need to prefix
275 + * the line with the same three spaces that "/* " takes up.
276 + * Without this code, blank stared lines in comments have
277 + * three too-many characters on the line when wrapped.
279 + if (s_com == e_com) {
280 + *e_com++ = ' '; /* add blanks for continuation */
286 if (++buf_ptr >= buf_end)
288 Only in pg_bsd_indent: pr_comment.o