Re: [fpc-pascal] New multicast event implementation

2011-02-02 Thread michael . vancanneyt
On Tue, 1 Feb 2011, Anthony Walter wrote: Hello all. I implemented a new type of multicast events in Delphi based on generics. I thought someone could maybe consider and convert this implementation to Free Pascal. Here is a link to an article describing the implementation, its benefits and

[fpc-pascal] dynamic array and new/dispose

2011-02-02 Thread Amit Bueno
I am writing an application on iMac, and having problem dynamically creating objects and reading them into an array: // I got the following object: PChunk = ^Chunk; Chunk = Object SubChunks: array of PChunk; Data: Pointer; . Function

Re: [fpc-pascal] dynamic array and new/dispose

2011-02-02 Thread ik
On Wed, Feb 2, 2011 at 10:20, Amit Bueno amitbu...@gmail.com wrote: I am writing an application on iMac, and having problem dynamically creating objects and reading them into an array: // I got the following object: PChunk = ^Chunk; Chunk = Object SubChunks:

RE: [fpc-pascal] dynamic array and new/dispose

2011-02-02 Thread Amit Bueno
The general error it raises is: Access Violation From: fpc-pascal-boun...@lists.freepascal.org [mailto:fpc-pascal-boun...@lists.freepascal.org] On Behalf Of ik Sent: Wednesday, February 02, 2011 10:31 AM To: FPC-Pascal users discussions Cc: mac-pas...@listman.sonic.net Subject: Re:

[fpc-pascal] Re: New multicast event implementation

2011-02-02 Thread Ben
Op 2011-02-02 03:45, Anthony Walter het geskryf: Hello all. I implemented a new type of multicast events in Delphi based I've always liked the idea of supporting multiple event handlers per event. Java, Qt, C# has had it for years. BTW: The print function (printer friendly version) at the

Re: [fpc-pascal] dynamic array and new/dispose

2011-02-02 Thread Jonas Maebe
On 02 Feb 2011, at 09:20, Amit Bueno wrote: // creating and reading more data SubChunks[NewSubChunk]^.read(Fl); // NewSubChunk function Function Chunk.NewSubchunk: integer; begin setlength(SubChunks, High(SubChunks)+2); New(subchunks[High(SubChunks)], create);

RE: [fpc-pascal] dynamic array and new/dispose

2011-02-02 Thread Amit Bueno
I am compiling in a delphi mode. Sorry for not posting a runnable source code,. The code portion was taken from a huge source code, which is probably hard to detach from the rest of the code. It is reading a TStream object, which is an input 3ds file given to the app. --- Amit -Original

Re: [fpc-pascal] dynamic array and new/dispose

2011-02-02 Thread ik
On Wed, Feb 2, 2011 at 11:18, Amit Bueno amitbu...@gmail.com wrote: I am compiling in a delphi mode. Sorry for not posting a runnable source code,. The code portion was taken from a huge source code, which is probably hard to detach from the rest of the code. It is reading a TStream object,

RE: [fpc-pascal] dynamic array and new/dispose

2011-02-02 Thread Amit Bueno
Have you got the prof.rar? Amit From: fpc-pascal-boun...@lists.freepascal.org [mailto:fpc-pascal-boun...@lists.freepascal.org] On Behalf Of ik Sent: Wednesday, February 02, 2011 11:29 AM To: FPC-Pascal users discussions Subject: Re: [fpc-pascal] dynamic array and new/dispose On Wed,

Re: [fpc-pascal] dynamic array and new/dispose

2011-02-02 Thread Jonas Maebe
On 02 Feb 2011, at 14:10, Amit Bueno wrote: Have you got the prof.rar? No. I've just looked at the posts held for moderation and your mail is over 5MB. That is way too large to send to a mailing list. First of all, make sure to only include source code, not compiled units, programs or

Re: [fpc-pascal] Re: New multicast event implementation

2011-02-02 Thread Anthony Walter
Yeah, I just added the code highlighter, which build the highlights using javascript. I set to display: none while the page loads which isn't effecting the print version. The workaround is that you can print the code blocks by clicking the print icon in each code section. I'll fix it later.

Re: [fpc-pascal] Re: New multicast event implementation

2011-02-02 Thread Anthony Walter
Just an update ... I fixed the print feature at the bottom. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Re: New multicast event implementation

2011-02-02 Thread michael . vancanneyt
On Wed, 2 Feb 2011, Anthony Walter wrote: Yeah, I just added the code highlighter, which build the highlights using javascript. I set to display: none while the page loads which isn't effecting the print version. The workaround is that you can print the code blocks by clicking the print icon

Re: [fpc-pascal] Re: New multicast event implementation

2011-02-02 Thread Anthony Walter
By the way, does Free Pascal generic support generic constraints yet? Also, this format seems more natural to me: TCollectionT: TCollectionItem = class property Count: Integer; property Items[Index: Integer]: T; end; TStatusPanels = class(TCollectionTStatusPanel); rather than ... generic

Re: [fpc-pascal] Re: New multicast event implementation

2011-02-02 Thread michael . vancanneyt
On Wed, 2 Feb 2011, Anthony Walter wrote: By the way, does Free Pascal generic support generic constraints yet? Also, this format seems more natural to me: No, it does not. Michael. TCollectionT: TCollectionItem = class property Count: Integer; property Items[Index: Integer]: T; end;

Re: [fpc-pascal] dynamic array and new/dispose

2011-02-02 Thread Amit Bueno
Seems that the ios doesn't allocated properly my objects,. after allocation when trying to run a function from the object it fails. I tried replacing the New(subchunks[X]) to SubChunks[X] := AllocMem(sizeof(Chunk)); Again this works on the windows, it doesn't on the ios. Have you got any ideas?

RE: [fpc-pascal] Internal error 2006012201 while cross compiling

2011-02-02 Thread Julien Devillers
Ok, so now it compiles but, I still an an error while linking : ld.exe: cannot find -lpthread This is basic crosslinking stuff. You must transfer all the required libraries from the target system, to be able to crosscompile it to there(In this case libpthread.so)

Re: [fpc-pascal] dynamic array and new/dispose

2011-02-02 Thread ik
On Wed, Feb 2, 2011 at 16:57, Amit Bueno amitbu...@gmail.com wrote: Seems that the ios doesn't allocated properly my objects,. after allocation when trying to run a function from the object it fails. I tried replacing the New(subchunks[X]) to SubChunks[X] := AllocMem(sizeof(Chunk)); Again

Re: [fpc-pascal] dynamic array and new/dispose

2011-02-02 Thread Amit Bueno
The SubChunks are -- 'var subchunks array of pchunk;' contained in chunk before allocating the subchunks a setlength(subchunks, High(subchunks)+2) is called. --- Amit On Wed, Feb 2, 2011 at 5:15 PM, ik ido...@gmail.com wrote: On Wed, Feb 2, 2011 at 16:57, Amit Bueno amitbu...@gmail.com

[fpc-pascal] if you really want to know who write a really good code read-it

2011-02-02 Thread denis Bertin
unit D_fleche; {written by denis bertin in a day for www.denisdraw.com with delphi-7} interface uses windows,whelp,wbase,col_plan,dialbase,messages; type Tdial_position_fleche = class(whelp.ThelpDialog) constructor create (un_parent:wbase.twindow; un_plan_param:col_plan.TCalque); procedure

Re: [fpc-pascal] dynamic array and new/dispose

2011-02-02 Thread ik
On Wed, Feb 2, 2011 at 17:18, Amit Bueno amitbu...@gmail.com wrote: The SubChunks are -- 'var subchunks array of pchunk;' contained in chunk before allocating the subchunks a setlength(subchunks, High(subchunks)+2) is called. But does the X variable point to existed index in the array ? if

Re: [fpc-pascal] dynamic array and new/dispose

2011-02-02 Thread Amit Bueno
Of course it does -- otherwise it won't have worked on delphi under windows. The X = High(SubChunks); --- Amit On Wed, Feb 2, 2011 at 5:27 PM, ik ido...@gmail.com wrote: On Wed, Feb 2, 2011 at 17:18, Amit Bueno amitbu...@gmail.com wrote: The SubChunks are -- 'var subchunks array of pchunk;'

Re: [fpc-pascal] dynamic array and new/dispose

2011-02-02 Thread ik
I have created a proof of concept from your code: {$mode delphi} program test; type PChunk = ^Chunk; Chunk = Object SubChunks : array of PChunk; data : Pointer; Function NewSubchunk: integer; end; function Chunk.NewSubchunk :integer; var

RE: [fpc-pascal] dynamic array and new/dispose

2011-02-02 Thread Amit Bueno
Seems that I found a workaround. When calling the NewSubChunk in the following syntax: SubChunks[NewSubChunk]^.read(fl); /// raise an exception. While MyIndex := NewSubChunk; SubChunks[MyIndex]^.read(fl); /// raise an exception. Doesn't raise any excetion…. Maybe the experts could

Re: [fpc-pascal] dynamic array and new/dispose

2011-02-02 Thread Jeppe Johansen
Den 02-02-2011 17:26, Amit Bueno skrev: Snipped And you say it was on iOS? On ARM I suppose? What sort of compiler version and options do you use? ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org

[fpc-pascal] Memory leak or object destruction?

2011-02-02 Thread Bo Berglund
I am curious as to how FPC handles the following situations: var MyObj: TsomeObject; begin MyObj := TsomeObject.Create; // do some processing MyObj := NIL; end; Will this create a memory leak or will FPC fnd by reference counting that nothing references the object memory and dispose of

Re: [fpc-pascal] Memory leak or object destruction?

2011-02-02 Thread Michael Van Canneyt
On Thu, 3 Feb 2011, Bo Berglund wrote: I am curious as to how FPC handles the following situations: var MyObj: TsomeObject; begin MyObj := TsomeObject.Create; // do some processing MyObj := NIL; end; Will this create a memory leak or will FPC fnd by reference counting that nothing

Re: [fpc-pascal] Memory leak or object destruction?

2011-02-02 Thread Andrew Hall
Interfaces support reference counting. ISomeObject = interface TSomeObject = class(TinterfacedObject, ISomeObject) var MyObj: ISomeObject; Regards, On 02 Feb 11, at 15:22 , Bo Berglund wrote: Will this create a memory leak or will FPC fnd by reference counting that nothing references the

RE: [fpc-pascal] dynamic array and new/dispose

2011-02-02 Thread Amit Bueno
I tested it both on ARM, and on i386 (iphonesim). I used the latest fpc svn trunk. Options I can say it wasn't something exceptional, only –Mdelphi or something. Amit From: fpc-pascal-boun...@lists.freepascal.org [mailto:fpc-pascal-boun...@lists.freepascal.org] On Behalf Of Jeppe Johansen

[fpc-pascal] Re: New multicast event implementation

2011-02-02 Thread Ben
Op 2011-02-02 15:55, Anthony Walter het geskryf: isn't effecting the print version. The workaround is that you can print the code blocks by clicking the print icon in each code section. I'll fix it later. I simply used the Browser's Print menu option, instead of the printer friendly webpage