[fpc-pascal] problem with interface (OOP not widget)
Hi all, I got problem with the code below. ---8--- begin code ---8--- program test_intf_query; {$IFDEF FPC} {$MODE OBJFPC}{$H+} {$ENDIF} uses Classes; type TPLFieldType = (plftUnknown, plftString, plftSmallint, plftInteger, plftWord, plftBoolean, plftFloat, plftCurrency, plftBCD, plftDate, plftTime, plftDateTime, plftBytes, plftVarBytes, plftAutoInc, plftBlob, plftMemo, plftGraphic, plftFmtMemo, plftParadoxOle, plftDBaseOle, plftTypedBinary, plftCursor, plftFixedChar, plftWideString, plftLargeint, plftADT, plftArray, plftReference, plftDataSet, plftOraBlob, plftOraClob, plftVariant, plftInterface, plftIDispatch, plftGuid, plftTimeStamp, plftFMTBcd, plftFixedWideChar, plftWideMemo, plftOraTimeStamp, plftOraInterval); ISimple = interface ['{24811FF3-4F01-4601-AC5C-22A5B5D46928}'] function ShowSomething: Integer; cdecl; function GetIsBlob: Boolean; cdecl; end; TSimple = class(TInterfacedObject, ISimple) private FDataType: TPLFieldType; protected { ISimple implementation } function ShowSomething: Integer; cdecl; function GetIsBlob: Boolean; cdecl; end; { query ISimple } function QuerySimple(const OnChange: TNotifyEvent = nil): ISimple; cdecl; begin Result := TSimple.Create; end; {*** TSimple ***} function TSimple.ShowSomething: Integer; cdecl; begin Writeln('Message from ISimple'); Result := 0; end; function TSimple.GetIsBlob: Boolean; cdecl; begin Result := FDataType in [ plftBytes, plftVarBytes, plftBlob, plftMemo, plftGraphic, plftFmtMemo, plftParadoxOle, plftDBaseOle, plftTypedBinary, plftOraClob, plftOraClob, plftWideMemo ]; end; {*** main program ***} var FSimple: ISimple; begin FSimple := QuerySimple(nil); //FSimple := TSimple.Create; FSimple.ShowSomething; end. ---8--- end code ---8--- FPC failed to compile it. The compiler complained with this message: test_intf_query.pas(56,26) Error: range check error in set constructor or duplicate set element With wonder, I commented line 56. Then the compiler complained with this message: test_intf_query.pas(66,14) Fatal: Internal error 200408162 Weird. So, I commented line 66 and uncommented line 67 (just to make it compilable). It compiled fine. But when it's executed, it ended up with AV. Here's the output: [EMAIL PROTECTED]:~/Programs$ ./test_intf_query Message from ISimple An unhandled exception occurred at $0804816C : EAccessViolation : Access violation $0804816C I'm using FPC 2.2.0, 2.2.1, and 2.3.1 on Ubuntu Gutsy i386. I thought it was the problem with FPC for Linux, so I tried it with FPC 2.2.0 on Windows (on exact machine). But, same errors persist on all FPC versions. :( IMHO, the above code (before modifications to make it compilable) should be fine. I can't see nothing wrong with it. To make sure, I compiled the code using Delphi 7 and Turbo Delphi Explorer. Both Delphi compiled fine and the executable output run without problem. The actual program actually much bigger than the above, it's a part of a big framework I've been working on. I cut it and made much simpler to isolate the problem. FYI, the framework itself initially written using Delphi 7 and works well. Now, I'm trying to port it to FPC. Hints? TIA. -Bee- has Bee.ography at: http://beeography.wordpress.com ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] problem with interface (OOP not widget)
You have plftOraClob, plftOraClob 2 times the same element. This is not allowed. Arrggg... what a stupid mistake! How can I didn't notice that?! It should be plftOraClob, plftOraBlob (clob and blob)! Thank you, Michael! Thank you again for the ultra fast response! :-D -Bee- has Bee.ography at: http://beeography.wordpress.com ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Populate the Format function
On Tue, 22 Jan 2008, Joao Morais wrote: Hello, I need to send an unknown amount of elements to the Format function (actually objects within a tlist decendant). I apparently cannot create a dynamic array of const, is there another way that I am missing? Currently I am parsing the Fmt param. Sure you can create one. Array of const is just an array of TVarRec. Just create a dynamical array of TVarRec and pass that. {$mode objfpc} program tests; uses sysutils; Var A : Array of TVarRec; begin SetLength(A,10); // Fill A; Format('Something',A); end. Michael. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] problem with interface (OOP not widget)
Arrggg... what a stupid mistake! How can I didn't notice that?! It should be plftOraClob, plftOraBlob (clob and blob)! Thank you, Michael! Thank you again for the ultra fast response! :-D FYI, the fatal internal error still persist. :) -Bee- has Bee.ography at: http://beeography.wordpress.com ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] problem with interface (OOP not widget)
Arrggg... what a stupid mistake! How can I didn't notice that?! It should be plftOraClob, plftOraBlob (clob and blob)! Thank you, Michael! Thank you again for the ultra fast response! :-D I must slipped my fingers and eyes during conversion to FPC. I saw the code in Delphi doesn't have the mistake. How did I do that? I feel so silly. :-D -Bee- has Bee.ography at: http://beeography.wordpress.com ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] problem with interface (OOP not widget)
On Wed, 23 Jan 2008, Bee wrote: Hi all, I got problem with the code below. ---8--- begin code ---8--- program test_intf_query; {$IFDEF FPC} {$MODE OBJFPC}{$H+} {$ENDIF} uses Classes; type TPLFieldType = (plftUnknown, plftString, plftSmallint, plftInteger, plftWord, plftBoolean, plftFloat, plftCurrency, plftBCD, plftDate, plftTime, plftDateTime, plftBytes, plftVarBytes, plftAutoInc, plftBlob, plftMemo, plftGraphic, plftFmtMemo, plftParadoxOle, plftDBaseOle, plftTypedBinary, plftCursor, plftFixedChar, plftWideString, plftLargeint, plftADT, plftArray, plftReference, plftDataSet, plftOraBlob, plftOraClob, plftVariant, plftInterface, plftIDispatch, plftGuid, plftTimeStamp, plftFMTBcd, plftFixedWideChar, plftWideMemo, plftOraTimeStamp, plftOraInterval); ISimple = interface ['{24811FF3-4F01-4601-AC5C-22A5B5D46928}'] function ShowSomething: Integer; cdecl; function GetIsBlob: Boolean; cdecl; end; TSimple = class(TInterfacedObject, ISimple) private FDataType: TPLFieldType; protected { ISimple implementation } function ShowSomething: Integer; cdecl; function GetIsBlob: Boolean; cdecl; end; { query ISimple } function QuerySimple(const OnChange: TNotifyEvent = nil): ISimple; cdecl; begin Result := TSimple.Create; end; {*** TSimple ***} function TSimple.ShowSomething: Integer; cdecl; begin Writeln('Message from ISimple'); Result := 0; end; function TSimple.GetIsBlob: Boolean; cdecl; begin Result := FDataType in [ plftBytes, plftVarBytes, plftBlob, plftMemo, plftGraphic, plftFmtMemo, plftParadoxOle, plftDBaseOle, plftTypedBinary, plftOraClob, plftOraClob, plftWideMemo You have plftOraClob, plftOraClob 2 times the same element. This is not allowed. Michael. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] problem with interface (OOP not widget)
I'm using FPC 2.2.0, 2.2.1, and 2.3.1 on Ubuntu Gutsy i386. I thought it was the problem with FPC for Linux, so I tried it with FPC 2.2.0 on Windows (on exact machine). But, same errors persist on all FPC versions. :( If it is a bug of FPC, I'll file it to Mantis ASAP. Just to make sure it's not my fault in the first place. :-D -Bee- has Bee.ography at: http://beeography.wordpress.com ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Re: FCL-DB/SQLDB docs started
On Dec 4, 2007 10:41 AM, Adrian Maier [EMAIL PROTECTED] wrote: On Dec 3, 2007 2:07 PM, Leonardo M. Ramé [EMAIL PROTECTED] wrote: I like the idea, can you start by creating the section's skeleton? Here is a possible structure of the page.I'm not familiar yet to working with this lufdoc , that's why i'm putting the skeleton here on the mailing list for the moment. Sqldb guide 1. Introduction - what is FCL-db - what is Sqldb ; the supported databases - the current document concentrates on the sql databases 2. Concepts - the diagram shown here http://wiki.lazarus.freepascal.org/SQLdb_Programming_Reference - explanations about each of the classes 3. Connecting to a database - how to instatiate a TsqlConnection for each of the supported databases - checking that the connection succeeded - closing the connection - frequently used methods of the TSqlConnection class - maybe : link to another doc Setting up the database for the sqldb guide examples , so that the specific instructions for creating the db doesn't clutter this guide 4. Transactions - how to instantiate a TsqlTransaction and link it to the connection object - frequently used methods of the TSqlTransaction class : StartTransaction, Commit, CommitRetaining, Rollback. 5. Executing SQL commands 5.1 The TSqlQuery class - how to instante and link the query to the transaction and connection. - frequently used methods 5.2 Executing simple sql queries (which don't return tuples) - cfilltable.pp 5.3 Executing a sql query and traversing the records - example for accessing the fields by name - dshowtable.pp - example for accessing the fields by position - using filters - gfiltertable.pp 5.4 Editing the records - fedittable.pp 5.5 Queries with parameters - efilltableparams.pp 5.6 Executing sql commands with connection.ExecuteDirect - example for using ExecuteDirect - bcreatetable.pp - advantages/disavantages compared to using a TSqlQUery 5.7 Other stuff - getting the list of tables - alisttables.pp - other functionality that i'm not aware of 6. Developing FCL-DB and SqlDb 6.1 Structure of the FCL-DB directory in the FPC sources 6.2 Implementing a new kind of TSqlConnection 7. Resources - links to the reference pages of the classes used - links to tutorials, wiki pages, etc. Hello, Unfortuately , L's initiative to start writing a guide for fcl-db and sqldb has stalled completely : http://z505.com/cgi-bin/powtils/docs/1.6/idx.cgi?file=fcldbnotes At that time I've tried to contribute with a possible structure of the guide. After that, nothing else happened. GIven that the few information on the subject is spread in tiny places (the only comprehensive source of information being the source code...) it's hard for me to understand how some people can actually build applications that need to access sql databases. Probably their Delphi experience helps them a lot , because the docs surely don't . Are there any people still interested in making it possible to have some real docs for sqldb and fcl-db ? If so, let's organize ourselves and see what needs to be done . I am very interested in the subject but I can't do it myself alone : if I knew enough about sqldb I wouldn't be so unhappy about the lack of documentation . Best wishes, Adrian Maier ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Re: [ann] AggPas 2.4 RM3 update
Milan Marusinec ha scritto: For those PASCAL users, who doesn't have a clue about which C/C++ programmers I am talking about in the rest of my announcement, I must admit that I have made a mistake in the content of the message (which was originally addressed to other discussion group). Again, sorry. It's 2.00 am here and I am getting a little tired :-ooo But, in the rest, the announcement is valid. Look, Try and Enjoy. I'll surely look at it, just two small questions before dowloading it: Agg2D API and also TAgg2D for Delphi VCL: can I use TAgg2D with Lazarus LCL? Can I use the API also with FPC-RTL/FCL applications? It seems to me that (a) in Agg there is a SDL platform support and (b) it in not in AggPas, am I correct? (I ask here only because actually I'm working with FPC and SDL) thanks for your very (huge) and interesting work :-) -- tiziano __ http://digilander.libero.it/tizzziano/ ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] Internal Error 200212277
I often got the error from FPC Internal Error 200212277 when I build my applications using Lazarus, whatever the version of fpc (=2.2 others I don't know) It happens only when I choose build and not Build all, so when my apps are not entirely rebuild. What is it exactly ? Have I something to do from my side ? -- Damien Gerard [EMAIL PROTECTED] Le temps n'a pas d'importance. Seul le code est important -- (f00ty) ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] debugger exited due to signal 5
When I run the 'go' I keep on receiving this error message: 'exited with status 5.The debugger is still running.' What can I do to solve it? any idea what is causing the problem? Just in case,the console reads: [Session started at 2008-01-22 16:00:04 +0100.] *2008-01-22 16:00:04.628 Xcode[1511:203] *** NSTask: Task create for path '/Users/etacsir/test-1.moved-aside/build/Release/test.app' failed: 13, Permission denied. Terminating temporary process.* The Debugger has exited due to signal 5 (SIGTRAP).The Debugger has exited due to signal 5 (SIGTRAP). Thanks, E. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Re: FCL-DB/SQLDB docs started
Op woensdag 23-01-2008 om 10:35 uur [tijdzone +0200], schreef Adrian Maier: On Dec 4, 2007 10:41 AM, Adrian Maier [EMAIL PROTECTED] wrote: On Dec 3, 2007 2:07 PM, Leonardo M. Ramé [EMAIL PROTECTED] wrote: I like the idea, can you start by creating the section's skeleton? Here is a possible structure of the page.I'm not familiar yet to working with this lufdoc , that's why i'm putting the skeleton here on the mailing list for the moment. GIven that the few information on the subject is spread in tiny places (the only comprehensive source of information being the source code...) it's hard for me to understand how some people can actually build applications that need to access sql databases. Probably their Delphi experience helps them a lot , because the docs surely don't . The basics of fcl-db are completely compatible with Delphi. I think most users use their Delphi knowledge. The sqldb-part is very easy if you understand the rest. Are there any people still interested in making it possible to have some real docs for sqldb and fcl-db ? I really would like it if such documentation will arise. But I also would like to add index-support and some more TClientDataset functionality. If so, let's organize ourselves and see what needs to be done . I am very interested in the subject but I can't do it myself alone : if I knew enough about sqldb I wouldn't be so unhappy about the lack of documentation . I'm the one who knows the most of sqldb, apart from some parts which aren't written by me. I would really like to help and eventually I'll start writing the documentation on my own. but I doubt if I'm the right person to do that now. But I'm willing to help and answer all questions. About the structure: I think it's best to use fpdoc to build the documentation. Just like Delphi does. Then in the descriptions of the components itself a short description of the whole component can be given, to explain the basics to new users. From there they can browse further into the documentation. So that's a completely different approach then suggested by Lars. Joost ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Re: FCL-DB/SQLDB docs started
Adrian Maier wrote: Are there any people still interested in making it possible to have some real docs for sqldb and fcl-db ? If so, let's organize ourselves and see what needs to be done . I am very interested in the subject but I can't do it myself alone : if I knew enough about sqldb I wouldn't be so unhappy about the lack of documentation . Hi Adrian, I am also. cheers, John Sunderland ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Re: [ann] AggPas 2.4 RM3 update
On 23/01/2008, Graeme Geldenhuys [EMAIL PROTECTED] wrote: AggPas is truely brilliant with what it can do! Excellent work Milan! These are such cool demos!! :-) http://www.aggpas.org/win32/trans_curve1.exe http://www.aggpas.org/win32/trans_curve2.exe Regards, - Graeme - ___ fpGUI - a cross-platform Free Pascal GUI toolkit http://opensoft.homeip.net/fpgui/ ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] class constants
Hello, Does FPC support class constants, and if it doesn't, are there any plans to add this support? Example: type TMyClass = class begin private const MyConst = '123'; end; Jon ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] Linux daemon crashing
Hi all, I'm trying to make a Linux daemon using FPC 2.2 I tried compiling the bundled daemon.pp (fcl-base/tests), it's an object oriented version. Compilation is ok, but when I run the daemon I get the following error: exception at 0046BF6C: Options do not allow determining what needs to be done. And the daemon exits. I also tried compiling an older version of daemon.pp, that was bundled with FPC 2.0.4 (but still compiling it with FPC 2.2). The older version is not object oriented, and contains more complex code, but it does work. Is this a known problem when creating a daemon in Linux, using the new units? Or maybe it could be because I am using AMD64? I have not yet tried it on a 32 bit Linux installation, so I am not sure. I would like to use the object oriented version if possible, I like the code, it looks clean and easy to use, but it doesn't work, so I am temporarily having to use the older version of daemon.pp for now. signature.asc Description: This is a digitally signed message part ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Linux daemon crashing
On Thu, 24 Jan 2008, Rob van der Linde wrote: Hi all, I'm trying to make a Linux daemon using FPC 2.2 I tried compiling the bundled daemon.pp (fcl-base/tests), it's an object oriented version. Compilation is ok, but when I run the daemon I get the following error: exception at 0046BF6C: Options do not allow determining what needs to be done. And the daemon exits. Add -r (or --run) to the command-line option. Michael. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Linux daemon crashing
Thanks or that, that seems to start it fine, but it doesn't close the master process and return to my terminal, as the non object oriented version from FPC 2.0.4 does. Any ideas if this is possible with the OOP version? On Wed, 2008-01-23 at 22:54 +0100, Michael Van Canneyt wrote: On Thu, 24 Jan 2008, Rob van der Linde wrote: Hi all, I'm trying to make a Linux daemon using FPC 2.2 I tried compiling the bundled daemon.pp (fcl-base/tests), it's an object oriented version. Compilation is ok, but when I run the daemon I get the following error: exception at 0046BF6C: Options do not allow determining what needs to be done. And the daemon exits. Add -r (or --run) to the command-line option. Michael. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal signature.asc Description: This is a digitally signed message part ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
RE: [fpc-pascal] class constants
Have a look at http://delphi.about.com/library/weekly/aa031505a.htm as a (not too bad) way to do it in Delphi. FPC too? Stu Cox Project Management Technician Southern Interior Region Ministry of Transportation 342-447 Columbia St., Kamloops, BC V2C 2T3 p: 250-828-4320 f: 250-828-4229 [EMAIL PROTECTED] -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jonathan Benedicto Sent: Wednesday, January 23, 2008 11:26 AM To: FPC-Pascal Subject: [fpc-pascal] class constants Hello, Does FPC support class constants, and if it doesn't, are there any plans to add this support? Example: type TMyClass = class begin private const MyConst = '123'; end; Jon ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] class constants
Jonathan, I never needed such type of feature, a propossed solution is to create one unit per class, and declare your constants in the implementation section of each unit. Example: unit People interface type TPeople = class .. end; implementation const name = 'default name'; ... end. --- Jonathan Benedicto [EMAIL PROTECTED] wrote: Hello, Does FPC support class constants, and if it doesn't, are there any plans to add this support? Example: type TMyClass = class begin private const MyConst = '123'; end; Jon ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal