Module Name: src Committed By: rillig Date: Fri Nov 5 19:33:29 UTC 2021
Modified Files: src/tests/usr.bin/indent: token_comment.c src/usr.bin/indent: indent.c indent.h lexi.c pr_comment.c Log Message: indent: rename ps.curr_newline to next_col_1 For symmetry with ps.curr_col_1. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/tests/usr.bin/indent/token_comment.c cvs rdiff -u -r1.207 -r1.208 src/usr.bin/indent/indent.c cvs rdiff -u -r1.76 -r1.77 src/usr.bin/indent/indent.h cvs rdiff -u -r1.129 -r1.130 src/usr.bin/indent/lexi.c cvs rdiff -u -r1.96 -r1.97 src/usr.bin/indent/pr_comment.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/tests/usr.bin/indent/token_comment.c diff -u src/tests/usr.bin/indent/token_comment.c:1.17 src/tests/usr.bin/indent/token_comment.c:1.18 --- src/tests/usr.bin/indent/token_comment.c:1.17 Thu Nov 4 18:38:37 2021 +++ src/tests/usr.bin/indent/token_comment.c Fri Nov 5 19:33:28 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: token_comment.c,v 1.17 2021/11/04 18:38:37 rillig Exp $ */ +/* $NetBSD: token_comment.c,v 1.18 2021/11/05 19:33:28 rillig Exp $ */ /* $FreeBSD$ */ /* @@ -41,7 +41,7 @@ * - with varying opt.comment_column (-c0, -c1, -c33, -c80) * - with varying opt.decl_comment_column (-cd0, -cd1, -cd20, -cd33, -cd80) * - with/without ps.decl_on_line - * - with/without ps.curr_newline + * - with/without ps.next_col_1 * * - very long comments that overflow the buffer 'com' * - comments that come from save_com Index: src/usr.bin/indent/indent.c diff -u src/usr.bin/indent/indent.c:1.207 src/usr.bin/indent/indent.c:1.208 --- src/usr.bin/indent/indent.c:1.207 Thu Nov 4 20:31:04 2021 +++ src/usr.bin/indent/indent.c Fri Nov 5 19:33:28 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: indent.c,v 1.207 2021/11/04 20:31:04 rillig Exp $ */ +/* $NetBSD: indent.c,v 1.208 2021/11/05 19:33:28 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -43,7 +43,7 @@ static char sccsid[] = "@(#)indent.c 5.1 #include <sys/cdefs.h> #if defined(__NetBSD__) -__RCSID("$NetBSD: indent.c,v 1.207 2021/11/04 20:31:04 rillig Exp $"); +__RCSID("$NetBSD: indent.c,v 1.208 2021/11/05 19:33:28 rillig Exp $"); #elif defined(__FreeBSD__) __FBSDID("$FreeBSD: head/usr.bin/indent/indent.c 340138 2018-11-04 19:24:49Z oshogbo $"); #endif @@ -513,7 +513,7 @@ main_init_globals(void) ps.s_sym[0] = psym_stmt_list; ps.prev_token = lsym_semicolon; - ps.curr_newline = true; + ps.next_col_1 = true; const char *suffix = getenv("SIMPLE_BACKUP_SUFFIX"); if (suffix != NULL) Index: src/usr.bin/indent/indent.h diff -u src/usr.bin/indent/indent.h:1.76 src/usr.bin/indent/indent.h:1.77 --- src/usr.bin/indent/indent.h:1.76 Wed Nov 3 21:47:35 2021 +++ src/usr.bin/indent/indent.h Fri Nov 5 19:33:28 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: indent.h,v 1.76 2021/11/03 21:47:35 rillig Exp $ */ +/* $NetBSD: indent.h,v 1.77 2021/11/05 19:33:28 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD @@ -263,9 +263,9 @@ extern struct parser_state { lexer_symbol prev_token; bool prev_is_type; bool curr_is_type; - bool curr_newline; bool curr_col_1; /* whether the current token started in column * 1 of the unformatted input */ + bool next_col_1; bool next_unary; /* whether the following operator should be * unary */ Index: src/usr.bin/indent/lexi.c diff -u src/usr.bin/indent/lexi.c:1.129 src/usr.bin/indent/lexi.c:1.130 --- src/usr.bin/indent/lexi.c:1.129 Mon Nov 1 23:44:08 2021 +++ src/usr.bin/indent/lexi.c Fri Nov 5 19:33:28 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: lexi.c,v 1.129 2021/11/01 23:44:08 rillig Exp $ */ +/* $NetBSD: lexi.c,v 1.130 2021/11/05 19:33:28 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -43,7 +43,7 @@ static char sccsid[] = "@(#)lexi.c 8.1 ( #include <sys/cdefs.h> #if defined(__NetBSD__) -__RCSID("$NetBSD: lexi.c,v 1.129 2021/11/01 23:44:08 rillig Exp $"); +__RCSID("$NetBSD: lexi.c,v 1.130 2021/11/05 19:33:28 rillig Exp $"); #elif defined(__FreeBSD__) __FBSDID("$FreeBSD: head/usr.bin/indent/lexi.c 337862 2018-08-15 18:19:45Z pstef $"); #endif @@ -294,7 +294,7 @@ debug_lexi(lexer_symbol lsym) debug_println(" ps.prev_token = %s", lsym_name(ps.prev_token)); debug_ps_bool(prev_is_type); - debug_ps_bool(curr_newline); + debug_ps_bool(next_col_1); debug_ps_bool(curr_col_1); debug_ps_bool(next_unary); // procname @@ -546,8 +546,8 @@ lexer_symbol lexi(void) { token.e = token.s; - ps.curr_col_1 = ps.curr_newline; - ps.curr_newline = false; + ps.curr_col_1 = ps.next_col_1; + ps.next_col_1 = false; ps.prev_is_type = ps.curr_is_type; ps.curr_is_type = false; @@ -573,7 +573,7 @@ lexi(void) switch (*token.s) { case '\n': unary_delim = ps.next_unary; - ps.curr_newline = true; + ps.next_col_1 = true; /* if data has been exhausted, the newline is a dummy. */ lsym = had_eof ? lsym_eof : lsym_newline; break; @@ -627,7 +627,7 @@ lexi(void) case '\f': unary_delim = ps.next_unary; - ps.curr_newline = true; + ps.next_col_1 = true; lsym = lsym_form_feed; break; Index: src/usr.bin/indent/pr_comment.c diff -u src/usr.bin/indent/pr_comment.c:1.96 src/usr.bin/indent/pr_comment.c:1.97 --- src/usr.bin/indent/pr_comment.c:1.96 Thu Nov 4 18:38:37 2021 +++ src/usr.bin/indent/pr_comment.c Fri Nov 5 19:33:28 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: pr_comment.c,v 1.96 2021/11/04 18:38:37 rillig Exp $ */ +/* $NetBSD: pr_comment.c,v 1.97 2021/11/05 19:33:28 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -43,7 +43,7 @@ static char sccsid[] = "@(#)pr_comment.c #include <sys/cdefs.h> #if defined(__NetBSD__) -__RCSID("$NetBSD: pr_comment.c,v 1.96 2021/11/04 18:38:37 rillig Exp $"); +__RCSID("$NetBSD: pr_comment.c,v 1.97 2021/11/05 19:33:28 rillig Exp $"); #elif defined(__FreeBSD__) __FBSDID("$FreeBSD: head/usr.bin/indent/pr_comment.c 334927 2018-06-10 16:44:18Z pstef $"); #endif @@ -233,7 +233,7 @@ copy_comment(int adj_max_line_length, bo } last_blank = -1; - if (!may_wrap || ps.curr_newline) { /* if this is a boxed comment, + if (!may_wrap || ps.next_col_1) { /* if this is a boxed comment, * we handle the newline */ if (com.s == com.e) com_add_char(' '); @@ -246,7 +246,7 @@ copy_comment(int adj_max_line_length, bo com_add_delim(); } else { - ps.curr_newline = true; + ps.next_col_1 = true; if (!ch_isblank(com.e[-1])) com_add_char(' '); last_blank = com.e - 1 - com.buf; @@ -311,7 +311,7 @@ copy_comment(int adj_max_line_length, bo break; } - ps.curr_newline = false; + ps.next_col_1 = false; if (now_len <= adj_max_line_length || !may_wrap) break;