Re: [fpc-pascal] Small OSX GUI apps
On 17 Sep 2008, at 01:58, Jon wrote: if you're coming from Win32 programming, you may want to read this: http://developer.apple.com/documentation/Porting/Conceptual/win32porting/win32porting.html Interesting document. Do I have to install Interface Builder and XCode to use FPC? You have to install the Xcode tools, which comes with Interface Builder, gcc, assembler, linker, headers, documentation, examples etc. Are any *simple* examples available for creating OSX gui apps? There's one here (using Carbon): http://svn.freepascal.org/cgi-bin/viewvc.cgi/trunk/packages/univint/examples/ Excellent, just what I was after. Are there any more, especially Cocoa? You can find quite a few at http://www.pascal-central.com/ Depends on who you ask. But Apple has made it clear that they want to move forward primarily with Cocoa. How good is the FPC for each? Is there a separate install for both? There is only one install, but currently FPC only ships with interfaces to Carbon routines (and other APIs that have procedural interfaces). Some people are also working on an interface to Cocoa, see http://wiki.freepascal.org/PasCocoa Jonas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] TThread.WaitFor not returning?
Hi! I have a similar problem when using threads with synchronize... And I understand that threads in FPC/Lazarus under Linux/BSD works like this: When you call synchronize from inside of you thread, this sends a message to application thread with the procedure that will be used to synchronize AND WAIT FOR a response from application thread of the execution of sync procedure. BUT when you call Thread.WaitFor in application thread, the application don't process any messages because it is waiting the thread finish, and thread don't finish because it is waiting a response of application thread of the execution of sync procedure... and you have your aplication freeze! My solution in this case is override the WaitFor procedure... procedure TMyThread.WaitFor; begin while not ended do application.processmessages; end; ...and var ended must be set to true in the last line of procedure execute... Fabio Luis Girardi 2008/9/16 Luca Olivetti [EMAIL PROTECTED] En/na Graeme Geldenhuys ha escrit: procedure TtiLogToCacheAbs.Terminate; begin writeln(' TtiLogToCacheAbs.Terminate'); FThrdLog.Terminate; writeln(' called .Terminate() and now calling .WaitFor()'); FThrdLog.WaitFor; writeln(' TtiLogToCacheAbs.Terminate'); end; Any ideas? Do you call synchronize inside the thread? Anyway, I don't usually call WaitFor (I've had many problems with it), I set a flag in the thread and I loop sleeping (or calling checksynchronize if the thread uses synchronize) until it's true, eg: procedure TMyThread.execute; begin while not terminated do begin end; finished:=true; end; MyThread.Terminate; while not MyThread.Finished do sleep(100); or while not MyThread.Finished do CheckSynchronize(100); Bye -- Luca ___ 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] TThread.WaitFor not returning?
On 9/17/08, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: When you call synchronize from inside of you thread, this sends a message to application thread with the procedure that will be used to synchronize AND WAIT FOR a response from application thread of the execution of sync procedure. BUT when you call Thread.WaitFor in application thread, the application don't process any messages because it is waiting the thread finish, and thread don't finish because it is waiting a response of application thread of the execution of sync procedure... and you have your aplication freeze! This is exactly what seems to be happening... I'll try your work-around and see how it goes. Thanks. Note: I have no such issues in Delphi, using the exact same threading code. So does that mean FPC has a bug in threading? 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
Re: [fpc-pascal] TThread.WaitFor not returning?
On 17/09/2008, Graeme Geldenhuys [EMAIL PROTECTED] wrote: On 9/17/08, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: When you call synchronize from inside of you thread, this sends a message to application thread with the procedure that will be used to synchronize AND WAIT FOR a response from application thread of the execution of sync procedure. BUT when you call Thread.WaitFor in application thread, the application don't process any messages because it is waiting the thread finish, and thread don't finish because it is waiting a response of application thread of the execution of sync procedure... and you have your aplication freeze! This is exactly what seems to be happening... I'll try your work-around and see how it goes. Thanks. Note: I have no such issues in Delphi, using the exact same threading code. So does that mean FPC has a bug in threading? Delphi has code in its WaitFor function that prevents this deadlock from occuring. They basically wait on the SyncEvent and the handle of the thread, calling CheckSynchonize when the SyncEvent triggers. I'm not sure if this is possible with fpc, but I'm sure there must be a solution. henry ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] TThread.WaitFor not returning?
On 9/17/08, Henry Vermaak [EMAIL PROTECTED] wrote: Delphi has code in its WaitFor function that prevents this deadlock from occuring. They basically wait on the SyncEvent and the handle of the thread, calling CheckSynchonize when the SyncEvent triggers. I'm not sure if this is possible with fpc, but I'm sure there must be a solution. Umm, and TThread.WaitFor is not virtual, so I can't override it either. :-( I can't see any CheckSynchronize call in the unix implementation of TThread, so is might be a bug. I'll raise this issue in the fpc-devel mailing list and see what they say. Thanks everybody for responding. 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
Re: [fpc-pascal] Small OSX GUI apps
On Tue, Sep 16, 2008 at 9:58 PM, Jon [EMAIL PROTECTED] wrote: Depends on who you ask. But Apple has made it clear that they want to move forward primarily with Cocoa. How good is the FPC for each? Is there a separate install for both? Carbon is stable. Cocoa support is experimental. It needs more people using it to test it and find problems / request that more classes be added. For the first users it won't be that easy, but they will clear the path for the next ones =) http://wiki.freepascal.org/PasCocoa If you can read german, there is an article in the german toolbox magazine about PasCocoa and Cocoa development in general: http://www.toolbox-mag.de/ The first part is in the latest edition. The second part will come in the next (it's a large article). You can use Lazarus as just an IDE. And write Free Pascal application in it which link directly to Carbon/Cocoa instead of using the Lazarus Component Library. -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] TThread.WaitFor not returning?
On Wed, 17 Sep 2008, Graeme Geldenhuys wrote: On 9/17/08, Henry Vermaak [EMAIL PROTECTED] wrote: Delphi has code in its WaitFor function that prevents this deadlock from occuring. They basically wait on the SyncEvent and the handle of the thread, calling CheckSynchonize when the SyncEvent triggers. I'm not sure if this is possible with fpc, but I'm sure there must be a solution. Umm, and TThread.WaitFor is not virtual, so I can't override it either. :-( I can't see any CheckSynchronize call in the unix implementation of TThread, so is might be a bug. I'll raise this issue in the fpc-devel mailing list and see what they say. Thanks everybody for responding. CheckSynchronize must be called by the main thread on a regular basis in the event loop, so this is normal. Michael. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Can't resize form in WinCE
Paul schreef: Installed these packages Lazarus-0.9.25-16602-fpc-2.2.2-20080916-win32.exe Lazarus-0.9.25-16602-fpc-2.2.2-20080916-cross-arm-wince-win32.exe If I try to compile the project, this error pops up: FATAL: Can't find unit interfaces used by project 1 in project file at line: uses {$IFDEF UNIX}{$IFDEF UseCThreads} what went wrong here ? No idea. Please paste the compiler options in an email: Project - Compiler Options - Show Options. Vincent ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Can't resize form in WinCE
- Original Message - From: Vincent Snijders [EMAIL PROTECTED] To: FPC-Pascal users discussions fpc-pascal@lists.freepascal.org Sent: Wednesday, September 17, 2008 2:16 PM Subject: Re: [fpc-pascal] Can't resize form in WinCE No idea. Please paste the compiler options in an email: Project - Compiler Options - Show Options. Vincent This is the config file: ?xml version=1.0? CONFIG ProjectOptions PathDelim Value=\/ Version Value=6/ General MainUnit Value=0/ TargetFileExt Value=.exe/ ActiveEditorIndexAtStart Value=0/ /General VersionInfo ProjectVersion Value=/ Language Value=/ CharSet Value=/ /VersionInfo PublishOptions Version Value=2/ IgnoreBinaries Value=False/ IncludeFileFilter Value=*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)/ ExcludeFileFilter Value=*.(bak|ppu|ppw|o|so);*~;backup/ /PublishOptions RunParams local FormatVersion Value=1/ LaunchingApplication PathPlusParams=/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)/ /local /RunParams RequiredPackages Count=1 Item1 PackageName Value=LCL/ /Item1 /RequiredPackages Units Count=2 Unit0 Filename Value=project10.lpr/ IsPartOfProject Value=True/ UnitName Value=project10/ UsageCount Value=20/ /Unit0 Unit1 Filename Value=unit10.pas/ ComponentName Value=Form1/ IsPartOfProject Value=True/ ResourceBaseClass Value=Form/ ResourceFilename Value=unit10.lrs/ UnitName Value=Unit10/ CursorPos X=17 Y=24/ TopLine Value=1/ EditorIndex Value=0/ UsageCount Value=20/ Loaded Value=True/ /Unit1 /Units JumpHistory Count=0 HistoryIndex=-1/ /ProjectOptions CompilerOptions Version Value=8/ PathDelim Value=\/ SearchPaths LCLWidgetType Value=wince/ /SearchPaths Parsing SyntaxOptions CStyleOperator Value=False/ /SyntaxOptions /Parsing CodeGeneration TargetCPU Value=arm/ TargetOS Value=WinCE/ /CodeGeneration Linking Options Win32 GraphicApplication Value=True/ /Win32 /Options /Linking Other CompilerPath Value=$(CompPath)/ /Other /CompilerOptions Debugging BreakPoints Count=2 Item1 Source Value=unit1.pas/ Line Value=160/ /Item1 Item2 Source Value=unit1.pas/ Line Value=156/ /Item2 /BreakPoints Exceptions Count=2 Item1 Name Value=ECodetoolError/ /Item1 Item2 Name Value=EFOpenError/ /Item2 /Exceptions /Debugging /CONFIG Paul ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] TThread.WaitFor not returning?
On 9/17/08, Michael Van Canneyt [EMAIL PROTECTED] wrote: CheckSynchronize must be called by the main thread on a regular basis in the event loop, so this is normal. CheckSynchronize is called in the main eventloop. This happens on application termination. The gLog singleton is freed in the finalization section of a unit. So maybe it's a timing issue? The main eventloop has already stopped functioning, by the time the gLog singleton is being free'd [...quickly testing...] Umm, a quick test seems to reveal that might be the problem. As soon as the main form closes, the main eventloop stops as well - only then does the finalization section try to free the gLog singleton which contains the thread. Freeing the gLog singleton in the main form's OnClose event, seems to resolve the issue. How does this work in Lazarus? Do finalization code execute before the lazarus application's main eventloop terminates? 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
Re: [fpc-pascal] Small OSX GUI apps
Jon [EMAIL PROTECTED] wrote: Thank you for your replies Jonas if you're coming from Win32 programming, you may want to read this: http://developer.apple.com/documentation/Porting/Conceptual/win32porting/win32porting.html Interesting document. Do I have to install Interface Builder and XCode to use FPC? You need some GCC tools that are installed with Xcode. It is possible to make installers for those only, but it is easier to install Xcode and then trash any unneeded apps. Are any *simple* examples available for creating OSX gui apps? There's one here (using Carbon): http://svn.freepascal.org/cgi-bin/viewvc.cgi/trunk/packages/univint/examples/ Excellent, just what I was after. Are there any more, especially Cocoa? Not much with Cocoa yet, but there is a whole bunch of Carbon-using examples here: http://www.ragnemalm.se/lightweight Check out distributions with all demos. - and which is best? Depends on who you ask. But Apple has made it clear that they want to move forward primarily with Cocoa. How good is the FPC for each? Is there a separate install for both? Currently (unless I have missed some significant breakthoughs) FPC support for Carbon is excellent while Cocoa is more experimental/preliminary. We will have to move to Cocoa GUIs simply because Apple won't provide anything else, but I have some ideas about making a nicer layer for hiding that. In particular, a cross-platform layer. /Ingemar ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Can't resize form in WinCE
On Wed, 17 Sep 2008 09:30:16 +0200 Paul [EMAIL PROTECTED] wrote: Installed these packages Lazarus-0.9.25-16602-fpc-2.2.2-20080916-win32.exe Lazarus-0.9.25-16602-fpc-2.2.2-20080916-cross-arm-wince-win32.exe If I try to compile the project, this error pops up: FATAL: Can't find unit interfaces used by project 1 FPC seldom reports correct line numbers and/or filenames when 'unit not found'. in project file at line: uses {$IFDEF UNIX}{$IFDEF UseCThreads} what went wrong here ? My guess: you forgot to cross compile the LCL. Tools / Configure Build lazarus Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] BLOCKWRITE-restrictions in writing .bmp-file?
IF (((NDum) MOD 4)0) THEN BLOCKWRITE(OutFile,Pixel,SIZEOF(Pixel)); IF (((NDum + 1) MOD 4)0) THEN BLOCKWRITE(OutFile,Pixel,SIZEOF(Pixel)); IF (((NDum + 2) MOD 4)0) THEN BLOCKWRITE(OutFile,Pixel,SIZEOF(Pixel)); 1. If NDum = 4k (e.g. 12=4*3), you write two times; if NDum = 4k + 3 (e.g. 15=5*3), you write two times. It's not right. 2. Check sizeof-s. Are you sure they are one byte each? 3. Are you sure the code worked good before? ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Can't resize form in WinCE
Mattias Gaertner schreef: On Wed, 17 Sep 2008 09:30:16 +0200 Paul [EMAIL PROTECTED] wrote: Installed these packages Lazarus-0.9.25-16602-fpc-2.2.2-20080916-win32.exe Lazarus-0.9.25-16602-fpc-2.2.2-20080916-cross-arm-wince-win32.exe My guess: you forgot to cross compile the LCL. Tools / Configure Build lazarus A cross compiled LCL is supposed to supplied by Lazarus-0.9.25-16602-fpc-2.2.2-20080916-cross-arm-wince-win32.exe Assuming that you install lazarus in c:\lazarus, do you have c:\lazarus\fpc\2.2.2\units\arm-wince\wince\interfaces.ppu ? If you compile your project with all messages enabled (-va in the compiler options), copy all and hidden messages to the clipboard, paste them in a textfile and send that in zipped format to me (probably too big for the list). Vincent ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Can't resize form in WinCE
On Wed, 17 Sep 2008 20:24:27 +0200 Vincent Snijders [EMAIL PROTECTED] wrote: Mattias Gaertner schreef: On Wed, 17 Sep 2008 09:30:16 +0200 Paul [EMAIL PROTECTED] wrote: Installed these packages Lazarus-0.9.25-16602-fpc-2.2.2-20080916-win32.exe Lazarus-0.9.25-16602-fpc-2.2.2-20080916-cross-arm-wince-win32.exe My guess: you forgot to cross compile the LCL. Tools / Configure Build lazarus A cross compiled LCL is supposed to supplied by Lazarus-0.9.25-16602-fpc-2.2.2-20080916-cross-arm-wince-win32.exe Assuming that you install lazarus in c:\lazarus, do you have c:\lazarus\fpc\2.2.2\units\arm-wince\wince\interfaces.ppu ? If you compile your project with all messages enabled (-va in the compiler options), copy all and hidden messages to the clipboard, paste them in a textfile and send that in zipped format to me (probably too big for the list). ... please run Project / Compiler options / Test and see what it finds. If we find out, what went wrong a check should be added to this test suite. Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] BLOCKWRITE-restrictions in writing .bmp-file?
IF (((NDum) MOD 4)0) THEN BLOCKWRITE(OutFile,Pixel,SIZEOF(Pixel)); IF (((NDum + 1) MOD 4)0) THEN BLOCKWRITE(OutFile,Pixel,SIZEOF(Pixel)); IF (((NDum + 2) MOD 4)0) THEN BLOCKWRITE(OutFile,Pixel,SIZEOF(Pixel)); 1. If NDum = 4k (e.g. 12=4*3), you write two times; if NDum = 4k + 3 (e.g. 15=5*3), you write two times. It's not right. 2. Check sizeof-s. Are you sure they are one byte each? 3. Are you sure the code worked good before? I modified the code a bit to make it better readable, but, as you remarked, with an error in the padding of the line! I'll recheck my original code and come back. Thanks! A. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Help converting h-file
Henry Vermaak schreef: 2008/9/15 Koenraad Lelong : ... I think I'm missing some file to link in, but I think I included every seems like it's not finding libc? henry Thanks, but I do have -Fl/opt/arcom/arm-linux/lib/* in the script and /opt/arcom/arm-linux/lib contains a libc.a, libc.so, libc.so.6 and a libc-2.3.3.so. I tried with -Fl/opt/arcom/arm-linux/lib with the same result. libc.a contains amongst others printf.o, getpagesize.o, getenv.o. Still missing something, but I can't see it. Koenraad. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Help converting h-file
On 17/09/2008, Koenraad Lelong [EMAIL PROTECTED] wrote: Thanks, but I do have -Fl/opt/arcom/arm-linux/lib/* in the script and /opt/arcom/arm-linux/lib contains a libc.a, libc.so, libc.so.6 and a libc-2.3.3.so. I tried with -Fl/opt/arcom/arm-linux/lib with the same result. libc.a contains amongst others printf.o, getpagesize.o, getenv.o. Still missing something, but I can't see it. hmm, is -lc passed to arm-linux-ld? you might have to add -k-lc to the fpc command line. btw, which arcom board do you have? i'm getting a new one very soon, so we can team up on this :) henry ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] FreeBSD/x86_64 snapshots
Hello, The first snapshots of x86_64-FreeBSD are rolling in: a 26MB snapshot is available at (all binaries, just needs a fpc.cfg) http://www.stack.nl/~marcov/snapshot-freebsd-x86_64-r11798.tar.bz2 Problems: - I had some odd problems on a 7.1.1-PRERELEASE2 machine. Looked like a binutils (AR) problem, but the versions are the same?!? - The textmode IDE looks fairly messed up, but that could be the VMware console (it was mostly developed in a VM) - shared linking works, but some ncurses programs RTE on shutdown (but not all). Some warnings there about signed arguments too. Maybe ioctl numbers vary. Greetings Marco ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal