NO

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

Grincheux

  • Guest
Re: Line Counter Add-IN
« Reply #45 on: June 13, 2021, 04:48:14 pm »
May the problem is awith comments
I added some kinds of them




Offline John Z

  • Member
  • *
  • Posts: 531
Re: Line Counter Add-IN
« Reply #46 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


Offline John Z

  • Member
  • *
  • Posts: 531
Re: Line Counter Add-IN
« Reply #47 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
« Last Edit: August 17, 2022, 04:29:59 pm by John Z »

Grincheux

  • Guest
Re: Line Counter Add-IN
« Reply #48 on: June 14, 2021, 06:30:10 pm »
Verified html file with 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

« Last Edit: June 14, 2021, 06:32:36 pm by Grincheux »

Offline John Z

  • Member
  • *
  • Posts: 531
Re: Line Counter Add-IN
« Reply #49 on: June 14, 2021, 07:00:48 pm »
Verified html file with 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

Grincheux

  • Guest
Re: Line Counter Add-IN
« Reply #50 on: June 14, 2021, 08:02:20 pm »
I tested with Operaand Edge, it was wrong.

Offline John Z

  • Member
  • *
  • Posts: 531
Re: Line Counter Add-IN
« Reply #51 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

Grincheux

  • Guest
Re: Line Counter Add-IN
« Reply #52 on: June 15, 2021, 03:07:34 pm »
Ok with Opera

Offline John Z

  • Member
  • *
  • Posts: 531
Re: Line Counter Add-IN
« Reply #53 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

 

Grincheux

  • Guest
Re: Line Counter Add-IN
« Reply #54 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
« Last Edit: June 15, 2021, 03:46:22 pm by Grincheux »

Offline John Z

  • Member
  • *
  • Posts: 531
Re: Line Counter Add-IN
« Reply #55 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.

Offline John Z

  • Member
  • *
  • Posts: 531
Re: Line Counter Add-IN
« Reply #56 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
« Last Edit: June 16, 2021, 05:25:19 pm by John Z »

Grincheux

  • Guest
Re: Line Counter Add-IN
« Reply #57 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.

Offline John Z

  • Member
  • *
  • Posts: 531
Re: Line Counter Add-IN
« Reply #58 on: June 16, 2021, 05:24:40 pm »
OH darn - what Have I done !!  :-[ >:(

Sorry - Slipped up testing only C

John Z

Offline John Z

  • Member
  • *
  • Posts: 531
Re: Line Counter Add-IN
« Reply #59 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
« Last Edit: June 18, 2021, 02:21:18 pm by John Z »