NO

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

Offline John Z

  • Member
  • *
  • Posts: 264
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: 264
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 »

Online Grincheux

  • Member
  • *
  • Posts: 252
  • Never be pleased, always improve
    • Arachne
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
-------------------------
Kenavo / Bye

Online Grincheux

  • Member
  • *
  • Posts: 252
  • Never be pleased, always improve
    • Arachne
Re: Line Counter Add-IN
« Reply #33 on: June 04, 2021, 04:05:37 am »
For four tests.
-------------------------
Kenavo / Bye

Offline John Z

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

Offline John Z

  • Member
  • *
  • Posts: 264
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
« Last Edit: June 07, 2021, 04:26:50 pm by John Z »

Online Grincheux

  • Member
  • *
  • Posts: 252
  • Never be pleased, always improve
    • Arachne
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.
-------------------------
Kenavo / Bye

Offline John Z

  • Member
  • *
  • Posts: 264
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

Online Grincheux

  • Member
  • *
  • Posts: 252
  • Never be pleased, always improve
    • Arachne
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
-------------------------
Kenavo / Bye

Offline John Z

  • Member
  • *
  • Posts: 264
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


Online Grincheux

  • Member
  • *
  • Posts: 252
  • Never be pleased, always improve
    • Arachne
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 »
-------------------------
Kenavo / Bye

Offline John Z

  • Member
  • *
  • Posts: 264
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