Overclockers Australia Forums

OCAU News - Wiki - QuickLinks - Pix - Sponsors  

Go Back   Overclockers Australia Forums > Software Topics > Programming & Software Development

Notices

Reply
 
Thread Tools
Old 13th August 2002, 11:56 PM   #1
Geo Thread Starter
Member
 
Join Date: Jun 2001
Location: Adelaide
Posts: 2,368
Default Geo's fantastic Perl script

Here is a little perl script I knocked up a while ago.

Download me

I wrote this little program while I was doing alot of C++ programming. When writing C++ I always write the headers first then write the cpp files. After writing a big long header file it always seemed really tedious to have to re-write your method declarations in a cpp file to fill out the actual methods themselves. So I looked around the net for something that convert headers to cpp files, but I could only find a commercial product that did it. So I spun my own, and its free.

Basically it reads in a C++ header file and writes out the cpp file with the skeletons of all the methods that need to be filled in. It should work for most standard class definitions, things that are little more tricky (or things I left out) it might stumble over. If you try it on anything and it produces the wrong output, let me know (post in here) and Ill fix it.

Feel free to use it for anything you want, C++ programmers might find it a real time saver, I do.

Like I said, if there are any bugs please let me know.

Aside:
Its good when you invent something out of laziness, has anyone else ever taken a few hours to write something that will stop you having to do something that will take 5 minutes, or just invented something out of laziness?
__________________
"That's the way good software gets designed. So if you pull out a piece it won't run" - Steve Ballmer
Geo is offline   Reply With Quote
Old 14th August 2002, 11:05 AM   #2
gatecrasher
Member
 
gatecrasher's Avatar
 
Join Date: Dec 2001
Location: London
Posts: 2,640
Default

Aside:

Well its not that lazy, but i had JCreator (Java IDE) set up so it autocompletes System.out.println("") and places the curser in between the "" was simple but made coding sooo much quicker..
gatecrasher is offline   Reply With Quote
Old 15th August 2002, 7:24 PM   #3
Geo Thread Starter
Member
 
Join Date: Jun 2001
Location: Adelaide
Posts: 2,368
Default

So has anyone downloaded this or has my generosity been in vain?
__________________
"That's the way good software gets designed. So if you pull out a piece it won't run" - Steve Ballmer
Geo is offline   Reply With Quote
Old 15th August 2002, 8:06 PM   #4
Rampage101
Member
 
Join Date: Jun 2001
Location: Country NSW
Posts: 2,032
Default

Well I can see the use for it, but for me to need it at the moment is just not happening. I'm only doing my second UNI unit, a second C++ unit, but I'm still only in Year11 at school and don't do enough programming as of yet. Although I'm looking into game programming.
__________________
AMD Phenom 920 || Gigabyte GA-MA790FX-DS5 || Seagate 320gb & A-RAM 64gb Pro SSD || 2x2GB Corsair XMS PC6400 DDR2 || 512MB Powercolor HD4850 ||
AMD Athlon II 245 || Gigabyte GA-MA770-S3 2.0 || WD 250gb OS, MDADM 5x HD753LJ Raid 5 || 2x2GB Corsair XMS + 2x1GB XMS || Nvidia x16 PCI-E cut down to 1x ||
Rampage101 is offline   Reply With Quote
Old 15th August 2002, 8:17 PM   #5
Decker
Member
 
Decker's Avatar
 
Join Date: Dec 2001
Location: Cyberspace
Posts: 402
Default

I downloaded it. Haven't used it yet, but seeing as I'm studying a few different header files atm and will be doing C++ for a while yet, It'll be very handy, I'm sure.

KTHXBIBIKEKEKE
Decker is offline   Reply With Quote
Old 16th August 2002, 9:18 PM   #6
xntrik
Member
 
Join Date: Jun 2001
Location: Perth
Posts: 161
Default

don't tools like the MS' Visual Studio and Rational Rose do this stuff already?

ie: u give it all the UMLesque info (incl. specs) and it'll create all the files with skeletal information?
__________________
Christian "xntrik" pHreakshow xntrik@gmail.com un-excogitate
xntrik is offline   Reply With Quote
Old 17th August 2002, 1:56 AM   #7
Geo Thread Starter
Member
 
Join Date: Jun 2001
Location: Adelaide
Posts: 2,368
Default

Not everyone uses those tools do they?
__________________
"That's the way good software gets designed. So if you pull out a piece it won't run" - Steve Ballmer
Geo is offline   Reply With Quote
Old 17th August 2002, 9:58 AM   #8
SpeedRacer
Member
 
SpeedRacer's Avatar
 
Join Date: Sep 2001
Location: Sydney
Posts: 2,948
Default

Quote:
Originally posted by xntrik
Rational Rose
ARRGGGHHHH

/me runs off screaming!!!!!

__________________
Frangipani's on cars... Australia says NO!!!
SpeedRacer is offline   Reply With Quote
Old 17th August 2002, 12:52 PM   #9
xntrik
Member
 
Join Date: Jun 2001
Location: Perth
Posts: 161
Default

yep. I suppose your both right.

and who could stay mad at you perl.. oh perl!
__________________
Christian "xntrik" pHreakshow xntrik@gmail.com un-excogitate
xntrik is offline   Reply With Quote
Old 19th August 2002, 7:35 PM   #10
Predator
Member
 
Predator's Avatar
 
Join Date: Jun 2001
Location: Newcastle
Posts: 1,797
Default

Quote:
Originally posted by SpeedRacer


ARRGGGHHHH

/me runs off screaming!!!!!

/me joins SpeedRacer
__________________
Quote:
Originally Posted by Christopher Joye View Post
Idiots will tell you that this means house prices are going to fall 20-40%. There is not a snowball's chance in hell that will happen.
Predator is offline   Reply With Quote
Old 28th September 2002, 6:27 PM   #11
Geo Thread Starter
Member
 
Join Date: Jun 2001
Location: Adelaide
Posts: 2,368
Default

I just did an update to this. It how handles the ordering of constructors a bit better and handles class and method declarations that span multiple lines... if any one is interested.
__________________
"That's the way good software gets designed. So if you pull out a piece it won't run" - Steve Ballmer
Geo is offline   Reply With Quote
Old 28th September 2002, 8:13 PM   #12
DRILL SGT
Member
 
Join Date: Feb 2002
Location: Brisbane
Posts: 508
Default

GEO, fuck yeah apps that save you time own ass. I was sick and tired of having to open IE and Notepad so I developed my own VB HTML/Javascript Editor and it saves time. Alas I am not at that level of C++ coding nice and slow does me fine.
DRILL SGT is offline   Reply With Quote
Old 29th September 2002, 1:54 PM   #13
Nasher
Member
 
Join Date: Jun 2001
Location: Hobart
Posts: 1,228
Default

Quote:
Originally posted by xntrik
don't tools like the MS' Visual Studio and Rational Rose do this stuff already?
They do. You also pay through the nose for licences if you wish to use these products legally. That's why I've boycotted Visual C++ 6.0 and taken to writing my programs in TextPad and compiling them with Borland command line tools.

I'll be the first to admit that I'm a C++ dunce, but I've had no luck in getting Geo's script to work. I knocked up a simple header file to feed it, and so far I've received no useful output. Here's my header file:

Code:
class blah : public test
{
	public:
		blah();
		~blah();
		int blah4(int a);
		char blah5(int a, int b);
}
I've named the file t.hpp
Originally, the script would straight away output "t.cpp written" and the file would be empty. I found out this was just because I'd stuffed up the header.

Now, if I'm not mistaken, the script should generate something like this:
Code:
test::blah()
{
}

test::~blah()
{
}

int test::blah4 (int a)
{
}

char test::blah5(int a, int b)
{
}
Correct?

I run the script, and a t.cpp will be created, but the script will freeze. Task manager indicates that perl.exe is using '99 CPU', so presumably it's trying to do something, but nothing seems to happen. The script doesn't end unless I ctrl-c it, and the t.cpp file remains empty.

I'm using Perl 5.6 which I found lying around on my hard drive, using Windows 2000 if any of that information is relevant.
Nasher is offline   Reply With Quote
Old 29th September 2002, 3:49 PM   #14
Geo Thread Starter
Member
 
Join Date: Jun 2001
Location: Adelaide
Posts: 2,368
Default

Ah, your one of those curly brace on the next line people arent you. I usually put mine on the end of the line (K&R Style) and I have tried one on the next line yet. I'll fix it up for you.

Thanks for testing it.
__________________
"That's the way good software gets designed. So if you pull out a piece it won't run" - Steve Ballmer
Geo is offline   Reply With Quote
Old 29th September 2002, 3:53 PM   #15
Geo Thread Starter
Member
 
Join Date: Jun 2001
Location: Adelaide
Posts: 2,368
Default

Actually, it did already handle it, you left a ; of the end of your class declaration. It should be:

Code:
public blah {
...

};
But Ill fix it up to handle it more gracefully and only output K&R style braces if K&R style braces were used.
__________________
"That's the way good software gets designed. So if you pull out a piece it won't run" - Steve Ballmer
Geo is offline   Reply With Quote
Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +10. The time now is 1:52 AM.


Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
OCAU is not responsible for the content of individual messages posted by others.
Other content copyright Overclockers Australia.
OCAU is hosted by Micron21!