Sign in to follow this  
Followers 0
Jos

New Beta Tidy.exe

72 posts in this topic

#1 ·  Posted (edited)

Uploaded a new beta version of Tidy.exe v 2.2.0.11 (Feb 1, 2011) and tidy.ini which has the following updates:

Additions/Changes:

- removed the 4096 record limit.

- added support for UTF8 with BOM files.

- added option /region_indent or /ri which will indent #region-#endregion sections.

- Set variable name case for variables as defined in the Constants included files.

Parameter /prc or /properconstants support is added for this function because it will slow down the Tidy process and by default it is off.

e.g.: #Tidy_Parameters=/prc=1

Tidy.ini:

[ProgramSettings]

* * * (tabchar) Indent setting: 0 = Tabs > 0 = Number of Space

tabchar = 0

* * * Update Functions / Keywords / Macros / UDFs To Proper Case

proper = 1

* * * Update Constants defined in the "constant Include files"

properconstants = 0

BugFixes:

- Fixed proper casing Keywords when they "look like a Function" e.g. switch ($a=1)

- Fixed space removal after ( when /Delim=0

- Fixed space addition Between sting and closing brace in case of a Dot after the Brace.

This was a major rewrite of the internal file-handling, reading and memory handling of the script records so need it to be tested.

While testing I would advice to run winmerge automatically so you can actually check what was changed by tidy to ensure you do not screw up a working script.

I use this line in Tidy.ini to accomplish this:

ShowDiffPgm = """C:\Program Files (x86)\WinMerge\winmergeu.exe" "%new%" "%old%"""

Could use some members to do some good testing to ensure things still work properly.

Thanks

jos

Edited by Jos

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites



I shall begin testing tomorrow, just to appease you oh most revered one.


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

I love this program, it makes me look good.;)

I know how much I hate to re-enter a working program and try to re-write it... or even up-date it. Thanks for the effort Jos, It is appreciated by many!!!

I will start testing and post any helpful feedback.

Valuater

8)

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites

Many thanks for this great program!

I will start testing right now!


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

No issues spotted, tired with different statement types, indentation, spaces and function.

Outstanding tool for AutoIt use it a lot, thanks!


Post your code because code says more then your words can. SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y. Use Opt("MustDeclareVars", 1)[topic="84960"]Brett F's Learning To Script with AutoIt V3[/topic][topic="21048"]Valuater's AutoIt 1-2-3, Class... is now in Session[/topic]Contribution: [topic="87994"]Get SVN Rev Number[/topic], [topic="93527"]Control Handle under mouse[/topic], [topic="91966"]A Presentation using AutoIt[/topic], [topic="112756"]Log ConsoleWrite output in Scite[/topic]

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Hello all,

here are my observations so far

The changes in my tidy.ini

endfunc_comment = 0
The original code:

EndFunc   ;==>{function name here}
Note the three spaces before the ';' sign.

The tidied up code:

EndFunc ;==>{fucuntion name here}
There is only one space before the ';' sign.

I'm really not sure what the expected behavior would be. The same happens with the tidy.exe v.2.1

Edited by stoyan

; Opt('MustDeclareVars', 1)

Share this post


Link to post
Share on other sites

I'm really not sure what the expected behavior would be. The same happens with the tidy.exe v.2.1

It is expected behaviour to strip the spaces at the end of the code and add a space and then the end-of-line comment.

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

It is expected behaviour to strip the spaces at the end of the code and add a space and then the end-of-line comment.

My bug reports a bad, I have to practice. What I meant with the previous port was that with 'endfunc_comment = 0' the output is different then the one with 'endfunc_comment = 1'. The difference is in those two spaces before the comment character.

The description in the ini says

Added comment To EndFunc statement E.g. "EndFunc   ;==>UDF_Name"
It wasn't clear to me what to expect when turn this feature on or off.

; Opt('MustDeclareVars', 1)

Share this post


Link to post
Share on other sites

No worries, appreciate the feedback!

Understand that it is different and probably could be called inconsistent, but when 'endfunc_comment = 1' is used the fixed text is added with the extra spaces.

When 'endfunc_comment = 0' is used it follows the standard behaviour which is what I described.

Jos ;)


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

Here's one for real.

Consider the following:

#include <Array.au3>
if $cmdline[0] > 0 Then
    _ArrayDisplay($cmdline)
endif

When tidied the result is:

#include <Array.au3>
f $cmdline[0] > 0 Then
_ArrayDisplay($cmdline)
ndif

If new line is added just before the 'EndIf' the result is

#include <Array.au3>
f $cmdline[0] > 0 Then
_ArrayDisplay($cmdline)
;### Tidy Error: next line creates a negative tablevel.
;### Tidy Error: next line creates a negative tablevel for the line after it.
EndIf

The result gets even more devastating the larger the file is.

This occurs if and only if the line ending in the target file are UNIX type. Not tried the mixed line endings case.

I guess you've got an assumption about the length of the new line white space.

Ideally the fix will result in adding a switch in the ini about the preferred line ending char(s).

Edit: Or keep them intact altogether.

Edited by stoyan

; Opt('MustDeclareVars', 1)

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

One more.

Source:

#include <Array.au3>
If $cmdline[0] > 0 Then
    _ArrayDisplay($cmdline)
EndIf

The result:

#include < Array.au3 >
f $cmdline[0] > 0 Then
_ArrayDisplay($cmdline)
ndif
Note the include line

The source file is UTF-8 with BOM and UNIX LE.

Edit: The includes related issue is not LE related.

Edited by stoyan

; Opt('MustDeclareVars', 1)

Share this post


Link to post
Share on other sites

Ideally the fix will result in adding a switch in the ini about the preferred line ending char(s).

Edit: Or keep them intact altogether.

Understand the bug and will have a look at that to support also single char line endings.

Will also look at the UTF8 file issue... could you PM me the original file as you use it?

Thanks

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

could you PM me the original file as you use it?

Just for further reference I'm attaching the test files.

I can confirm that the two issues are fixed in v 2.2.0.2

Thank you.

testcase.zip


; Opt('MustDeclareVars', 1)

Share this post


Link to post
Share on other sites

A foolish consistency is the hobgoblin of little minds

Ralph Waldo Emerson

But consistency in file line endings I would consider anything but foolish. I would call it entirely normal - if not essential! ;)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

I believe that there should be an option in Tidy to normalize the line endings.

Share this post


Link to post
Share on other sites

For what it's worth, my opinion is that Tidy should read in files with mixed line endings and then just normalize them. It doesn't need to be complex, just normalize to the first line ending or something (or use a hard-coded setting). Some simple logic to read in files with mixed line endings is to just replace the CRLF combination with LF, then replace all remaining CR with LF. Any existing LF will go unchanged. Then on writing just convert LF to the desired normalized ending.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0