Home | History | Annotate | Line # | Download | only in indent
      1 /* $NetBSD: opt_c.c,v 1.4 2022/04/24 09:04:12 rillig Exp $ */
      2 
      3 /*
      4  * Tests for the option '-c', which specifies the column in which the comments
      5  * to the right of the code start.
      6  */
      7 
      8 //indent input
      9 bool
     10 is_prime(int n)
     11 {
     12 	if (n <= 3)
     13 		return n >= 2; /* special case */
     14 	if (n % 2 == 0)
     15 		return false;				/* even numbers */
     16 	return true;
     17 }
     18 //indent end
     19 
     20 //indent run -c49
     21 bool
     22 is_prime(int n)
     23 {
     24 	if (n <= 3)
     25 		return n >= 2;			/* special case */
     26 	if (n % 2 == 0)
     27 		return false;			/* even numbers */
     28 	return true;
     29 }
     30 //indent end
     31 
     32 /*
     33  * If the code is too wide to allow the comment in its preferred column, it is
     34  * nevertheless indented with a single tab, to keep multiple comments
     35  * vertically aligned.
     36  */
     37 //indent run -c9
     38 bool
     39 is_prime(int n)
     40 {
     41 	if (n <= 3)
     42 		return n >= 2;	/* special case */
     43 	if (n % 2 == 0)
     44 		return false;	/* even numbers */
     45 	return true;
     46 }
     47 //indent end
     48 
     49 /*
     50  * Usually, comments are aligned at a tabstop, but indent can also align them
     51  * at any other column.
     52  */
     53 //indent run -c37
     54 bool
     55 is_prime(int n)
     56 {
     57 	if (n <= 3)
     58 		return n >= 2;	    /* special case */
     59 	if (n % 2 == 0)
     60 		return false;	    /* even numbers */
     61 	return true;
     62 }
     63 //indent end
     64