Re: [fpc-pascal]TCollection question
James, Think of my code as a design pattern for a list, or possibly a template. You could replace the class name you are storing everywhere in the code and would then have a completely different List class. A bit like a C++ template, except you have to define all the code each time. > A question about your basic-design and using TList (and descandents in > general)... > > Could I not do this: > > TMyList = class(TList); Yes, but a wrapper gives more flexibility. You can give the class user the exact interface you had in mind, rather than forcing the whole of the TList legacy onto them. The OO term of the month is Aggregation here. > And thereby extend the basic TList class into a custom List ? > The way you use TList is as a private variable in a generic class. Sure you could, but using a wrapper allows you to take more control. To be honest, you should use a TObjectList anyway. The TObjectList already does almost everything you desire except the specific named class Add/Insert/Items functionality. Matt ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal]FPC Debugging (with SQLite)
Hi, I have a problem with the SQLite library (www.sqlite.org). I believe Michael helped me with the conversion of the headers and the unit that Eric Jourde wrote. This all works fine, however when compiling a program with the debug options (-g, -gg etc), it won't produce any tracebacks of error. It makes it impossible to trace down something like: An unhandled exception occurred at 0x0809911D : List index exceeds bounds (1) 0x0809911D Without the source and line numbers ? (I think perhaps the SQLite library is interferring with the debug symbols in the program? I'm not sure). Any ideas ? cheers James -- - - James Mills Zero Defect Software Engineers Group - ZDSEG ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal]FPC Debugging (with SQLite)
On Mon, Jul 07, 2003 at 08:19:38PM +1000, James Mills wrote: > Hi, > > I have a problem with the SQLite library (www.sqlite.org). > I believe Michael helped me with the conversion of the headers and the > unit that Eric Jourde wrote. > > This all works fine, however when compiling a program with the debug > options (-g, -gg etc), it won't produce any tracebacks of error. It > makes it impossible to trace down something like: > > An unhandled exception occurred at 0x0809911D : >List index exceeds bounds > (1) > > 0x0809911D I found a solution to this problem by using a break point on the address in gdb (didn't know this till I did some digging on the break command). However I would still like to know why the backtrace wasn't there to begin with... Normally it is :) cheers James > > Without the source and line numbers ? (I think perhaps the SQLite > library is interferring with the debug symbols in the program? I'm not > sure). > > Any ideas ? > > cheers > James > > -- > - > - James Mills > Zero Defect Software Engineers Group - ZDSEG > > ___ > fpc-pascal maillist - [EMAIL PROTECTED] > http://lists.freepascal.org/mailman/listinfo/fpc-pascal -- - - James Mills Zero Defect Software Engineers Group - ZDSEG ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal]FPC Debugging (with SQLite)
At 12:35 07/07/2003, James Mills wrote: >On Mon, Jul 07, 2003 at 08:19:38PM +1000, James Mills wrote: >> Hi, >> >> I have a problem with the SQLite library (www.sqlite.org). >> I believe Michael helped me with the conversion of the headers and the >> unit that Eric Jourde wrote. >> >> This all works fine, however when compiling a program with the debug >> options (-g, -gg etc), it won't produce any tracebacks of error. It >> makes it impossible to trace down something like: >> >> An unhandled exception occurred at 0x0809911D : >>List index exceeds bounds >> (1) >> >> 0x0809911D > >I found a solution to this problem by using a break point on the address >in gdb (didn't know this till I did some digging on the break command). You mean that inside GDB you got information about the source position and the C structures used... >However I would still like to know why the backtrace wasn't there to >begin with... Normally it is :) The problem is that GDB is reading the dynamic library to get this information, which is not the case for the -gl option, only the main executable debug info is read. If you link statically to the SQLite library, you might still not get the correct source position inside the library, because Free Pascal only generates stabs debugging infos, while GCC usually uses dwarf-2 debugging format. In that case, recompiling the library with adding -gstabs+ to the CFLAGS option might help. ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal]FPC Debugging (with SQLite)
Eric will have written that unit for BeOS, so I would ask if anyone tested it for other platforms Had a look on BeShare and he's not online, but that is certainly a question that needs to be addressed first. Matt > Hi, > > I have a problem with the SQLite library (www.sqlite.org). > I believe Michael helped me with the conversion of the headers and the > unit that Eric Jourde wrote. > > This all works fine, however when compiling a program with the debug > options (-g, -gg etc), it won't produce any tracebacks of error. It > makes it impossible to trace down something like: > > An unhandled exception occurred at 0x0809911D : >List index exceeds bounds > (1) > 0x0809911D > > Without the source and line numbers ? (I think perhaps the SQLite > library is interferring with the debug symbols in the program? I'm not > sure). > > Any ideas ? > > cheers > James > > -- > - > - James Mills > Zero Defect Software Engineers Group - ZDSEG > > ___ > fpc-pascal maillist - [EMAIL PROTECTED] > http://lists.freepascal.org/mailman/listinfo/fpc-pascal > ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal]FPC Debugging (with SQLite)
On Mon, Jul 07, 2003 at 11:54:38AM +0100, Matt Emson wrote: > Eric will have written that unit for BeOS, so I would ask if anyone tested > it for other platforms Had a look on BeShare and he's not online, but > that is certainly a question that needs to be addressed first. I know he wrote it. I regularly speak to him on MSN. There was a problem with using it, for some reason he didn't need to use the cMem unit back when he wrote the unit. But he had used a very old version of sqlite at the time. I guess the SQLite library has changed dramatically since 2.7... I have tested it on Linux, and the only modification to the unit necessary (I think) is that you have to use the cMem unit. It works quite well and I'll continue to use this for my programs that require an embedded database vs. mysql server. cheers James > > Matt > > > Hi, > > > > I have a problem with the SQLite library (www.sqlite.org). > > I believe Michael helped me with the conversion of the headers and the > > unit that Eric Jourde wrote. > > > > This all works fine, however when compiling a program with the debug > > options (-g, -gg etc), it won't produce any tracebacks of error. It > > makes it impossible to trace down something like: > > > > An unhandled exception occurred at 0x0809911D : > >List index exceeds bounds > > (1) > > > 0x0809911D > > > > Without the source and line numbers ? (I think perhaps the SQLite > > library is interferring with the debug symbols in the program? I'm not > > sure). > > > > Any ideas ? > > > > cheers > > James > > > > -- > > - > > - James Mills > > Zero Defect Software Engineers Group - ZDSEG > > > > ___ > > fpc-pascal maillist - [EMAIL PROTECTED] > > http://lists.freepascal.org/mailman/listinfo/fpc-pascal > > > > > > ___ > fpc-pascal maillist - [EMAIL PROTECTED] > http://lists.freepascal.org/mailman/listinfo/fpc-pascal -- - - James Mills Zero Defect Software Engineers Group - ZDSEG ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal]FPC Debugging (with SQLite)
> I know he wrote it. I regularly speak to him on MSN. There was a problem > with using it, for some reason he didn't need to use the cMem unit back > when he wrote the unit. But he had used a very old version of sqlite at > the time. I guess the SQLite library has changed dramatically since > 2.7... I think that was more to do with whoever ported SQLLite to BeOS rather than him actually wanting to use an older version ;-) Matt ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal]FPC Debugging (with SQLite)
On Mon, Jul 07, 2003 at 12:29:10PM +0100, Matt Emson wrote: > > I know he wrote it. I regularly speak to him on MSN. There was a problem > > with using it, for some reason he didn't need to use the cMem unit back > > when he wrote the unit. But he had used a very old version of sqlite at > > the time. I guess the SQLite library has changed dramatically since > > 2.7... > > I think that was more to do with whoever ported SQLLite to BeOS rather than > him actually wanting to use an older version ;-) How so ? It's been fixed there was no problem with his unit other than the fact that, with the current version of SQLite the cMem unit was needed in order because of the way SQLite uses memory. cheers James > > Matt > > > > ___ > fpc-pascal maillist - [EMAIL PROTECTED] > http://lists.freepascal.org/mailman/listinfo/fpc-pascal -- - - James Mills Zero Defect Software Engineers Group - ZDSEG ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal]FPC Debugging (with SQLite)
> How so ? James, he did *not* port this app to BeOS, some one else did. He wrote a Pascal interface to the version that that developer had ported to BeOS (you're following me right ;-). He therefore had no option but to use the version ported under BeOS, unless he ported a newer version himself, right? So therefore, he was only able to do the interface as per the version available to him. Therefore my comment. Do you understand? No trickery involved. Looking at the BeBits page, (http://www.bebits.com/app/3156), 2.7.1 was the last port made (circa November 2002). > It's been fixed there was no problem with his unit other than > the fact that, with the current version of SQLite the cMem unit was > needed in order because of the way SQLite uses memory. Cool. Let him know ;-) ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal]FPC Debugging (with SQLite)
Actually, got it to compile and run under Delphi with only about 2 or 3 changes. Change all ref's to 'strings' to 'sysutils', and there is an assignment to 'OnData' that must read: OnData := SQLOnData; rather than OnData := @SQLOnData; Other than that it compiles and runs. One question, why is StrAlloc in Strings??? It should be in Sysutils for Delphi compatibility. I thought the main FPC thrust was now for Delphi compatibility over Turbo Pascal?!?! Matt - Original Message - From: "James Mills" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, July 07, 2003 12:49 PM Subject: Re: [fpc-pascal]FPC Debugging (with SQLite) > On Mon, Jul 07, 2003 at 12:29:10PM +0100, Matt Emson wrote: > > > I know he wrote it. I regularly speak to him on MSN. There was a problem > > > with using it, for some reason he didn't need to use the cMem unit back > > > when he wrote the unit. But he had used a very old version of sqlite at > > > the time. I guess the SQLite library has changed dramatically since > > > 2.7... > > > > I think that was more to do with whoever ported SQLLite to BeOS rather than > > him actually wanting to use an older version ;-) > > How so ? It's been fixed there was no problem with his unit other than > the fact that, with the current version of SQLite the cMem unit was > needed in order because of the way SQLite uses memory. > > cheers > James > > > > > Matt > > > > > > > > ___ > > fpc-pascal maillist - [EMAIL PROTECTED] > > http://lists.freepascal.org/mailman/listinfo/fpc-pascal > > -- > - > - James Mills > Zero Defect Software Engineers Group - ZDSEG > > ___ > fpc-pascal maillist - [EMAIL PROTECTED] > http://lists.freepascal.org/mailman/listinfo/fpc-pascal > ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal]Developing GUI apps with FPC 1.0.4/Linux?
Hello! >From time to time I get the wish to develop graphical applications with FreePascal, but until now I could not find a useful tool. Well, there are some attempts to wrap GTK. I had a look into the samples, but this is definitely not what I am looking for -- too complicated! Is there no really EASY to use unit for that, as easy as oCRT? I get always shocked when I see some pages of code only for getting a simple window opened! Also, the programming style with oCRT and GUI is totally different, what I do not understand. What I am looking for is some replacement for oCRT which basically does the same, but in graphical mode. So it should be possible in the best case to compile one and the same program either for GUI or ncurses... For that, Buttons should be translated into KeyStrokes (i.e. function keys) and fed into the keyboard input. This will allow to operate the program either with Keys or with mouse clicks. Also, opening a normal window should be done with one simple procedure instead of writing "half a page" of code... Is there something which works like that? Should work in OOP, if possible, and be as close to oCRT as possible. mfg Ing. Rainer Hantsch -- .-. | \\|// Ing. Rainer HANTSCH - Hardware + Software | | (o o) Forget Windoze! -- We focus on L-I-N-U-X... | |--oOOo-(_)-oOOo--| | Ing. Rainer HANTSCH | mail: [EMAIL PROTECTED] | | Khunngasse 21/20| www: http://www.hantsch.co.at | | A-1030 Vienna | tel: +43-1-79885380fax: +43-1-798853818 | | ** A u s t r i a ** | handy: +43-664-9194382 UID-Nr: ATU 11134002 | '-' ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal]FPC Debugging (with SQLite)
On Mon, Jul 07, 2003 at 03:26:41PM +0100, Matt Emson wrote: > > > How so ? > > James, he did *not* port this app to BeOS, some one else did. He wrote a > Pascal interface to the version that that developer had ported to BeOS > (you're following me right ;-). He therefore had no option but to use the > version ported under BeOS, unless he ported a newer version himself, right? > So therefore, he was only able to do the interface as per the version > available to him. Therefore my comment. Do you understand? No trickery > involved. > > Looking at the BeBits page, (http://www.bebits.com/app/3156), 2.7.1 was the > last port made (circa November 2002). Now I'm following you. Yes I'm aware that Eric did not actually develop this unit, one of his (people) did. His/Her/It's name is unknown to me. ;) > > > It's been fixed there was no problem with his unit other than > > the fact that, with the current version of SQLite the cMem unit was > > needed in order because of the way SQLite uses memory. > > Cool. Let him know ;-) It should be released in future versions of the FCL according to Michael of FPC :) I can send you a tar.gz of the header translation and the unit though... cheers James > > > > > > > ___ > fpc-pascal maillist - [EMAIL PROTECTED] > http://lists.freepascal.org/mailman/listinfo/fpc-pascal -- - - James Mills Zero Defect Software Engineers Group - ZDSEG ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal]FPC Debugging (with SQLite)
On Mon, Jul 07, 2003 at 03:37:20PM +0100, Matt Emson wrote: > Actually, got it to compile and run under Delphi with only about 2 or 3 > changes. > > Change all ref's to 'strings' to 'sysutils', and there is an assignment to > 'OnData' that must read: > > OnData := SQLOnData; > > rather than > > OnData := @SQLOnData; > > Other than that it compiles and runs. > > One question, why is StrAlloc in Strings??? It should be in Sysutils for > Delphi compatibility. I thought the main FPC thrust was now for Delphi > compatibility over Turbo Pascal?!?! Good question. However I don't really care about Delphi compatibility, as as such I think the FPC developers put it in Strings for a very logical reason. Afterall it is a String function call. cheers James > > Matt > > - Original Message - > From: "James Mills" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Monday, July 07, 2003 12:49 PM > Subject: Re: [fpc-pascal]FPC Debugging (with SQLite) > > > > On Mon, Jul 07, 2003 at 12:29:10PM +0100, Matt Emson wrote: > > > > I know he wrote it. I regularly speak to him on MSN. There was a > problem > > > > with using it, for some reason he didn't need to use the cMem unit > back > > > > when he wrote the unit. But he had used a very old version of sqlite > at > > > > the time. I guess the SQLite library has changed dramatically since > > > > 2.7... > > > > > > I think that was more to do with whoever ported SQLLite to BeOS rather > than > > > him actually wanting to use an older version ;-) > > > > How so ? It's been fixed there was no problem with his unit other than > > the fact that, with the current version of SQLite the cMem unit was > > needed in order because of the way SQLite uses memory. > > > > cheers > > James > > > > > > > > Matt > > > > > > > > > > > > ___ > > > fpc-pascal maillist - [EMAIL PROTECTED] > > > http://lists.freepascal.org/mailman/listinfo/fpc-pascal > > > > -- > > - > > - James Mills > > Zero Defect Software Engineers Group - ZDSEG > > > > ___ > > fpc-pascal maillist - [EMAIL PROTECTED] > > http://lists.freepascal.org/mailman/listinfo/fpc-pascal > > > > > > ___ > fpc-pascal maillist - [EMAIL PROTECTED] > http://lists.freepascal.org/mailman/listinfo/fpc-pascal -- - - James Mills Zero Defect Software Engineers Group - ZDSEG ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal