Jump to content

New tool - a PreProcessor


kjactive
 Share

Recommended Posts

Complited a new update, some bugs was removed and some new option attached...

#cs / #ce '#comments-start' ec. now get treated as a block comments, was not inplimentated before...

Attached a new function - a user defined global string to search for in the script as a new remove option, no limits in keywords but beaware that a lot of searches do speed process down, but one could include a global search for words like _Debug( and every line that matches get removed - press the button right to the info line and the keyword list get displayed starting with the word USER:, 'Do not remove this' sepparate new keywords with a blank character, press return to activate. It is a security to put an '(' at the end - keywords get removed by highlight, delete and press a return - All normal PreProcess options will by time get local script related options but this will be a global PreProcess to all scripts like to remove a _Debug( line in all scripts... WebMedic

Removed a trailing comment line bug reported by wooltown...

Eltorro I'll have to look a little closer on the Enum bug as I never use this me self but comming on...

Download http://www.sitecenter.dk/latenight/nss-fol...t%20Manager.zip

Please keep on reporting bugs and comments - thanks

kjactive :whistle:

Edited by kjactive
Link to comment
Share on other sites

Link to comment
Share on other sites

Now that was a tricky one Wooltown but I knew that it was comming someday - Now fixed...

The search for includes used in scripts now has three passes:

1.Look for a match in Autoit3 default include path

2.Look in the main script local path

3.If it's a compliate path, search this for a match

If non of these three search paths has an include match - notify user with error and provide an option to break PreProcess...

Download http://www.sitecenter.dk/latenight/nss-fol...t%20Manager.zip

Thanks - Please report bugs and comments

kjactive :whistle:

Edited by kjactive
Link to comment
Share on other sites

kjactive, you do realize the details of AutoIt's #include search logic is fully documented, right? Why are you shooting in the dark coming up with incorrect methods when you can just read the documentation and implement the logic to follow what it says?

Link to comment
Share on other sites

Now that was a tricky one Wooltown but I knew that it was comming someday - Now fixed...

The search for includes used in scripts now has three passes:

1.Look for a match in Autoit3 default include path

2.Look in the main script local path

3.If it's a compliate path, search this for a match

If non of these three search paths has an include match - notify user with error and provide an option to break PreProcess...

Download http://www.sitecenter.dk/latenight/nss-fol...3PreProcess.zip

Thanks - Please report bugs and comments

kjactive :whistle:

I don't think it is the same algorithm as the one use in #include , just part of.

Reread the doc it will help to avoid next complain.

:)

Link to comment
Share on other sites

Very nice, thank you! Please keep at it.

I'm using Au3Preprocess 2.4 Preprocessed - Date 07:02:2007 Time 19:21

This:

If StringUpper(StringLeft(StringStripWS($sLine, 1), 25)) = ");_ DEFUN START-TOOLS" Then

Became this:

If StringUpper(StringLeft(StringStripWS($sLine,1),25))=")

The script sees the semicolon as a comment, even though it's within quotations.

Unprocessed script source: 85KB

PreProcessed script source: 47.5KB

Unprocessed script compiled: 248KB

PreProcessed script compiled: 214KB

Phillip

Link to comment
Share on other sites

Include works fin, found another small problem though:

GUICtrlCreateLabel ( "Own   Used     Free   Total    Num",95,5,230,20)
MsgBox(48,"Database                        Update failed","Your reservations didn't work correctly, please verify")

is after the PreProcess

GUICtrlCreateLabel ( "Own Used Free Total Num",95,5,230,20)
MsgBox(48,"Database Update failed","Your reservations didn't work correctly,please verify")

it has removed a lot of blanks in my GUICtrlCreateLabel and MsgBox which isn't so good.

Link to comment
Share on other sites

Wooltown - The option to remove blank characters inbetween is an option, and working dam well too, you just have to uncheck this PreProcess parameter option...

phillip123adams - there is no way to spot comment characters somewhere in a string from a trailing comment keyword like in your example = ");_ DEFUN START-TOOLS", you can put in a hex value though representing ; as Chr(0x3B) but otherwise you just have to uncheck ´remove trailing commets´ parameter option, The 248KB verse PreProcessed 214KB executes. One difference here is that the execute from Au3PreProcess is compliatly with all functions and variables buildin - actually no need for autoit3 installed if one wants to distibute to a non autoitter etc. so the differences is greater than these values showup...

Remember - not all preprocess options is available to all kind of scripts, that's why 'comming up' easy to create a DMakefile to control different preprocess options sepparately related to every script...

Please keep up reporting bugs and comments...

On the todo list - Still have to look into the enum bug...

kjactive :whistle:

Edited by kjactive
Link to comment
Share on other sites

Well it seems like I finally nailed the Enum bug and in the same process found a cleaning up bug that got fixed too

Download http://www.sitecenter.dk/latenight/nss-fol...t%20Manager.zip

Please keep up reporting and doing comments as I'm faceing a week of holiday and it's freezing cold here in Denmark, has to keep my fingers warm by tapping on the keyboard...

kjactive :whistle:

Edited by kjactive
Link to comment
Share on other sites

phillip123adams - there is no way to spot comment characters somewhere in a string from a trailing comment keyword like in your example = ");_ DEFUN START-TOOLS", ...

kjactive - All you have to do is check if the comment character is within a pair of quotation marks (both single and double quotes). Think about it, the AutoIt interpreter, Tidy, etc. are able to identify this condition.

I did a quick and dirty addition to your code and it worked for me, although it does not check to see if the quote closes before the comment character (needs more work). And there may be other conditions to satisfy as well. Below is the code I added and revised:

; Define double and single quote constants
           Global Const $dq = Chr(0x22), $sq = Chr(0x60)

Just below the following line in your code

$wd = StringInStr(StringStripWS($line,1),$cc)

Add

$wd2 = StringInStr($line,$dq,0,1); First Double quote position
             $wd3 = StringInStr($line,$sq,0,1); First Single quote position

and change

ElseIf $RemCommT = 1 AND $wd > 1 Then; remove traling comments

to

ElseIf $RemCommT = 1 AND $wd > 1 And _
                     ($wd2 = 0 Or $wd2 > $wd) And _
                     ($wd3 = 0 Or $wd3 > $wd) _
                     Then; remove traling comments

New problem. The space before the line continuation character following a comma or ampersand is being removed alghough it is a requirement:

This:

MsgBox(4096, _
           "Folder does not exist", _
           "Folder " & GUICtrlRead($eCTPath) & @LF & "does not exist." _
           & @LF & @LF & _
           "It will be created during installation.")

Becomes:

MsgBox(4096,_
         "Folder does not exist",_
         "Folder "&GUICtrlRead($eCTPath)&@LF&"does not exist." _
         & @LF&@LF&_
         "It will be created during installation.")

Phillip

Link to comment
Share on other sites

Okay phillip123adams, you got your changes, But the scan process for block comment keywords included 'in string or as a trailing comment' was not that easy as you nicely pointed out as there are two different string include characters and the single one can actually be part of the language it self and there can also be more than one dubble inclosed string as part of a single line - I'm not shure this is that smart but working alright for the time being...

The broken function call trouble was a bug and now fixed - thanks...

I did managed to remove two small bugs as well...

Download http://www.sitecenter.dk/latenight/nss-fol...t%20Manager.zip

Thanks and keep up reporting...

kjactive :whistle:

Edited by kjactive
Link to comment
Share on other sites

  • 3 weeks later...

Major Update, First of all I changed the name from Au3PreProcess to 'Project Manager' as now rev. 2.8...

Large Project and PreProcess manager...

post-4760-1172734118_thumb.gif

It has been some while ago seens last update, but I've been busy and the application has grown to a state of 'almost finished', there's probably still a bug or two around as there is a lot of things going around under the hood in this appliaction...

Some new features:

Attached the Makefile handle system to provide all preprocessed scripts with uniqe specified settings...

Wrote and attached a topics Help file...

Attached a menu with special features...

Attached an option to get information directly from the listview window - highlight a line and click at the title in the selectetd list gadget...

Made the global user scan option case sensetive...

Found a strip blank line bug...

Wrote and attached the compile option both as manual or done automatically from startup...

attached an about window with link to application homepage...

New PreProcess option attached - PreProcess Globals, change the actual globals right into the script...

Made the application available as a SciTe buildin macro tool with option to directly PreProcessed and compile script...

Made a prepreferences with lots of Global default parametre as well as some local makefile settings...

Attached an option to attach special function as buildin related to the makefile system, nice feature with dynamically created function calls....

Attached a MSAgent guided tour script both available as directly executed or run from the help menu...

Opdated the exclude keywords handle process...

Attached an option to look directly into Includes, function available, Globals variables used and lookup the final script...

Wrote a example script on how to attach the application into SciTe's properties script - Topics under special notes...

The MSAgent script checks for character presents ec. and if not available provide a end-user download site at MSDN ( Microsoft )...

And a lot more to discover by doing...

As I Changed the name, the old links to the application download is no more, Please download from site

http://www.sitecenter.dk/latenight/nss-fol...t%20Manager.zip

Please make comments and report bugs but Please read the Topics...

No install script, Just unzip to location, Source code attached...

kjactive :whistle:

Edited by kjactive
Link to comment
Share on other sites

kjavtive,

I just tested Project Manager 2.8 on one of my scripts. It failed to include the user defined function _ArrayReverse which is called by the user defined function _ArraySort, both of which are defined in Array.au3 located in the AutoIt Include folder.

Here's a simple script you can test this with:

#include <Array.au3>
Dim $aTest[4]
$aTest[0] = 1
$aTest[1] = 4
$aTest[2] = 2
$aTest[3] = 3
_ArraySort($aTest, 0, 0)
MsgBox(4096, "Test", $aTest[0] &@LF& $aTest[1] &@LF& $aTest[2] &@LF& $aTest[3])
Exit

Thanks again for sharing your script.

Phillip

Phillip

Link to comment
Share on other sites

Thanks Phillip123adams, true you nailed down a bug...

The trouble came when the included function was placed first on a line, seldom done but anyway hopefully gone....

Note: I coundn't check for _ArrayReverse but _ArraySort now get include and deep checked including qsort1 & 2 functions as well...

I attached two simple testing scripts in the zip under Data directory. These can be used to look deep into bugs, Default.au3 is the mother script that calls an UDF called function.au3, this script contains two functions, both get called from the mother script and get buildin. It would help a lot If the trouble somehow get related or written into these as an example but anyway keep on comming...

Download from

http://www.sitecenter.dk/latenight/nss-fol...t%20Manager.zip

kjactive :whistle:

Edited by kjactive
Link to comment
Share on other sites

The trouble came when the included function was placed first on a line, seldom done but anyway hopefully gone....

Note: I coundn't check for _ArrayReverse but _ArraySort now get include and deep checked including qsort1 & 2 functions as well...

kjactive,

Thanks, but I'm confused! Are you saying you fixed a bug, but not for _ArrayReverse. Also, functions _ArraySort, __ArrayQSort1 and __ArrayQSort2 were already included in the output with the previous version. It was only _ArrrayReverse that was not included when I reported the bug.

Anyway, I downloaded and tried the version dated March 2. It still does not include function _ArrayReverse in the output. However, if I revise the include file, Array.au3, so that the call to function _ArrayReverse is not on the same line as the If/Then statement, Project Manager properly includes the _ArrayReverse function in the output.

The following fails:

If $i_Decending Then _ArrayReverse($a_Array, $i_Base, $i_UBound)

Hope this helps,

phillip

Phillip

Link to comment
Share on other sites

Yes that helped me a lot - thanks

I can see that you just nailed down two bugs in the function scan process...

First bug: when the function was first on a line, the scan process sometime failed, fixed...

Second: When there are more than one underscore character on the same line could fool the scan process, fixed...

I found one me self regarding the makefile special function buildin process if there was no script present it wrote an empty line, fixed...

Download from site:

http://www.sitecenter.dk/latenight/nss-fol...t%20Manager.zip

Nice work phillip123adams

kjactive :">

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...