View previous topic :: View next topic |
Author |
Message |
beaker404
Joined: 24 Jul 2012 Posts: 163
|
counting lines of code |
Posted: Thu Jun 13, 2019 6:44 am |
|
|
is there an automated way to count valid code lines in CCS?
CCS 5.064
MPLAB 8.91 |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah
Joined: 11 Mar 2010 Posts: 19381
|
|
Posted: Thu Jun 13, 2019 8:15 am |
|
|
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. |
|
![](templates/subSilver/images/spacer.gif) |
beaker404
Joined: 24 Jul 2012 Posts: 163
|
|
Posted: Thu Jun 13, 2019 8:33 am |
|
|
Thanks.
not sure where/ how to set that in MPLAB interface, compiler config screens in MPLAB will not let me edit the command line. |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah
Joined: 11 Mar 2010 Posts: 19381
|
|
Posted: Thu Jun 13, 2019 9:51 am |
|
|
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. |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah
Joined: 11 Mar 2010 Posts: 19381
|
|
Posted: Fri Jun 14, 2019 12:30 am |
|
|
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> |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Jun 14, 2019 1:14 am |
|
|
It works in MPLAB vs. 8.92 if you add +P10 (not -P10).
It shows Files, Statements, Time, and Lines. |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Jun 14, 2019 1:47 am |
|
|
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 |
|
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah
Joined: 11 Mar 2010 Posts: 19381
|
|
Posted: Fri Jun 14, 2019 3:52 am |
|
|
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. |
|
![](templates/subSilver/images/spacer.gif) |
beaker404
Joined: 24 Jul 2012 Posts: 163
|
|
Posted: Fri Jun 14, 2019 2:50 pm |
|
|
Thanks guys. Set up like PCM said.
Sorks great, I am using version 8.91 MPLAB. |
|
![](templates/subSilver/images/spacer.gif) |
|