I have already written the parsing engine for this format (for my new version)and i invite comments suggestions on it.
Stolen from format readme:  :P

;How the cfg file SHOULD  :P work:

;The lines in the cfg file is split into 3 sections
;that works like this:

example: "Text to search for",Localtabposition,Globaltabposition

; As the program enumerates your asm lines the Globaltabposition ,which controls
; how many tabs/space are inserted at the start,is modified by the text contained in that
; line.
; Localtabposition is copied from Globaltabposition at the start of each line
; You can modify the tabs current position and also its position on the next line.
; Localtabposition modifies the current lines tabs ONLY and does not change
; the Global tab position.

; The changed Globaltabposition is used on next line and not the current line.
; You DONT need to adjust your localTabpos to allow for a modified Globaltabposition.
; Say i want to indent whenever pushad is used and outdent when popad is used
; to covert text from this:

mov eax,eax
pushad
mov eax,eax
popad
mov eax,eax

;to this
mov eax,eax
pushad
mov eax,eax
popad
mov eax,eax

;I would add these two lines to my cfg file:
;First the indent
example: "pushad",0,1
;Read in english:
; If a line contains "pushad" dont modify this lines tabpos but move the Globaltabposition
; forward one tab.
; The Current line will now be indented as normal.(ie.Globaltabposition since we dont change it)
; Also the following lines will now be indented 1 more than the current line.(ie.Globaltabposition+1)

; Now for the outdent
example: "popad",-1,-1
;Read in english:
; If a line contains "popad" move the tab pointer for this line back one tab and
; move the GlobalTabpos back one tab
; The Current line will now be indented 1 less.(ie.Globaltabposition-1)
; The following lines will now also be indented 1 less.(ie.Globaltabposition-1)

; This Method makes adding temporary out/indents easy (.ie .elseif Case etc.)
example: ".elseif ",-1,0 ;drop back 1 tab for this line but continue like normal
example: "Case ",-1,0 ;on the  next lines

; If you wish for a different type of indent you could use 
example: "pushad",1,2; to make this
mov eax,eax
pushad
mov eax,eax
mov eax,eax;
mov eax,eax
popad
mov eax,eax
; Note. the same modification has to be made to the matching outdent to allow for this
example: "popad",-1,-2

Also you can force also a tab positon by using * in setting
example: ".code",*0,0 ;would force no tabs for this line
example: ".const",*0,0;but normal tabs for the following text

This could also be used to make text after unmatched indent blocks
format correctly

Example: " endp",*0,*0 ; set the current line to 0 tabs
                                ;and reset GlobalTabpos

More examples:
".if ",0,1
".elseif ",-1,0
".else",-1,0
".endif ",-1,-1

Posted on 2006-07-06 22:15:47 by asmrixstar
Another question here, I seem to differ between a lot of people here because all my instructions are tabbed, so that instead of a space after a mov command, I tab to line all of the operands up. Will I have to do that myself, or will there be an option in the future for that?
Posted on 2006-07-07 16:18:57 by Bobbias
...and of course revert the tab to a single space after a mov command.

...and some of us capitalize IF ELSEIF ELSE ENDIF WHILE ENDW etc... Also add an option to convert all those.

...and some capitalize the opcodes (geesh) - there should also be an option to convert them too.

This will be sweet - a fully customizable Code Converter. :D
Posted on 2006-07-07 16:32:50 by JimmyClif
Progress Update:
1.The Actual 'Tab insertion' routine is now completed  :D :D
2.The cfgfile parser is alot more carefull when handling things like spaces after commas negative number etc (the boring stuff! :sad:)
3.added ** as a passable arg this will reset the globalTabpos,LocalTabpos to default defined in ini file
.ie . ".const",*0,** ; force current line tab size to 0,next lines reset to 'StartingSize'

Still to do:
1. User defined Global text replacement for stuff like "EAX" --->  "eax" and ".WHILE"-->".while"
2. Clean it all up and move code into dll template (curr. in exe4 easier testing)
3. Add export to dll to modify StartingSize so it can,for example ,format from halfway through a proc and still look correct. EM_REPLACESELTEXT .etc
4.Check it all works

eta. approx 2 days till a beta(alpha  :P) and we can try and bash out any bugs i didnt get.


I seem to differ between a lot of people here because all my instructions are tabbed, so that instead of a space after a mov command, Will I have to do that myself, or will there be an option in the future for that?


I tab to line all of the operands up. < sorry,i didnt understand this bit!
I try to answer the q i think ur asking..  :oops:
If your saying you would like youre default tab to be 1 indent from the very start then yes it was implemented last nite under the ini setting key of StartingSize, you could also set MinIndent to 1
and this would prevent any line from having less than 1 tab. (Same For Max indent)

This is the top section of the ini file:


UseSpacesNotTabs=0 ; Use Spaces Instead of Tabs .....
  ;(tip:use ScaleFactor to increase number of spaces )
ScaleFactor=0 ; Valid Values are 0,2,4+8 all else will be ignored to 0
StartingSize=1 ; Begining Indent size (Recommended : 1)
MinIndent=0 ; Must be lower than max or will be set to zero
MaxIndent=10 ;
the strings follow after this...... I hope i answered your questions...
:)
Posted on 2006-07-08 04:46:14 by asmrixstar
oooooooh!  :shock:
Just realized what you meant,
You mean specify:
xor{TAB}eax,eax ;instead of
xor{SPACE}eax,eax

Yes,sort of, the global replacer will( :P) be able to do this
format:"replace me","with me",Casesensitive
example:"xor{SPACE}","xor{TAB}",0

which should achieve the same result if not ill add for you. ;)

My reason for this is, i dont care if it takes and extra 1/4 of a second to format some huge doc if it would normally take me 10 mins! While im not trying the write slow code my emphasis is on opening the engine to as many options as possible and keeping it maintainable even if that comes at the expence of speed.
Since the prog is/willbe open source speedfreaks can tweak if they like ;)
Posted on 2006-07-08 05:15:48 by asmrixstar
Thanks, i feel special to know that you'll add that :P and yeah, you got it right the second time, I use tab after the processor instruction/invoke to line the operands up regardless of the length of the operation itsel. just looks a little less cluttered to me, and asm has always looked somewhat clusterd to me :/ In any case, thanks. This thing looks to really be shaping up nicely!
Posted on 2006-07-09 00:57:27 by Bobbias
The dll is very nearly complete (Thank you real life! :roll:)

Im developing an app along side the dll that will autoformat code between an asm standard and a config file based on a specific author and back again (quite easy due to dll design)

That way it will be easier to convert another authors code format to yours via this standard.
All you will need is his/her std file which converts code from the std style to his prefered style...

Stupid example: One of the ways I code is
mov hDc,_(CreateCompatableDc,eax)  ; I use an underscore instead of $invoke or rv macro

Because the 'first pass' (to the std format) will have coverted any "$invoke" to rv
my config file can always assume the standard "rv" even if my fellow programmer always uses "$invoke"

Before anyone starts getting upset about a standard being 'imposed' It should be noted that the whole point of this program is to make it easier for other people to read your code as well as the other way around!
If some one continues to post in the non-standard style this will still make it easier to convert from his/her format to your format because you can build a config file for ur self based on that user....
This would also reduce the need for a MUCH slower attempt to convert everyones standard to yours in one 'pass' (although this is prefered to bugging the orig authour to use AutoFormat.dll)

The Tabs part of the formating code remains unaffected,this is just for the global replace feature.
As u can see im trying to keep everyone happy! :D :P

I have a question though do u think the forum standard should default to 2 spaces instead of a tab for easier viewing? (side feature)
thx
Posted on 2006-07-13 12:00:13 by asmrixstar