NO

Author Topic: Line Counter Add-IN  (Read 16663 times)

Offline John Z

  • Member
  • *
  • Posts: 790
Re: Line Counter Add-IN
« Reply #30 on: May 27, 2021, 12:18:41 PM »
Tweak, tweak, tweak  :)

Here is a version that adds function count to the output.  It may miss some under certain circumstances but I'm still improving it.  Also this version enhances .asm processing using Grincheux's wiw.asm as a reference example.

Code: [Select]
File name:C:\Program Files\PellesC\Files\LCounter\Line_Count.c
 Start Line:1, End Line:892
  Total Lines : 892
  Empty Lines : 103
  Lone { : 62
  Lone } : 77
  All { : 118
  All } : 117
  Comment Lines : 199
  Code Lines : 439
  Functions : 12

John Z
« Last Edit: June 10, 2021, 03:05:16 PM by John Z »

Offline John Z

  • Member
  • *
  • Posts: 790
Re: Line Counter Add-IN
« Reply #31 on: June 03, 2021, 05:17:49 PM »
Updated with another feature.  It can now enumerate the user defined functions from the code procedures section if desired.
Code: [Select]
File name:C:\Program Files\PellesC\Files\LCounter\Line_Count.c
 Start Line:1, End Line:1114
  Total Lines : 1114
  Empty Lines : 136
  Lone { : 67
  Lone } : 86
  All { : 152
  All } : 151
  Comment Lines : 268
  Code Lines : 541
  Functions : 16
1111 AddToList
1077 Extract_PName
1030 Extract_FName
1004 EnumProjFileCallback
914 OutputFileInfo
850 CheckForCall
783 CheckForFunction
732 CheckForContinue
695 Trailing_WTrim
678 Leading_WTrim
507 Parse_ASM
304 Parse_C
188 PreParse
136 AddInCommandEx
92 AddInMain
64 DllMain
For C code the number is the line number for the start of the procedure.  For ASM the line number is the END of the PROC ie. ENDP line.

John Z
« Last Edit: June 10, 2021, 03:05:36 PM by John Z »

Grincheux

  • Guest
Re: Line Counter Add-IN
« Reply #32 on: June 03, 2021, 07:58:20 PM »
GENIAL :D ;) ;D :D ;) :) ;D :D ;) :)

Quote
File name:C:\Users\51966\Documents\Pelles C Projects\ImgView\ImgView.asm
 Start Line:1, End Line:1690
  Total Lines   : 1690
  Empty Lines   : 385
  .Const       : 4
  .Data       : 178
  Lone Labels     : 25
  Comment Lines   : 109
  Code Lines   : 989
  Functions   : 12
1685   Start
1468   WinMain
1346   WndProc
1244   WmCreate
1034   WmSize
951   WmCommand
897   SearchFiles
615   WriteToDataBase
586   CreateTheToolBar
506   Profile_Write
417   Profile_Read
338   Error
File name:C:\Users\51966\Documents\Pelles C Projects\ImgView\ImgView.inc
 Start Line:1, End Line:95
  Total Lines   : 95
  Empty Lines   : 23
  Code Lines   : 72
File name:C:\Users\51966\Documents\Pelles C Projects\ImgView\libgfl.inc
 Start Line:1, End Line:307
  Total Lines   : 307
  Empty Lines   : 33
  Code Lines   : 274

*Summary results*
  Total Lines   : 2092
  Empty Lines   : 441
  .Data       : 178
  Lone Labels     : 25
  Comment Lines   : 109
  Code Lines   : 1335
  Functions   : 12

Grincheux

  • Guest
Re: Line Counter Add-IN
« Reply #33 on: June 04, 2021, 04:05:37 AM »
For four tests.

Offline John Z

  • Member
  • *
  • Posts: 790
Re: Line Counter Add-IN
« Reply #34 on: June 04, 2021, 11:41:47 AM »

Offline John Z

  • Member
  • *
  • Posts: 790
Re: Line Counter Add-IN
« Reply #35 on: June 07, 2021, 04:19:52 PM »
Sample output with 'FlowTrace' enabled in a new beta version of the LineCounter Add-In.  Project source for the testing was an old version of Sir Grincheux's ImageTools.prj.  It has 40 source files ….

Is this output analysis useful?  Maybe should be it's own add-in, but 'just' counting lines would probably not be a highly used add-in....

John Z

P.S. To skip to the FlowTrace section just search the file for FlowTrace, it is at the end

removed old attachment to free upload space
« Last Edit: August 17, 2022, 04:27:01 PM by John Z »

Grincheux

  • Guest
Re: Line Counter Add-IN
« Reply #36 on: June 07, 2021, 10:05:45 PM »
Bravo


Great Work.
That is very complete now.
Take some vacations, you must be tired after sur a work.


I am very pleased that my source files could help you.


The PoLink does not gives results as your addin and I must say that is missing and gives a great help for a programmer.
This afternoon, I was searching for a function int a project I must say that I would have appreciate to have your tool.


Bravo John.

Offline John Z

  • Member
  • *
  • Posts: 790
Re: Line Counter Add-IN
« Reply #37 on: June 08, 2021, 04:04:51 PM »
Very kind words - thank you.

Here is a sample run on WiW.asm. 

Working on possible output improvements and features to be more informative so not quite ready for prime time, currently useful,  but to borrow from you "Never be pleased, always improve"  :)

John Z

Grincheux

  • Guest
Re: Line Counter Add-IN
« Reply #38 on: June 08, 2021, 04:08:47 PM »
As would say a great coffee drinker : What else?


PERFECT for C and for ASM

Offline John Z

  • Member
  • *
  • Posts: 790
Re: Line Counter Add-IN
« Reply #39 on: June 10, 2021, 03:02:27 PM »
Newer version but still not quite where I want to leave it.  'FlowTrace' now functional for ASM files.

Code: [Select]
File name:C:\Program Files\PellesC\Files\WiW\WiW.asm
 Start Line:1, End Line:2326
  Total Lines : 2326
  Empty Lines : 387
  .Const : 10
  .Data : 71
  Lone Labels  : 50
  Comment Lines : 221
  Code Lines : 1587
  Functions : 15
---------
189 EnumWindowsProc
537 EnumChildrenWindowsProc
880 CompareFunc
988 SearchWindows
1023 SearchChildrenWindows
1063 WmCommand
1128 WmSize
1167 WmSizeChildren
1206 WmCreateChildren
1465 CreateTheChildWindow
1510 WndChildProc
1668 WmCreate
1945 WndProc
2131 WinMain
2271 Start

FlowTrace
File name:C:\Program Files\PellesC\Files\WiW\WiW.asm
Calls under Procedure EnumWindowsProc
Calls under Procedure EnumChildrenWindowsProc
Calls under Procedure CompareFunc
Calls under Procedure SearchWindows
Calls under Procedure SearchChildrenWindows
Calls under Procedure WmCommand
Function [SearchWindows] on line 1093
Calls under Procedure WmSize
Calls under Procedure WmSizeChildren
Function [WmSize] on line 1167
Function [WmCreate] on line 1206
Function [SearchChildrenWindows] on line 1442
Calls under Procedure CreateTheChildWindow
Calls under Procedure WndChildProc
Function [WmSize] on line 1523
Function [WmCreate] on line 1526
Function [CreateTheChildWindow] on line 1597
Function [WmSizeChildren] on line 1637
Function [WmCreate] on line 1642
Calls under Procedure WmCreate
Function [SearchWindows] on line 1923
Calls under Procedure WndProc
Function [WmCommand] on line 1957
Function [WmSize] on line 1960
Function [WmCreate] on line 1966
Function [CreateTheChildWindow] on line 2039
Function [WmSize] on line 2078
Function [WmCommand] on line 2085
Function [WmCreate] on line 2092
Calls under Procedure WinMain
Calls under Procedure Start
Function [WinMain] on line 2317


John Z

« Last Edit: June 13, 2021, 01:37:19 PM by John Z »

Grincheux

  • Guest
Re: Line Counter Add-IN
« Reply #40 on: June 10, 2021, 04:27:36 PM »
Very Fast

Quote
File name:C:\Users\51966\Documents\Pelles C Projects\ImgView\Images.c
 Start Line:1, End Line:426
  Total Lines   : 426
  Empty Lines   : 99
  Lone {      : 29
  Lone }      : 27
  All {      : 29
  All }      : 29
  Comment Lines   : 15
  Code Lines   : 251
  Functions   : 5
---------
93   Dec2Hex
130   Sph_Keccak_256
142   ImageResize
185   LoadImageFromFile
282   LoadImageFromFileEx
File name:C:\Users\51966\Documents\Pelles C Projects\ImgView\ImgView.asm
 Start Line:1, End Line:3785
  Total Lines   : 3785
  Empty Lines   : 712
  .Const       : 179
  .Data       : 31
  Lone Labels     : 83
  Comment Lines   : 376
  Code Lines   : 2404
  Functions   : 21
---------
298   Error
314   Delete_Error
336   Delete_Warning
359   MyBrowseCallbackProc
379   BrowseForFolder
428   Profile_Read
564   Profile_Write
736   DeleteFiles_Common
969   DeleteFiles
1297   CreateTheToolBar
1379   WriteToDataBase
1443   SearchFiles
1880   DeleteDuplicatedFiles
2015   DlgSortProc
2541   SortImages
2912   WmCommand
3028   WmSize
3119   WmCreate
3338   WndProc
3450   WinMain
3574   Start

*Summary results*
  Total Lines   : 4211
  Empty Lines   : 811
  Lone {      : 29
  Lone }      : 27
  All {      : 29
  All }      : 29
  .Data       : 31
  Lone Labels     : 83
  Comment Lines   : 391
  Code Lines   : 2655
  Functions   : 26
---------
  End Functions   : 21
---------
* Possible parse error PROC & ENDP counts are unequal. *
 

FlowTrace
File name:C:\Users\51966\Documents\Pelles C Projects\ImgView\Images.c
Calls under Procedure Dec2Hex
Calls under Procedure Sph_Keccak_256
Function [Dec2Hex] on line 137
Calls under Procedure ImageResize
Calls under Procedure LoadImageFromFile
Function [ImageResize] on line 241
Calls under Procedure LoadImageFromFileEx
Function [LoadImageFromFile] on line 282
Function [ImageResize] on line 370
Function [Sph_Keccak_256] on line 374

FlowTrace
File name:C:\Users\51966\Documents\Pelles C Projects\ImgView\ImgView.asm
Calls under Procedure Error
Calls under Procedure Delete_Error
Function [Error] on line 314
Calls under Procedure Delete_Warning
Calls under Procedure MyBrowseCallbackProc
Function [MyBrowseCallbackProc] on line 375
Calls under Procedure BrowseForFolder
Function [MyBrowseCallbackProc] on line 394
Function [BrowseForFolder] on line 398
Calls under Procedure Profile_Read
Calls under Procedure Profile_Write
Function [DeleteFiles] on line 736
Function [Delete_Error] on line 770
Function [Delete_Error] on line 792
Function [Delete_Error] on line 806
Function [Delete_Error] on line 844
Function [Delete_Error] on line 872
Function [Delete_Error] on line 891
Function [Delete_Error] on line 924
Calls under Procedure DeleteFiles
Function [DeleteFiles] on line 1061
Function [DeleteFiles] on line 1194
Function [Delete_Warning] on line 1245
Function [Delete_Warning] on line 1258
Function [Delete_Warning] on line 1271
Function [Delete_Error] on line 1278
Function [Delete_Error] on line 1285
Calls under Procedure CreateTheToolBar
Calls under Procedure WriteToDataBase
Calls under Procedure SearchFiles
Function [LoadImageFromFile] on line 1741
Function [WriteToDataBase] on line 1768
Calls under Procedure DeleteDuplicatedFiles
Function [Error] on line 1908
Function [Error] on line 1925
Function [Error] on line 1994
Calls under Procedure DlgSortProc
Function [WmCommand] on line 2034
Calls under Procedure SortImages
Function [Error] on line 2809
Function [Error] on line 2832
Calls under Procedure WmCommand
Function [DeleteDuplicatedFiles] on line 2927
Function [SortImages] on line 2933
Function [BrowseForFolder] on line 2944
Function [SortImages] on line 2971
Function [DeleteFiles] on line 2979
Function [DeleteDuplicatedFiles] on line 2987
Calls under Procedure WmSize
Calls under Procedure WmCreate
Function [CreateTheToolBar] on line 3151
Calls under Procedure WndProc
Function [WmCommand] on line 3348
Function [WmSize] on line 3351
Function [WmCreate] on line 3357
Function [WmSize] on line 3400
Function [WmCommand] on line 3408
Function [WmCreate] on line 3416
Calls under Procedure WinMain
Calls under Procedure Start
Function [Error] on line 3581
Function [Profile_Read] on line 3662
Function [Error] on line 3703
Function [Error] on line 3718
Function [WinMain] on line 3741
Function [Profile_Write] on line 3743

*Summary results*
  Total Lines   : 4211
  Empty Lines   : 811
  Lone {      : 29
  Lone }      : 27
  All {      : 29
  All }      : 29
  .Data       : 31
  Lone Labels     : 83
  Comment Lines   : 391
  Code Lines   : 2655
  Functions   : 26
---------
  End Functions   : 21
---------
* Possible parse error PROC & ENDP counts are unequal. *

 

3786 lines in ImgView.asm
Thank You


« Last Edit: June 10, 2021, 04:29:16 PM by Grincheux »

Offline John Z

  • Member
  • *
  • Posts: 790
Re: Line Counter Add-IN
« Reply #41 on: June 10, 2021, 06:29:55 PM »
Oops I see one mistake, for asm I compare PROC and ENDP as a double check, but I've added both C and ASM functions together for totals.
That is why
Code: [Select]
  Functions   : 26  <-5 from preceding C code
---------
  End Functions   : 21
---------
* Possible parse error PROC & ENDP counts are unequal. *

Thanks for the testing!  version 1.6 will fix that  :)

John Z

Offline John Z

  • Member
  • *
  • Posts: 790
Re: Line Counter Add-IN
« Reply #42 on: June 13, 2021, 01:34:13 PM »
A new version with more fixes.  Fixed the end count issue.  Also found the ASM parse was being fooled by labels using the same name as PROCs but with an @ in front.  Well labels are not 'calls' so I've fixed that with more robust checking of the proc name.  Output verified with WiW.asm.  I think it is looking useful.   Still considering next steps as possibly being graphic....

John Z

removed old version attachment to free upload space
« Last Edit: August 17, 2022, 04:29:15 PM by John Z »

Grincheux

  • Guest
Re: Line Counter Add-IN
« Reply #43 on: June 13, 2021, 03:53:36 PM »
WiW

Quote
File name:C:\Users\51966\Documents\Pelles C Projects\WiW\WiW.asm
 Start Line:1, End Line:2134
  Total Lines   : 2134
  Empty Lines   : 395
  .Const       : 10
  .Data       : 69
  Lone Labels     : 53
  Comment Lines   : 208
  Code Lines   : 1399
  Functions   : 16
---------
194   EnumWindowsProc
540   EnumChildrenWindowsProc
881   CompareFunc
988   SearchWindows
1023   SearchChildrenWindows
1072   WmCommand
1137   WmSize
1176   WmSizeChildren
1218   InsertColumns
1475   WmCreateChildren
1498   CreateTheChildWindow
1543   WndChildProc
1718   WmCreate
1763   WndProc
1948   WinMain
2088   Start
File name:C:\Users\51966\Documents\Pelles C Projects\WiW\Convert.c
 Start Line:1, End Line:76
  Total Lines   : 76
  Empty Lines   : 18
  Lone {      : 9
  Lone }      : 9
  All {      : 9
  All }      : 9
  Comment Lines   : 3
  Code Lines   : 34
  Functions   : 3
---------
7   Convert
28   EnableWindowsPrivilege
53   DisableWindowsPrivilege

*Summary results*
  Total Lines   : 2210
  Empty Lines   : 413
  Lone {      : 9
  Lone }      : 9
  All {      : 9
  All }      : 9
  .Data       : 69
  Lone Labels     : 53
  Comment Lines   : 211
  Code Lines   : 1433
  Functions   : 19
---------

FlowTrace
File name:C:\Users\51966\Documents\Pelles C Projects\WiW\WiW.asm
  Calls under Procedure EnumWindowsProc
Function [EnableWindowsPrivilege] on line 384
Function [DisableWindowsPrivilege] on line 462
  Calls under Procedure EnumChildrenWindowsProc
  Calls under Procedure CompareFunc
Function [Convert] on line 932
Function [Convert] on line 940
  Calls under Procedure SearchWindows
  Calls under Procedure SearchChildrenWindows
  Calls under Procedure WmCommand
Function [SearchWindows] on line 1102
  Calls under Procedure WmSize
  Calls under Procedure WmSizeChildren
  Calls under Procedure InsertColumns
  Calls under Procedure WmCreateChildren
Function [InsertColumns] on line 1479
Function [SearchChildrenWindows] on line 1485
  Calls under Procedure CreateTheChildWindow
  Calls under Procedure WndChildProc
Function [CreateTheChildWindow] on line 1641
Function [WmSizeChildren] on line 1687
Function [WmCreateChildren] on line 1692
  Calls under Procedure WmCreate
Function [InsertColumns] on line 1745
Function [SearchWindows] on line 1750
  Calls under Procedure WndProc
Function [CreateTheChildWindow] on line 1856
Function [WmSize] on line 1895
Function [WmCommand] on line 1902
Function [WmCreate] on line 1909
  Calls under Procedure WinMain
  Calls under Procedure Start
Function [WinMain] on line 2125

FlowTrace
File name:C:\Users\51966\Documents\Pelles C Projects\WiW\Convert.c
  Calls under Procedure Convert
  Calls under Procedure EnableWindowsPrivilege
  Calls under Procedure DisableWindowsPrivilege


ImgView
Quote

File name:C:\Users\51966\Documents\Pelles C Projects\ImgView\ImgView.asm
 Start Line:1, End Line:4257
  Total Lines   : 4257
  Empty Lines   : 779
  .Const       : 184
  .Data       : 31
  Lone Labels     : 102
  Comment Lines   : 441
  Code Lines   : 2720
  Functions   : 26
---------
294   Error
310   Delete_Error
332   Delete_Warning
354   MyBrowseCallbackProc
374   BrowseForFolder
423   Profile_Read
559   Profile_Write
731   DeleteFiles_Common
964   DeleteFiles
1292   CreateTheToolBar
1374   WriteToDataBase
1431   SearchFiles
1862   DeleteDuplicatedFiles
1995   DlgSortProc
2521   SortImages
2890   PaintFullScreen
2919   FullScreenProc
2978   LivstViewDoubleClick
3142   PhotoFiltre
3269   EditFile
3396   WmCommand
3521   WmSize
3612   WmCreate
3817   WndProc
3918   WinMain
4059   Start
File name:C:\Users\51966\Documents\Pelles C Projects\ImgView\ImgView.inc
 Start Line:1, End Line:111
  Total Lines   : 111
  Empty Lines   : 31
  Code Lines   : 76
  Functions   : 4
---------
25   dup
32   dup
38   dup
81   dup

*Summary results*
  Total Lines   : 4368
  Empty Lines   : 810
  .Data       : 31
  Lone Labels     : 102
  Comment Lines   : 441
  Code Lines   : 2796
  Functions   : 30
---------

FlowTrace
File name:C:\Users\51966\Documents\Pelles C Projects\ImgView\ImgView.asm
  Calls under Procedure Error
  Calls under Procedure Delete_Error
Function [Error] on line 310
  Calls under Procedure Delete_Warning
  Calls under Procedure MyBrowseCallbackProc
  Calls under Procedure BrowseForFolder
Function [MyBrowseCallbackProc] on line 389
  Calls under Procedure Profile_Read
  Calls under Procedure Profile_Write
  Calls under Procedure DeleteFiles_Common
Function [Delete_Error] on line 765
Function [Delete_Error] on line 787
Function [Delete_Error] on line 801
Function [Delete_Error] on line 839
Function [Delete_Error] on line 867
Function [Delete_Error] on line 886
Function [Delete_Error] on line 919
  Calls under Procedure DeleteFiles
Function [DeleteFiles] on line 1056
Function [DeleteFiles] on line 1189
Function [Delete_Warning] on line 1240
Function [Delete_Warning] on line 1253
Function [Delete_Warning] on line 1266
Function [Delete_Error] on line 1273
Function [Delete_Error] on line 1280
  Calls under Procedure CreateTheToolBar
  Calls under Procedure WriteToDataBase
  Calls under Procedure SearchFiles
Function [WriteToDataBase] on line 1758
  Calls under Procedure DeleteDuplicatedFiles
Function [Error] on line 1906
Function [Error] on line 1974
  Calls under Procedure DlgSortProc
  Calls under Procedure SortImages
Function [Error] on line 2788
Function [Error] on line 2810
  Calls under Procedure PaintFullScreen
  Calls under Procedure FullScreenProc
Function [PaintFullScreen] on line 2941
  Calls under Procedure LivstViewDoubleClick
Function [Error] on line 3024
Function [Error] on line 3046
Function [Error] on line 3060
  Calls under Procedure PhotoFiltre
Function [Error] on line 3192
Function [Error] on line 3206
  Calls under Procedure EditFile
Function [PhotoFiltre] on line 3335
Function [PhotoFiltre] on line 3383
  Calls under Procedure WmCommand
Function [EditFile] on line 3433
Function [BrowseForFolder] on line 3437
Function [SortImages] on line 3464
Function [DeleteFiles] on line 3472
Function [DeleteDuplicatedFiles] on line 3480
  Calls under Procedure WmSize
  Calls under Procedure WmCreate
Function [CreateTheToolBar] on line 3642
  Calls under Procedure WndProc
Function [LivstViewDoubleClick] on line 3864
Function [WmSize] on line 3874
Function [WmCommand] on line 3880
Function [WmCreate] on line 3886
  Calls under Procedure WinMain
  Calls under Procedure Start
Function [Profile_Read] on line 4138
Function [Error] on line 4178
Function [Error] on line 4192
Function [WinMain] on line 4213
Function [Profile_Write] on line 4215

FlowTrace
File name:C:\Users\51966\Documents\Pelles C Projects\ImgView\ImgView.inc
Function [dup] on line 25
Function [dup] on line 32
Function [dup] on line 38
Function [dup] on line 75
  Calls under Procedure dup
Function [dup] on line 81


What means function [Dup]?

Your add-in is PERFECT
« Last Edit: June 13, 2021, 04:37:13 PM by Grincheux »

Offline John Z

  • Member
  • *
  • Posts: 790
Re: Line Counter Add-IN
« Reply #44 on: June 13, 2021, 04:32:48 PM »
 :(
it is seeing '24 dup(?)' in the include files as a user defined function  :(
Since the file extension is not asm it is being parsed as a C file  :( mistake!

I'll see how to correct.  Simplest is probably look for .inc but I'm not sure that will always be a sure thing.
Will need to ponder this a bit.

Thanks for all of your help and inputs!  Gets better every time you point out the issues  :( :) :)

John Z