[fpc-pascal] Using Graph unit on Linux Ubuntu...
On windows I was trying the graph unit with the old BGIDemo of Borland Pascal. It worked nicely, after some adaptations (fpc 2.0.2). Now I'd like to compile the same on Linux Ubuntu, but have lot of problems with a link error on the following instructions. { Link with VGA, gl and c libraries } {$linklib vga} {$linklib c} I am not a linux expert, so after installing the library libsvga (the only like libvga I found on the ubuntu repository) I don't understand what the linker wants and I'm giving up. Some hints would be appreciated, thanks tiziano ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Re: Threads executing in sequence instead of parallel
On 29/09/06, Vincent Snijders [EMAIL PROTECTED] wrote: I thought in your initial mail your were talking about having a console test app with threads. Synchronize is harder then, because you have to call CheckSynchronize yourself. Vincent. Below is a text (console) thread demo. The one thread counts from 0 to 1k and the other thread counts down from 1k to 0. Again, under Linux, one thread executes and teminates, then the next thread executes and terminates. Under windows, both threads run at the same time (output is mixed as expected). No sychronize() is used in this demo. See attached screenshots for my output. Regards, - Graeme - --- program demo1; {$mode objfpc}{$H+} uses {$IFDEF UNIX}{$IFDEF UseCThreads} cthreads, {$ENDIF}{$ENDIF} Classes, SysUtils; type // counts up till 1k TIncrementer = class(TThread) protected procedure Execute; override; end; // counts down from 1k TDecrementer = class(TThread) protected procedure Execute; override; end; TRunThreads = class(TObject) procedure ThreadTerminated(Sender: TObject); private t1, t2: TThread; FThreadCount: integer; public constructor Create; procedure RunNow; end; { TRunThreads } procedure TRunThreads.ThreadTerminated(Sender: TObject); begin Dec(FThreadCount); end; constructor TRunThreads.Create; begin FThreadCount := 2; t1 := TIncrementer.Create(True); t1.OnTerminate := @ThreadTerminated; t1.Priority := tpLower; t1.FreeOnTerminate := True; t2 := TDecrementer.Create(True); t2.OnTerminate := @ThreadTerminated; t2.Priority := tpLower; t2.FreeOnTerminate := True; end; procedure TRunThreads.RunNow; begin writeln('RunNow'); t1.Resume; t2.Resume; repeat sleep(100); until FThreadCount = 0; WriteLn('All threads completed!'); end; { TIncrementer } procedure TIncrementer.Execute; var i: integer; begin for i := 0 to 1000 do Writeln(Classname + ': ' + IntToStr(i)); Terminate; end; { TDecrementer } procedure TDecrementer.Execute; var i: integer; begin for i := 1000 downto 0 do Writeln(Classname + ': ' + IntToStr(i)); Terminate; end; var lRunThreads: TRunThreads; begin lRunThreads := TRunThreads.Create; lRunThreads.RunNow; writeln('Done...'); end. --- -- There's no place like 127.0.0.1 linux_demo1.png Description: PNG image vmware_win32_demo1.png Description: PNG image ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] presenting fpunit test results
Graeme Geldenhuys schreef: Hi Vincent, Attached is my latest efforts on fpcUnit Test Reports using XSLT. Before, I sent you two versions of the .xsl file. One created a report based on CSS only and the other one based on HTML Tables only. I tested both against my results (around 900 tests) and the CSS version was dog slow!! I then created from scratch a .xsl file generating HTML Tables (small ones) and uses a small CSS file to format (colors, fonts, etc) the generated HTML. The speed is *much* better. Attached is a archive containing the CSS, XSL and sample results files. I also included a small script file (fixup_xml.sh) which inserts a single line into the xml results file, to specify the xslt stylesheet to use. I like the result: http://www.hu.freepascal.org/lazarus/testresults/results.xml The reason for the script file, is because I didn't what to modify fpcUnit to insert that line automaticaly, as I like to generate different formatted results from the original xml file and need to insert different XSLT stylesheets for that. For example, I generate two different outputs from the same results.xml file. One for HTML results going to my web server and the other, a plain text email, which gets emailed to a newsgroup showing only the summary of the results. The console testrunner, that I use, will insert the stylesheet information. This version is much better than the ones I sent you before. A few things are still missing though, but that is due to the data being missing in the xml results. * The test listings need to be grouped by test suites which will allow for a better summaries to be generated. This would be my first feature request. * More attributes need to be added to the test listings to give information like: Did the test pass, fail or give a error. This will allow me to link the summary test listing to the detailed results using the HTML version of the XSLT. * Ignored/Skipped tests still need support - My version of fpcUnit has not been patched yet. Enjoy, and please give me some feedback. Good or bad! Looking forward to further improvements. Vincent ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] presenting fpunit test results
On 02/10/06, Vincent Snijders [EMAIL PROTECTED] wrote: I like the result: http://www.hu.freepascal.org/lazarus/testresults/results.xml I couldn't view it. Got an error that the results.xsl file couldn't be found. Note: I renamed the results.xsl file to fpcunit.xsl, so you will have to update your 2nd line in the results.xml file to point to the right xsl file. Damn, that sounds confusing! :-) The console testrunner, that I use, will insert the stylesheet information. I didn't want to amend mine, for in case I accidentally send it in a patch. Also I needed two result output formats. * The test listings need to be grouped by test suites which will allow for a better summaries to be generated. This would be my first feature request. Mine too. Coming up shortly... Regards, - Graeme - ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] presenting fpunit test results
Graeme Geldenhuys schreef: On 02/10/06, Vincent Snijders [EMAIL PROTECTED] wrote: I like the result: http://www.hu.freepascal.org/lazarus/testresults/results.xml I couldn't view it. Got an error that the results.xsl file couldn't be found. Note: I renamed the results.xsl file to fpcunit.xsl, so you will have to update your 2nd line in the results.xml file to point to the right xsl file. Damn, that sounds confusing! :-) I already did that and tested that. Maybe the browser is showing you an old version? The console testrunner, that I use, will insert the stylesheet information. I didn't want to amend mine, for in case I accidentally send it in a patch. Also I needed two result output formats. Make it a command line parameter. * The test listings need to be grouped by test suites which will allow for a better summaries to be generated. This would be my first feature request. Mine too. Coming up shortly... Great. Vincent ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] presenting fpunit test results
On 02/10/06, Vincent Snijders [EMAIL PROTECTED] wrote: I already did that and tested that. Maybe the browser is showing you an old version? Ah yes, it view my browser cache. Refresh fixed it. :-) The console testrunner, that I use, will insert the stylesheet information. I didn't want to amend mine, for in case I accidentally send it in a patch. Also I needed two result output formats. Make it a command line parameter. Nope I didn't want to, because then I need to re-run all my tests again, just to get another output format. Well, I guess I could add and just not use it. That way I could still insert my own stylesheets on a single test run. Oh, here is my results for tiOPF2. I haven't enabled all tests yet. Those are only half of them. See the reason why I want to fix the Test Listing nodes. Also notice that my summary is Red, not Green, due to the Error count 0. http://opensoft.homeip.net/tiopf/fpcunit/results.xml Graeme. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] arm cpu with freepascal
Hello, I have tested a simple hello world with the arm compiler On the main linux (fedora), no problem to execute it (using qemu-arm) but on the target (gumstix with strongarm) i got a Illegal instruction I have tested with uclibc and glibc. I miss something ? Thanks ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Re: Threads executing in sequence instead of parallel
On Friday 29 September 2006 04:57, Graeme Geldenhuys wrote: Below is a text (console) thread demo. The one thread counts from 0 to 1k and the other thread counts down from 1k to 0. Again, under Linux, one thread executes and teminates, then the next thread executes and terminates. Greetings, Graeme. I think I see the problem. On today's fast machines, a count of 1000 just isn't enough processing for a meaningful test, at least not under Linux. I really don't know much about Windows, but my conjecture is that perhaps under that system the function calls to write the output cause the other thread to receive processing time. The following modified version of your program shows that threads work under Linux. The execute loops have been modified to continually count up/down (as appropriate) until terminated. The RunNow procedure was modified to let the threads run for three seconds before terminating them itself, and the FThreadCount thing was taken out (along with the OnTerminate handlers). To properly see the output, you should redirect it to a file, unless you really have a LOT of scrollback buffer set up. :-) On my Athlon XP 2200 I get a file 35.5 megabytes in size! ~/tmp $./demo1 demo1.txt ~/tmp $ls -l demo1.txt -rw-r--r-- 1 pcervasio users 39566886 2006-10-02 12:31 demo1.txt After looking at the contents of demo1.txt, I can see that the increment thread actually got to its eleventh count up before the decrement thread got its first share of time. This should help explain why in your original program it appeared that one thread was executing to completion before the other... it WAS, but only because there wasn't enough to do. The above was done using version 2.04 of the compiler on a Slackware 10.1 machine with a 2.4.32 kernel. I appear to get similar results on my 2.6.17.6 box after copying the executable over (running an Athlon 2600). The decrementor first shows up after incrementor loop 15. The redirected output file is 53 megabytes, though... much bigger than I expected from the machine speed difference alone. I hope this is helpful. Best regards, Pete C. --- program demo1a; {$mode objfpc}{$H+} uses {$IFDEF UNIX} {$IFDEF UseCThreads} cthreads, {$ENDIF} {$ENDIF} Classes, SysUtils; type // counts up till 1k until terminated TIncrementer = class(TThread) protected procedure Execute; override; end; // counts down from 1k until terminated TDecrementer = class(TThread) protected procedure Execute; override; end; TRunThreads = class(TObject) private t1, t2: TThread; public constructor Create; procedure RunNow; end; { TRunThreads } constructor TRunThreads.Create; begin t1 := TIncrementer.Create(True); t1.Priority := tpLower; t1.FreeOnTerminate := True; t2 := TDecrementer.Create(True); t2.Priority := tpLower; t2.FreeOnTerminate := True; end; procedure TRunThreads.RunNow; var donetime: TDateTime; begin { run for 3 seconds } donetime := now + encodetime(0, 0, 3, 0); writeln('RunNow'); t1.Resume; t2.Resume; repeat sleep (100); until now donetime; t1.terminate; t2.terminate; sleep (10); { give threads a chance to end } WriteLn('All threads completed!'); end; { TIncrementer } procedure TIncrementer.Execute; var i, j: integer; begin j := 0; while not terminated do begin writeln (ClassName, ': --- Loop ', j); for i := 0 to 1000 do begin if terminated then break; Writeln(Classname, ': ', i); end; end; end; { TDecrementer } procedure TDecrementer.Execute; var i, j: integer; begin j := 0; while not terminated do begin writeln (ClassName, ': --- Loop ', j); for i := 1000 downto 0 do begin if terminated then break; Writeln(Classname, ': ', i); end; end; end; var lRunThreads: TRunThreads; begin lRunThreads := TRunThreads.Create; lRunThreads.RunNow; writeln('Done...'); end. --- ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] XPath Problem?
Hello, I am trying to use the xpath unit... I am getting an An unhandled exception occurred at $000E4268 : EAccessViolation : Access violation $000E4268 Via gdb, I can see the place it's happening is xpath.pp:2470. Here is my simple test program: program xpathtest; uses dom, xpath; var doc : TXMLDocument; root : TDOMElement; TP : TXPathVariable; begin doc := TXMLDocument.Create; root := doc.CreateElement('abc'); root.SetAttribute('id', '10'); doc.AppendChild(root); TP := EvaluateXPathExpression('/abc/@id', doc); WriteLn(TP.AsText); doc.Destroy; end. -- Can anyone offer advise on how to make this work? Thank you, Jeremy ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal