Commits

Anonymous committed 33b782e

User -C flag to extract comments,
also pass -D__builtin_va_list and -D__attribute__ to cpp.

Comments (0)

Files changed (1)

examples/c-comment.py

 	        for fn in os.listdir('c_files')[:-1]]
 
     for cfn in files:
-	ast = parse_file(cfn, use_cpp=True, cpp_args="-C")
+	ast = parse_file(cfn, use_cpp=True,
+		cpp_args= [ "-C",	# trigger to keep comments	
+		  '-D__builtin_va_list=int',
+		  '-D__attribute__(a)=',
+		]
+	)
 	print "===== %s =====" % cfn 
 	for fn, cmtLst in ast.commentDir.viewitems():
 	    for tkNo, (fl,fc), (tl, tc), comment in cmtLst:
-	    	print "%d %d:%d-%d:%d: %s" % (
-		   tkNo, fl,fc, tl,tc, `comment`)
+	    	print "%d:%s:%d:%d-%d:%d: %s" % (
+		   tkNo, fn, fl,fc, tl,tc, `comment`)