CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

counting lines of code

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
beaker404



Joined: 24 Jul 2012
Posts: 163

View user's profile Send private message

counting lines of code
PostPosted: Thu Jun 13, 2019 6:44 am     Reply with quote

is there an automated way to count valid code lines in CCS?

CCS 5.064
MPLAB 8.91
Ttelmah



Joined: 11 Mar 2010
Posts: 19545

View user's profile Send private message

PostPosted: Thu Jun 13, 2019 8:15 am     Reply with quote

There isn't really any such 'thing'. After all a remark line is just as much a
valid code line as anything else. Also you can perfectly well put multiple
statements on one physical line. Or have a single statement that stretches
over multiple source lines (using \). The key thing, rather than 'lines', is
'statements'. A statement is a code 'entity' that says to actually do something.
When you compile a program the compiler window shows:

Files, Statements, Time, Lines

The lines value is the number of source lines. Files is how many source
files are involved, Time is how long the compilation took, while 'Statements'
is the total number of separate C statements in the code.

If it disappears too quickly for you to read these, you can change how long this
is displayed from 'Options', 'Project', 'Output Files'. Or from the command line
compiler +Pnn - nn is how many seconds you want it to show for.
beaker404



Joined: 24 Jul 2012
Posts: 163

View user's profile Send private message

PostPosted: Thu Jun 13, 2019 8:33 am     Reply with quote

Thanks.
not sure where/ how to set that in MPLAB interface, compiler config screens in MPLAB will not let me edit the command line.
Ttelmah



Joined: 11 Mar 2010
Posts: 19545

View user's profile Send private message

PostPosted: Thu Jun 13, 2019 9:51 am     Reply with quote

It should allow you to change the line. I've done it in the past.
There should be an 'additional options' box. Try putting -P10 into this.
It should then display the build window for 10 seconds.
Ttelmah



Joined: 11 Mar 2010
Posts: 19545

View user's profile Send private message

PostPosted: Fri Jun 14, 2019 12:30 am     Reply with quote

The issue is using MPLAB....

The standard status window has this data, but when used inside MPLAB
it doesn't show this.

For just the number of lines, there is a plug-in for netbeans at:

<http://plugins.netbeans.org/plugin/68189/line-counter>
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Jun 14, 2019 1:14 am     Reply with quote

It works in MPLAB vs. 8.92 if you add +P10 (not -P10).

It shows Files, Statements, Time, and Lines.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Jun 14, 2019 1:47 am     Reply with quote

beaker404 wrote:
Thanks.
not sure where/ how to set that in MPLAB interface, compiler config screens in MPLAB will not let me edit the command line.

Go through the following menu chain:
Code:

Project
  Build Options
     Click on your project's filename (For me, it's PCH_Test.c ).
       CCS Compiler tab
         Click the box for Alternate Settings. Add +P10 to the end.
             (Make sure there is a space in front of the +P10)
            Click the Apply button
              Click the OK button
                You're done
Ttelmah



Joined: 11 Mar 2010
Posts: 19545

View user's profile Send private message

PostPosted: Fri Jun 14, 2019 3:52 am     Reply with quote

Unfortunately it doesn't work in MPLAB-X.

In this you have Files
Project Properties
Then select from the left hand window Compiler options
Then in 'Option Categories', Compile Status Window
You can specify to keep it open and for how long.
But the window being generated, does not give the data.
beaker404



Joined: 24 Jul 2012
Posts: 163

View user's profile Send private message

PostPosted: Fri Jun 14, 2019 2:50 pm     Reply with quote

Thanks guys. Set up like PCM said.
Sorks great, I am using version 8.91 MPLAB.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group