Re: [fpc-pascal] Size of program vs library ?
On Mon, 3 Feb 2014, Fred van Stappen wrote: Date: Mon, 3 Feb 2014 18:30:57 +0100 From: mich...@freepascal.org To: fpc-pascal@lists.freepascal.org Subject: Re: [fpc-pascal] Size of program vs library ? On Mon, 3 Feb 2014, Fred van Stappen wrote: Hello. Here size of nude program and library compiled with fpc 2.7.1. Why is it a so big size-difference ? Compiled with = fpc 2.7.1 = linux 64 Compiler parameters : -MObjFPC -Scghi -CX -Os1 -Xs -XX -vewnhi -fPIC I suspect PIC is to blame. This adds a lot of tables to your library. Michael. Hum, when compile with or without -fPIC, it does not change anything,... i get exactly the same size... If I am correct, the compiler will add the PIC by itself. But someone of the compiler team should confirm this... Michael. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] SVN revisions and builds
Hi all, We use FPC trunk for the development of several projects and we download it from ftp://freepascal.dfmk.hu/pub/lazarus/snapshots/ However for FPC 2.7.1, the latest build is from September. Is there any plan to update it? Or is there a more updated ftp directory somewhere else we could use? I tried to compile FPC from source using FPCUP with its default options using the latest trunk code but it failed to compile LCL, probably due to Unicode changes. Could you tell me what is the most recent revision on svn that I can use to make it compile ? Also what is the revision number for the 2.7.1 builds on the ftp directory above? It mentions the revision number only for Lazarus but for FPC it only mentions the date of the checkout. Thank you in advance. --Constantine ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] Nested generic parameters
Hello again, Can I use a defined generic type parameter inside a constraint of the same generic declaration on FPC trunk code? Something like: {$mode Delphi} type TFooT = class end; TGenericT, U: TFooT = class end; This compiles in Delphi XE or later but in FPC it gives the error Identifier not found 'T' at the T parameter in the constraint. Thanks in advance. --Constantine ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Size of program vs library ?
If I am correct, the compiler will add the PIC by itself. But someone of the compiler team should confirm this... Michael. Yep, Michael, many thanks for answer. Sorry to insist on that, but the size of fp library is very too big vs other libraries (C for example). But there are huge advantages to use fp library : for example i never was able to create dynamic loaded libraries who load dynamically other libraries ( not possible with gcc, nor with M$ Visual Studio). But with fp, it is possible... So, if it could be possible to create fp library with a reasonable size, i think fp library is the future for all other libraries... Many thanks. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Size of program vs library ?
Am 04.02.2014 13:35, schrieb Fred van Stappen: Sorry to insist on that, but the size of fp library is very too big vs other libraries (C for example). The size of FPC libraries will always(*) be bigger then e.g. C ones, because in FPC the RTL is statically linked into the program/library, while C libraries link against the C runtime library. (*) Once dynamic runtime packages are supported this might change though... Regards, Sven ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] SVN revisions and builds
Am 04.02.2014 11:35, schrieb Constantine Yannakopoulos: We use FPC trunk for the development of several projects and we download it from ftp://freepascal.dfmk.hu/pub/lazarus/snapshots/ However for FPC 2.7.1, the latest build is from September. Is there any plan to update it? Or is there a more updated ftp directory somewhere else we could use? This is the official link provided on http://www.freepascal.org/develop.var : ftp://ftp.freepascal.org/pub/fpc/snapshot/trunk/ I tried to compile FPC from source using FPCUP with its default options using the latest trunk code but it failed to compile LCL, probably due to Unicode changes. Could you tell me what is the most recent revision on svn that I can use to make it compile ? Also what is the revision number for the 2.7.1 builds on the ftp directory above? It mentions the revision number only for Lazarus but for FPC it only mentions the date of the checkout. Current trunk versions of Lazarus should be able to build using a current FPC development version. Regards, Sven ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Nested generic parameters
Am 04.02.2014 11:48, schrieb Constantine Yannakopoulos: Hello again, Can I use a defined generic type parameter inside a constraint of the same generic declaration on FPC trunk code? Something like: {$mode Delphi} type TFooT = class end; TGenericT, U: TFooT = class end; This compiles in Delphi XE or later but in FPC it gives the error Identifier not found 'T' at the T parameter in the constraint. Thanks in advance. Yes, that is not supported yet. Please report as a bug, so that it is not forgotten (and attach a simple example that compiles in Delphi). Regards, Sven ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] TSQLQuery UniDirectional and SaveToStream
Hi all, i will appreciate a little help / advice / anything for the following problem i'm having. I need to use the xmldatapacketreader to transfer datasets between free pascal and delphi. The problem i'm having is that i can't use UniDirectional and SaveToStream at the same time ( getting DataBaseError(SUniDirectional) ) and for big datasets the memory goes . So, does anyone have any idea how to use xmldatapacketreader ( which implies SaveToStream ) and UniDirectional ? Best Regards, -- Dimitrios Chr. Ioannidis ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Size of program vs library ?
(*) Once dynamic runtime packages are supported this might change though... Regards, Sven Ok, thanks Sven, that will be the best... But before the triumph of fp, i will do that universal audio open source library with fp too... Many thanks for all of you, fp designers Fred ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] DefaultFormatSettings usage
Hello, I'm using this configuration: initialization DefaultFormatSettings.DateSeparator := '-'; DefaultFormatSettings.TimeSeparator := ':'; DefaultFormatSettings.ShortDateFormat := '-mm-dd'; DefaultFormatSettings.ShortTimeFormat := 'hh:nn:ss'; but, when i try: var t: TDateTime; begin t := StrToDate('2013-02-04 11:39:54'); // to format -mm-dd hh:nn:ss end; result: 2013-02-04 11:39:54 is not a valid date format. What am I doing wrong? -- Silvio Clécio My public projects - github.com/silvioprog ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] DefaultFormatSettings usage
Hi, Στις 4/2/2014 3:54 μμ, ο/η silvioprog έγραψε: Hello, I'm using this configuration: initialization DefaultFormatSettings.DateSeparator := '-'; DefaultFormatSettings.TimeSeparator := ':'; DefaultFormatSettings.ShortDateFormat := '-mm-dd'; DefaultFormatSettings.ShortTimeFormat := 'hh:nn:ss'; but, when i try: var t: TDateTime; begin t := StrToDate('2013-02-04 11:39:54'); // to format -mm-dd hh:nn:ss end; result: 2013-02-04 11:39:54 is not a valid date format. Try the overload StrToDate(S, DefaultFormatSettings), or better declare a FFormatSettings: TFormatSettings setup it as you like pass that to the StrToDate leaving the DefaultFormatSettings. Regards, -- Dimitrios Chr. Ioannidis ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] DefaultFormatSettings usage
2014-02-04 Dimitrios Chr. Ioannidis d.ioanni...@nephelae.eu: Hi, Στις 4/2/2014 3:54 μμ, ο/η silvioprog έγραψε: Hello, I'm using this configuration: initialization DefaultFormatSettings.DateSeparator := '-'; DefaultFormatSettings.TimeSeparator := ':'; DefaultFormatSettings.ShortDateFormat := '-mm-dd'; DefaultFormatSettings.ShortTimeFormat := 'hh:nn:ss'; but, when i try: var t: TDateTime; begin t := StrToDate('2013-02-04 11:39:54'); // to format -mm-dd hh:nn:ss end; result: 2013-02-04 11:39:54 is not a valid date format. Try the overload StrToDate(S, DefaultFormatSettings), or better declare a FFormatSettings: TFormatSettings setup it as you like pass that to the StrToDate leaving the DefaultFormatSettings. Regards, -- Dimitrios Chr. Ioannidis Thank you Dimitrios! Worked with: var t: TDateTime; begin t := StrToDateTime('2013-02-04 11:39:54'); end; sorry, I forgot to use the function StrToDateTime. :S -- Silvio Clécio My public projects - github.com/silvioprog ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] DefaultFormatSettings usage
In our previous episode, silvioprog said: Worked with: var t: TDateTime; begin t := StrToDateTime('2013-02-04 11:39:54'); end; sorry, I forgot to use the function StrToDateTime. :S Or use http://www.freepascal.org/docs-html/rtl/dateutils/scandatetime.html ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] fp universal library ?
On Sun, 2014-02-02 at 23:13 +0100, Fred van Stappen wrote: - Here example for function inside a class of myunit: library mylib ; uses myunit; function mylibclassfunction() : integer; cdecl; var myclass : TMyUnitClass; /// class defined in myunit (if can be a variable outside the function) begin result := -1 ; myclass := TMyUnitClass.Create; result := myclass.myunitclassfunction() ; // a function of myclass end; exports mylibclassfunction ; begin end. Now what I would like in the compiler is a warning: potential memory leak at myclass := TMyUnitClass.Create; ;) ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] TSortedCollection dupes ordering
i have a TSortedCollection that i'm allowing duplicate keys to be inserted in... the problem that i'm having is that the duplicate keys are in reverse order from how they were inserted... i am overriding MyCollection^.Insert because i have additional tasks that need to be done at the time of insertion... without duplicate keys, everything works perfectly so that lesser keys do have a lower index than higher keys... with duplicate keys, though, the lesser keys are right but the duplicate lesser keys are in reverse order within their grouping... MyCollection^.Insert uses AtInsert to insert the new record... i switched this to Insert after i read the documentation statement that AtInsert should not be used... when i did this, my program crashed with an unknown runtime error 202 (stack overflow???)... at a guess, i would say that i ended up calling MyCollection^.Insert recursively... perhaps instead of just AtInsert i should use something_else.Insert inside my Insert?? anyway, how can i fix this problem where duplicates are inserted in the proper order while still retaining the existing proper key ordering? -- NOTE: No off-list assistance is given without prior approval. Please keep mailing list traffic on the list unless private contact is specifically requested and granted. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] DefaultFormatSettings usage
On 2/4/2014 8:54 AM, silvioprog wrote: t := StrToDate('2013-02-04 11:39:54'); // to format -mm-dd hh:nn:ss the above is StrToDate but you are also sending the time... you would see similar if you were sending the above string to StrToTime... StrToDate only accepts date formats as StrToTime only accepts time formats... if you want to send both, you have to use StrToDateTime ;) -- NOTE: No off-list assistance is given without prior approval. Please keep mailing list traffic on the list unless private contact is specifically requested and granted. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] TSortedCollection dupes ordering
On 2/4/2014 1:40 PM, waldo kitty wrote: i have a TSortedCollection that i'm allowing duplicate keys to be inserted in... the problem that i'm having is that the duplicate keys are in reverse order from how they were inserted... Sounds like your TSortedCollection.Compare() needs additional logic. It isn't doing enough comparisons internally to order things properly. i am overriding MyCollection^.Insert because i have additional tasks that need to be done at the time of insertion... without duplicate keys, Wouldn't it be better to perform your additional tasks before the insertion, then call a normal .Insert? Why overload something if there isn't really a need to? -- Jim Leonard (trix...@oldskool.org) Check out some trippy MindCandy: http://www.mindcandydvd.com/ A child borne of the home computer wars: http://trixter.oldskool.org/ You're all insane and trying to steal my magic bag! ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] TSortedCollection dupes ordering
On 2/4/2014 3:28 PM, Jim Leonard wrote: On 2/4/2014 1:40 PM, waldo kitty wrote: i have a TSortedCollection that i'm allowing duplicate keys to be inserted in... the problem that i'm having is that the duplicate keys are in reverse order from how they were inserted... Sounds like your TSortedCollection.Compare() needs additional logic. It isn't doing enough comparisons internally to order things properly. possibly... i dunno... currently it compares the (pstring) keys only... i thought about trying to also include a second field (a double) which is used for the time stamp but i don't know how to do that without having to use the key and this time stamp field every time i do anything with the records... i am overriding MyCollection^.Insert because i have additional tasks that need to be done at the time of insertion... without duplicate keys, Wouldn't it be better to perform your additional tasks before the insertion, then call a normal .Insert? Why overload something if there isn't really a need to? i kinda thought about that earlier when i was digging thru the code... IIRC, insert was overridden because there are cases where the existing record needs to be replaced (because the new record is newer) using AtPut and the non-added records must be logged and their reason for not being added (older or same)... -- NOTE: No off-list assistance is given without prior approval. Please keep mailing list traffic on the list unless private contact is specifically requested and granted. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] fp universal library ?
- Here example for function inside a class of myunit: library mylib ; uses myunit; function mylibclassfunction() : integer; cdecl; var myclass : TMyUnitClass; /// class defined in myunit (if can be a variable outside the function) begin result := -1 ; myclass := TMyUnitClass.Create; result := myclass.myunitclassfunction() ; // a function of myclass end; exports mylibclassfunction ; begin end. Now what I would like in the compiler is a warning: potential memory leak at myclass := TMyUnitClass.Create; ;) Yep, before to get that sympathetic message, i changed the code, now all the class.create are done inside the unit used by the library and i do not get the message... Thanks. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] fp universal library ?
Now what I would like in the compiler is a warning: potential memory leak at myclass := TMyUnitClass.Create; ;) Oops, prior message was cut... Yep, before to get that sympathetic message, i changed the code, now all the class.create are done inside the unit used by the library and i will not get the message because i will not forget to free it before to close... ;-) Thanks. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] TSortedCollection dupes ordering
2014-02-04 waldo kitty wkitt...@windstream.net: On 2/4/2014 3:28 PM, Jim Leonard wrote: On 2/4/2014 1:40 PM, waldo kitty wrote: i have a TSortedCollection that i'm allowing duplicate keys to be inserted in... the problem that i'm having is that the duplicate keys are in reverse order from how they were inserted... Sounds like your TSortedCollection.Compare() needs additional logic. It isn't doing enough comparisons internally to order things properly. possibly... i dunno... currently it compares the (pstring) keys only... i thought about trying to also include a second field (a double) which is used for the time stamp but i don't know how to do that without having to use the key and this time stamp field every time i do anything with the records... i am overriding MyCollection^.Insert because i have additional tasks that need to be done at the time of insertion... without duplicate keys, Wouldn't it be better to perform your additional tasks before the insertion, then call a normal .Insert? Why overload something if there isn't really a need to? i kinda thought about that earlier when i was digging thru the code... IIRC, insert was overridden because there are cases where the existing record needs to be replaced (because the new record is newer) using AtPut and the non-added records must be logged and their reason for not being added (older or same)... Just a quick idea which could be completely wrong, but wouldn't it solve your issue if Compare always returned -1 instead of 0? -- Frederic Da Vitoria (davitof) Membre de l'April - « promouvoir et défendre le logiciel libre » - http://www.april.org ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] TSortedCollection dupes ordering
On 2/4/2014 5:16 PM, Frederic Da Vitoria wrote: 2014-02-04 waldo kitty wkitt...@windstream.net mailto:wkitt...@windstream.net: [...] i kinda thought about that earlier when i was digging thru the code... IIRC, insert was overridden because there are cases where the existing record needs to be replaced (because the new record is newer) using AtPut and the non-added records must be logged and their reason for not being added (older or same)... Just a quick idea which could be completely wrong, but wouldn't it solve your issue if Compare always returned -1 instead of 0? no, because i lose (at least) the logging of why the record was tossed out... see below... it wouldn't help with the duplicate keys being inserted in reverse order... Procedure TTLEColl.Insert(Item: Pointer); var I : Sw_Integer = 0; old : Pointer; foo : integer = 0; begin I := 0; If NOT Search(KeyOf(Item), I) OR Duplicates Then // Item valid begin logTLEEntryType('M'); // MERGE this TLE AtInsert(I, Item);// Insert the item // Insert(Item); // Insert the item inc(cur_TLEs_added); // increment the add counter end else // otherwise begin foo := CompareReal(PTLERec(At(i))^.epoch,PTLERec(Item)^.epoch); // compare the epochs case foo of -1 : begin // replace existing record logTLEEntryType('U');// UPDATE this entry old := At(i);// save existing pointer first! AtPut(i, Item); // now put in the new record dispose(PTLERec(old),done); // dispose old one inc(cur_TLEs_updtd); // increment the updated counter end; 0 : begin // we're tossing this one out logTLEEntryType('S');// this entry is the SAME dispose(PTLERec(Item),done); // dispose the item inc(cur_TLEs_same); // increment the same counter end; 1 : begin // we're tossing this one out logTLEEntryType('N');// the existing entry is NEWER dispose(PTLERec(Item),done); // dispose the item inc(cur_TLEs_old); // increment the old counter end; end; // case end; end; -- NOTE: No off-list assistance is given without prior approval. Please keep mailing list traffic on the list unless private contact is specifically requested and granted. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] DefaultFormatSettings usage
2014-02-04 waldo kitty wkitt...@windstream.net: On 2/4/2014 8:54 AM, silvioprog wrote: t := StrToDate('2013-02-04 11:39:54'); // to format -mm-dd hh:nn:ss the above is StrToDate but you are also sending the time... you would see similar if you were sending the above string to StrToTime... StrToDate only accepts date formats as StrToTime only accepts time formats... if you want to send both, you have to use StrToDateTime ;) -- NOTE: No off-list assistance is given without prior approval. Please keep mailing list traffic on the list unless private contact is specifically requested and granted. Yes yes, after I saw that in typing fast, I forgot to use StrToDateTime. -- Silvio Clécio My public projects - github.com/silvioprog ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] DefaultFormatSettings usage
2014-02-04 Marco van de Voort mar...@stack.nl: In our previous episode, silvioprog said: Worked with: var t: TDateTime; begin t := StrToDateTime('2013-02-04 11:39:54'); end; sorry, I forgot to use the function StrToDateTime. :S Or use http://www.freepascal.org/docs-html/rtl/dateutils/scandatetime.html Very nice option, I did not know this function. It would be better (or fast) that the SysUtils date funcs? For example, in my new units, would be better to use ScanDateTime instead of StrToDateTime? Thx Marco! :) -- Silvio Clécio My public projects - github.com/silvioprog ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] DefaultFormatSettings usage
2014-02-05 silvioprog silviop...@gmail.com: 2014-02-04 Marco van de Voort mar...@stack.nl: In our previous episode, silvioprog said: Worked with: var t: TDateTime; begin t := StrToDateTime('2013-02-04 11:39:54'); end; sorry, I forgot to use the function StrToDateTime. :S Or use http://www.freepascal.org/docs-html/rtl/dateutils/scandatetime.html Very nice option, I did not know this function. It would be better (or fast) that the SysUtils date funcs? For example, in my new units, would be better to use ScanDateTime instead of StrToDateTime? Thx Marco! :) It would be nice if you could: if TryScanDateTime(datestring, datetime) then raise EMyOwnExcept.Create('My own datetime exception message'); -- Silvio Clécio My public projects - github.com/silvioprog ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal