Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/indent indent: rename ps.curr_newline to next_col_1



details:   https://anonhg.NetBSD.org/src/rev/334ae17e350b
branches:  trunk
changeset: 1024795:334ae17e350b
user:      rillig <rillig%NetBSD.org@localhost>
date:      Fri Nov 05 19:33:28 2021 +0000

description:
indent: rename ps.curr_newline to next_col_1

For symmetry with ps.curr_col_1.

No functional change.

diffstat:

 tests/usr.bin/indent/token_comment.c |   4 ++--
 usr.bin/indent/indent.c              |   6 +++---
 usr.bin/indent/indent.h              |   4 ++--
 usr.bin/indent/lexi.c                |  14 +++++++-------
 usr.bin/indent/pr_comment.c          |  10 +++++-----
 5 files changed, 19 insertions(+), 19 deletions(-)

diffs (166 lines):

diff -r 27629fa20f11 -r 334ae17e350b tests/usr.bin/indent/token_comment.c
--- a/tests/usr.bin/indent/token_comment.c      Fri Nov 05 15:18:18 2021 +0000
+++ b/tests/usr.bin/indent/token_comment.c      Fri Nov 05 19:33:28 2021 +0000
@@ -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
diff -r 27629fa20f11 -r 334ae17e350b usr.bin/indent/indent.c
--- a/usr.bin/indent/indent.c   Fri Nov 05 15:18:18 2021 +0000
+++ b/usr.bin/indent/indent.c   Fri Nov 05 19:33:28 2021 +0000
@@ -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 @@
 
 #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 @@
 
     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)
diff -r 27629fa20f11 -r 334ae17e350b usr.bin/indent/indent.h
--- a/usr.bin/indent/indent.h   Fri Nov 05 15:18:18 2021 +0000
+++ b/usr.bin/indent/indent.h   Fri Nov 05 19:33:28 2021 +0000
@@ -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 @@
     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 */
 
diff -r 27629fa20f11 -r 334ae17e350b usr.bin/indent/lexi.c
--- a/usr.bin/indent/lexi.c     Fri Nov 05 15:18:18 2021 +0000
+++ b/usr.bin/indent/lexi.c     Fri Nov 05 19:33:28 2021 +0000
@@ -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 @@
 
 #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_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 @@
 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 @@
     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 @@
 
     case '\f':
        unary_delim = ps.next_unary;
-       ps.curr_newline = true;
+       ps.next_col_1 = true;
        lsym = lsym_form_feed;
        break;
 
diff -r 27629fa20f11 -r 334ae17e350b usr.bin/indent/pr_comment.c
--- a/usr.bin/indent/pr_comment.c       Fri Nov 05 15:18:18 2021 +0000
+++ b/usr.bin/indent/pr_comment.c       Fri Nov 05 19:33:28 2021 +0000
@@ -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 @@
 
 #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 @@
            }
 
            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 @@
                    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 @@
                    break;
            }
 
-           ps.curr_newline = false;
+           ps.next_col_1 = false;
 
            if (now_len <= adj_max_line_length || !may_wrap)
                break;



Home | Main Index | Thread Index | Old Index