Re: [fpc-pascal] inline and other modifiers
2011/12/16 Jonas Maebe : > Inline is not a calling convention, nor does it affect the calling convention. You are right, its not a calling convention and declaring a different convention in the implementation indeed does not work. But I am still surprised that inline can be declared in either of the two sections ( I am not complaining, I am actually glad it works for my particular application). Is there any recommended style, is it bad practice to put it into the implementation? (I'm not totally sure whether I should conceptually regard inline as an implementation detail or as something that belongs into the interface section since it affects the generated code of other units) Bernd ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] inline and other modifiers
On 17 Dec 2011, at 11:29, Bernd wrote: > But I am still surprised that inline can be declared in either of the > two sections ( I am not complaining, I am actually glad it works for > my particular application). Is there any recommended style, is it bad > practice to put it into the implementation? Keeping the interface and implementation declarations the same is the best approach. Inline currently always changes the definition anyway (as far as the compiler is concerned) because the implementation becomes part of the definition once it's parsed. In the future, this may however change to prevent unexpected recompilations (http://bugs.freepascal.org/view.php?id=19673 ). Jonas___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] JSON Dataset in FCL-DB.
- Original Message - > From: Michael Van Canneyt > To: FPC-Pascal users discussions > Cc: Lazarus mailing list > Sent: Friday, December 16, 2011 5:52 PM > Subject: Re: [fpc-pascal] JSON Dataset in FCL-DB. > > > > On Fri, 16 Dec 2011, Leonardo M. Ramé wrote: > >>> What is missing currently is the delta to update data on the server, > but that >>> should be easily added. >>> >>> Michael. >> >> >> Thanks. >> >> Btw. I've found this dependency related error when I tried to compile. >> > > Fixed in revision 19858. > > Michael. Michael, could you apply this? Without it fpjsondataset unit is not found: Index: fpmake.pp === --- fpmake.pp (revision 19860) +++ fpmake.pp (working copy) @@ -37,6 +37,7 @@ P.SourcePath.Add('src/sqldb/examples'); P.SourcePath.Add('src/sqldb/oracle'); P.SourcePath.Add('src/sdf'); + P.SourcePath.Add('src/json'); P.SourcePath.Add('src/datadict'); P.SourcePath.Add('src/memds'); P.SourcePath.Add('src/codegen'); @@ -661,6 +662,9 @@ end; T.ResourceStrings := True; + // JSON + T:=P.Targets.AddUnit('fpjsondataset.pp'); + P.ExamplePath.Add('tests'); T:=P.Targets.AddExampleProgram('dbftoolsunit.pas'); T:=P.Targets.AddExampleProgram('dbtestframework.pas'); Leonardo M. Ramé http://leonardorame.blogspot.com ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] JSON Dataset in FCL-DB.
- Original Message - > From: Leonardo M. Ramé > To: FPC-Pascal users discussions > Cc: > Sent: Saturday, December 17, 2011 10:00 AM > Subject: Re: [fpc-pascal] JSON Dataset in FCL-DB. > > - Original Message - > >> From: Michael Van Canneyt >> To: FPC-Pascal users discussions >> Cc: Lazarus mailing list >> Sent: Friday, December 16, 2011 5:52 PM >> Subject: Re: [fpc-pascal] JSON Dataset in FCL-DB. >> >> >> >> On Fri, 16 Dec 2011, Leonardo M. Ramé wrote: >> What is missing currently is the delta to update data on the > server, >> but that should be easily added. Michael. >>> >>> >>> Thanks. >>> >>> Btw. I've found this dependency related error when I tried to > compile. >>> >> >> Fixed in revision 19858. >> >> Michael. > > > > Michael, could you apply this? Without it fpjsondataset unit is not found: > > Index: fpmake.pp > > === > --- fpmake.pp (revision 19860) > +++ fpmake.pp (working copy) > @@ -37,6 +37,7 @@ > P.SourcePath.Add('src/sqldb/examples'); > P.SourcePath.Add('src/sqldb/oracle'); > P.SourcePath.Add('src/sdf'); > + P.SourcePath.Add('src/json'); > P.SourcePath.Add('src/datadict'); > P.SourcePath.Add('src/memds'); > P.SourcePath.Add('src/codegen'); > @@ -661,6 +662,9 @@ > end; > T.ResourceStrings := True; > > + // JSON > + T:=P.Targets.AddUnit('fpjsondataset.pp'); > + > P.ExamplePath.Add('tests'); > T:=P.Targets.AddExampleProgram('dbftoolsunit.pas'); > T:=P.Targets.AddExampleProgram('dbtestframework.pas'); > > Also this on tests directory: Index: testjsondataset.pp === --- testjsondataset.pp (revision 19860) +++ testjsondataset.pp (working copy) @@ -3,9 +3,8 @@ {$mode objfpc}{$H+} uses - Classes, sysutils, DB, jsondataset, fpjson, jsonparser; + Classes, sysutils, DB, fpjsondataset, fpjson, jsonparser; -{$R *.res} Function ExtractData(Const AFileName : string) : TJSONObject; -- Leonardo M. Ramé http://leonardorame.blogspot.com ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] JSON Dataset in FCL-DB.
On Sat, 17 Dec 2011, Leonardo M. Ramé wrote: - Original Message - From: Michael Van Canneyt To: FPC-Pascal users discussions Cc: Lazarus mailing list Sent: Friday, December 16, 2011 5:52 PM Subject: Re: [fpc-pascal] JSON Dataset in FCL-DB. + P.ExamplePath.Add('tests'); T:=P.Targets.AddExampleProgram('dbftoolsunit.pas'); T:=P.Targets.AddExampleProgram('dbtestframework.pas'); Done, thank you. Committed in rev. 19862. Michael.___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] JSON Dataset in FCL-DB.
On Sat, 17 Dec 2011, Leonardo M. Ramé wrote: - Original Message - Also this on tests directory: Index: testjsondataset.pp === --- testjsondataset.pp (revision 19860) +++ testjsondataset.pp (working copy) @@ -3,9 +3,8 @@ {$mode objfpc}{$H+} Also done, thank you ! Rev. 19864. Michael.___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Testing applications with FPCUnit
The article is very good, but it does not focuse on all aspects. I have tried to create my first test example, but it didn't work. The compilation is successful and the program is executed without errors. However, I received no messages, informing the test has failed. Actually, the test should be failed. This example is seemingly equivalent the minimum example supplied by the article. As recommended, I only add the unit "test" in the clause "uses", so the test was expected to run. Does someone know what is wrong? First of all, a unit with a routine to be tested: unit numbers; {$mode objfpc}{$h+} interface uses Sysutils; function calculate(a, b: integer):integer; implementation function calculate(a, b: integer):integer; begin result := a + b; end; INITIALIZATION END. Now, my testcase class: unit test; {$mode objfpc}{$h+} interface numbers, fpcunit, testregistry; uses type TBugTest = class(TTestCase) published procedure calculate; end; implementation procedure TBugTest.calculate; begin AssertEquals('The calculation is not done', 8, numbers.calculate(5, 4)); end; INITIALIZATION RegisterTest(TBugTest); END. Now, the runer: program apptest; {$mode objfpc}{$h+} uses test; begin end. Em 16/12/2011 11:44, Michael Van Canneyt escreveu: On Fri, 16 Dec 2011, Vincent Snijders wrote: 2011/12/16 luciano de souza : Hello listers, Navigating in FPC source codes, I found fpcunit. It's really wonderful. With the tTestCase class, we can generate a report with the success or the failure of our tests. Is there documentation on the usage of fpcunit? What is the best way to study it? Google found this (old) article: http://www.freepascal.org/olddocs-html/fpcunit.pdf It is old, but still correct. I will see about refreshing it, and adding it in the FPC documentation. Michael. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal -- Luciano de Souza ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Testing applications with FPCUnit
You see no test results, because the program file of your test application is missing some essential things. If you are using lazarus, simply create a new testing application: First, make sure that package fpcunitide is installed. Then, in the 'File-New' dialog, your testproject should be of type 'FPCUNit console test application' or 'FPCUnit test application' This will install a test decorator which prints out the result. Then add your test unit to this application. If you run the console test application on the command-line, specify options '--format=plain' and '--all' The graphical application will show test results in a tree. Michael. On Sat, 17 Dec 2011, Luciano de Souza wrote: The article is very good, but it does not focuse on all aspects. I have tried to create my first test example, but it didn't work. The compilation is successful and the program is executed without errors. However, I received no messages, informing the test has failed. Actually, the test should be failed. This example is seemingly equivalent the minimum example supplied by the article. As recommended, I only add the unit "test" in the clause "uses", so the test was expected to run. Does someone know what is wrong? First of all, a unit with a routine to be tested: unit numbers; {$mode objfpc}{$h+} interface uses Sysutils; function calculate(a, b: integer):integer; implementation function calculate(a, b: integer):integer; begin result := a + b; end; INITIALIZATION END. Now, my testcase class: unit test; {$mode objfpc}{$h+} interface numbers, fpcunit, testregistry; uses type TBugTest = class(TTestCase) published procedure calculate; end; implementation procedure TBugTest.calculate; begin AssertEquals('The calculation is not done', 8, numbers.calculate(5, 4)); end; INITIALIZATION RegisterTest(TBugTest); END. Now, the runer: program apptest; {$mode objfpc}{$h+} uses test; begin end. Em 16/12/2011 11:44, Michael Van Canneyt escreveu: On Fri, 16 Dec 2011, Vincent Snijders wrote: 2011/12/16 luciano de souza : Hello listers, Navigating in FPC source codes, I found fpcunit. It's really wonderful. With the tTestCase class, we can generate a report with the success or the failure of our tests. Is there documentation on the usage of fpcunit? What is the best way to study it? Google found this (old) article: http://www.freepascal.org/olddocs-html/fpcunit.pdf It is old, but still correct. I will see about refreshing it, and adding it in the FPC documentation. Michael. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal -- Luciano de Souza ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Testing applications with FPCUnit
Michael, I have a meaningful peculiarity: I am blind and I use Freepascal only in the console interface, reading all the output by means of my screen reader. Lazarus and Freepascal console IDE are both inaccessible. But, fortunately, for me, it's easy to call the compiler passing parameters at the command line. I can compile using callings like: fpc test.pas fpc -XX test.pas fpc test.pas -Fu./pas -FE./exe I really thank Freepascal developers. The reachness of its command line allow me to access the features of the compiler. For these reasons, it's not possible to open Lazarus and compile the project using its interface. My screen reader has an awful response in this environment. After reading your message, I ask for a help. A friend told me fpcunit depends on FPCUnitConsole... Well, I don't remember exactly the name, but it's a Lazarus package. Observe I need to compile in the console. If it's possible to run the executable, but it's not possible to compile in the command line, I won't be able to use FPCUnit. You said that I need to use '--format=plain' '--all'. I tried: fpc apptest.pas --format=plain -all And also: fpc apptest apptest --format=plain -alll But, in both cases, I got no result. I don't know how to embody this parameters in my compilation tasks. So I ask you: Is it possible to use FPCUnit only in the command line, it means, compiling and executing in console? The idea of FPCUnit is really wonderful. I really would like to use it, but Lazarus dependences can complicate a lot. Em 17/12/2011 11:02, Michael Van Canneyt escreveu: You see no test results, because the program file of your test application is missing some essential things. If you are using lazarus, simply create a new testing application: First, make sure that package fpcunitide is installed. Then, in the 'File-New' dialog, your testproject should be of type 'FPCUNit console test application' or 'FPCUnit test application' This will install a test decorator which prints out the result. Then add your test unit to this application. If you run the console test application on the command-line, specify options '--format=plain' and '--all' The graphical application will show test results in a tree. Michael. On Sat, 17 Dec 2011, Luciano de Souza wrote: The article is very good, but it does not focuse on all aspects. I have tried to create my first test example, but it didn't work. The compilation is successful and the program is executed without errors. However, I received no messages, informing the test has failed. Actually, the test should be failed. This example is seemingly equivalent the minimum example supplied by the article. As recommended, I only add the unit "test" in the clause "uses", so the test was expected to run. Does someone know what is wrong? First of all, a unit with a routine to be tested: unit numbers; {$mode objfpc}{$h+} interface uses Sysutils; function calculate(a, b: integer):integer; implementation function calculate(a, b: integer):integer; begin result := a + b; end; INITIALIZATION END. Now, my testcase class: unit test; {$mode objfpc}{$h+} interface numbers, fpcunit, testregistry; uses type TBugTest = class(TTestCase) published procedure calculate; end; implementation procedure TBugTest.calculate; begin AssertEquals('The calculation is not done', 8, numbers.calculate(5, 4)); end; INITIALIZATION RegisterTest(TBugTest); END. Now, the runer: program apptest; {$mode objfpc}{$h+} uses test; begin end. Em 16/12/2011 11:44, Michael Van Canneyt escreveu: On Fri, 16 Dec 2011, Vincent Snijders wrote: 2011/12/16 luciano de souza : Hello listers, Navigating in FPC source codes, I found fpcunit. It's really wonderful. With the tTestCase class, we can generate a report with the success or the failure of our tests. Is there documentation on the usage of fpcunit? What is the best way to study it? Google found this (old) article: http://www.freepascal.org/olddocs-html/fpcunit.pdf It is old, but still correct. I will see about refreshing it, and adding it in the FPC documentation. Michael. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal -- Luciano de Souza ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal -- Luciano de Souza ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Testing applications with FPCUnit
On Sat, Dec 17, 2011 at 5:03 PM, Luciano de Souza wrote: > I can compile using callings like: > fpc test.pas > fpc -XX test.pas > fpc test.pas -Fu./pas -FE./exe You can compile Lazarus projects in the command line using lazbuild which comes with Lazarus, like this: lazbuild project.lpi It will build all required projects and otherwise do everything the IDE would do to build the project. The only catch might be if the package requires a package that your Lazarus doesn't know. I don't know which configuration file would need to be modified to tell Lazarus where a package is without opening the IDE. -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] Generics and Mac
I used generics in Lazarus code base for the first time, in TreeFilter component: TTreeNodeList = specialize TFPGList; and TBranchList = specialize TFPGObjectList; I works for me on Windows and Linux, with FPC 2.4.4 and 2.6.0 RC1. Now Zeljan reported it does not compile on Mac OSX 64-bit, using FPC 2.6.0 RC1. What can cause it? My generics usage is the most basic possible. Both TTreeNode and TBranch are simple classes. Juha ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] Re: Generics and Mac
2011/12/17 Juha Manninen > I used generics in Lazarus code base for the first time, in TreeFilter > component: > > TTreeNodeList = specialize TFPGList; > and > TBranchList = specialize TFPGObjectList; > > I works for me on Windows and Linux, with FPC 2.4.4 and 2.6.0 RC1. > Now Zeljan reported it does not compile on Mac OSX 64-bit, using FPC 2.6.0 > RC1. > What can cause it? My generics usage is the most basic possible. > Both TTreeNode and TBranch are simple classes. > "Fatal: Syntax error, ">" expected but "CLASS" found" Works on 64-bit Linux. How can OSX affect generics syntax? Juha ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Re: Generics and Mac
On 17 Dec 2011, at 18:22, Juha Manninen wrote: > "Fatal: Syntax error, ">" expected but "CLASS" found" > > Works on 64-bit Linux. > How can OSX affect generics syntax? There are no Mac OS X-specific failures of generics tests in the testsuite (64 bit or otherwise, Intel or PowerPC). There are no bug reports about it either. This is unlikely to have anything to do with Mac OS X, and most likely related to an installation/configuration problem. Jonas___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Re: Generics and Mac
2011/12/17 Jonas Maebe > > On 17 Dec 2011, at 18:22, Juha Manninen wrote: > > > "Fatal: Syntax error, ">" expected but "CLASS" found" > > > > Works on 64-bit Linux. > > How can OSX affect generics syntax? > > There are no Mac OS X-specific failures of generics tests in the testsuite > (64 bit or otherwise, Intel or PowerPC). There are no bug reports about it > either. This is unlikely to have anything to do with Mac OS X, and most > likely related to an installation/configuration problem. > Thanks. Zeljan was in a hurry but he promised to make some basic tests with generics tomorrow. The strange thing is that everything except generics worked for him. How can a config problem affect only generics but nothing else? We will find out... Juha ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Testing applications with FPCUnit
On Sat, 17 Dec 2011 17:47:49 +0100 Felipe Monteiro de Carvalho wrote: > On Sat, Dec 17, 2011 at 5:03 PM, Luciano de Souza wrote: > > I can compile using callings like: > > fpc test.pas > > fpc -XX test.pas > > fpc test.pas -Fu./pas -FE./exe > > You can compile Lazarus projects in the command line using lazbuild > which comes with Lazarus, like this: > > lazbuild project.lpi > > It will build all required projects and otherwise do everything the > IDE would do to build the project. The only catch might be if the > package requires a package that your Lazarus doesn't know. I don't > know which configuration file would need to be modified to tell > Lazarus where a package is without opening the IDE. lazbuild path/packagename.lpk Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Testing applications with FPCUnit
You would believe if I told you I could not compile yet? It's not lack of effort, believe me. I really can't understand what is failing. See my compilation script: @echo off set compilerpath="c:\lazarus\fpc\2.4.4\bin\i386-win32\fpc.exe" set unitpath="-Fuc:\lazarus\fpc\units\i386-win32\* -Fuc:\lazarus\units\i386-win32\* -Fuc:\lazarus\lcl\units\i386-win32\*" set debugerpath = ""c:\lazarus\mingw\bin\gdb.exe" Set NormalParam="-XX" set DebugParam="-g" if "%1"=="" goto end else goto start :start if "%1"=="-n" goto normalmode if "%1"=="-d" goto debugmode if %1=="-g" goto debuger goto end :normalmode %compilerpath% %2 %NormalParam% %unitpath% goto end :debugmode %compilerpath% %2 %DebugParam% %unitpath% goto end :debuger gdb %1 goto end :end When I do: "make -n {filename}", I got an error. "fileutil is not found". But "fileutil" is in c:\lazarus\lcl\units\i386-win32" and this path is already added. Actually, I added this path in fpc.cfg. Lazbuild seems to simplify compilation using Lazarus. But as a parameter, it receives a LPI file. However, lpi files are created in Lazarus interface. The lack of accessibility of Lazarus is so big that even this task I could not do at Lazarus interface. If LPI files are really necessary, I must create then manually. Em 17/12/2011 16:11, Mattias Gaertner escreveu: On Sat, 17 Dec 2011 17:47:49 +0100 Felipe Monteiro de Carvalho wrote: On Sat, Dec 17, 2011 at 5:03 PM, Luciano de Souza wrote: I can compile using callings like: fpc test.pas fpc -XX test.pas fpc test.pas -Fu./pas -FE./exe You can compile Lazarus projects in the command line using lazbuild which comes with Lazarus, like this: lazbuild project.lpi It will build all required projects and otherwise do everything the IDE would do to build the project. The only catch might be if the package requires a package that your Lazarus doesn't know. I don't know which configuration file would need to be modified to tell Lazarus where a package is without opening the IDE. lazbuild path/packagename.lpk Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal -- Luciano de Souza ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] alias a function + overload 'in'
two little questions 1. Is it possible to make an alias to a function ... so rather than just re-calling with the same parameters, it's actually the same thing? like the way we can do, e.g., type natural = cardinal, or const GG = 6, but with a function? 2. is it possible to overload the 'in' operator, so that it may work (using supplied code) on things that are not a pascal set? Thanks! ~David. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal