Re: [fpc-pascal] Compilation progress

2012-04-26 Thread waldo kitty

On 4/26/2012 15:06, Jonas Maebe wrote:


On 26 Apr 2012, at 17:31, OBones wrote:


Is there a way get progress information output by the compiler while building a 
project?
I tried the -vt option, but I can't figure out a way to parse this and get 
something like current value and max while the lines are output.
I also tried to look in the lazarus sources but could not figure out how they 
do it either.


-vl shows progress every 100 lines. The compiler only knows the total number of 
lines once it reaches the end of the source file, so it does not print the 
total until it is finished.


is this why there is a blank line every X lines when logging via redirection? 
i've seen it but not hunted it down as to why ;)

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Compilation progress

2012-04-26 Thread Jonas Maebe

On 26 Apr 2012, at 17:31, OBones wrote:

> Is there a way get progress information output by the compiler while building 
> a project?
> I tried the -vt option, but I can't figure out a way to parse this and get 
> something like current value and max while the lines are output.
> I also tried to look in the lazarus sources but could not figure out how they 
> do it either.

-vl shows progress every 100 lines. The compiler only knows the total number of 
lines once it reaches the end of the source file, so it does not print the 
total until it is finished.


Jonas___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Compilation progress

2012-04-26 Thread Sven Barth

On 26.04.2012 17:31, OBones wrote:

Hello,

Is there a way get progress information output by the compiler while
building a project?
I tried the -vt option, but I can't figure out a way to parse this and
get something like current value and max while the lines are output.
I also tried to look in the lazarus sources but could not figure out how
they do it either.

Any help would be very much appreciated.


FPC does not print continous line information. Only at the end if either 
in the fpc.cfg or the command line -vi is given it shows a line similar 
to the following one:


35 lines compiled, 1.4 sec

Regards,
Sven
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] Compilation progress

2012-04-26 Thread OBones

Hello,

Is there a way get progress information output by the compiler while 
building a project?
I tried the -vt option, but I can't figure out a way to parse this and 
get something like current value and max while the lines are output.
I also tried to look in the lazarus sources but could not figure out how 
they do it either.


Any help would be very much appreciated.

Regards
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Compiling from and to memory

2012-04-26 Thread OBones

Jonas Maebe wrote:


OBones wrote on Mon, 23 Apr 2012:

And because I have to split my generated files so that FPC does not 
hit the 2GB memory limit (which it does for a 15M source file)


What is the structure of that source code? (a few giant routines, 
large constant arrays, ... ?)
Thousands of small routines. Splitting them across multiple units allows 
to compile, with the "write to disk" issue.

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Compiling from and to memory

2012-04-26 Thread Jonas Maebe


OBones wrote on Mon, 23 Apr 2012:

And because I have to split my generated files so that FPC does not  
hit the 2GB memory limit (which it does for a 15M source file)


What is the structure of that source code? (a few giant routines,  
large constant arrays, ... ?)



Jonas
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Re: Can it map class type as key?

2012-04-26 Thread ZHANG Dao-yuan

Yes, I didn't clearly understand the generic mechanism in fpc/tfpgmap.
I've read, `A class can be seen as a pointer to an object, or a pointer to a 
record, with methods associated with it.' in fpc reference.pdf, chapter 6 - 
Classes. Hence I think fpc takes object as pointer when specialize tfpgmap 
template.

Now I catch your idea. The specialization of tfpgmap is similar to std::map in C++ 
(must define a (bool operator<(ref to another obj)const) function for the KEY 
class).
I'll read the source code of unit fgl to deepen understanding.

Thank you very much.

On 04/26/2012 06:25 PM, JC Chu wrote:

I’m not quite getting what you’re trying to say…  Free Pascal and Delphi
do have distinct syntaxes for generic type definition and
specialization.  You may want to consult respective documentations to
clarify your understanding of the code.

   ◦ Delphi ―
  
   ◦ Free Pascal ―
  

Hope it helps.

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Re: Can it map class type as key?

2012-04-26 Thread Honza
2012/4/26 ZHANG Dao-yuan <1123mon...@gmail.com>:
> Thanks for your makeshift :) . But the problem still confusing me. My code
> is in type-section and it's a declaration not a statement.
>
>> tFpGMap
> The form of the code is similar to a comparision expression and `<' here
> looks like a less-than operator. But they are not. In my opinion, fpc should
> not take the declaration as a statement then try to search for the nonsense
> operator-overloaded methods.

You might want to have a look at
http://code.google.com/p/fprb/wiki/TheCmpBTreeMap

-jan
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Can it map class type as key?

2012-04-26 Thread Sven Barth
Am 26.04.2012 10:45 schrieb "ZHANG Dao-yuan" <1123mon...@gmail.com>:
>>
>> program moi;
>> {$mode objfpc}
>>uses fgl;
>>type
>>tSI= specialize tFpGMap;
>>// tIS= specialize tFpGMap;
>> begin
>> end.
>
>
> Hi,
> I'm trying to use template in fpc 2.6.0. I can map class type as value as
above code can be compiled. But if I uncomment the declaration of tIS --
map class type as key, fpc fail to compile and print out these error msgs:
>
> Error: Operator is not overloaded: "TObject" < "TObject"
> Error: Operator is not overloaded: "TObject" > "TObject"
> t.pas(10) Fatal: There were 2 errors compiling module, stopping
> Fatal: Compilation aborted
> Error: /usr/bin/ppcx64 returned an error exitcode (normal if you did not
specify a source file to be compiled)
>
> Any way to resolve it?

This has nothing to do with < and > in the declaration.
TFPGMap uses < and > comparisons for key comparisons, so these operators
need to be overloaded. You can't use global operators here, because of
scope problems, so you need to use either a different type or wrap them in
a record with operators.

Regards,
Sven
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Re: Can it map class type as key?

2012-04-26 Thread JC Chu
I’m not quite getting what you’re trying to say…  Free Pascal and Delphi
do have distinct syntaxes for generic type definition and
specialization.  You may want to consult respective documentations to
clarify your understanding of the code.

  ◦ Delphi ―
 
  ◦ Free Pascal ―
 

Hope it helps.

On April 26, at 18:00, ZHANG Dao-yuan wrote:

>> tFpGMap The form of the code is similar to a comparision expression and `<' here
> looks like a less-than operator. But they are not. In my opinion, fpc
> should not take the declaration as a statement then try to search for
> the nonsense operator-overloaded methods.

-- 
Best Regards,
JC Chu
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Testing existence of a file at compilation time

2012-04-26 Thread Sven Barth
Am 26.04.2012 11:21 schrieb "Mark Morgan Lloyd" <
markmll.fpc-pas...@telemetry.co.uk>:
>
> Is it possible to test for the existence of a file, directory or package
at compilation time, i.e. {$if exists() or similar?
>
> The specific scenario I'm looking at is where I want to publish a couple
of projects on Berlios, and the functionality will differ depending on
whether a particular (Lazarus) package is available: as an example,
character-by-character (not syntax-defined) colouring which I don't think I
can do in any standard text-output controls. If at compilation time it was
possible to detect that a package was available, it would then be possible
to enable the code that at runtime created a graphical component from that
package without any intervention on the part of the user building the app.

That's currently not possible.

> I've just checked the 2.6.0 manuals: where are things like {$if
declared() defined?

It's in the Programmer's manual:
http://www.freepascal.org/docs-html/prog/progsu112.html#x124-1250002.4.1

Regards,
Sven
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Re: Can it map class type as key?

2012-04-26 Thread ZHANG Dao-yuan

Thanks for your makeshift :) . But the problem still confusing me. My code is 
in type-section and it's a declaration not a statement.


tFpGMap
The form of the code is similar to a comparision expression and `<' here looks 
like a less-than operator. But they are not. In my opinion, fpc should not take 
the declaration as a statement then try to search for the nonsense 
operator-overloaded methods.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] Re: RE : SQLDB: logging all generated SQL?

2012-04-26 Thread Reinier Olislagers
On 26-4-2012 11:27, Ludo Brands wrote:
>>> I vaguely remember somebody mentioning SQLDB has the option 
>> of dumping 
>>> to a log all the SQL it sends to the database (in other 
>> words: logging 
>>> all SQL sent to the database).
>>>
>>> Can somebody tell me if that functionality is there and 
>> where to find 
>>> it? Perhaps something to do with TSQLConnection.LogEvents?
>>
>> That's the one.
> Just to be clear. The logging happens at the level of TSQLQuery and
> TSQLTransaction and will record events such as prepare, execute, commit,
> rollback, etc. SQL strings are as known at that layer (ie parameters are not
> expanded). Database layers that use data binding will never expand
> parameters and use a proprietary protocol to send the data to the database. 

Thanks, guess you must have read my forum post as well ;)

It makes sense parameters are not expanded; I'll just have to see what
the logging contains.

Thanks,
Reinier
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


RE : [fpc-pascal] SQLDB: logging all generated SQL?

2012-04-26 Thread Ludo Brands
> > I vaguely remember somebody mentioning SQLDB has the option 
> of dumping 
> > to a log all the SQL it sends to the database (in other 
> words: logging 
> > all SQL sent to the database).
> >
> > Can somebody tell me if that functionality is there and 
> where to find 
> > it? Perhaps something to do with TSQLConnection.LogEvents?
> 
> That's the one.
> 

Just to be clear. The logging happens at the level of TSQLQuery and
TSQLTransaction and will record events such as prepare, execute, commit,
rollback, etc. SQL strings are as known at that layer (ie parameters are not
expanded). Database layers that use data binding will never expand
parameters and use a proprietary protocol to send the data to the database. 

Ludo 

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Re: Can it map class type as key?

2012-04-26 Thread JC Chu
Notice the {$MODE DELPHI} directive.

On Thu, Apr 26, 2012 at 17:24, Lukasz Sokol  wrote:
> On 26/04/2012 10:14, JC Chu wrote:
>> It fails because the operators < and > are not defined for TObject,
>> which is assumed by TFPGMap.KeyCompare().
>>
>> As a makeshift you can implement a record type to wrap TObject and
>> define these operators for it.  See the attached file for an
>> example.
>>
>> Hope it helps.
>>
>
> The OP asks for generics usage, not for the operator overload (notice the 
> 'specialize' keyword).
>
> L.
>
> ___
> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal



-- 
Best Regards,
JC Chu
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] Re: Can it map class type as key?

2012-04-26 Thread Lukasz Sokol
On 26/04/2012 10:14, JC Chu wrote:
> It fails because the operators < and > are not defined for TObject, 
> which is assumed by TFPGMap.KeyCompare().
> 
> As a makeshift you can implement a record type to wrap TObject and 
> define these operators for it.  See the attached file for an
> example.
> 
> Hope it helps.
> 

The OP asks for generics usage, not for the operator overload (notice the 
'specialize' keyword).

L.

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] Testing existence of a file at compilation time

2012-04-26 Thread Mark Morgan Lloyd
Is it possible to test for the existence of a file, directory or package 
at compilation time, i.e. {$if exists() or similar?


The specific scenario I'm looking at is where I want to publish a couple 
of projects on Berlios, and the functionality will differ depending on 
whether a particular (Lazarus) package is available: as an example, 
character-by-character (not syntax-defined) colouring which I don't 
think I can do in any standard text-output controls. If at compilation 
time it was possible to detect that a package was available, it would 
then be possible to enable the code that at runtime created a graphical 
component from that package without any intervention on the part of the 
user building the app.


I've just checked the 2.6.0 manuals: where are things like {$if 
declared() defined?


I note that the FPC documentation pointed to at 
http://wiki.lazarus.freepascal.org/Lazarus_Documentation#Free_Pascal_Compiler_Documentation 
is still 2.2.


--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] Re: SQLDB: logging all generated SQL?

2012-04-26 Thread Reinier Olislagers
On 26-4-2012 10:58, LacaK wrote:
>> Can somebody tell me if that functionality is there and where to find
>> it? Perhaps something to do with TSQLConnection.LogEvents?
>>
>>   
> Look into sqldb.pp at TSQLConnection property OnLog or at global
> variable GlobalDBLogHook.
> You can register procedure, which will receive log events and you can
> handle them as you want (write to form or into file) ...
> Look at sources ... ;-)

Thanks guys, doing exactly that right now (looking at sources) ;)...

I'll update my pasql command line interpreter and update the wiki...

Regards,
Reinier
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Can it map class type as key?

2012-04-26 Thread JC Chu
It fails because the operators < and > are not defined for TObject,
which is assumed by TFPGMap.KeyCompare().

As a makeshift you can implement a record type to wrap TObject and
define these operators for it.  See the attached file for an example.

Hope it helps.


On April 26, at 16:45, ZHANG Dao-yuan wrote:

>> program moi;
>> {$mode objfpc}
>> uses fgl;
>> type
>> tSI= specialize tFpGMap;
>> // tIS= specialize tFpGMap;
>> begin
>> end.
> 
> Hi,
> I'm trying to use template in fpc 2.6.0. I can map class type as value
> as above code can be compiled. But if I uncomment the declaration of tIS
> -- map class type as key, fpc fail to compile and print out these error
> msgs:
> 
> Error: Operator is not overloaded: "TObject" < "TObject"
> Error: Operator is not overloaded: "TObject" > "TObject"
> t.pas(10) Fatal: There were 2 errors compiling module, stopping
> Fatal: Compilation aborted
> Error: /usr/bin/ppcx64 returned an error exitcode (normal if you did not
> specify a source file to be compiled)
> 
> Any way to resolve it?
> ___
> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal

-- 
Best Regards,
JC Chu
{$MODE DELPHI}

uses Fgl;

type
  TObjectRec = record
Value: TObject;
class operator LessThan(lhs, rhs: TObjectRec): Boolean;
class operator GreaterThan(lhs, rhs: TObjectRec): Boolean;
class operator Implicit(obj: TObject): TObjectRec;
class operator Implicit(rec: TObjectRec): TObject;
  end;

  TTest = TFPGMap;

class operator TObjectRec.LessThan(lhs, rhs: TObjectRec): Boolean;
begin
  Exit(NativeInt(lhs) < NativeInt(rhs));
end;

class operator TObjectRec.GreaterThan(lhs, rhs: TObjectRec): Boolean;
begin
  Exit(NativeInt(lhs) > NativeInt(rhs));
end;

class operator TObjectRec.Implicit(obj: TObject): TObjectRec;
begin
  Result.Value := obj;
end;

class operator TObjectRec.Implicit(rec: TObjectRec): TObject;
begin
  Exit(rec.Value);
end;

begin
end.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] SQLDB: logging all generated SQL?

2012-04-26 Thread LacaK




Can somebody tell me if that functionality is there and where to find
it? Perhaps something to do with TSQLConnection.LogEvents?

  
Look into sqldb.pp at TSQLConnection property OnLog or at global 
variable GlobalDBLogHook.
You can register procedure, which will receive log events and you can 
handle them as you want (write to form or into file) ...

Look at sources ... ;-)
L.

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] Can it map class type as key?

2012-04-26 Thread ZHANG Dao-yuan

program moi;
{$mode objfpc}
uses fgl;
type
tSI= specialize tFpGMap;
// tIS= specialize tFpGMap;
begin
end.


Hi,
I'm trying to use template in fpc 2.6.0. I can map class type as value as above 
code can be compiled. But if I uncomment the declaration of tIS -- map class 
type as key, fpc fail to compile and print out these error msgs:

Error: Operator is not overloaded: "TObject" < "TObject"
Error: Operator is not overloaded: "TObject" > "TObject"
t.pas(10) Fatal: There were 2 errors compiling module, stopping
Fatal: Compilation aborted
Error: /usr/bin/ppcx64 returned an error exitcode (normal if you did not 
specify a source file to be compiled)

Any way to resolve it?
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] SQLDB: logging all generated SQL?

2012-04-26 Thread michael . vancanneyt



On Thu, 26 Apr 2012, Reinier Olislagers wrote:


Good morning list,

I vaguely remember somebody mentioning SQLDB has the option of dumping
to a log all the SQL it sends to the database (in other words: logging
all SQL sent to the database).

Can somebody tell me if that functionality is there and where to find
it? Perhaps something to do with TSQLConnection.LogEvents?


That's the one.

Michael.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] SQLDB: logging all generated SQL?

2012-04-26 Thread Reinier Olislagers
Good morning list,

I vaguely remember somebody mentioning SQLDB has the option of dumping
to a log all the SQL it sends to the database (in other words: logging
all SQL sent to the database).

Can somebody tell me if that functionality is there and where to find
it? Perhaps something to do with TSQLConnection.LogEvents?

Thanks,
Reinier
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal