Re: [fpc-pascal] Re: ++ and -- ( and +=, -=, ...)

2013-08-01 Thread kyan
Somehow relevant, has someone thought of turning Inc()/Dec() into functions that return the modified value -like the Interlocked ones? I think this would cover some of the cases discussed in a more "pascalish" notation.Also, Include()/Exclude() could similarly be turned into functions. -- Constant

Re: [fpc-pascal] How To write an enumerator for trees

2013-03-22 Thread kyan
On Fri, Mar 22, 2013 at 12:39 AM, S. Fisher wrote: > --- On Thu, 3/21/13, kyan wrote: > Are you the man who created Kyan Pascal? I used that many > years ago. I'd never heard of it till now. I wish. I'm nowhere nearly that good. :) ___

Re: [fpc-pascal] How To write an enumerator for trees

2013-03-21 Thread kyan
On Thu, Mar 21, 2013 at 10:32 AM, Xiangrong Fang wrote: > I have read this. My question is not about how to write enumerator, but how > to do this for TREEs Usually linearizing recursion is done with a stack. Here's a sample implementation that will give you an in-order tree traversal (Left - Par

Re: [fpc-pascal] TurboPower FlashFiler for Free Pascal

2012-10-23 Thread kyan
On Tue, Oct 23, 2012 at 4:34 PM, wrote: > If I understand Graeme correctly, he wants it compiled-in (i.e. without > dll). SQLite is a separate DLL. SqLite source can be downloaded and compiled with a C compiler (e.g. CBuilder) and its .lib file linked directly in a Delphi application using the {

Re: [fpc-pascal] Header translation, argument list, array of const?

2012-06-29 Thread kyan
On Sat, Jun 30, 2012 at 12:21 AM, Bernd wrote: > Hello, I need to call the following function: > > > /** >  * Notifies Purple that a buddy's status has been activated. >  * >  * This is meant to be called from protocol plugins. >  * >  * @param account   The account the user is on. >  * @param nam

Re: [fpc-pascal] Unhandled exception from library crashes host exe

2012-06-28 Thread kyan
On Thu, Jun 28, 2012 at 12:45 PM, Jonas Maebe wrote: > The safecall calling convention is only supported on a few platforms. > Originally it was only supported on Windows. Nowadays it's also supported on > a few extra platforms because it was required for XPCOM (someone wanted to > use XPCOM on ce

Re: [fpc-pascal] Unhandled exception from library crashes host exe

2012-06-28 Thread kyan
On Wed, Jun 27, 2012 at 8:15 PM, Sven Barth wrote: > Summa summarum: don't let exceptions travel past the DLL boundary. One might > be able to fix it on Windows, but *nix maybe not so much... Thank you for your reply Sven. It seem that the way to go -I don't have much knowledge on SEH so I'd rat

Re: [fpc-pascal] Unhandled exception from library crashes host exe

2012-06-27 Thread kyan
Thank you all for your replies. > Regular exceptions, those raised with the "raise" keyword are always trapped > by try..except blocks but you have to make sure that EVERY method in the DLL > that is called by the host exe has such a construct so as not to let the > exception escape. As I already

[fpc-pascal] Unhandled exception from library crashes host exe

2012-06-27 Thread kyan
I am sure that this has been asked before but I couldn't find an answer. I am in the process of porting a large application consisting of an exe and many dlls from Delphi7 to FPC 2.7.1/Lazarus for Windows/WinCE with hopes of being able to finally port it to Linux. I have managed to overcome all ob

Re: [fpc-pascal] Adding method dynamically to a class

2012-06-20 Thread kyan
I suggest that you implement this using interfaces. You place the interface declaration in a common file, use the interfaces from the main exe but implement them in separate dlls. This gives you all the flexibility you want, e.g. group your methods into bundles and place them on different interface

[fpc-pascal] Strings and objects crossing dll boundaries

2012-06-14 Thread kyan
Hello all, A couple of questions regarding handling of strings, dynamic arrays and objects -especially exceptions- when writing programs that use shared libraries (.dll, .so). In Delphi we have the option of either using packages to ensure that there is only one instance of the memory allocator o

Re: [fpc-pascal] Unit initialization in dll initialization for arm/WinCE

2012-06-12 Thread kyan
Thank you for your reply Sven. > It might't be that Windows (or CE only) initalizes a library only if you use > GetProcAddress at least once... I have not tested that, but it might be an > idea. If that is the case we can not influence that. No need to, it really doesn't matter since one has to d

Re: [fpc-pascal] Unit initialization in dll initialization for arm/WinCE

2012-06-12 Thread kyan
us/library/ms908441.aspx And from what I've found in the web a Linux implementation is possible using dladdr(). On Mon, Jun 11, 2012 at 1:53 PM, Sven Barth wrote: > Am 11.06.2012 12:25, schrieb kyan: > >> Does unit initialization in libraries (.dll files) work in arm/WinCE? >

[fpc-pascal] Unit initialization in dll initialization for arm/WinCE

2012-06-11 Thread kyan
Hello all, Does unit initialization in libraries (.dll files) work in arm/WinCE? Somehow it seems that even code placed in the library initialization begin end block isn't executed either. I found some bug reports (e.g. 0019404) suggesting that this didn't work for arm/Linux but it has been added

Re: [fpc-pascal] Default value for an open array

2012-06-01 Thread kyan
> However, given a declaration of that form, is it possible to define a > default parameter of [] so that OutputWriteF('Test, no params\n') is > valid? Not for open arrays, but you can write an overloaded version without the open array argument that calls the version with the open array paramete

Re: [fpc-pascal] Streaming of Generics

2012-05-29 Thread kyan
> Ideally, I'd only like to write the streaming mechanism for each set > of types (normal, anisstring, dynamic array, objects, interfaced > objects) once, and use it for every set of items. However, there's no > reasonable way to detect the type and do an execution for it. Ideally You can use the

[fpc-pascal] Reason of procedure overload RTLeventWaitFor(state, timeout) return.

2012-05-02 Thread kyan
Hello all, I am trying to port a small library previously written for Delphi and Kylix to FPC. This library contains an "event" object that has similar functionality to a windows kernel event. This object is supposed to have a method that lets you wait for the event object with a timeout and retur

Re: [fpc-pascal] Internal Error 2010021405 when compiling in Linux

2012-05-02 Thread kyan
On Wed, May 2, 2012 at 4:34 PM, Sven Barth wrote: > Your code triggers a different bug in the compiler than the mentioned report > though the presented error is the same. Please open a new bug report with a > example that should compile. Done, #0021921. ___

[fpc-pascal] Internal Error 2010021405 when compiling in Linux

2012-05-02 Thread kyan
Hello all, I am trying to compile a program that contains the following code consturct: type THashEntry = record Key: string; Value: T; class function Create(const AKey: string; const AValue: T): THashEntry; static; inline; end; in Lazarus with FPC version 2.7.1 built from the tr

Re: [fpc-pascal] Re: Class const of array of record.

2012-02-24 Thread kyan
On Fri, Feb 24, 2012 at 6:29 PM, Everton Vieira wrote: > Doesn't work this code doesn't compile: Sorry, I forgot to mention that advanced record syntax works in Delphi mode only. To compile it you must change {$mode objfpc} to {$mode Delphi}. See also: http://wiki.freepascal.org/FPC_New_Feature

Re: [fpc-pascal] Re: Class const of array of record.

2012-02-24 Thread kyan
>> Is there any how to do it? You can use advanced record syntax and do something like this: type TRec = record Numero: Integer; Nome: String; class function Create(ANumero: Integer; const ANome: string): TRec; static; inline; end; ... class function TRec.Create(ANumero: Integer

Re: [fpc-pascal] Generic type parameter variable initialization

2012-01-05 Thread kyan
> Saying a FPC compiler developer to look at the Delphi implementation is > problematic, because than we could get accused of copying code (which is why > I use the Delphi XE starter version which does not contain the source code > of the RTL and VCL). I am sorry, I wasn't aware of that. But by me

Re: [fpc-pascal] Generic type parameter variable initialization

2012-01-05 Thread kyan
On Thu, Jan 5, 2012 at 4:03 PM, Florian Klämpfl wrote: > Am 05.01.2012 14:19, schrieb Sven Barth: > Has the workaround really the same effect? I really wonder why there is > a need for default then ... Yes, works for Variants as well. Look at the implementation of System._FinalizeArray() in Delph

[fpc-pascal] Generic type parameter variable initialization

2012-01-05 Thread kyan
Hello everybody. I am new to FPC/Lazarus and I am trying to port some Delphi XE code that uses the units Generics.Defaults and Generics.Collections so I have to write these units for FPC because they do not exist and the code I am porting relies heavily on them. In this process I have come across