PDA

View Full Version : Code Formatter/Colorizer for the Board



LuckY
12-23-2004, 12:54 PM
It is very obvious to anyone who has been within walking distance of this board that more people do not use code tags than you can shake a stick at. Anyway, after noticing that a few people like to be sort of flashy by coloring up their code blocks, I figured it might be a kick to write a program to automate it. So, without further ado, here's my nifty little program "CodeFmt.exe". Just drop your *.cpp on it or run it from the command line if you're old fashioned. After it parses your file, the colored/code-blocked source will be on your clipboard. Just head on over to cboard.cprogramming.com and paste it on in.

Please give it a try and tell me what you think or if you find any insects. I wrote it in about an hour, so there might be something I missed (like keywords or some such thing). Thanks.

Thantos
12-23-2004, 01:10 PM
I'm gonna tell you the same thing I tell everyone who posts an executable:

Post the source. Sorry its not that I don't trust you, its that I don't trust anyone ;)

RoD
12-23-2004, 01:17 PM
Yea i think that it should be a forum rule honestly, it lessens the chance of us running something that will compromise our system.

algi
12-23-2004, 01:43 PM
Trust everyone, just don't trust the devil inside them

I got that off some movie

LuckY
12-24-2004, 12:31 AM
You have clearly treaded well into the realm of the severely overdramatic, Thantos, but to your credit, you have at the very least successfully managed to induce one other onto your bandwagon.

Thantos
12-24-2004, 12:37 AM
What is overdramatic about asking for the source? There are a couple good reasons:
1) You computer could be infected and this executable is infected
2) You haven't stated which platform you compiled it on. Not everyone here runs windows or your flavor of linux.
3) I don't know you. While I don't suspect you'd post a malicious program its not outside the realm of possiblities.
4) No one learns from an executable. This site's main purpose is learning.

Govtcheez
12-24-2004, 01:36 AM
You have clearly treaded well into the realm of the severely overdramatic, Thantos, but to your credit, you have at the very least successfully managed to induce one other onto your bandwagon.
With all the wannabe script kiddies here, why would anyone download any executable without the source to back it up? Get off your high horse.

misplaced
12-24-2004, 01:54 AM
With all the wannabe script kiddies here, why would anyone download any executable without the source to back it up? Get off your high horse.

...but then still, you don't know that the source matches the executable

Kleid-0
12-24-2004, 02:15 AM
...but then still, you don't know that the source matches the executable
Well, if there's no executable in the first place, then there's no reason to match. Executables == bad :(. Source == good :).

Sang-drax
12-24-2004, 05:57 AM
There are already code formatters for vBulletin out there. I have a program called Syntax Highlighter which monitors the clipboard for C++ code and automatically parses it.

Govtcheez
12-24-2004, 07:55 AM
...but then still, you don't know that the source matches the executable
You do if you compile the source yourself

LuckY
12-24-2004, 11:52 AM
What is overdramatic about asking for the source? There are a couple good reasons:
1) You computer could be infected and this executable is infected
2) You haven't stated which platform you compiled it on. Not everyone here runs windows or your flavor of linux.
3) I don't know you. While I don't suspect you'd post a malicious program its not outside the realm of possiblities.
4) No one learns from an executable. This site's main purpose is learning.

What I'm calling overdramatic is that your implication is that you refuse to download any executable and that you are only willing to accept source code on your computer. There are executables that you could download from anywhere. Is it your intention to never trust any application, allowing only applications you compile or purchase on a CD-ROM into your inner circle of trust? I'm not saying you should go around running every executable you come across, but to say that you "don't trust anyone" can easily be considered paranoic. There may be some good reasons that you ask for source code, but you were less asking for source and more explaining your fear that I might have uploaded a virus-ridden or just generally malicious application.


With all the wannabe script kiddies here, why would anyone download any executable without the source to back it up?
To reiterate the aforementioned statement, I was simply asking for some input on it's operation. I think it is quite obvious that I am not a "script kiddy," and it is very evident in many cases, especially considering the years one spends on this board, who might not be trustworthy.


Get off your high horse.
Good one. I'm on a high horse for saying it's overdramatic to be afraid of every executable that hasn't come through your compiler?


There are already code formatters for vBulletin out there. I have a program called Syntax Highlighter which monitors the clipboard for C++ code and automatically parses it.That sounds like a very interesting application. To be clear, I did not go out searching for existing software, nor was it my intention to come up with something profoundly original. I just had the idea to write it and went for it and was simply asking for feedback. As an aside, I'm glad to see that you of all people, who has probably downloaded my work more than anyone else on this board, are not as frightened as Thantos of my applications.

Govtcheez
12-24-2004, 12:11 PM
> Good one. I'm on a high horse for saying it's overdramatic to be afraid of every executable that hasn't come through your compiler?

The way you're saying it, you really come off that way, yeah. "Pish, 'twould be nonsensical for one to even begin to presume that such as I would compose a program that would harm another user! Poppycock!"

[keep it civil]

Thantos
12-24-2004, 12:13 PM
Where did I imply that I won't download executables from anywhere? Since I used the word post, I implied this board. I don't trust anyone (salem, webmaster, prelude, kermi, etc included) at this board well enough to blindly execute a program.

The reason I posted that line was so you wouldn't feel I was singling you out.

kermi3
12-24-2004, 01:08 PM
Ok, flame war, nothing constructive here. Thanks for the suggestion on the code formatter Sang - if you have a link I'd love to see it.

Everyone on this thread is an old hat to the boards. I'm not going to close the thread, I'm close. You are all respectful people and I don't think it needs to be done. But I am going to ask you to please maintain a reasonable level of curtisy and avoid name calling and other types of flaming that are atypical for longtime posters like yourselves.

Thank you,
Kermi3

major_small
12-24-2004, 01:18 PM
Anyway, after noticing that a few people like to be sort of flashy by coloring up their code blocks, I figured it might be a kick to write a program to automate it.

I don't know if you were including me in those 'few people' (because I do color/format my code), but if you were, I hate to bust your bubble but the only reason my code is colored is because of this program (http://www.codeguru.com/forum/showthread.php?s=&threadid=216655) :D

Sang-drax
12-24-2004, 02:33 PM
Ok, flame war, nothing constructive here. Thanks for the suggestion on the code formatter Sang - if you have a link I'd love to see it.

major_small linked to the same program. It works well.
Source is included :)

LuckY
12-24-2004, 04:16 PM
Thanks for mentioning the program Sang-drax and thanks for the link major_small. It's giving me some ideas on how to make my thing a bit more attractive. I'm going to improve on it and then upload the source. :)

7smurfs
12-24-2004, 04:28 PM
Wooo! I love looking at source code! :)

Kleid-0
12-24-2004, 06:05 PM
Me like source too 7smurfs :)