Re: [fpc-pascal] Updating to 2.0.4 bugreport
On 15 Sep 2006, at 20:01, Rainer Stratmann wrote: the update on 2.0.4 shows some bugs: var dirstr:string getdir(0,dirstr); // <- not works (on linux), the result is a string with length 0 The Compiler switch "Use register-variables" (switch off state) seems not to work. Please report bugs using http://www.freepascal.org/mantis/, and always supply a compilable test program (not just one or two lines of code) and the necessary compiler switches to reproduce the problem. Jonas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] multidimensional dynarrays SetLenght and memory layout
Marc Santhoff schrieb: Hi, since I managed to get static arrays handed over to a C library I want to know if this is possible for dynamic arrays too. I browsed the docs and source but I'm not able to find the actual implementation of the SetLength() procedure for dynarrays. rtl/inc/dynarr.inc Where is it or maybe better: how does it work? I think I'll know when the first question is answered, but: how is the memory for dynamic arrays handled, is there a chance of forcing it to be one continuous block on the heap for giving a pointer to it to an external function? No. Dyn. arrays involve several compiler magic. A dyn. array is basically a pointer to the real dyn. array containing size information and the data. TIA, Marc ___ 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] multidimensional dynarrays SetLenght and memory layout
Am Samstag, den 16.09.2006, 09:45 +0200 schrieb Florian Klaempfl: > Marc Santhoff schrieb: > > Hi, > > > > since I managed to get static arrays handed over to a C library I want > > to know if this is possible for dynamic arrays too. > > > > I browsed the docs and source but I'm not able to find the actual > > implementation of the SetLength() procedure for dynarrays. > > rtl/inc/dynarr.inc I had looked at that one, but didn't understand ... > > Where is it > > or maybe better: how does it work? > > > > I think I'll know when the first question is answered, but: how is the > > memory for dynamic arrays handled, is there a chance of forcing it to be > > one continuous block on the heap for giving a pointer to it to an > > external function? > > No. Dyn. arrays involve several compiler magic. A dyn. array is > basically a pointer to the real dyn. array containing size information > and the data. ... and that's the cause. At least I know and can decide between forgetting about dynamic arrays or making an own implementation. Thank you, Marc ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] problem freeing strings
Hi, when running a program that is working it SIGSEGVs at the finalization: <--- snip ---> (gdb) r Starting program: /usr/home/marc/tmp/test/./h5_attribute ping The value of the attribute "Integer attribute" is 1 The value of the attribute with index 2 is ABCD Name : "Float attribute" Rank : 2 Dimension sizes : 2 3 Type : FLOAT Values : -1.10024E+00 -1.10024E+00 -1.10024E+00 -1.10024E+00 -1.10024E+00 -1.10024E+00 Name : "Integer attribute" Name : "Character attribute" Iteration done. Program received signal SIGSEGV, Segmentation fault. 0x804dcea in fpc_ansistr_decr_ref () (gdb) bt #0 0x804dcea in fpc_ansistr_decr_ref () #1 0x80552d7 in fpc_finalize () #2 0x80497c2 in P$H5_ATTRIBUTE_finalize_implicit () at h5_attribute.pas:338 #3 0x8055a53 in SYSTEM_FINALIZEUNITS () #4 0x8055ab6 in SYSTEM_INTERNALEXIT () #5 0x8055c7c in SYSTEM_DO_EXIT () #6 0x804979a in main () at h5_attribute.pas:338 Line 338 is far after the "END." and anything else is done as expected. How can I track down the source of this poblem? Any hints or rtfm's on debugging techniques for this special case are welcome ... TIA, Marc ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Please Help - Need ONE HINT - Trying to get
>Jason Sage wrote: > Hi all - and thanks to who ever can respond in advance. > > > > I have a Server Like App - I need the equivalent of sched_yield > >Tried sleep(0); yet ? > > > Micha Yes. Sleep has been added where appropriate. I didn't know to try Sleep ZERO. That sounds better than my Sleep(10). Thank You for that suggestion. I was trying to avoid sysutils sleep(0) in linux platform due to the size of sysutils. The fact I don't know how to make dynamic linking work on linux yet - (use shared libs versus static) makes my exe's bigger than I would like. In most of my applications, size isn't an issue - but in one in particular - it is everything. Using shared linking in linux, which I think is possible, would make for less overhead for the operating system to invoke each instance of this (ideally) small as possible application. This "small" app is fired often, simultaneously, and load/execute/terminate time is critical but needs to yield when its not busy. The YIELDING part works. Thank You. On this note, for size reasons, in win 32 I use the Win32 API call that does the same thing as sysutils sleep. This is what promprted my question - to call the operating system (in linux I guess its sched_yield) "sleep" directly. In another area around CPU yielding - and multithreading What I have learned since I wrote this question is that sleep (and sched_yield) is not an appropriate means to get different "threads" a timeslice, which was my impression. I THINK that sleep refers to releasing or yielding your entire application to other tasks the operating system is handling. Which means its use should be minimal, and strategic - like when you application true "should" release the CPU a bit... or is "truly" idle. You see I have been playing with TThread - and I noticed that the most currently launched thread is the one who stays running - and everything else in my app stops until it finishes. This leads me to believe I am responsible for managing what threads runs when - whether timeslices, "loop counters" inside the thread - (I ran four iterations - you can suspend me again) ... or some sort of mechanism. I believe TThread.Syncronize and possibly TThread Critical Section are going to be my next area of experimentation. Along this lines I have changed the entire "main loop" architecture of my bigger THREADING application - to work similar to how Lazarus makes its executables or how a windows program works in win32 - I've built a messaging system - that is a COMMON construct throughout all my classes, so that they can ALL communicate in a context-less way to the main program - allowing the main program to respond by suspending, resuming, terminating... etc any/all of the working threads as it deems correct. Thank You For Your Response Micha. Any and all help is always appreciated. Jason P Sage ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Please Help - Need ONE HINT - Trying to get
Am Samstag, den 16.09.2006, 09:54 -0400 schrieb Jason P Sage: > >Jason Sage wrote: > > Hi all - and thanks to who ever can respond in advance. > > > > > > > > I have a Server Like App - I need the equivalent of sched_yield > > > >Tried sleep(0); yet ? > > > > > > Micha > > Yes. Sleep has been added where appropriate. I didn't know to try Sleep > ZERO. That sounds better than my Sleep(10). Thank You for that suggestion. You're maybe looking for fpNanoSleep() on Linux. HTH, Marc ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] 204 Compiler
Am Donnerstag, den 14.09.2006, 19:25 +0200 schrieb Jonas Maebe: > On 14 Sep 2006, at 19:20, Marc Santhoff wrote: > > > Fpc 2.0.2 was used in the precompiled version packaged with a set of > > binutils. > > As the subject indicates, this is about FPC 2.0.4 If there is no crosscompiler involved, for me it does work: D:\Eigene Dateien>ver Windows 98 [Version 4.10.] D:\Eigene Dateien>fpc ptest Free Pascal Compiler version 2.0.4 [2006/08/21] for i386 Copyright (c) 1993-2006 by Florian Klaempfl Target OS: Win32 for i386 Compiling ptest.pas Compiling utest.pas Linking ptest.exe 24 Lines compiled, 0.9 sec D:\Eigene Dateien>ptest Test --- D:\Eigene Dateien>ver Microsoft Windows 2000 [Version 5.00.2195] D:\Eigene Dateien>del *.ppu D:\Eigene Dateien>fpc ptest Free Pascal Compiler version 2.0.4 [2006/08/21] for i386 Copyright (c) 1993-2006 by Florian Klaempfl Target OS: Win32 for i386 Compiling ptest.pas Compiling utest.pas Linking ptest.exe 24 Lines compiled, 0.1 sec D:\Eigene Dateien>ptest Test Note that I have the /bin directory in the path. HTH, Marc ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Please Help - Need ONE HINT - Trying to get
Jason P Sage wrote: > I was trying to avoid sysutils sleep(0) in linux platform due to the size of > sysutils. The fact I don't know how to make dynamic linking work on linux > yet - (use shared libs versus static) makes my exe's bigger than I would > like. In most of my applications, size isn't an issue - but in one in > particular - it is everything. Using shared linking in linux, which I think It's better to help us increase effectiveness of smart linking ;-). > timeslice, which was my impression. I THINK that sleep refers to releasing > or yielding your entire application to other tasks the operating system is > handling. Which means its use should be minimal, and strategic - like when > you application true "should" release the CPU a bit... or is "truly" idle. I think Sleep is per-thread, not sure though. Anyway, you should never need Sleep; instead you should use mutexes or similar techniques to sleep until you need to wake up for calculation or whatever. > You see I have been playing with TThread - and I noticed that the most > currently launched thread is the one who stays running - and everything else > in my app stops until it finishes. This leads me to believe I am responsible How did you arrive at this conclusion ? It should not be so, the OS will do the scheduling for you, all threads will get their timeslice. > or some sort of mechanism. I believe TThread.Syncronize and possibly TThread > Critical Section are going to be my next area of experimentation. Critical sections are a sort of mutex indeed, about which I was talking above. > Along this lines I have changed the entire "main loop" architecture of my > bigger THREADING application - to work similar to how Lazarus makes its > executables or how a windows program works in win32 - I've built a messaging > system - that is a COMMON construct throughout all my classes, so that they > can ALL communicate in a context-less way to the main program - allowing the > main program to respond by suspending, resuming, terminating... etc any/all > of the working threads as it deems correct. Sounds like a good architecture. Micha ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] fpdoc with UML output
Hi, I got a request from a developer in the tiOPF News Groups regarding fpDoc. I showed them some output of fpdoc against the tiOPF source code. One of the requests was that of including a UML diagram in the documentation of a unit. I thought that was an excellent idea. I can clearly see how many projects can benefit from such a feature. tiOPF for one, Lazarus's LCL and surely quite a few units in FPC. Is something like this possible? Does fpdoc collect enough information to generate such a image? How do you generate a image like that from code? The HTML output should be easy to modify to support a image in the Unit summary page, I would guess. Any thoughts on this? Regards, - Graeme - -- There's no place like 127.0.0.1 ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal