[fpc-pascal] Re: android share library with classes unit
I use this binutils http://www.gnu.org/software/binutils/ using this command to build crosscompiler make clean crossinstall CPU_TARGET=arm OS_TARGET=linux CROSSBINDIR=/usr/share/fpcsrc/binutils/ OPT="-dFPC_ARMEL -O- -gl" CROSSOPT="-dANDROID -CpARMv6 -gl -CfSOFT -O-" I may have to repeat it thank u - - -- View this message in context: http://free-pascal-general.1045716.n5.nabble.com/android-share-library-with-classes-unit-tp4297859p4299510.html Sent from the Free Pascal - General mailing list archive at Nabble.com. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] TMenu - barbreak Delphi Compatbility.
12.04.2011 21:52, Justin Smyth wrote: Guys. In Delphi you can set the break to barbreak to break the menu in half , whats the best way ( if possible to do this in lazarus ) ? This is a windows only feature and it is not implemented in lazarus. To achive the desired effect on windows you can play with TMenuItem.Handle and windows api in {$ifdef windows} block inside your application. Best regards, Paul Ishenin ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] Inherit interface from 2 interfaces
On Tue Apr 12, michael.vancanneyt worte: On Tue, 12 Apr 2011, Andreas Dorn wrote: On Fri, 8 Apr 2011, michael.vancanneyt worte: The whole idea of interfaces is to avoid multiple inheritance. Hm. I don't believe that. One of the major points of interfaces is indeed to avoid the problems of multiple class inheritance (diamond problems - i.e. problems caused by conflicting implementations of a method in different ancestor classes). But Interfaces themselves don't have an implementation, so those diamond problems simply don't exist for them. Of course they do. If they inherit from 2 interfaces that have the same method with a different signature, you have a problem. InterfaceA = Interface Function IsValid : Integer; end; InterfaceB = Interface Function IsValid : String; end; Good point. Well, I don't see a diamond here as such a serious problem as it is for multiple class inheritance. (where eventually trying to override the conflicting methods in descendant classes will bite...) C# handles multiple interface inheritance quite well, so I'm quite confident that it's possible to get it done right. As far as I've seen the "diamond problem for interface inheritance" there just means that it's not directly possible to call an ambigous method directly from InterfaceC without first casting to Interface A or B - and that sounds rational to me. What's important is that you can get from C to A and B without a blind cast and then call the method you like. How to define : InterfaceC = Interface(InterfaceA,InterfaceB) Let's give it a try: Interface A and B are sets of pointers to Methods, InterfaceC then simply is the union of those sets. (As a pure contract InterfaceC itself doesn't really have to contain non-ambiguous signatures) It's no problem for a class to implement Interface A and B at the same time anyway... TTest = class(TObject, InterfaceA, InterfaceB) function InterfaceA.IsValid = IsValid_A; function InterfaceB.IsValid = IsValid_B; function IsValid_A: Integer; function IsValid_B: String; end; All ambiguities regarding implementation can be resolved by the implementing class. It just has to map all the pointers to (non-conflicting) method implementations. .. Finally I'd like to mention one usecases for interface inheritance I'd like to have: 1) Splitting a big IDataInterface into smaller ones, like: IDataInterface = Interface(IInitMethods, IReadMethods, IEditMethods, ...) This would allow me to pass an IDataInterface into Factories, Loggers, etc. without passing too many methods and without ugly runtime casts or artificial single-inheritance chains... 2) Containers. Without multiple inheritance it's a pain to get some things like: IMyContainer = Interface(ISortableContainer, IVectorList, IEditableList, ...) Practically for me not having multiple interface inheritance sometimes leads to: a) artificial (single) inheritance chains b) blind runtime casts instead of casts to a known parent c) having to pass parameters that are bigger than necessary (IQuery instead of IReadOnlyQuery) All in all I'd really like to have multiple interface inheritance... -- Andreas. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Is there a problem on the lazarus mailing list?
Luca Olivetti kirjoitti tiistai, 12. huhtikuuta 2011 11:41:03: > Are you sure? > I didn't get it and it's not in the archive > http://lists.lazarus.freepascal.org/pipermail/lazarus/2011-April/date.html I don't see it in archive either for some reason. I do see it in my e-mail client (KMail) configured for GMail IMAP, and I also see it in GMail web-interface. Today the message was even replied by Patspiper. Somehow the DNS problem affected only some people. Juha ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Is there a problem on the lazarus mailing list?
Al 12/04/2011 15:45, En/na Vincent Snijders ha escrit: 2011/4/12 Luca Olivetti: Sorry for the off-topic, but I sent a message yesterday to the lazarus mailing list and it hasn't appeared. In fact there aren't new messages since last Sunday. Does anybody know if is there a problem with the lazarus list server? I restarted mailman, and that seems to have fixed the issue. Thank you. Bye -- Luca ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] TMenu - barbreak Delphi Compatbility.
Thats for a Horizital break , i'm trying to set a vertical break ie 2 or more columns,... its for a Win32/Win64 Project. - Original Message - From: "Felipe Monteiro de Carvalho" To: "Justin Smyth" ; "FPC-Pascal users discussions" Sent: Wednesday, April 13, 2011 12:15 AM Subject: Re: [fpc-pascal] TMenu - barbreak Delphi Compatbility. In the same way: Set the caption of the item which is a separator to "-" without quotes -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] TMenu - barbreak Delphi Compatbility.
In the same way: Set the caption of the item which is a separator to "-" without quotes -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] TMenu - barbreak Delphi Compatbility.
Guys. In Delphi you can set the break to barbreak to break the menu in half , whats the best way ( if possible to do this in lazarus ) ? Delphian___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Is there a problem on the lazarus mailing list?
2011/4/12 Luca Olivetti : > Sorry for the off-topic, but I sent a message yesterday to the lazarus > mailing list and it hasn't appeared. > In fact there aren't new messages since last Sunday. > Does anybody know if is there a problem with the lazarus list server? I restarted mailman, and that seems to have fixed the issue. Vincent ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] android share library with classes unit
W dniu 2011-04-12 11:56, herux pisze: I managed to compile and run the library for android on emulator, which I compile the project just a libhellojni.so compile using paramater like this ppcarm -Scghi -O1 -Parm -gl -b -B -XX -Xc -XD -CpARMv6 -CfSOFT -dandroid -vewnhi -l -XParm-linux- -Fi/home/herux/workspace/hellojni/jni/lib/arm-linux/ -Fu. -FUlib/arm-linux/ -o../libs/armeabi/libhellojni.so -FD/usr/share/fpcsrc/binutils/ hellojni.lpr on Kubuntu 10.04 x86_64 library code: library hellojni; {$ ifdef fpc} {$ mode delphi} {$ endif} uses JNI, log; Java_com_herux_hellojni_MainActivity_Hellojni function (env: PJNIEnv; Thiz: jobject): jstring; cdecl; begin result: = env ^. NewStringUTF (env, PChar ('Hello JNI from FreePascal ..')); end; exports Java_com_herux_hellojni_MainActivity_Hellojni name 'Java_com_herux_hellojni_MainActivity_Hellojni'; begin end; then I try to use classes unit or sysutils, the project succeeded in compiling, but the library did not loaded by the emulator. there is an error SIGSEGV D/dalvikvm( 1082): Trying to load lib /data/data/com.herux.hellojni/lib/libhellojni.so 0x44e7ea48 I/DEBUG ( 31): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** I/DEBUG ( 31): How You prepare crosscompiler did You use -dARMEL -CpARMv6 or problems with binutils On Android each bug in linking is showing the same Darek ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Font reading library
On Tue, 12 Apr 2011 13:33:35 +0200, Helmut Hartl wrote: (Have a look at : http://www.freetype.org/freetype1/index.html, and the name of the authors ...) What's special with the name of the authors nothing - but a name compare should have revealed the strong indication that fornix has nothing to do with it (which i cannot comment as i dont care about fornix anyway) and that freetype2 originated from freetype1 which was written in pascal years ago. (as you already know) I was mislead by wikipedia: http://en.wikipedia.org/w/index.php?title=FreeType&oldid=417331396 which lead me to the fornix project. It's not that I own fornix shares or somehing ;) Darius ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Font reading library
Am 12.04.11 11:03, schrieb Felipe Monteiro de Carvalho: Hello, I fixed the compilation of the old freetype and put it in the Lazarus-ccr for now. Maybe it can be added to FPC later on if it proves a good substitute: http://wiki.lazarus.freepascal.org/Freetype#Download nice It's not maintained anymore - but imho has nothing todo with fornix ? > From what I saw fornix has nothing to do with it. Probably they just used this library in one of their projects, like X11 uses. (Have a look at : http://www.freetype.org/freetype1/index.html, and the name of the authors ...) What's special with the name of the authors nothing - but a name compare should have revealed the strong indication that fornix has nothing to do with it (which i cannot comment as i dont care about fornix anyway) and that freetype2 originated from freetype1 which was written in pascal years ago. (as you already know) helmut ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] android share library with classes unit
I managed to compile and run the library for android on emulator, which I compile the project just a libhellojni.so compile using paramater like this ppcarm -Scghi -O1 -Parm -gl -b -B -XX -Xc -XD -CpARMv6 -CfSOFT -dandroid -vewnhi -l -XParm-linux- -Fi/home/herux/workspace/hellojni/jni/lib/arm-linux/ -Fu. -FUlib/arm-linux/ -o../libs/armeabi/libhellojni.so -FD/usr/share/fpcsrc/binutils/ hellojni.lpr on Kubuntu 10.04 x86_64 library code: library hellojni; {$ ifdef fpc} {$ mode delphi} {$ endif} uses JNI, log; Java_com_herux_hellojni_MainActivity_Hellojni function (env: PJNIEnv; Thiz: jobject): jstring; cdecl; begin result: = env ^. NewStringUTF (env, PChar ('Hello JNI from FreePascal ..')); end; exports Java_com_herux_hellojni_MainActivity_Hellojni name 'Java_com_herux_hellojni_MainActivity_Hellojni'; begin end; then I try to use classes unit or sysutils, the project succeeded in compiling, but the library did not loaded by the emulator. there is an error SIGSEGV D/dalvikvm( 1082): Trying to load lib /data/data/com.herux.hellojni/lib/libhellojni.so 0x44e7ea48 I/DEBUG ( 31): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** I/DEBUG ( 31): Build fingerprint: 'generic/sdk/generic/:2.2/FRF91/43546:eng/test-keys' I/DEBUG ( 31): pid: 1082, tid: 1082 >>> com.herux.hellojni <<< I/DEBUG ( 31): signal 11 (SIGSEGV), fault addr 7eb67b08 I/DEBUG ( 31): r0 7eb67b08 r1 7eb67b08 r2 r3 003d I/DEBUG ( 31): r4 0006 r5 809aa4cc r6 b001037c r7 I/DEBUG ( 31): r8 80813b00 r9 ccb0 10 4186b904 fp beb1986c I/DEBUG ( 31): ip beb19870 sp beb19818 lr 809ab5d4 pc 809ab56c cpsr 6010 I/DEBUG ( 31): #00 pc 000ab56c /data/data/com.herux.hellojni/lib/libhellojni.so I/DEBUG ( 31): #01 lr 809ab5d4 /data/data/com.herux.hellojni/lib/libhellojni.so I/DEBUG ( 31): I/DEBUG ( 31): code around pc: if anyone has ever experienced it? or is it a bug? thanks - - -- View this message in context: http://free-pascal-general.1045716.n5.nabble.com/android-share-library-with-classes-unit-tp4297859p4297859.html Sent from the Free Pascal - General mailing list archive at Nabble.com.___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Inherit interface from 2 interfaces
On Tue, 12 Apr 2011, Andreas Dorn wrote: On Fri, 8 Apr 2011,michael.vancanneyt worte: The whole idea of interfaces is to avoid multiple inheritance. Hm. I don't believe that. One of the major points of interfaces is indeed to avoid the problems of multiple class inheritance (diamond problems - i.e. problems caused by conflicting implementations of a method in different ancestor classes). But Interfaces themselves don't have an implementation, so those diamond problems simply don't exist for them. Of course they do. If they inherit from 2 interfaces that have the same method with a different signature, you have a problem. InterfaceA = Interface Function IsValid : Integer; end; InterfaceB = Interface Function IsValid : String; end; How to define : InterfaceC = Interface(InterfaceA,InterfaceB) Michael. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Font reading library
Hello, I fixed the compilation of the old freetype and put it in the Lazarus-ccr for now. Maybe it can be added to FPC later on if it proves a good substitute: http://wiki.lazarus.freepascal.org/Freetype#Download > http://www.koders.com/delphi/fidEAE4D251909342259720229735A9CBF6C74B15AB.aspx?s=delphi+freetype#L40 I prefered to take the sources from here: http://cvsweb.xfree86.org/cvsweb/xc/extras/FreeType/pascal/lib/Attic/ > It's not maintained anymore - but imho has nothing todo with fornix ? >From what I saw fornix has nothing to do with it. Probably they just used this library in one of their projects, like X11 uses. > (Have a look at : http://www.freetype.org/freetype1/index.html, > and the name of the authors ...) What's special with the name of the authors? -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] Re: Strange arm-linux cross-compilation errors
I think we should change the file crt0.as, as described in the following link http://honeypod.blogspot.com/2007/12/initialize-libc-for-android.html I have not done so, I'm doing another job first. - - -- View this message in context: http://free-pascal-general.1045716.n5.nabble.com/Strange-arm-linux-cross-compilation-errors-tp4269189p4297396.html Sent from the Free Pascal - General mailing list archive at Nabble.com.___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Inherit interface from 2 interfaces
On Fri, 8 Apr 2011,michael.vancanneyt worte: The whole idea of interfaces is to avoid multiple inheritance. Hm. I don't believe that. One of the major points of interfaces is indeed to avoid the problems of multiple class inheritance (diamond problems - i.e. problems caused by conflicting implementations of a method in different ancestor classes). But Interfaces themselves don't have an implementation, so those diamond problems simply don't exist for them. I don't think there's a good reason against multiple interface inheritance. Not having multiple interface inheritance complicated certain situations for myself.. forcing me to put runtime interface-casts into my code that a compiler with multiple interface inheritance could have checked at compiletime. -- Andreas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Is there a problem on the lazarus mailing list?
Al 12/04/2011 9:24, En/na Juha (gmail) ha escrit: Luca Olivetti kirjoitti tiistai, 12. huhtikuuta 2011 10:20:04: Sorry for the off-topic, but I sent a message yesterday to the lazarus mailing list and it hasn't appeared. In fact there aren't new messages since last Sunday. Does anybody know if is there a problem with the lazarus list server? I got my message through yesterday night, at topic: Component visibility at design time Are you sure? I didn't get it and it's not in the archive http://lists.lazarus.freepascal.org/pipermail/lazarus/2011-April/date.html Bye -- Luca ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Is there a problem on the lazarus mailing list?
2011/4/12 Juha (gmail) : > Luca Olivetti kirjoitti tiistai, 12. huhtikuuta 2011 10:20:04: >> Sorry for the off-topic, but I sent a message yesterday to the lazarus >> mailing list and it hasn't appeared. >> In fact there aren't new messages since last Sunday. >> Does anybody know if is there a problem with the lazarus list server? > > I got my message through yesterday night, at topic: > Component visibility at design time There seems to be a problem with DNS: http://www.dnswatch.info/dns/dnslookup?la=en&host=lists.lazarus.freepascal.org&type=MX&submit=Resolve Searching for lists.lazarus.freepascal.org. MX record at A.ROOT-SERVERS.NET. [198.41.0.4] ...took 27 ms Searching for lists.lazarus.freepascal.org. MX record at d0.org.afilias-nst.org. [199.19.57.1] ...took 10 ms Searching for fpc.dfmk.hu. A record at A.ROOT-SERVERS.NET. [198.41.0.4] ...took 24 ms Searching for fpc.dfmk.hu. A record at ns1.nic.hu. [193.239.149.3] ...took 19 ms Searching for fpc.dfmk.hu. A record at ns2.iif.hu. [193.225.12.59] ...took 21 ms Searching for lists.lazarus.freepascal.org. MX record at fpc.dfmk.hu. [193.224.143.26] ...took 25 ms Nameserver fpc.dfmk.hu. reports: No such host lists.lazarus.freepascal.org hint: Try lazarus.freepascal.org instead. I will ask the fpc admin to try and fix this. Vincent ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re[4]: [fpc-pascal] read lines at end of file
Hello FPC-Pascal, Tuesday, April 12, 2011, 12:51:17 AM, you wrote: jgc> So the idea is to open file eg as file of array [1:65536] of char or jgc> something similar, seek & read to end of file, then go through the last jgc> array converting to strings by finding crlfs correct? Is this the simplest jgc> way? If not any outline code? There is the right way which is a bit complex as there are 3 different line ending sequences based in the platform. The code get simpler if you support only one end of line, but as in your case you only need 4 lines and this lines for sure are not too large there is a more simple way, not very elegant but simple: function GetLast4Lines(const aFileName: ansistring): ansistring; var Lines: TStringList; FileToRead: TFileStream; Buffer: ansistring; ToReadBytes: int64; i: integer; begin //Open the file with fmShareDenyNone, so other process can write in //the file while I'm reading FileToRead := TFileStream.Create(aFileName,fmOpenRead or fmShareDenyNone); //Can I read at least 4096 bytes ? if FileToRead.Size > 4096 then ToReadBytes := 4096 else ToReadBytes := FileToRead.Size; //Locate read position at 4096 bytes from the end FileToRead.Position := FileToRead.Size - ToReadBytes; //Setup buffer to space needed SetLength (Buffer, ToReadBytes); //Read the last 4096 or less bytes in Buffer FileToRead.Read (Buffer[1], ToReadBytes); //Release the file, not needed anymore. FileToRead.Free; //Create a lines array Lines := TStringList.Create; //Assign the buffer to the lines array Lines.Text := Buffer; //Initialize output to nothing Result:=''; //Read from lastline-4 to lastline for i := Lines.Count-1-4 to Lines.Count-1 do begin //Add each line to the output Result := Result + Lines[i] + LineEnding; end; //Release lines array Lines.Free; //Result now have the last 4 files. end; -- Best regards, José ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re[2]: [fpc-pascal] read lines at end of file
Hello FPC-Pascal, Tuesday, April 12, 2011, 1:09:34 AM, you wrote: RW> On 04/11/2011 12:32 PM, John Lee wrote: >> Need to read the last 4 lines (txt) of a very large log file 100M >> bytes, 100k lines or more lots of times - of course I can read RW> Hmm, could first have the reader enumerate the number of lines in the RW> file, then read through the files using the "total number of lines - 4" RW> variable and then start displaying the lines after that variable has RW> been reached. If necessary, I would be happy to see what I can come up RW> with here and then post it to the mailing list. Go get the amount of lines of a file you must read the whole file as each line does not have a fixed size. To put an non programming example you think in an elevator and I tell you that the elevator can lift up 600 kilograms. How many people are inside ? You can routhly calculate that 8 persons as in average one persons is 75 kilograms in weigth, but what happends if the elevator is filled with childrem ( sometimes called people too :-) ) between 5 and 6 years old ? -- Best regards, José ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Is there a problem on the lazarus mailing list?
Luca Olivetti kirjoitti tiistai, 12. huhtikuuta 2011 10:20:04: > Sorry for the off-topic, but I sent a message yesterday to the lazarus > mailing list and it hasn't appeared. > In fact there aren't new messages since last Sunday. > Does anybody know if is there a problem with the lazarus list server? I got my message through yesterday night, at topic: Component visibility at design time Juha ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] Is there a problem on the lazarus mailing list?
Sorry for the off-topic, but I sent a message yesterday to the lazarus mailing list and it hasn't appeared. In fact there aren't new messages since last Sunday. Does anybody know if is there a problem with the lazarus list server? Bye -- Luca ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal