1 /* $NetBSD: opt_lp.c,v 1.6 2022/04/24 09:04:12 rillig Exp $ */ 2 3 /* 4 * Tests for the options '-lp' and '-nlp'. 5 * 6 * The option '-lp' lines up code surrounded by parentheses in continuation 7 * lines. With '-lp', if a line has a left parenthesis that is not closed on 8 * that line, continuation lines are lined up to start at the character 9 * position just after the left parenthesis. 10 * 11 * The option '-nlp' indents continuation lines with the continuation 12 * indentation; see '-ci'. 13 */ 14 15 //indent input 16 void 17 example(void) 18 { 19 p1 = first_procedure(second_procedure(p2, p3), 20 third_procedure(p4, p5)); 21 22 p1 = first_procedure(second_procedure(p2, 23 p3), 24 third_procedure(p4, 25 p5)); 26 27 p1 = first_procedure( 28 second_procedure(p2, p3), 29 third_procedure(p4, p5)); 30 } 31 //indent end 32 33 //indent run -lp 34 void 35 example(void) 36 { 37 p1 = first_procedure(second_procedure(p2, p3), 38 third_procedure(p4, p5)); 39 40 p1 = first_procedure(second_procedure(p2, 41 p3), 42 third_procedure(p4, 43 p5)); 44 45 p1 = first_procedure( 46 second_procedure(p2, p3), 47 third_procedure(p4, p5)); 48 } 49 //indent end 50 51 //indent run -nlp 52 void 53 example(void) 54 { 55 p1 = first_procedure(second_procedure(p2, p3), 56 third_procedure(p4, p5)); 57 58 p1 = first_procedure(second_procedure(p2, 59 p3), 60 third_procedure(p4, 61 p5)); 62 63 p1 = first_procedure( 64 second_procedure(p2, p3), 65 third_procedure(p4, p5)); 66 } 67 //indent end 68 69 /* 70 * XXX: Combining the options '-nlp' and '-ci4' is counterproductive as the 71 * indentation does not make the nesting level of the function calls visible. 72 */ 73 //indent run -nlp -ci4 74 void 75 example(void) 76 { 77 p1 = first_procedure(second_procedure(p2, p3), 78 third_procedure(p4, p5)); 79 80 p1 = first_procedure(second_procedure(p2, 81 p3), 82 third_procedure(p4, 83 p5)); 84 85 p1 = first_procedure( 86 second_procedure(p2, p3), 87 third_procedure(p4, p5)); 88 } 89 //indent end 90