Page 6 of 7
Posted: Wed Mar 26, 2008 2:21 pm
by inc.
I will have a look this week as right now im a bit busy.
Posted: Fri Apr 03, 2009 5:48 pm
by inc.
I went into it and it should work now without bugs when handling multiple Imports also when using IncludePath.
http://www.file-upload.net/download-156 ... e.zip.html
Posted: Mon Jun 15, 2009 10:27 pm
by inc.
Update:
- fixed Declare bug in the resulting parser code
http://pb-oop.origo.ethz.ch/download
Posted: Fri Jun 19, 2009 6:02 pm
by inc.
Update:
- fixed bug of incorrect include file parsing
http://pb-oop.origo.ethz.ch/download
Posted: Fri Jul 17, 2009 11:48 am
by inc.
New Release 1.0rev72:
- 64bit support
http://pb-oop.origo.ethz.ch/download
Please test,
thanks
Re: PureObject - PureBasic OOP support
Posted: Sun Nov 22, 2009 9:38 am
by aonyn
Hi,
I apologize if this is a dumb question, I am not an expert coder by any means.
I am still learning, and feeling comfortable with simple concepts, but trying to progress to more complex concepts.
I have been playing with PB OOP and overall it is beginning to make sense.
However, I am having one problem, returning a value from a method
Here is an example I have been trying to write
Code: Select all
Class vector2D
vector2D()
Release()
set(x.f, y.f, test.s)
getX()
getY()
getTestString()
x.f
y.f
test.s
EndClass
Procedure vector2D\vector2D()
; Constructor
EndProcedure
Procedure vector2D\Release()
; Destructor
EndProcedure
Procedure vector2D\set(x.f, y.f, test.s)
This\x = x
This\y = y
This\test = test
EndProcedure
Procedure.f vector2D\getX()
x.f = This\x
Debug x
ProcedureReturn x
EndProcedure
Procedure.f vector2D\getY()
y.f = This\y
Debug y
ProcedureReturn y
EndProcedure
Procedure.s vector2D\getTestString()
test$ = This\test
Debug test$
ProcedureReturn test$
EndProcedure
*v1.vector2D = NewObject vector2D()
*v1\set(1.0, -1.0, "String Test")
Debug *v1\getX()
Debug *v1\getY()
Debug *v1\getTestString()
I am getting the expected values inside the method, but not after the return, I am instead getting strange results outside the method.
Would someone please help me see what I am doing wrong?
I feel as though I almost grasp how to use PB OOP for simple tasks, except this one very confusing bit.
I am baffled.
Thanks,
Dave
Re: PureObject - PureBasic OOP support
Posted: Sun Nov 22, 2009 5:17 pm
by Demivec
aonyn wrote:I am getting the expected values inside the method, but not after the return, I am instead getting strange results outside the method.
Would someone please help me see what I am doing wrong?
I feel as though I almost grasp how to use PB OOP for simple tasks, except this one very confusing bit.
I am baffled.
@aonyn: Your code needs to be adapted further. One notable item needed for PureBasic OOP is the defining of an interface for an object's methods. Another point is that the constructor sets up access to the interface.
Here is your code modified to include these points:
Code: Select all
Structure members_Vector2D
;virtual table address for function list
*vtable
;all other object data elements
x.f
y.f
test.s
EndStructure
Interface Vector2D_Object
;list all functions for object
Release()
set(x.f, y.f, test.s)
getX.f()
getY.f()
getTestString.s()
EndInterface
Procedure new_Vector2D()
; Constructor
Protected *object.members_Vector2D = AllocateMemory(SizeOf(members_Vector2D))
If *object
;assign vector table address so object can use the functions in the interface
*object\vtable = ?vector2D_vtable
;assign default values if any
EndIf
ProcedureReturn *object ;return objects address
EndProcedure
Procedure vector2D_Release(*this.members_Vector2D)
; Destructor
FreeMemory(*this)
;the return value is designed to be used like this object = object\Release()
ProcedureReturn #Null
EndProcedure
Procedure vector2D_set(*this.members_Vector2D, x.f, y.f, test.s)
*this\x = x
*this\y = y
*this\test = test
EndProcedure
Procedure.f vector2D_getX(*this.members_Vector2D)
x.f = *this\x
Debug x
ProcedureReturn x
EndProcedure
Procedure.f vector2D_getY(*this.members_Vector2D)
y.f = *this\y
Debug y
ProcedureReturn y
EndProcedure
Procedure.s vector2D_getTestString(*this.members_Vector2D)
test$ = *this\test
Debug test$
ProcedureReturn test$
EndProcedure
DataSection
;vector2D virtual table
vector2D_vtable:
Data.i @vector2D_Release()
Data.i @vector2D_set()
Data.i @vector2D_getX()
Data.i @vector2D_getY()
Data.i @vector2D_getTestString()
EndDataSection
V1.Vector2D_Object = new_Vector2D()
;always make sure return value <> #Null to ensure a valid object was created
If V1 = #Null
Debug "Object couldn't be created"
End
EndIf
V1\set(1.0, -1.0, "String Test")
Debug V1\getX()
Debug V1\getY()
Debug V1\getTestString()
Debug V1 = V1\Release()
An additional point is that there is no special variable names required or recognized by PureBasic for any of the functions, variables, or structures (i.e. *this.members_Vector2D could have been written *x.stuff), as long as they are used properly correctly in the code. The ones that were chosen in the example code were to make it easy to understand how the OOP method is implemented (i.e. members_Vector2D is the structure containing the members of the Vector2D object).
Re: PureObject - PureBasic OOP support
Posted: Sun Nov 22, 2009 8:34 pm
by aonyn
Thanks Demivec,
I am going to study your example and try to get my head around it.
It is certainly a good idea for me to understand how purebasic does OOP with native tools only.
May I ask how it would be done correctly as well with the PB OOP precompiler?
I am not sure, bit it seems to be a bit simpler with the precomiler, and I am hoping if I can learn to understand OOP with OOP style tools, it will then perhaps be easier to understand how it works in native PB, which of course is not made for OOP, so the implementation in native PB is perhaps overly complex, and less intuitive to learn.
I will indeed study what you just gave me Demivec, I do want to understand under the hood as well.
I will post back to let you know how I am doing with it.
Thanks again,
and regards,
Dave
Re: PureObject - PureBasic OOP support
Posted: Mon Nov 23, 2009 2:32 am
by Demivec
aonyn wrote:I am going to study your example and try to get my head around it.
It is certainly a good idea for me to understand how purebasic does OOP with native tools only.
May I ask how it would be done correctly as well with the PB OOP precompiler?
I am not sure, bit it seems to be a bit simpler with the precomiler, and I am hoping if I can learn to understand OOP with OOP style tools, it will then perhaps be easier to understand how it works in native PB, which of course is not made for OOP, so the implementation in native PB is perhaps overly complex, and less intuitive to learn.
I will indeed study what you just gave me Demivec, I do want to understand under the hood as well.
I will post back to let you know how I am doing with it.
@aonyn: I'm a little embarrassed. I responded to your question without realizing that the thread dealt with the pre-compiler PureObject.

My comments only reflect doing things natively and not with using PureObject, nor any other pre-compiler. My apologies for being a little off-topic with my response.

Re: PureObject - PureBasic OOP support
Posted: Mon Nov 23, 2009 9:43 am
by Fred
Just a shoot in the dark (didn't tried it), but you will may be have to specify the correct return type in your class defnition ?
Code: Select all
Class vector2D
vector2D()
Release()
set(x.f, y.f, test.s)
getX.f()
getY.f()
getTestString.s()
x.f
y.f
test.s
EndClass
Re: PureObject - PureBasic OOP support
Posted: Wed Nov 25, 2009 1:10 am
by aonyn
No worries Demivec,
I appreciate your effort to help.
You could have simply ignored my thread.
Besides that, as I said, I want to learn native OOP style as well, but I am trying to understand the basics with a precompiler first, because it seems to simplify things a bit.
Also, thanks for your reply Fred.
That makes sense, and I will give it a try and post back with my results.
regards,
Dave
Re: PureObject - PureBasic OOP support
Posted: Sat Nov 28, 2009 7:15 am
by aonyn
Hi Fred,
Thanks again for your advice.
Perhaps it was a shot in the dark for you, but you were absolutely correct.
I typed my method returns in the class definition, and now my code works as expected.
I feel dumb now, it was so obvious now that you have solved it for me
Oh, and off topic, but while I have your attention, thanks for your continued development of PureBasic.
I have been trying to learn to code, in various languages, until about a year ago, when I discovered PureBasic.
I was able to learn very basic concepts, but never to the point of feeling comfortable writing my own apps.
Finally in PureBasic, I am confident and comfortable writing apps which I never dreamed of being capable of previously.
And on top of that, I have yet to experience any limits imposed by lacking features in the language.
No regrets purchasing my license, and I will send a donation soon as thanks for the new version you are working on
regards,
Dave
Re: PureObject - PureBasic OOP support
Posted: Fri Jan 01, 2010 7:34 pm
by SFSxOI
@ inc.
Did you know your OOP forum page still shows this:
"This free forum hosting network is under New Management.
We are reviewing all our phpBB version 2 free forum for possible violation.
If you are still viewing this page, please contact us at immediately to get your forum Reviewed and Activated within minutes.
MSN Messenger:
freeforum@noeclue.com
Email Support:
freeforum@noeclue.com
Any members of this forum can request to get this forum reviewed and activated. When you send either a messenger or email, Please include your full forum URL!
In the meantime, feel free to browse our company online shopping.
Note: New Support Forum will be up and running by tomorrow night!"
?
Re: PureObject - PureBasic OOP support
Posted: Sat Jan 02, 2010 7:47 pm
by inc.
yeah, i did notice that and I did send a mail but with NO answer or even reopening the specific forum.
I you do know a good free forum space? Seems like
http://www.forumer.com/ is worth a look.
But with all honours ... seems almost noone was interested in a specific community dealing with PureObject means PB OOP capabilities.
In times of beeing online, at the end that forum only gots about 15 registrations, so .... I think those topics could be handled in here as well.
But of cource my sig now is updated

Re: PureObject - PureBasic OOP support
Posted: Tue Jan 26, 2010 9:34 pm
by erion
Hello,
It seems there is a problem with accented characters when using PureObject. For example:
When PureObject is installed in PB's default ide, the preprocessed source's encoding is wrong, which affects accented chars (i.e. when passing them to a function, setting a variable, etc).
With the commandLine compiler (and without PureObject in the IDE) everything works fine.
I thought I'd post it here at first, but please let me know if filling a bug report on your site would be better.
Erion