.ps64,78.lm0.rm78.nhd 1 CLIST .br CLIST is a crude but effective C source checker and line-numbered listing program. It counts the numbers of matching braces, parentheses, brackets, comments, string quotes, and character quotes, and displays them at the left edge of the listing, along with line numbers. It also flags strings which are continued over an end of line without a backslash. .p0 The command format is: .p8 $ CLIST input__file__spec [list__file__spec] .p0 By default, the listing goes to the user's terminal. Flags at the LHS of the listing indicate the nesting level of the various types of bracket or comment, plus a single-quote (') if within an unmatched character constant, double-quote (") if within a string, and backslash (_\) if the previous line contained a continued string without a backslash continuation mark. .p0 CLIST correctly ignores parentheses and brackets inside comments, strings, and character constants. It will also match comments within comments. (Unlike Whitesmiths' C compiler, to which this is an error!) .b1 2 Example .RM76.b1 This is an example listing on the terminal of a C source program with a large number of unmatched items. The CLIST command used was: .p5 $ CLIST UNMATCHED.C .literal CLIST V2.3. Listing of file unmatched.c on 16-May-1986 at 14:29:54 0{ 0( 0[ 0/* 1 /* This C file is just to test CLIST */ 0{ 0( 0[ 0/* 2 main() 0{ 0( 0[ 0/* 3 { 1{ 0( 0[ 0/* 4 putfmt(" First, we have a\ 1{ 1( 0[ 0/* " 5 string which stretches over several\ 1{ 1( 0[ 0/* " 6 lines to check that all but first are\ 1{ 1( 0[ 0/* " 7 marked with quotes.\ 1{ 1( 0[ 0/* " 8 Check also that the failure of this line 1{ 1( 0[ 0/* "\ 9 to end with \\ is reported (on this line)"; 1{ 1( 0[ 0/* 10 /* Now do the same 1{ 1( 0[ 1/* 11 with comment*/ 1{ 1( 0[ 0/* 12 putch(' /* And also with prime */ 1{ 2( 0[ 0/* ' 13 ') 1{ 1( 0[ 0/* 14 /* Check nesting of {} */ 1{ 1( 0[ 0/* 15 { 2{ 1( 0[ 0/* 16 { 3{ 1( 0[ 0/* 17 { 4{ 1( 0[ 0/* 18 } 3{ 1( 0[ 0/* 19 } 2{ 1( 0[ 0/* 20 } 1{ 1( 0[ 0/* 21 and_also( 1{ 2( 0[ 0/* 22 ( 1{ 3( 0[ 0/* 23 ( 1{ 4( 0[ 0/* 24 ) 1{ 3( 0[ 0/* 25 ) 1{ 2( 0[ 0/* 26 ); 1{ 1( 0[ 0/* 27 and [one 1{ 1( 1[ 0/* 28 [ 1{ 1( 2[ 0/* 29 two[ 1{ 1( 3[ 0/* 30 x] 1{ 1( 2[ 0/* 31 ] 1{ 1( 1[ 0/* 32 ] 1{ 1( 0[ 0/* 33 ] = 0; 1{ 1( 1] 0/* 34 backwards too 1{ 1( 1] 0/* 35 ] 1{ 1( 2] 0/* 36 ] 1{ 1( 3] 0/* 37 [ 1{ 1( 2] 0/* 38 [ 1{ 1( 1] 0/* 39 /* Nested comments 1{ 1( 1] 1/* 40 /* are handled properly 1{ 1( 1] 2/* 41 */ by CLIST 1{ 1( 1] 1/* 42 but don't 1{ 1( 1] 1/* 43 expect Whitesmiths' C to accept them! 1{ 1( 1] 1/* 44 */ 1{ 1( 1] 0/* 45 */ 1{ 1( 1] 1*/ 46 /* 1{ 1( 1] 0/* 47 End with some mismatches 1{ 1( 1] 0/* 48 } 0{ 1( 1] 0/* 49 { 1{ 1( 1] 0/* 50 )) 1{ 1) 1] 0/* 51 [[[ 1{ 1) 2[ 0/* 52 can't do all 1{ 1) 2[ 0/* ' 53 -- testing quote prevents 1{ 1) 2[ 0/* ' 54 doing double-quote or comments %CLIST-W-BRACE, 1 unbalanced brace %CLIST-W-PAREN, -1 unbalanced parentheses %CLIST-W-BRACKET, 2 unbalanced brackets %CLIST-W-CHAR, Unclosed character constant %CLIST-W-CONSTR, 1 string continued without \ .EL