Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Work in Progress / DBA Maid (code formatter)

Author
Message
Joe Cooning
21
Years of Service
User Offline
Joined: 29th Mar 2003
Location: United States
Posted: 15th Aug 2006 05:56 Edited at: 15th Aug 2006 05:58
This is just a program I threw together to try and take a DBA file and output it into another file so that it is formatted properly.
For example, it will change this code:

to this:

I figured it could be useful to someone, and nice for things like the 20 line challenge.

Attachments

Login to view attachments
Cash Curtis II
19
Years of Service
User Offline
Joined: 8th Apr 2005
Location: Corpus Christi Texas
Posted: 15th Aug 2006 08:28
Well, it worked for the most part Nice idea.

Around line 2281 it stopped formatting. Then at line 2470 it converted a comment ` into a " for some reason. It didn't mess anything up, it just made the rest of the program into an open string.

Looking good, and I know it will help out a lot of messy programs


Come see the WIP!
Aaron Miller
18
Years of Service
User Offline
Joined: 25th Feb 2006
Playing: osu!
Posted: 15th Aug 2006 09:19
Good idea! I will use this alot with source contibutions! Try to fix the bugs cash mentioned, and this will be completely amazing!

Good luck
-db

Cash Curtis II
19
Years of Service
User Offline
Joined: 8th Apr 2005
Location: Corpus Christi Texas
Posted: 15th Aug 2006 13:30
Oh hey, one more tip. We should have the option to disable the reformatting of things that are remmed out. I have lots of stuff like this...



That doesn't survive the reformat.


Come see the WIP!
NeX the Fairly Fast Ferret
19
Years of Service
User Offline
Joined: 10th Apr 2005
Location: The Fifth Plane of Oblivion
Posted: 15th Aug 2006 13:50
That's because you're not supposed to spend half an hour on each comment. You're supposed to do:

or

so you can find it easily in the ide.


Since the other one was scaring you guys so much...
Cash Curtis II
19
Years of Service
User Offline
Joined: 8th Apr 2005
Location: Corpus Christi Texas
Posted: 15th Aug 2006 14:12 Edited at: 15th Aug 2006 14:12
@NeX the Fairly Fast Ferret -
Quote: "That's because you're not supposed to spend half an hour on each comment. You're supposed to do:"

Umm... thanks for the info I like to physically separate sections of code with markers like that. I also use the labels and the single line Rem comments. Those take all of .5 seconds to make. I don't do it by hand.


Come see the WIP!
Van B
Moderator
21
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 15th Aug 2006 16:16
You can't beat a big huge seperator for your functions, I tend to use long strings of dashes or something, makes it look like each function can be cut-out and kept .

One thing I'd add to this is the ability to arrange functions, like just give you a list of functions and let your sort them how you like by simply dragging or moving up or down the list. My functions tend to get spread all over the place when I don't plan out projects - and I don't plan out projects until the week before there due .

Also - just a bonus feature that I hankered for ages ago - but it can take a very very long time to find a nesting error - like say you deleted a random ENDIF in your code - logically it would be easy to find that by counting the IF's and ENDIF's, like find an IF when there's an unclosed nest and it could mark it for you. It's really more a debugging tool, but when you have 10,000 lines and a missing endif, really the best course is to snail on through your code tidying it up manually - it'd be a cool feature and save time when things go wrong.

''Stick that in your text and scroll it!.''
Joe Cooning
21
Years of Service
User Offline
Joined: 29th Mar 2003
Location: United States
Posted: 15th Aug 2006 18:26
@cash: Can I see the code area where it stopped formatting? Maybe I can find the problem.

@Van B: I ike that function arranging idea. I'll see what I can come up with.

Duffer
21
Years of Service
User Offline
Joined: 9th Feb 2003
Location: chair
Posted: 15th Aug 2006 19:15
@ Joe Cooning,

Potentially excellent and v useful - will keep an eye on this thread

a long time dabbler with DBC and DBPro with no actual talent but lots of enthusiasm...
Medieval Coder
18
Years of Service
User Offline
Joined: 31st Dec 2005
Location:
Posted: 15th Aug 2006 22:31
*Bookmarks*

Fallout
22
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 15th Aug 2006 23:11 Edited at: 15th Aug 2006 23:12
Cash's big ass comments are a complete necessity for big programs. You can't use the function finder thing in the IDE when you have hundreds of functions across multiple source files. I generally do what Van does and have big old spaces with lots of lines of dashes and stars and then some writing in caps. If I wasn't such a lazy bastardo, I would do it the cash way and do a little Ascii picture.

Cool idea for an app though. Quite handy as a lot of code snippets online are poorly formatted.

Cash Curtis II
19
Years of Service
User Offline
Joined: 8th Apr 2005
Location: Corpus Christi Texas
Posted: 16th Aug 2006 02:30 Edited at: 16th Aug 2006 02:33
It's easier than all that.
http://www.network-science.de/ascii/
Just put in your text and it will generate hundreds of banners in hundreds of retro ascii fonts instantly. My whole program looks like a warez shrine.
I also mark the banner separators with other symbols. I usually use 3 full lines of ">>>>>>>>>>>" for begin block and "<<<<<<<<<<<<<<" for end block. Makes everything easier to visualize.


Come see the WIP!
NeX the Fairly Fast Ferret
19
Years of Service
User Offline
Joined: 10th Apr 2005
Location: The Fifth Plane of Oblivion
Posted: 16th Aug 2006 12:27
I don't use comments at all... it just makes the program look cluttered to me. I can just remember what everything does.


Since the other one was scaring you guys so much...
Cash Curtis II
19
Years of Service
User Offline
Joined: 8th Apr 2005
Location: Corpus Christi Texas
Posted: 16th Aug 2006 12:39
Well, I remember what everything does. However, it's not easy to spot one segment of code inside of 12,000 other lines of code. Comments are very useful for that. They're also very useful for making your code understandable long after you've written it. Nobody can remember forever.


Come see the WIP!
Ginga
18
Years of Service
User Offline
Joined: 3rd Jul 2006
Location: Dorset, England
Posted: 16th Aug 2006 13:22
I LOVE using long REM statements to keep my program looking tidy, scrolling up n down, looking for the section you want is easier if you have a LONG statement saying what it does, EG

REM *-*-*-*-*-*-*-*-*-* CONTROLLS *-*-*-*-*-*-*-*-*-*-*-*-*
REM *-*-*-*-*-*-*-*-*-* FUNCTIONS *-*-*-*-*-*-*-*-*-*-*-*-*
Joe Cooning
21
Years of Service
User Offline
Joined: 29th Mar 2003
Location: United States
Posted: 16th Aug 2006 17:55
Here's an update. Hopefully I fixed up some of the problems you might have had.
I also added a cfg file. All it does so far is allow you to turn off and on the formatting of comments. Enjoy!

Attachments

Login to view attachments
Joe Cooning
21
Years of Service
User Offline
Joined: 29th Mar 2003
Location: United States
Posted: 28th Aug 2006 04:09
(*bump*)
Here's a new update. This one has a new graphic for it, and it gives you some options dealing with functions (look in the cfg file to figure out what). Not quite the function sorting that Van B wanted, but I think it might be useful. Enjoy!

Attachments

Login to view attachments
Aaron Miller
18
Years of Service
User Offline
Joined: 25th Feb 2006
Playing: osu!
Posted: 28th Aug 2006 08:24
Nice, i am downloading it right now, glad its only 963kb. I will see what the config file does, then i will edit this post to give any suggestions or ideas i may have (and bugs of course).


(This is not an edit)
When formatting (last time i tried), i find it usefull when you have a block like:


It would be usefull to add spaces, ex:


except, ive usually got 1000s of lines of things needed to be written (Well, at least in the double digits), and i would find that usefull.

Also (Still original post), it would be usefull to choose the amount of spaces, like by default it might be 3, so the user can choose 1,2,3,4, etc. Just an idea.



Anyways, looks good.

Joe Cooning
21
Years of Service
User Offline
Joined: 29th Mar 2003
Location: United States
Posted: 28th Aug 2006 19:07
I'll see what I can do about the open and close file. As for the spaces, I just have it add a tab, not a certain number of spaces. Try opening it in notepad or wordpad and see.

Aaron Miller
18
Years of Service
User Offline
Joined: 25th Feb 2006
Playing: osu!

Login to post a reply

Server time is: 2024-09-29 16:35:51
Your offset time is: 2024-09-29 16:35:51