Page 2 of 2

Re: Cross Reference List (XRef)

Posted: 12 Jan 2018, 10:10
by stealzy
Great obfuscation, it looks crazy ;) ! Just a small piece of your script if you don't mind:

Code: Select all

Loop Read,%fi%
{ If (ex="c")
{ L:="",z:=A_LoopReadLine,x=1,c1:=z~="^[^\s#]"
IfEqual true,% !(z~="/\*|\*/|//")&&cm!=2,SetEnv L,%z%
else while x<=StrLen(z)
{ y:=SubStr(z,x,2),(cm=2&&y="*/")?(cm:=0,L.=" ",x++)
: (cm=0&&y="/*")?(cm:=2, L.=" ",x++):0
IfEqual cm,0,IfEqual y,//,break
(cm=2)?x++:L.=SubStr(z,x++,1)
} } else { L:=A_LoopReadLine, ln:=cm=1?"":SubStr(LTrim(L),1,2)
cm:=ex="a"&&ln="/*"?2:cm
IfEqual true,% ex="d"&&ln="::"||ex="a"&&cm=2&&L~="\*/"&&!(cm:=0)||cm=2,continue
} L:=rr(rr(L,":="," "),":",ex="d"?" :":ex="a"?": ":" ")
L:=rr(rr(ex="c"?rr(L,"\s+\(","("):L,"(;|\()","$1 "),"((``.)|{|\)|,)"," $1 ")
L:=Trim(rr(L,"[^\w#@$;" co "``]+"," ")),ln#=A_Index,cr=0
Loop Parse,L,%A_Space% ; ^^ c?[ (=>(] [;(=>$1 ] [`?{),=> $1 ]
{ z:=A_LoopField,y:=SubStr(z,1,1),cr:=ex!="a"||cr?cr:y=";"
IfEqual true,% (ex="d"&&z="rem"||ex="a"&&y=";"), IfNotEqual cm,1,break
(ex="a"&&A_Index=1&&z<>","&&z<>"{")?f#:=0:0
fr:=ex="d"?y=":"?A_Index=1?"F":lw="call"?"R":" ":" "
:ex="c"? SubStr(z,0)="("?c1&&!cr++&&!(nf[z]&2)? "F":"R":" "
:ex="a"&&SubStr(z,0)="("&&!(nf[z]&1)?"R":" "
(ex="a"&&SubStr(z,0)="("&&A_Index>1)?f#:=0:0
(ex="a"&&z="{"&&lw=")"&&f#&&fu)?fu:=SubStr(fu,1,f#) "F" SubStr(fu,f#+2):0
(ex="a")?(SubStr(z,0)=":"&&A_Index=1?fr:="F":lw="gosub"?fr:="R"):0
lw:=cr?lw:z,x:=rr(z,"(^[{:]+)|([({;:,)]+$)")
IfEqual x,,continue
fu.=ln#>=lb&&(ln#<=le||!le)?x "/" ln# "/" ++ic "/" fr "|":""
(ex="a"&&SubStr(z,0)="("&&A_Index=1&&!(nf[z]&1))?f#:=StrLen(fu)-2:0
IfEqual ex,d,IfEqual A_Index,1,IfEqual y,:,IfNotEqual cm,1,break
} } SplashTextOff
nz:=StrLen(ln#)+1,s:=dp(nz),wz=0,b2=2*10**9,int=""
IfLess lz,% nz*4,MsgBox 8240,,% "Characters/line must be " nz*4 " or greater!"
IfLess lz,% nz*4,goto rpt
How do you do this?

I use Notepad++ Ctrl+F → "Find all in current document" button for this goal.
Little bug: function map display hotkeys like a:: as function.

Re: Cross Reference List (XRef)

Posted: 12 Jan 2018, 10:38
by Helgef
@ stealzy see, someone else had similar questions ;). I reacted similarily to ReClip source code, but I found it quite easy to modify because the code was well commented, much more than your snippet, it looks a bit daunting indeed ;).

@ TAC109, I'm still using ReClip quite often, XRef, occasionally. :thumbup:

Cheers :wave:.

Re: Cross Reference List (XRef)

Posted: 12 Jan 2018, 18:12
by TAC109
@stealzy - Well, my code is not quite as confusing as you portray, as you've lost the comments and indents in your shown example! Many short variable names are simple contractions of a longer more meaningful name (saves typing). The single character names near the end of the alphabet (z, y, x, etc) are like localised working registers (contents used within a few lines only).

Anyway, thanks for trying XRef. I'll look into the bug you found.

@Helgef - I haven't progressed much with the '#include' enhancement we discussed a while ago as there doesn't seem to be much demand for this facility, and I don't need it myself. I've mentally planned the method I would use, but not coded anything.

Thanks for your comments.

Re: Cross Reference List (XRef)

Posted: 12 Jan 2018, 18:44
by TAC109
stealzy wrote:Little bug: function map display hotkeys like a:: as function.
Actually, that's not a bug. For AHK scripts, XRef includes functions and labels in the 'Function Map'. As hotkeys can be the subject of 'goto' and 'gosub' commands, they are included in the report.

Cheers

Re: Cross Reference List (XRef)

Posted: 13 Nov 2018, 21:59
by TAC109
Update 14 November 2018 -
  • The subset lines input box must now be completed or dismissed before continuing.
  • Subset XRef files created now have the supplied line number range in the file name.
  • Analysis of large scripts will now cause a readable progress tool tip to be shown.

Re: Cross Reference List (XRef)

Posted: 15 Nov 2018, 18:11
by TAC109
Update 16 November 2018 - n/up reports will now show the page number of the report in the 'page top' line.

Re: Cross Reference List (XRef)

Posted: 06 Jan 2019, 18:17
by TAC109
Update 07 January 2019 -
On recent versions of Windows 10, pressing the XRef Mono button would mistakenly clear Notepad's header and footer fields.
Now, pressing the Mono button will only:-
  • Set Notepad's margins to the defaults.
  • Set the Notepad font to mono.
  • (All other Notepad properties will remain unchanged.)
XRef is described in this post, where you can find the download link.

Re: Cross Reference List (XRef)

Posted: 04 Apr 2019, 22:05
by TAC109
Update 5 April 2019 -
  • Now can process AHK '#Include's to produce consolidated reports. (See the updated documentation for details.)
  • The Function Map now incorporates 'goto's.
  • The detection of comments in AHK and DOS scripts has been greatly improved.
  • Now handles AHK '#CommentFlag's and '#EscapeChar's directives.
  • Certain checkboxes in the 'Options' window now have a 3-way state for mutually exclusive or additive actions.
  • The text associated with these checkboxes will change to indicate the option selected.
XRef is described in this post, where you can find the download link.

Re: Cross Reference List (XRef)

Posted: 14 Apr 2019, 23:09
by TAC109
Update 15 April 2019 - Provide for the correct working directory defaults when processing '#Include' directives for AHK v2 (as well as v1).

XRef is described in this post, where you can find the download link.

Re: Cross Reference List (XRef)

Posted: 19 Apr 2019, 02:10
by Helgef
Excellent! It works well with v2 now, thanks for sharing this.

Cheers!

Re: Cross Reference List (XRef)

Posted: 19 Apr 2019, 03:28
by TAC109
@Helgef Thanks for the confirmation!

Re: Cross Reference List (XRef)

Posted: 02 Jun 2019, 19:01
by TAC109
Update 03 June 2019 -
  • Modified print commands for Notepad, to work with Windows 10, 1903 version.
  • Note:- Do not use this version unless your Windows 10 version is 1903 or later.
XRef is described in this post, where you can find the download link.

Re: Cross Reference List (XRef)

Posted: 20 Jun 2019, 22:56
by hoppfrosch
The download link from OP leads to an error ... "Error (404) - We can't find the page you're looking for." (https://bit.ly/2nmi8Id -> https://www.dropbox.com/s/dl/ast2uf4e7uzrxg9/XRef.zip)

You should consider, hosting it on github (or similar)

Re: Cross Reference List (XRef)

Posted: 21 Jun 2019, 00:58
by TAC109
Update 21 June 2019 - Fixed download link.
(Thanks @hoppfrosch)

Re: Cross Reference List (XRef)

Posted: 03 Sep 2019, 18:24
by TAC109
Update 04 September 2019 -
  • Any ;@Ahk2Exe compiler directives encountered will have their data included in the reports.
  • Progress messages, etc. will now be shown in the status area of the Options window.
  • Any error messages generated by AutoHotkey.exe will now appear in the '#Include List'.
XRef is described in this post, where you can find the download link.