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.

Program Announcements / DBP OOP - Arrays and methods are DONE!

Author
Message
Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 13th Jan 2008 21:21 Edited at: 27th Jul 2008 11:47
After my internet stopped working this week-end, I decided to start working on my OOP precompiler for dbp again

You can now have methods within classes, and have arrays in classes, so all sorts of things are now possible

Here is an example header file and code file:




And the code produced (I know it's unreadable, but it keeps the line numbers the same:


I have included a .bat file with the executable. To set what files you want to precompile, right-click on it, and select 'edit'. You will see where to write the file names.

Download the latest version here (27 July 08)

Yuor signutare was aresed by a deslyxic mud...
Curious? CLICK HERE!
Tochiro GE999
16
Years of Service
User Offline
Joined: 20th Dec 2007
Location: Virginia
Posted: 13th Jan 2008 21:37
Nice Diggsey! I'll definitely have to try this out seeing as OOP is one thing that DBP could really use.

---------------
Michael Rogers
Xsniper.net
Roxas
18
Years of Service
User Offline
Joined: 11th Nov 2005
Location: http://forum.thegamecreators.com
Posted: 13th Jan 2008 21:56
Awesome!!!


Click For Details!
Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 13th Jan 2008 22:59 Edited at: 27th Jul 2008 11:07
Just to let you know of some built in array functions:

new_array = ResizeArray(array, newsize)
This will resize any array, returning a pointer to the new one (It automatically frees the old one and copies across the data)

size = ArraySize(array)
This will return the number of elements in the array (one more than the maximum array index)

new_array = CloneArray(array)
This will create a shallow copy of the array (If the elements are classes, both arrays will have the SAME classes, not copies of each other! To create a deeper copy, you will have to write your own function to do it)

Also, bear in mind that ALL class or array types must be allocated before use (using new), and deallocated when you no longer need them (using delete).

Yuor signutare was aresed by a deslyxic mud...
Curious? CLICK HERE!
Mr Z
16
Years of Service
User Offline
Joined: 27th Oct 2007
Location:
Posted: 21st Jan 2008 12:27
Awsome Diggsey!

Darkness, you haunt me. If I give in, I would be an monster beyond imagining. Light, you guide me. Thanks to you, I see past the nothingness. Life, I choose to live in the light.
andrey d
16
Years of Service
User Offline
Joined: 30th Jun 2007
Location:
Posted: 5th Feb 2008 07:42 Edited at: 5th Feb 2008 07:45
How does this work again?
Epimetheus
20
Years of Service
User Offline
Joined: 5th Oct 2003
Location: Naples, Florida
Posted: 13th May 2008 12:48
Nice work!

Are you considering adding support for static variables as well?
Uncle Sam
18
Years of Service
User Offline
Joined: 23rd Jul 2005
Location: West Coast, USA
Posted: 17th May 2008 20:33
Genious!

Zotoaster
19
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 17th May 2008 21:18
Wow, I just noticed this. Don't let this die! This is really great stuff

Don't you just hate that Zotoaster guy?
Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 19th May 2008 01:07
I'm rewriting it from scratch <again> so that it will support non-reference classes (eg. structures) which don't need you to use the new command on them all the time, as well as normal classes as before. Also, arrays of arrays will be supported, without having to create an extra class, and maybe even scope modifiers like public/private, and maybe even inheritance! Methods will be in there as usual, and adding static methods and members shouldn't be too hard

Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 21st May 2008 01:38
I've got the rewrite up to the same level as before, with about half as much code I'm going to start work on inheritance and scope tomorrow

Lancewrath
21
Years of Service
User Offline
Joined: 30th Dec 2002
Location:
Posted: 26th Jul 2008 19:38
very sweet

LIKE OMFG IM TEH KING OF TEH INTARWEB!
Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 27th Jul 2008 11:23 Edited at: 24th Jun 2012 23:10
I've had this done for a while, but forgot to upload it. Here is the latest version

- Structures (when you assign these, the actual data is copied across)
- Classes (when you assign these, the assigned variable IS the variable that it was assigned)
- Methods
- Properties!
- Arrays
- Members
- Public/Protected/Private modifiers for members
- Custom offset for members in class data, allowing unions
- Custom member alignment for classes/structures (You can align members on X byte boundaries)
- Inheritance
- Header files are now chosen by writing 'Declare "Header.txt"' on the first line of your code, so you only need to drag one file onto the precompiler.

Example header:


Example code:


Output:


https://forumfiles.thegamecreators.com/download/1556686

[b]

Attachments

Login to view attachments
Final Epsilon
20
Years of Service
User Offline
Joined: 26th Jan 2004
Location: CA, USA
Posted: 30th Jul 2008 01:27
Thanks diggsey! This looks really awesome. =)

My only question is whether this can be integrated into the compile process of any of the current third party IDEs.
RedFlames
16
Years of Service
User Offline
Joined: 25th Aug 2007
Location: Germania
Posted: 30th Jul 2008 03:00
Synergy has a Precompilers Option but i have never used it... but theoretically it should work i think

Login to post a reply

Server time is: 2024-04-26 04:50:34
Your offset time is: 2024-04-26 04:50:34