Pelles C forum

Pelles C => Add-ins => Topic started by: John Z on May 17, 2021, 04:00:50 PM

Title: Line Counter Add-IN
Post by: John Z on May 17, 2021, 04:00:50 PM
Here is version 1.7.6.1 of an Add-In for PellesC (of course).
This Add-In is a Line counter. I saw a forum member ask for one.
The Add-In will be a menu item under the main menu 'Source.' It
will show as "Line Counts +".

It will do more than just line counting. You can get the line number for each user procedure.  You can also get list of all user procedures called from within each user procedure.  BTW the user procedure determination is independent and not using the treeview information from the project window.

John Z

Update 6/24 - The attachment here is the latest version 1.7.5 to make it easy  :)
Update 7/6/2023 - The attachment here is the Pelles C V12.002 build to version 1.7.6
Update 8/14/2023 - The attachment here is the Pelles C V12.002 build to version 1.7.6.1
Update 11/01/2023 - The attachment here is the Pelles C V12.002 build to version 1.7.7
Title: Re: Line Counter Add-IN
Post by: Grincheux on May 17, 2021, 07:24:20 PM
I have loaded your addin but I can't see any line. :-[
Title: Re: Line Counter Add-IN
Post by: John Z on May 17, 2021, 08:00:57 PM
perhaps a step wise instruction
1) Close PellesC
2) Copy the dll into the "Bin" folder subfolder "Addins64"
3) Open PellesC
4) Click 'Tools'
5) Click 'Customize'
6) Click 'Add-Ins' tab
7) Check box next to "PellesC Line Counte Add-In"  (I see typo)
8) Click OK

Steps 1-8 only need to be done the first time

9) Open a PellesC project file
10) Select a source .C file
11) Click Menu 'Source'
12) Click 'Line Counts'   - Should be there ;) like attached screen shot

13) See results in Output tab

John Z
Title: Re: Line Counter Add-IN
Post by: Grincheux on May 17, 2021, 08:14:32 PM
Quote
File name:C:\Users\51966\OneDrive\Documents\Pelles C Projects\Essai\Start.asm
startLine:90, endLine:93
Total Lines: 4
 Empty Lines: 1
 Code Lines: 3


With my current ASM Project
Title: Re: Line Counter Add-IN
Post by: Grincheux on May 17, 2021, 08:17:17 PM
Tested on CFE project


Quote
File name:C:\Users\51966\OneDrive\Documents\Pelles C Projects\Cfe\Cfe.c
startLine:0, endLine:5946
Total Lines: 5946
 Empty Lines: 1076
 Lone {: 350
 Lone {: 348
 Comment Lines: 8
 Continuations: 139
 Code Lines: 4025
Title: Re: Line Counter Add-IN
Post by: John Z on May 17, 2021, 09:11:54 PM
Great! I know it’s not detecting asm comment lines …. might be worth adding. I’ll look at your attachment.  Was targeting C code originally.

Thanks for trying it.


John Z
Title: Re: Line Counter Add-IN
Post by: frankie on May 17, 2021, 10:57:00 PM
File name:C:\Program Files\PellesC\Files\LCounter\Line_Count.c
startLine:0, endLine:371
Total Lines: 371
 Empty Lines: 44
 Lone {: 15
 Lone {: 26
 Comment Lines: 103
 Continuations: 1
 Code Lines: 182
 

Shouldn't be: "Total Lines: 372" ?  ???
Title: Re: Line Counter Add-IN
Post by: John Z on May 18, 2021, 12:12:32 AM
Thanks Frankie,

Well... there are actually 371 lines when I use the cursor in the file. The discrepancy, if any, might be in saying the start is line 0. PellesC edit window shows that to be line 1.  I'll double check though when I fix the typos, one of which was the second output { line which should have been lone } (close bracket).

The TrimTail code had these lines for the full page:
Code: [Select]
iFirstLine = 0;
iLastLine = AddIn_GetSourceLineCount(hwndDoc) - 1;

So it appears to get line 1 you start with line 0, and the last line which is the required PellesC closing CRLF is not included.

The sum of the processed lines also adds up to the 371.

I'll look further though :)

Thanks for the inputs,

John Z
Title: Re: Line Counter Add-IN
Post by: Grincheux on May 18, 2021, 06:01:54 AM
In C you search for '{' and '}', in asm search for 'PROC' and 'ENDP'.
Title: Re: Line Counter Add-IN
Post by: John Z on May 18, 2021, 02:28:35 PM
Version 0.2
Fixed text typos, fixed line start when processing entire source file, fixed line end when processing a selected block of source code.  Added some error reporting, added a count and warning of long lines > 4095 characters when found.

Haven't looked at processing asm specifically yet....

John Z
Title: Re: Line Counter Add-IN
Post by: Grincheux on May 18, 2021, 03:00:44 PM
It was version 1.0 before and now 0.2!
For the asm I will wait, perhaps one day >:( >:( >:(
Title: Re: Line Counter Add-IN
Post by: John Z on May 18, 2021, 03:40:49 PM
 :)
it was version 0.1 before …. shouldn't version 1.0 be the first 'official' release?   ;D

I think asm line count needs different groupings, like .data, .code, comments, label lines, etc so will need to check extension and change processing based on the file type.


Cheers,

John Z


Title: Re: Line Counter Add-IN
Post by: John Z on May 19, 2021, 03:04:27 PM
Version 0.3 for testing
This version adds in ASM specific line binning when the file extension is .asm

Question:  Should it clear the output window before showing results?

Example Output:
File name:C:\Program Files\PellesC\Files\Essai\Start.asm
startLine:1, endLine:118
Total Lines: 118
 Empty Lines: 27
 Data : 4
 Labels  : 5
 Comment Lines: 22
 Code Lines: 60

I'll post the code soon.  I think it is almost done, I know it is not and probably never will be a high use add-in but it was a good one for me to gain experience on.

John Z
Title: Re: Line Counter Add-IN
Post by: Grincheux on May 19, 2021, 03:21:30 PM
Quote
Question:  Should it clear the output window before showing results?


YES

I have installed the add-in but I don't see annythig for a '.c' file and a '.asm' file.
I made a wrong thing but which one?
Title: Re: Line Counter Add-IN
Post by: John Z on May 19, 2021, 03:34:13 PM
Quote
Question:  Should it clear the output window before showing results?
Quote
YES
Thanks I'll add the clear.
Quote
I have installed the add-in but I don't see anything for a '.c' file and a '.asm' file.
I made a wrong thing but which one?

The determination of .asm or .c (where really is anything but .asm) is within the code by looking at the file extension.  The user does not select C or ASM directly.

Looks like your post was hit with the Notepad++ bug but I was able to read it by using quote :)

Thanks,

John Z
Title: Re: Line Counter Add-IN
Post by: John Z on May 20, 2021, 12:42:51 PM
Version 1.0  :)
Attachments:
ReadMe.txt - brief introduction and instructions
LineCount.dll - the add-in dll
LineCount.zip - The entire project as zipped by PellesC

John Z
Title: Re: Line Counter Add-IN
Post by: Grincheux on May 20, 2021, 01:40:40 PM
Quote
File name:C:\Users\51966\Documents\Pelles C Projects\TestSSE\Fusion.asm
startLine:1, endLine:107
Total Lines: 107
 Empty Lines: 32
 Data : 3
 Labels  : 5
 Comment Lines: 19
 Code Lines: 48


EXACT


 :D :D :D :D :D :D
Title: Re: Line Counter Add-IN
Post by: Grincheux on May 20, 2021, 01:54:11 PM
With the following comment it is OK too



/////////////////////////////
// This is a valid comment //
/////////////////////////////

You would say that if there are errors at compile time the results you display can be wrong.
The file you read must be FREE of ERRORS

Very good job
Title: Re: Line Counter Add-IN
Post by: Grincheux on May 20, 2021, 02:11:56 PM
It seems that the count of "}" is wrong.
I have 24 "{" and you find them.
I have 24 "}" and you find 22.
Verified with Notepad++


When I saw the numbers I thought I had removed some lines.
This indication is very important for me.
"startline" and "endline" are in lowercase but for the other lines the first letters is in uppercase.


I would prefer the following style :



     File name: C:\Users\...\TestSSE\Main.c
    Start Line: 1, EndLine: 262
   Total Lines: 262
   Empty Lines: 64
        Lone {: 24
        Lone }: 22
Comment Lines: 3
    Code Lines: 149


In the case the number of '{' is deferent that the number of '}' you could display a warning.
For me this add-in is useful when reformating the text, after removing unnecessary lines...
Knowing that there is no problem with the pair {} is a good thing.
Title: Re: Line Counter Add-IN
Post by: John Z on May 20, 2021, 04:08:44 PM
I'll check, but point out that it counts lone } not brackets that are with preceded with code.
so
{
  A=1;
}

and
{
 A=1;}

and
{ A=1;}

and
{
  A=1;
} B=2;

all give different counts
example 1 would be 1{ and 1} and 1 Code,
example 2 would be 1{ and 0} and 1 Code,
example 3 would be 0{ and 0} and 1 Code
example 4 would be 1{ and 0} and 2 Code

So I was not trying to match Open and Close counts I was distinguishing code from just a lone bracket which I don't really consider a line of 'code', I might add that …

John Z
Title: Re: Line Counter Add-IN
Post by: Grincheux on May 20, 2021, 04:15:26 PM
Ok but with the file I used it is the case 1.
The file used is in the 7zip file of my post about TestSSE
I join it here
Title: Re: Line Counter Add-IN
Post by: John Z on May 20, 2021, 04:28:33 PM
Good to have examples - Thanks.

From your file
Code: [Select]
typedef struct tagBITMAPINFOV5
{
BITMAPV5HEADER bmiHeader;
RGBQUAD bmiColors[1];
} BITMAPINFOV5,*LPBITMAPINFOV5;

The last line is the second example case.  There are two spots where this is done. Here is the second:
Code: [Select]
typedef struct tagIMAGEINFOS
{
LPBYTE lpOriginal ;
double dRatio ; // Height Divided by Width (double = 64 bits)
BITMAPINFOV5 BitmapInfo ;
} IMAGEINFOS,*LPIMAGEINFOS ;

Both of these would give 1 count of {, and no } counts because there is 'code' after the }

Perhaps not optimum, I'll think on it.

John Z
Title: Re: Line Counter Add-IN
Post by: Grincheux on May 20, 2021, 05:51:44 PM
I have not thought to structures!


I join some examples of code of mine
Title: Re: Line Counter Add-IN
Post by: Grincheux on May 20, 2021, 05:56:41 PM
That's all I have
Title: Re: Line Counter Add-IN
Post by: John Z on May 20, 2021, 05:58:48 PM
Thanks,

I may add structure detection to handle differently as a unique (but standard) case.  Thinking about it.....

Appreciate the additional examples. I'll try them.

John Z

Title: Re: Line Counter Add-IN
Post by: John Z on May 21, 2021, 05:51:05 PM
Next version to test.
Modified to count every { and } report separately,
as well as counting the Lone { and }.
Should be more representative, however it is not perfect.  For example if there is a text string containing
{ or } they are counted too.  Not sure it is worth the code to detect these cases.....

Change output format ;)

John Z
Title: Re: Line Counter Add-IN
Post by: Grincheux on May 22, 2021, 03:28:32 AM
Quote
File name:C:\Users\51966\Documents\Pelles C Projects\Cfe\Fusion.c
 Start Line:1, End Line:2033
  Total Lines   : 2033
  Empty Lines   : 351
  Lone {      : 54
  Lone }      : 54
  ALL {      : 67
  All }      : 67
  Comment Lines   : 694
  Code Lines   : 880


PERFECT
Title: Re: Line Counter Add-IN
Post by: John Z on May 22, 2021, 11:34:27 AM
Thanks
Here is all of version 1.1. 

It currently only processes the 'active' project source window.  Might be nice to be able to process every source file in the project.  To do that I'll have to figure out how to open each file in the source tree.  Then it could give the project totals too.


John Z

P.S. It works best if the source code has been processed using PellesC "Convert to"-"Formatted C code"  :)

removed old attachment to free upload space
Title: Re: Line Counter Add-IN
Post by: Grincheux on May 22, 2021, 03:39:56 PM
Publicity is prohibited... Like the internet site, "This is better if using G...C... Or M...."
Title: Re: Line Counter Add-IN
Post by: John Z on May 23, 2021, 04:55:09 PM
Here is a new version which will process all source files open in the edit window.  When there are multiple files open there will be a summary at the end of the output. So if you want the project totals just have the files open in the edit window then invoke the Line Counter.  As long as the file is a source file it will be processed.  To process a resource file it must be opened as text.  If there are both C and asm and h they are all summarized together.  If multiple files are open but a selection is made in one file and Line Counter is invoked with the selection the other files are not processed, just the selection.

I think this is much more useful now....

Example Output:
Code: [Select]
File name:C:\Program Files\PellesC\Files\LCounter\Line_Count.c
 Start Line:1, End Line:748
  Total Lines : 748
  Empty Lines : 89
  Lone { : 57
  Lone } : 66
  All { : 95
  All } : 96
  Comment Lines : 165
  Code Lines : 371
File name:C:\Program Files\PellesC\Files\LCounter\LineCount.h
 Start Line:1, End Line:23
  Total Lines : 23
  Empty Lines : 2
  All { : 1
  All } : 1
  Comment Lines : 2
  Code Lines : 19

*Summary results*
  Total Lines : 771
  Empty Lines : 91
  Lone { : 57
  Lone } : 66
  All { : 96
  All } : 97
  Comment Lines : 167
  Code Lines : 390

I need to update the doc and clean the source before posting them.

John Z

Update attached project zip and document ReadMe....

removed old attachments to free upload space
Title: Re: Line Counter Add-IN
Post by: John Z 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
Title: Re: Line Counter Add-IN
Post by: John Z 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
Title: Re: Line Counter Add-IN
Post by: Grincheux 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
Title: Re: Line Counter Add-IN
Post by: Grincheux on June 04, 2021, 04:05:37 AM
For four tests.
Title: Re: Line Counter Add-IN
Post by: John Z on June 04, 2021, 11:41:47 AM
For four tests.

Thank You.

John Z
Title: Re: Line Counter Add-IN
Post by: John Z 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
Title: Re: Line Counter Add-IN
Post by: Grincheux 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.
Title: Re: Line Counter Add-IN
Post by: John Z 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
Title: Re: Line Counter Add-IN
Post by: Grincheux on June 08, 2021, 04:08:47 PM
As would say a great coffee drinker : What else?


PERFECT for C and for ASM
Title: Re: Line Counter Add-IN
Post by: John Z 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

Title: Re: Line Counter Add-IN
Post by: Grincheux 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


Title: Re: Line Counter Add-IN
Post by: John Z 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
Title: Re: Line Counter Add-IN
Post by: John Z 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
Title: Re: Line Counter Add-IN
Post by: Grincheux 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
Title: Re: Line Counter Add-IN
Post by: John Z 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
Title: Re: Line Counter Add-IN
Post by: Grincheux on June 13, 2021, 04:48:14 PM
May the problem is awith comments
I added some kinds of them



Title: Re: Line Counter Add-IN
Post by: John Z on June 13, 2021, 04:57:18 PM
I'll double check those but I'm fairly confident I've captured them.
The reported line numbers  direct me to the spots in the .inc file for example this one:
   Field_Name               BYTE      24 dup(?)
so it is reported as a C procedure dup ….


John Z

Title: Re: Line Counter Add-IN
Post by: John Z on June 14, 2021, 06:22:53 PM
HTML output preview.  It is created in the project directory if option selected.

Looks OK?  It is in HTML5.  In IE11 need to use File-Open, Firefox just dbl click.  I haven't tried to send it to the embedded PellesC browser interface yet.

Also modified so that .inc is processed as an ASM file for the dup(?) issue.

Still testing so no new dll posted yet.

John Z

removed attachment to free upload space
Title: Re: Line Counter Add-IN
Post by: Grincheux on June 14, 2021, 06:30:10 PM
Verified html file with https://validator.w3.org/nu/#file (https://validator.w3.org/nu/#file)
Ok but must be converted in UTF-8

Quote
File name:C:\Program Files\PellesC\Files\LCounter\Line_Count.cStart Line:1, End Line:1408
   Lone {       : 77
   Lone {       : 125
   All {        : 208
   All }        : 206
   Comment Lines: 303
   Code Lines   : 708
   Functions    : 18
---------
74 DllMain
102 AddInMain
146 AddInCommandEx
224 PreParse
340 Parse_C
543 Parse_ASM
723 Leading_WTrim
740 Trailing_WTrim
773 CheckForContinue
824 CheckForFunction
889 UserCFunctDef
953 UsedFunction
1015 OutputFileInfo
1196 EnumProjFileCallback
1218 EnumFileCalls
1248 Extract_FName
1297 Extract_PName
1330 FlowTrace
----------

File name:C:\Program Files\PellesC\Files\LCounter\HTML_Output.cStart Line:1, End Line:143
   Lone {       : 2
   Lone {       : 4
   All {        : 7
   All }        : 7
   Comment Lines: 24
   Continuations: 2
   Code Lines   : 87
   Functions    : 3
---------
41 InitHTML
95 HTML_WriteOutput
137 Close_HTML
----------

File name:C:\Program Files\PellesC\Files\LCounter\User_Choice.cStart Line:1, End Line:156
   Lone {       : 6
   Lone {       : 5
   All {        : 13
   All }        : 13
   Comment Lines: 40
   Continuations: 2
   Code Lines   : 75
   Functions    : 3
---------
43 Show_Choice
60 ChoiceDialogProc
139 Show_Error
----------

File name:C:\Program Files\PellesC\Files\LCounter\Linked_list.cStart Line:1, End Line:288
   Lone {       : 5
   Lone {       : 15
   All {        : 29
   All }        : 29
   Comment Lines: 124
   Code Lines   : 106
   Functions    : 5
---------
45 Top_insert
104 InToSubList
157 Output_List
200 IsInList
264 Delete_List
----------

*Summary results*
   Lone {       : 90
   Lone {       : 149
   All {        : 257
   All }        : 255
   Comment Lines: 491
   Continuations: 4
   Code Lines   : 976
   Functions    : 29
---------
File name:C:\Program Files\PellesC\Files\LCounter\Line_Count.c    Function [Leading_WTrim] on line 41
    Function [Trailing_WTrim] on line 42
    Function [OutputFileInfo] on line 43
    Function [CheckForContinue] on line 44
    Function [Parse_C] on line 45
    Function [Parse_ASM] on line 46
    Function [EnumProjFileCallback] on line 47
    Function [EnumFileCalls] on line 48
    Function [PreParse] on line 49
    Function [CheckForFunction] on line 50
    Function [UserCFunctDef] on line 51
    Function [UsedFunction] on line 52
    Function [Extract_FName] on line 53
    Function [Extract_PName] on line 54
    Function [FlowTrace] on line 55
    Function [Top_insert] on line 56
    Function [Output_List] on line 57
    Function [Delete_List] on line 58
    Function [IsInList] on line 59
    Function [Show_Choice] on line 60
    Function [InitHTML] on line 61
    Function [HTML_WriteOutput] on line 62
Calls under Procedure DllMain
Calls under Procedure AddInMain
Calls under Procedure AddInCommandEx
    Function [Show_Choice] on line 175
    Function [InitHTML] on line 179
    Function [Close_HTML] on line 201
    Function [Delete_List] on line 204
Calls under Procedure PreParse
    Function [Parse_ASM] on line 282
    Function [Parse_C] on line 286
    Function [OutputFileInfo] on line 313
Calls under Procedure Parse_C
    Function [Leading_WTrim] on line 377
    Function [Trailing_WTrim] on line 378
    Function [CheckForFunction] on line 394
    Function [CheckForContinue] on line 502
Calls under Procedure Parse_ASM
    Function [Leading_WTrim] on line 582
    Function [Trailing_WTrim] on line 583
    Function [Extract_PName] on line 673
    Function [Top_insert] on line 675
    Function [Extract_PName] on line 681
Calls under Procedure Leading_WTrim
Calls under Procedure Trailing_WTrim
Calls under Procedure CheckForContinue
Calls under Procedure CheckForFunction
    Function [UserCFunctDef] on line 862
    Function [Extract_FName] on line 867
    Function [Top_insert] on line 870
Calls under Procedure UserCFunctDef
Calls under Procedure UsedFunction
    Function [UserCFunctDef] on line 970
    Function [IsInList] on line 998
Calls under Procedure OutputFileInfo
    Function [HTML_WriteOutput] on line 1047
    Function [HTML_WriteOutput] on line 1056
    Function [HTML_WriteOutput] on line 1065
    Function [HTML_WriteOutput] on line 1075
    Function [HTML_WriteOutput] on line 1085
    Function [HTML_WriteOutput] on line 1094
    Function [HTML_WriteOutput] on line 1103
    Function [HTML_WriteOutput] on line 1112
    Function [HTML_WriteOutput] on line 1121
    Function [HTML_WriteOutput] on line 1130
    Function [HTML_WriteOutput] on line 1139
    Function [HTML_WriteOutput] on line 1148
    Function [HTML_WriteOutput] on line 1157
    Function [HTML_WriteOutput] on line 1158
    Function [HTML_WriteOutput] on line 1173
    Function [HTML_WriteOutput] on line 1174
    Function [HTML_WriteOutput] on line 1180
Calls under Procedure EnumProjFileCallback
    Function [PreParse] on line 1202
Calls under Procedure EnumFileCalls
    Function [FlowTrace] on line 1224
    Function [EnumProjFileCallback] on line 1242
Calls under Procedure Extract_FName
Calls under Procedure Extract_PName
    Function [Trailing_WTrim] on line 1312
Calls under Procedure FlowTrace
    Function [Leading_WTrim] on line 1396
    Function [Trailing_WTrim] on line 1397
    Function [UsedFunction] on line 1398
File name:C:\Program Files\PellesC\Files\LCounter\HTML_Output.cCalls under Procedure InitHTML
Calls under Procedure HTML_WriteOutput
Calls under Procedure Close_HTML
File name:C:\Program Files\PellesC\Files\LCounter\User_Choice.c    Function [ChoiceDialogProc] on line 33
    Function [Show_Error] on line 34
Calls under Procedure Show_Choice
    Function [Show_Error] on line 48
Calls under Procedure ChoiceDialogProc
    Function [Show_Error] on line 75
Calls under Procedure Show_Error
File name:C:\Program Files\PellesC\Files\LCounter\Linked_list.c    Function [HTML_WriteOutput] on line 29
Calls under Procedure Top_insert
Calls under Procedure InToSubList
Calls under Procedure Output_List
Calls under Procedure IsInList

Calls under Procedure Delete_List

Title: Re: Line Counter Add-IN
Post by: John Z on June 14, 2021, 07:00:48 PM
Verified html file with https://validator.w3.org/nu/#file (https://validator.w3.org/nu/#file)
Ok but must be converted in UTF-8
Thanks I'll have to check that out.  HTML5 is suppose to handle UTF-8 and UTF-16.  It shows in the two browser ok but maybe they are converting on the fly.   I thought I was using UTF-8 …..

John Z
Title: Re: Line Counter Add-IN
Post by: Grincheux on June 14, 2021, 08:02:20 PM
I tested with Operaand Edge, it was wrong.
Title: Re: Line Counter Add-IN
Post by: John Z on June 15, 2021, 01:26:53 PM
Thanks!  Attached is a new version of the html output.  It opens in Firefox and Edge on my machine.
It won't auto-display (dbl clicking on it) in IE11 (I am probably one of the last 10 people still using it)  but will show correctly if I use File-Open in IE 11.

If you can test in Opera It would be a great help.

Thanks so much,

John Z
Title: Re: Line Counter Add-IN
Post by: Grincheux on June 15, 2021, 03:07:34 PM
Ok with Opera
Title: Re: Line Counter Add-IN
Post by: John Z on June 15, 2021, 03:28:45 PM
 :) :) :) Thanks good to go for that part now.

It shows correctly in Pelles embedded browser too. Pasting the output filename into the URL.
I'll need to try a few foreign character procedures and filenames too.

I've not been able to find an API to invoke the internal browser.
I can set ADDIN_WEB_INFO as needed and AddIn_SetWebInfo(hwndDoc, &showinfo);
but this does not invoke a web window, only works if the window is already open.

The web add-in example also presupposes the WEB window is already open, and does
not work if not.

Also tried AddIn_SendIDECommand(g_hwndMain, AIC_FILE_NEWWEB);
no error but if a new web page was created it was not shown.

Maybe not possible, or maybe someone knows how?

John Z

 
Title: Re: Line Counter Add-IN
Post by: Grincheux on June 15, 2021, 03:33:02 PM
Code: [Select]
static void Child_Web(HWND __hWnd)
{
   register   LPEDITOR      _lpEditor ;
         LPSTR      _lpszTmp ;
         int         _iNumBytes ;
         DWORD      _dwTmp ;
         CHARRANGE   _Cr, _CharRange,*_lpCharRange ;
         char         _szSelection[1024] ;
         char         _szTmp[1024] ;
         GETTEXTEX   _Gte,*_lpGte ;

   _lpEditor = (LPEDITOR) GetWindowLongPtr(__hWnd,GWLP_USERDATA) ;
   if(!_lpEditor)      return ;

   SendMessage(_lpEditor->hEdit,EM_GETSEL,(WPARAM) &_Cr.cpMin,(LPARAM) &_Cr.cpMax) ;
   if(_Cr.cpMin == _Cr.cpMax)
   {
      _dwTmp = sizeof(_szSelection) ;
      AssocQueryString(0,ASSOCSTR_EXECUTABLE,".htm","open",_szSelection,&_dwTmp) ;
      _lpszTmp = _szTmp ;
      sqlite3_snprintf(sizeof(_szTmp),_lpszTmp,"\"%s\"",_szSelection) ;
      WinExec(_lpszTmp,SW_SHOWMAXIMIZED) ;
      return ;
   }

   _lpCharRange = &_CharRange ;
   _lpGte = &_Gte ;

   _lpCharRange->cpMin = 0 ;
   _lpCharRange->cpMax = 0 ;

   SendMessage(_lpEditor->hEdit,EM_EXGETSEL,0,(LPARAM) _lpCharRange) ;
   _iNumBytes = _lpCharRange->cpMax - _lpCharRange->cpMin ;
   if(_iNumBytes == 0)      return ;

   _lpGte->cb = _iNumBytes ;
   _lpGte->flags = GT_SELECTION ;
   _lpGte->codepage = CP_ACP ;
   _lpGte->lpDefaultChar = NULL ;
   _lpGte->lpUsedDefChar = NULL ;

   SendMessage(_lpEditor->hEdit,EM_GETSELTEXT,(WPARAM) _lpGte,(LPARAM) szGlobalBufferW) ;
   WideCharToMultiByte(CP_ACP,WC_NO_BEST_FIT_CHARS,(const wchar_t *) szGlobalBufferW,-1,szGlobalBufferA,_iNumBytes,NULL,NULL) ;
   SendMessage(_lpEditor->hEdit,EM_REPLACESEL,TRUE,(LPARAM) szGlobalBufferA) ;

   _dwTmp = sizeof(_szSelection) ;
   AssocQueryString(0,ASSOCSTR_EXECUTABLE,".htm","open",_szSelection,&_dwTmp) ;
   _lpszTmp = _szTmp ;
   sqlite3_snprintf(sizeof(_szTmp),_lpszTmp,"\"%s\"\"https://www.google.com/search?q=%s\"",_szSelection,szGlobalBufferA) ;
   WinExec(_lpszTmp,SW_SHOWMAXIMIZED) ;

   return ;
}
OR
Code: [Select]
MOV      RCX,RDI
CALL   PathFindExtensionA   ; Get the file extension
MOV      R8,RAX
MOV      _dwTmp,SIZEOF _szTmp
XOR      RCX,RCX
MOV      RDX,ASSOCF_OPEN_BYEXENAME
MOV      R9,OFFSET szVerb_Open
MOV      [RSP + 20h],RSI
LEA      RAX,_dwTmp
MOV      [RSP + 28h],RAX
CALL   AssocQueryStringA       Get the file associated with the extension

MOV      RCX,SIZEOF _szExec
LEA      RDX,_szExec
MOV      R8,OFFSET szFmt_FindFiles_Exec
MOV      R9,RSI
MOV      RAX,RDI
MOV      [RSP + 20h],RAX
CALL   sqlite3_snprintf    ; Format the string to execute

LEA      RCX,_szExec
MOV      EDX,SW_NORMAL
CALL   WinExec        ; Launch the program with the file in parameter

char szFmt_FindFiles_Exec[] = "\"%s\" \"%s\"" ;
szVerb_Open                  BYTE   "open",0

If that can help you
Title: Re: Line Counter Add-IN
Post by: John Z on June 15, 2021, 04:15:24 PM
Thanks.  I've got C code to invoke an external browser that I wrote for vCardz_i to show vcf embedded link web pages. 

I've been trying to invoke the Pelles internal browser window, and open the file there, to keep everything within the IDE.

The output html resides in the project directory too, so any double click on it should open it in the users default browser. 

John Z

BTW - I tried Opera a while back.  Especially wanted the VPN to work but it does not work worldwide.
I also saw an analysis that showed upon startup Opera automatically contacted double the endpoints compared to any other browser - so that bothered me a bit.
Title: Re: Line Counter Add-IN
Post by: John Z on June 16, 2021, 02:12:42 PM
Newest version 1.7 with option for documenting the results in a HTML format file.   
The filename will always be LC_output.html in the project directory. Each run overwrites the prior output.

Thanks to Sir Grincheux for testing in several browsers.
Opera, Edge, Firefox, PellesC internal browser, and yes IE11.  IE11 must use File-Open, send-to for some reason blanks out.

John Z
Title: Re: Line Counter Add-IN
Post by: Grincheux on June 16, 2021, 04:46:12 PM
Here is the result:
Quote
File name:C:\Users\51966\Documents\Pelles C Projects\ImgView\ImgView.asmStart Line:1, End Line:5609
   Code Lines   : 4610
   Functions    : 17
---------
91 COUNT
109 [Images]
120 DEFAULT
121 CHAR
122 CHAR
128 "
301 dup
302 dup
303 dup
304 dup
305 dup
306 dup
307 dup
314 dup
315 dup
316 dup
317 dup
----------

File name:C:\Users\51966\Documents\Pelles C Projects\ImgView\ImgView.asm-----

created by Pelles C add-in LineCount.dll.



With this version, with the above result, LC is not useful for me. I preferred the previous one.
Title: Re: Line Counter Add-IN
Post by: John Z on June 16, 2021, 05:24:40 PM
OH darn - what Have I done !!  :-[ >:(

Sorry - Slipped up testing only C

John Z
Title: Re: Line Counter Add-IN
Post by: John Z on June 16, 2021, 05:52:51 PM
That will teach me a lesson!

Anyway it was due to what I thought would be a quick fix for .inc files to be processes as ASM.  So I fixed the fix, but also see other issues parsing  some .inc and even some h files. 

John Z
Title: Re: Line Counter Add-IN
Post by: Grincheux on June 16, 2021, 05:55:07 PM
Quote
File name:C:\Users\51966\Documents\Pelles C Projects\ImgView\ImgView.asm
Start Line:1, End Line:5609
  Total Lines   : 5609
  Empty Lines   : 982
  .Const       : 206
  .Data       : 32
  Lone Labels     : 163
  Comment Lines   : 637
  Code Lines   : 3580
  Functions   : 39
---------
323   Error
339   Delete_Error
361   Delete_Warning
383   MyBrowseCallbackProc
403   BrowseForFolder
452   Profile_Read
588   Profile_Write
751   WmSize
871   DeleteFiles_Common
1104   DeleteFiles
1432   CreateTheToolBar
1514   WriteToDataBase
1569   GetCurrentFileEx
1677   GetCurrentFile
1839   SearchFiles
2269   DeleteDuplicatedFiles
2402   DlgSortProc
2928   SortImages
3297   PaintFullScreen
3342   FullScreenProc
3418   LivstViewDoubleClick
3497   LivstViewDoubleClickEx
3566   PhotoFiltre
3693   EditFile
3820   RedChannel
3901   GreenChannel
3982   BlueChannel
4063   ChannelRedProc
4139   ShowChannelRed
4247   ChannelGreenProc
4323   ShowChannelGreen
4431   ChannelBlueProc
4507   ShowChannelBlue
4614   TabControlSubClassProc
4655   WmCommand
4816   WmCreate
5036   WndProc
5255   WinMain
5427   Start
----------

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 339
  Calls under Procedure Delete_Warning
  Calls under Procedure MyBrowseCallbackProc
  Calls under Procedure BrowseForFolder
Function [MyBrowseCallbackProc] on line 418
  Calls under Procedure Profile_Read
  Calls under Procedure Profile_Write
  Calls under Procedure WmSize
  Calls under Procedure DeleteFiles_Common
Function [Delete_Error] on line 905
Function [Delete_Error] on line 927
Function [Delete_Error] on line 941
Function [Delete_Error] on line 979
Function [Delete_Error] on line 1007
Function [Delete_Error] on line 1026
Function [Delete_Error] on line 1059
  Calls under Procedure DeleteFiles
Function [DeleteFiles] on line 1196
Function [DeleteFiles] on line 1329
Function [Delete_Warning] on line 1380
Function [Delete_Warning] on line 1393
Function [Delete_Warning] on line 1406
Function [Delete_Error] on line 1413
Function [Delete_Error] on line 1420
  Calls under Procedure CreateTheToolBar
  Calls under Procedure WriteToDataBase
  Calls under Procedure GetCurrentFileEx
Function [Error] on line 1617
Function [Error] on line 1630
Function [Error] on line 1664
  Calls under Procedure GetCurrentFile
Function [Error] on line 1780
Function [Error] on line 1793
Function [Error] on line 1827
  Calls under Procedure SearchFiles
Function [WriteToDataBase] on line 2166
  Calls under Procedure DeleteDuplicatedFiles
Function [Error] on line 2313
Function [Error] on line 2381
  Calls under Procedure DlgSortProc
  Calls under Procedure SortImages
Function [Error] on line 3195
Function [Error] on line 3217
  Calls under Procedure PaintFullScreen
Function [GetCurrentFileEx] on line 3317
  Calls under Procedure FullScreenProc
Function [PaintFullScreen] on line 3377
  Calls under Procedure LivstViewDoubleClick
  Calls under Procedure LivstViewDoubleClickEx
Function [GetCurrentFile] on line 3502
  Calls under Procedure PhotoFiltre
Function [Error] on line 3616
Function [Error] on line 3630
  Calls under Procedure EditFile
Function [PhotoFiltre] on line 3759
Function [PhotoFiltre] on line 3807
  Calls under Procedure RedChannel
  Calls under Procedure GreenChannel
  Calls under Procedure BlueChannel
  Calls under Procedure ChannelRedProc
  Calls under Procedure ShowChannelRed
Function [GetCurrentFile] on line 4147
Function [WmSize] on line 4236
  Calls under Procedure ChannelGreenProc
  Calls under Procedure ShowChannelGreen
Function [GetCurrentFile] on line 4331
Function [WmSize] on line 4420
  Calls under Procedure ChannelBlueProc
  Calls under Procedure ShowChannelBlue
Function [GetCurrentFile] on line 4515
Function [WmSize] on line 4603
  Calls under Procedure TabControlSubClassProc
  Calls under Procedure WmCommand
Function [LivstViewDoubleClickEx] on line 4704
Function [ShowChannelRed] on line 4710
Function [ShowChannelGreen] on line 4716
Function [ShowChannelBlue] on line 4722
Function [EditFile] on line 4728
Function [BrowseForFolder] on line 4732
Function [SortImages] on line 4759
Function [DeleteFiles] on line 4767
Function [DeleteDuplicatedFiles] on line 4775
  Calls under Procedure WmCreate
Function [CreateTheToolBar] on line 4846
  Calls under Procedure WndProc
Function [LivstViewDoubleClick] on line 5156
Function [WmSize] on line 5215
Function [WmCommand] on line 5221
Function [WmCreate] on line 5227
  Calls under Procedure WinMain
  Calls under Procedure Start
Function [Profile_Read] on line 5496
Function [Error] on line 5530
Function [Error] on line 5544
Function [WinMain] on line 5565
Function [Profile_Write] on line 5567
----- done -----
LineCount Results in file:
C:\Users\51966\Documents\Pelles C Projects\ImgView\LC_output.html


Like this I like
Title: Re: Line Counter Add-IN
Post by: John Z on June 16, 2021, 06:02:25 PM
Here is the html and seems I've got some more work to do with the filename/output location too.


John Z

removed old attachments to free upload space
Title: Re: Line Counter Add-IN
Post by: Grincheux on June 16, 2021, 06:28:31 PM
You can have a function in *.c module which is referenced only once but called many times in a *.asm file.
This is the case for extern functions.
Title: Re: Line Counter Add-IN
Post by: John Z on June 18, 2021, 02:07:32 PM
Improved parsing especially for sqlite3.h, and fixed filename bug referenced above.
Still have a few false functions, for example this line
__asm__ __volatile__ (
is identified as function __volatile__, more work to do.....

John Z
Title: Re: Line Counter Add-IN
Post by: Grincheux on June 18, 2021, 03:37:18 PM
Quote
File name:C:\Users\51966\Documents\Pelles C Projects\ImgView\Images.c
 Start Line:1, End Line:855
  Total Lines   : 855
  Empty Lines   : 185
  Lone {      : 79
  Lone }      : 77
  All {      : 79
  All }      : 79
  Comment Lines   : 18
  Code Lines   : 486
  Functions   : 10
---------
90   Dec2Hex
127   Sph_Keccak_256
139   ImageResize
182   GetBitsFromBitmapHandle
227   ImageGetBitmap
315   ImageGetThumbNails
439   LoadImageFromFile
534   LoadImageFromFileEx
668   GetBitsOfBitmap
769   PaintChannel
----------
File name:C:\Users\51966\Documents\Pelles C Projects\ImgView\ImgView.asm
 Start Line:1, End Line:5934
  Total Lines   : 5934
  Empty Lines   : 1022
  .Const       : 216
  .Data       : 31
  Lone Labels     : 174
  Comment Lines   : 682
  Code Lines   : 3800
  Functions   : 41
---------
335   Error
351   Delete_Error
373   Delete_Warning
395   MyBrowseCallbackProc
415   BrowseForFolder
464   Profile_Read
609   Profile_Write
784   WmSize
904   DeleteFiles_Common
1137   DeleteFiles
1465   CreateTheToolBar
1547   WriteToDataBase
1602   GetCurrentFileEx2
1746   GetCurrentFileEx
1854   GetCurrentFile
2016   SearchFiles
2470   DeleteDuplicatedFiles
2606   DlgSortProc
3132   SortImages
3501   PaintFullScreen
3546   FullScreenProc
3622   LivstViewDoubleClick
3701   LivstViewDoubleClickEx
3783   ListViewOneClick
3839   PhotoFiltre
3966   EditFile
4093   RedChannel
4174   GreenChannel
4255   BlueChannel
4336   ChannelRedProc
4412   ShowChannelRed
4520   ChannelGreenProc
4596   ShowChannelGreen
4704   ChannelBlueProc
4780   ShowChannelBlue
4887   TabControlSubClassProc
4928   WmCommand
5092   WmCreate
5316   WndProc
5566   WinMain
5738   Start
----------
File name:C:\Users\51966\Documents\Pelles C Projects\ImgView\ImgView.inc
 Start Line:1, End Line:130
  Total Lines   : 130
  Empty Lines   : 34
  Comment Lines   : 1
335   Error
351   Delete_Error
373   Delete_Warning
395   MyBrowseCallbackProc
415   BrowseForFolder
464   Profile_Read
609   Profile_Write
784   WmSize
904   DeleteFiles_Common
1137   DeleteFiles
1465   CreateTheToolBar
1547   WriteToDataBase
1602   GetCurrentFileEx2
1746   GetCurrentFileEx
1854   GetCurrentFile
2016   SearchFiles
2470   DeleteDuplicatedFiles
2606   DlgSortProc
3132   SortImages
3501   PaintFullScreen
3546   FullScreenProc
3622   LivstViewDoubleClick
3701   LivstViewDoubleClickEx
3783   ListViewOneClick
3839   PhotoFiltre
3966   EditFile
4093   RedChannel
4174   GreenChannel
4255   BlueChannel
4336   ChannelRedProc
4412   ShowChannelRed
4520   ChannelGreenProc
4596   ShowChannelGreen
4704   ChannelBlueProc
4780   ShowChannelBlue
4887   TabControlSubClassProc
4928   WmCommand
5092   WmCreate
5316   WndProc
5566   WinMain
5738   Start
----------

*Summary results*
  Total Lines   : 6919
  Empty Lines   : 1241
  Lone {      : 79
  Lone }      : 77
  All {      : 79
  All }      : 79
  .Data       : 31
  Lone Labels     : 174
  Comment Lines   : 701
  Code Lines   : 4286
  Functions   : 51
---------

FlowTrace
File name:C:\Users\51966\Documents\Pelles C Projects\ImgView\Images.c
Function [RedChannel] on line 83
Function [GreenChannel] on line 84
Function [BlueChannel] on line 85
Function [GetCurrentFile] on line 86
Function [GetCurrentFileEx] on line 87
  Calls under Procedure Dec2Hex
  Calls under Procedure Sph_Keccak_256
Function [Dec2Hex] on line 134
  Calls under Procedure ImageResize
  Calls under Procedure GetBitsFromBitmapHandle
  Calls under Procedure ImageGetBitmap
Function [ImageResize] on line 284
  Calls under Procedure ImageGetThumbNails
Function [ImageResize] on line 384
Function [GetBitsFromBitmapHandle] on line 402
Function [Sph_Keccak_256] on line 405
  Calls under Procedure LoadImageFromFile
Function [ImageResize] on line 494
  Calls under Procedure LoadImageFromFileEx
Function [ImageResize] on line 612
Function [Sph_Keccak_256] on line 616
  Calls under Procedure GetBitsOfBitmap
Function [ImageResize] on line 738
  Calls under Procedure PaintChannel
Function [GetBitsOfBitmap] on line 796
Function [ImageResize] on line 811
Function [RedChannel] on line 815
Function [GreenChannel] on line 816
Function [BlueChannel] on line 817

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 351
  Calls under Procedure Delete_Warning
  Calls under Procedure MyBrowseCallbackProc
  Calls under Procedure BrowseForFolder
Function [MyBrowseCallbackProc] on line 430
  Calls under Procedure Profile_Read
  Calls under Procedure Profile_Write
  Calls under Procedure WmSize
  Calls under Procedure DeleteFiles_Common
Function [Delete_Error] on line 938
Function [Delete_Error] on line 960
Function [Delete_Error] on line 974
Function [Delete_Error] on line 1012
Function [Delete_Error] on line 1040
Function [Delete_Error] on line 1059
Function [Delete_Error] on line 1092
  Calls under Procedure DeleteFiles
Function [DeleteFiles] on line 1229
Function [DeleteFiles] on line 1362
Function [Delete_Warning] on line 1413
Function [Delete_Warning] on line 1426
Function [Delete_Warning] on line 1439
Function [Delete_Error] on line 1446
Function [Delete_Error] on line 1453
  Calls under Procedure CreateTheToolBar
  Calls under Procedure WriteToDataBase
  Calls under Procedure GetCurrentFileEx2
Function [Error] on line 1668
Function [Error] on line 1681
  Calls under Procedure GetCurrentFileEx
Function [Error] on line 1794
Function [Error] on line 1807
Function [Error] on line 1841
  Calls under Procedure GetCurrentFile
Function [Error] on line 1957
Function [Error] on line 1970
Function [Error] on line 2004
  Calls under Procedure SearchFiles
Function [Error] on line 2107
Function [ImageGetThumbNails] on line 2340
Function [WriteToDataBase] on line 2370
  Calls under Procedure DeleteDuplicatedFiles
Function [Error] on line 2517
Function [Error] on line 2585
  Calls under Procedure DlgSortProc
  Calls under Procedure SortImages
Function [Error] on line 3399
Function [Error] on line 3421
  Calls under Procedure PaintFullScreen
Function [GetCurrentFileEx] on line 3521
Function [ImageGetBitmap] on line 3529
  Calls under Procedure FullScreenProc
Function [PaintFullScreen] on line 3581
  Calls under Procedure LivstViewDoubleClick
  Calls under Procedure LivstViewDoubleClickEx
Function [GetCurrentFile] on line 3706
  Calls under Procedure ListViewOneClick
Function [GetCurrentFileEx2] on line 3790
  Calls under Procedure PhotoFiltre
Function [Error] on line 3889
Function [Error] on line 3903
  Calls under Procedure EditFile
Function [PhotoFiltre] on line 4032
Function [PhotoFiltre] on line 4080
  Calls under Procedure RedChannel
  Calls under Procedure GreenChannel
  Calls under Procedure BlueChannel
  Calls under Procedure ChannelRedProc
Function [PaintChannel] on line 4371
  Calls under Procedure ShowChannelRed
Function [GetCurrentFile] on line 4420
Function [WmSize] on line 4509
  Calls under Procedure ChannelGreenProc
Function [PaintChannel] on line 4555
  Calls under Procedure ShowChannelGreen
Function [GetCurrentFile] on line 4604
Function [WmSize] on line 4693
  Calls under Procedure ChannelBlueProc
Function [PaintChannel] on line 4739
  Calls under Procedure ShowChannelBlue
Function [GetCurrentFile] on line 4788
Function [WmSize] on line 4876
  Calls under Procedure TabControlSubClassProc
  Calls under Procedure WmCommand
Function [LivstViewDoubleClickEx] on line 4992
Function [ShowChannelRed] on line 4998
Function [ShowChannelGreen] on line 5004
Function [ShowChannelBlue] on line 5010
Function [EditFile] on line 5016
Function [BrowseForFolder] on line 5020
Function [SortImages] on line 5046
Function [DeleteFiles] on line 5052
Function [DeleteDuplicatedFiles] on line 5058
  Calls under Procedure WmCreate
Function [CreateTheToolBar] on line 5122
  Calls under Procedure WndProc
Function [LivstViewDoubleClick] on line 5460
Function [ListViewOneClick] on line 5471
Function [WmSize] on line 5526
Function [WmCommand] on line 5532
Function [WmCreate] on line 5538
  Calls under Procedure WinMain
  Calls under Procedure Start
Function [Profile_Read] on line 5823
Function [Error] on line 5857
Function [Error] on line 5871
Function [WinMain] on line 5892
Function [Profile_Write] on line 5894

FlowTrace
File name:C:\Users\51966\Documents\Pelles C Projects\ImgView\ImgView.inc
----- done -----
LineCount Results in file:
C:\Users\51966\Documents\Pelles C Projects\ImgView\LC_output.html

PERFECT
Title: Re: Line Counter Add-IN
Post by: Grincheux on June 18, 2021, 03:44:01 PM
By curiosity I asked the linker to make a map file.
In many cases you addin more useful.
Quote
ImgView.exe

 Timestamp is 60cca229 (Fri Jun 18 15:39:53 2021)

 Preferred load address is 0000000140000000

 Start         Length     Name                   Class
 0001:00000000 0000ab2dH .text                   CODE
 0002:00000000 000018e0H .rdata                  DATA
 0002:000018e0 00000110H .xdata                  DATA
 0003:00000000 000000b4H .pdata                  DATA
 0004:00000000 000000b4H .idata$2                DATA
 0004:000000b4 00000014H .idata$3                DATA
 0004:000000c8 000003b0H .idata$4                DATA
 0004:00000478 000003b0H .idata$5                DATA
 0004:00000828 0000081aH .idata$6                DATA
 0004:00001050 00000b58H .bss                    DATA
 0005:00000000 0003e278H .rsrc                   DATA
 0006:00000000 000003c8H .reloc                  DATA

  Address         Publics by Value              Rva+Base             Lib:Object

 0001:00000000       ClearMem                   0000000140001000 f   ClearMem.obj
 0001:00000041       CompareQSortProc           0000000140001041 f   ClearMem.obj
 0001:00003eb0       sph_keccak224_init         0000000140004eb0 f   Fns_Keccak.obj
 0001:00003ec0       sph_keccak224              0000000140004ec0 f   Fns_Keccak.obj
 0001:00003ed0       sph_keccak224_close        0000000140004ed0 f   Fns_Keccak.obj
 0001:00003ee0       sph_keccak224_addbits_and_close 0000000140004ee0 f   Fns_Keccak.obj
 0001:00003ef0       sph_keccak256_init         0000000140004ef0 f   Fns_Keccak.obj
 0001:00003f00       sph_keccak256              0000000140004f00 f   Fns_Keccak.obj
 0001:00003f10       sph_keccak256_close        0000000140004f10 f   Fns_Keccak.obj
 0001:00003f20       sph_keccak256_addbits_and_close 0000000140004f20 f   Fns_Keccak.obj
 0001:00003f30       sph_keccak384_init         0000000140004f30 f   Fns_Keccak.obj
 0001:00003f40       sph_keccak384              0000000140004f40 f   Fns_Keccak.obj
 0001:00003f50       sph_keccak384_close        0000000140004f50 f   Fns_Keccak.obj
 0001:00003f60       sph_keccak384_addbits_and_close 0000000140004f60 f   Fns_Keccak.obj
 0001:00003f70       sph_keccak512_init         0000000140004f70 f   Fns_Keccak.obj
 0001:00003f80       sph_keccak512              0000000140004f80 f   Fns_Keccak.obj
 0001:00003f90       sph_keccak512_close        0000000140004f90 f   Fns_Keccak.obj
 0001:00003fa0       sph_keccak512_addbits_and_close 0000000140004fa0 f   Fns_Keccak.obj
 0001:00003fb0       Dec2Hex                    0000000140004fb0 f   Images.obj
 0001:00004040       Sph_Keccak_256             0000000140005040 f   Images.obj
 0001:000040a0       ImageResize                00000001400050a0 f   Images.obj
 0001:00004130       GetBitsFromBitmapHandle    0000000140005130 f   Images.obj
 0001:00004260       ImageGetBitmap             0000000140005260 f   Images.obj
 0001:00004540       ImageGetThumbNails         0000000140005540 f   Images.obj
 0001:00004980       LoadImageFromFile          0000000140005980 f   Images.obj
 0001:00004c50       LoadImageFromFileEx        0000000140005c50 f   Images.obj
 0001:000050c0       GetBitsOfBitmap            00000001400060c0 f   Images.obj
 0001:000053d0       PaintChannel               00000001400063d0 f   Images.obj
 0001:00005780       Error                      0000000140006780 f   ImgView.obj
 0001:000057b0       Delete_Error               00000001400067b0 f   ImgView.obj
 0001:000057f0       Delete_Warning             00000001400067f0 f   ImgView.obj
 0001:00005830       MyBrowseCallbackProc       0000000140006830 f   ImgView.obj
 0001:00005870       BrowseForFolder            0000000140006870 f   ImgView.obj
 0001:00005930       Profile_Read               0000000140006930 f   ImgView.obj
 0001:00005c20       Profile_Write              0000000140006c20 f   ImgView.obj
 0001:00006030       WmSize                     0000000140007030 f   ImgView.obj
 0001:000061f0       DeleteFiles_Common         00000001400071f0 f   ImgView.obj
 0001:00006500       DeleteFiles                0000000140007500 f   ImgView.obj
 0001:000069a0       CreateTheToolBar           00000001400079a0 f   ImgView.obj
 0001:00006b00       WriteToDataBase            0000000140007b00 f   ImgView.obj
 0001:00006bd6       GetCurrentFileEx2          0000000140007bd6 f   ImgView.obj
 0001:00006dc9       GetCurrentFileEx           0000000140007dc9 f   ImgView.obj
 0001:00006f30       GetCurrentFile             0000000140007f30 f   ImgView.obj
 0001:00007140       SearchFiles                0000000140008140 f   ImgView.obj
 0001:00007880       DeleteDuplicatedFiles      0000000140008880 f   ImgView.obj
 0001:00007ab0       DlgSortProc                0000000140008ab0 f   ImgView.obj
 0001:000081f0       SortImages                 00000001400091f0 f   ImgView.obj
 0001:00008730       PaintFullScreen            0000000140009730 f   ImgView.obj
 0001:000087b0       FullScreenProc             00000001400097b0 f   ImgView.obj
 0001:00008890       LivstViewDoubleClick       0000000140009890 f   ImgView.obj
 0001:00008990       LivstViewDoubleClickEx     0000000140009990 f   ImgView.obj
 0001:00008a90       ListViewOneClick           0000000140009a90 f   ImgView.obj
 0001:00008b90       PhotoFiltre                0000000140009b90 f   ImgView.obj
 0001:00008d40       EditFile                   0000000140009d40 f   ImgView.obj
 0001:00008ee0       RedChannel                 0000000140009ee0 f   ImgView.obj
 0001:00008f80       GreenChannel               0000000140009f80 f   ImgView.obj
 0001:00009020       BlueChannel                000000014000a020 f   ImgView.obj
 0001:000090c0       ChannelRedProc             000000014000a0c0 f   ImgView.obj
 0001:000091b0       ShowChannelRed             000000014000a1b0 f   ImgView.obj
 0001:00009390       ChannelGreenProc           000000014000a390 f   ImgView.obj
 0001:00009480       ShowChannelGreen           000000014000a480 f   ImgView.obj
 0001:00009660       ChannelBlueProc            000000014000a660 f   ImgView.obj
 0001:00009750       ShowChannelBlue            000000014000a750 f   ImgView.obj
 0001:00009920       TabControlSubClassProc     000000014000a920 f   ImgView.obj
 0001:000099a0       WmCommand                  000000014000a9a0 f   ImgView.obj
 0001:00009bd0       WmCreate                   000000014000abd0 f   ImgView.obj
 0001:0000a030       WndProc                    000000014000b030 f   ImgView.obj
 0001:0000a3a0       WinMain                    000000014000b3a0 f   ImgView.obj
 0001:0000a620       Start                      000000014000b620 f   ImgView.obj

 entry point at        0001:0000a620

 Static symbols

 0001:000000d0       keccak_core                00000001400010d0 f   Fns_Keccak.obj
 0001:000039f0       keccak_close28             00000001400049f0 f   Fns_Keccak.obj
 0001:00003b20       keccak_close32             0000000140004b20 f   Fns_Keccak.obj
 0001:00003c50       keccak_close48             0000000140004c50 f   Fns_Keccak.obj
 0001:00003d80       keccak_close64             0000000140004d80 f   Fns_Keccak.obj
 0001:00000050       keccak_init                0000000140001050 f   Fns_Keccak.obj
Title: Re: Line Counter Add-IN
Post by: John Z on June 20, 2021, 02:45:28 PM
Improvements  :)
Thought I had a big problem as in Pelles C project window it shows no procs for FNS_Keccak.c in your ImgView.ppj project, but turns out there are, and LineCount is right, mostly.  However LineCount shows four false functions because they are defines 'DEFCLOSE' which 'appear' as functions to it.  I can improve more.  attached output files in text and HTML for the entire ImgView project, 34,002 lines worth.  :)

I ran your ImgView program too, screen shot attached.  I do wish it would delete into the Recycle bin though.  Very nice display, nice icons on the toolbar even though most inactivated.  Would be great to show a tooltip when hovering over a button.  Kibitzing . . . . kibitiser


John Z

removed jpg attachment to free upload space
Title: Re: Line Counter Add-IN
Post by: Grincheux on June 20, 2021, 03:43:51 PM

Stop John You Add-In is PERFECT. and VERY USEFUL.

I have added more options in ImgView and here is a link to it https://www.mediafire.com/file/r67hlalofxr360n/ImgView.7z/file
You can sort the files
Delete one or more files
Delete duplicated files (Just modify the imgwiew.ini)
Red, Green and Blue Channels
Grey Conversions (not standard, I don't like the standards...)
Added fullscreen view (F11 or Double-Click)
Possibility to edit the file (F3) with an external editor
You can now change of folder.
You can refresh the folder (F5)
When you open a tab, double-click on it to close it
I am working on mirrors, you will laugth
I don't want to do what other programmers did before me and better than I.
To exit the fullscreen press ESCape
I advance very slowly because I very often come back to my code, add messages where there is none...
The IDE does not help me very much.
And when I solve a problem, if It could help someone I make a tuto.
There is no save option, it will become but in the last part of the project
When saving I will let the user to set a name (GetSaveFilename)
The idea is that I open the file, read it, close it and draw.
If you want to save the result give a new name or not, but it is your choice.
You will never write into the original one.
Title: Re: Line Counter Add-IN
Post by: Grincheux on June 20, 2021, 03:56:17 PM
My avatar is one of the mirrors. ;D
Title: Re: Line Counter Add-IN
Post by: John Z on June 20, 2021, 05:24:53 PM
 :) Looks more like your blog page :)

One use for the Add-In is if you believe in code reuse.  It is good for building an inventory list of procedures and where they can be found. 

I downloaded your newest ImgView. Thanks.
I tried to close the RED tab with the X - my bad, file deleted.  I did not read your instructions carefully enough, you wrote clearly "When you open a tab, double-click on it to close it". Fortunately not irreplaceable picture file.  Recuva could not get it back either.....

John Z
Title: Re: Line Counter Add-IN 1.7.5
Post by: John Z on June 24, 2021, 02:15:09 PM
Bug fixes and improvements to processing and procedure detection. Maybe a bit faster.
Unless bugs found no more versions unless I decide to do a graphic using the FlowTrace data.  This would
show the program flow graphically.  Would be a lot of work not sure if time invested would be worthwhile.

John Z
Title: Re: Line Counter Add-IN
Post by: Grincheux on June 24, 2021, 04:27:54 PM
I agree with you
Title: Re: Line Counter Add-IN
Post by: Grincheux on June 24, 2021, 04:36:26 PM
Quote
3) API 'AddIn_GetSourceLine' throws a warning #2805: Possible violation
   of strict-aliasing rules when compile is set to Level 2. No other
   warnings or errors should be reported
#pragma warn(disable: 2805)
if(User is Pleased)
{
#pragma message("Merci JohnZ")
}
Title: Re: Line Counter Add-IN
Post by: John Z on June 25, 2021, 06:18:04 PM
 :)
I am pragmatic but I like to fix all errors and warnings IF possible, pounding pragma if not.

Starting add-in #2

Thanks Sir Grincheux.

John Z
Title: Re: Line Counter Add-IN
Post by: Grincheux on October 24, 2021, 05:56:02 PM
Perhaps a problem
Title: Re: Line Counter Add-IN
Post by: John Z on October 24, 2021, 09:38:51 PM
Thanks.
I’ll try to reproduce. From the picture it looks like some Unicode characters in the path name.
I don’t recall right off if I coded for Unicode path/file names.

John Z
Title: Re: Line Counter Add-IN
Post by: John Z on October 25, 2021, 11:52:37 AM
Looking at the source code it is coded to allow for Unicode filenames, so that is probably OK.

After the message box picture that you attached there should have been another
message explaining exactly what the error was.  The box title should have been
"FileName Creation"  if you can see that it would help.

My only thought at the moment is that a prior LC_Output.html was still open which locks
the file and would prevent opening the file again to write the new data.  The utility always
writes to the same filename. 


John Z
Title: Re: Line Counter Add-IN
Post by: Grincheux on October 25, 2021, 02:50:15 PM
I make an other test.
These time I often use your add-in to locate the function and see if I don't call a function which is part of the previous called.
Example:
Code: [Select]
int Function_A(void)
{
    JohnFunction() ;
    return ;
}

int MyFunction(void)
{
     Function_A() ;
     JohnFunction() ;

     return
}
Title: Re: Line Counter Add-IN
Post by: John Z on October 27, 2021, 01:49:41 PM
Yes this is a handy feature I use quite a bit myself. 

Happy it is a useful Add-In, maybe more people will try it.....

Also I like my Named Bookmarks, very useful although it is not the only one ...

John Z
Title: Re: Line Counter Add-IN
Post by: John Z on July 07, 2023, 03:41:07 AM
Updated for Pelles C v 12.002.  No code changes so just posting the DLL.
Posted here and on the initial page.
Title: Re: Line Counter Add-IN
Post by: John Z on August 14, 2023, 04:09:41 PM
Updated with Pelles C 12.00.2 small bug fix for invalid file creation error message for HTML output.
It is always created...

Just replace the DLL in the AddIns64 folder.

John Z
Title: Re: Line Counter Add-IN
Post by: John Z on November 01, 2023, 02:28:59 PM
Updated with improved procedure detection under Win11 and Pelles v12
Added reporting of the number of calls to each procedure as a report option.

John Z