Re: [fpc-pascal] Lazarus with FPC 2.3.1 i386 Mac OSX

2008-02-06 Thread Wanderlan Santos dos Anjos
Use the compiler command line option -CPPACKSET=1 or source directive
{$PACKSET 1} for Delphi compatibility in Set sizes. This works in 2.3.1 and
2.2.0.
I use too {$Z1} or {$PACKENUM 1} for Delphi compatibility in enumerated
sizes. Curiously, and sadly, these options are not automatically attributed
in Delphi mode.

-- 
Att,

Wanderlan Santos dos Anjos
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Lazarus with FPC 2.3.1 i386 Mac OSX

2008-02-06 Thread Jonas Maebe


On 05 Feb 2008, at 13:45, Wanderlan Santos dos Anjos wrote:


Use the compiler command line option -CPPACKSET=1 or source directive
{$PACKSET 1} for Delphi compatibility in Set sizes. This works in  
2.3.1 and

2.2.0.


It contains several bugs in 2.2.0 though and it's not advisable to  
use it there.



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


Re: [fpc-pascal] EControlC exception

2008-02-06 Thread Jonas Maebe


On 06 Feb 2008, at 11:27, Michael Van Canneyt wrote:



You can catch this signal using a signal handler:

PROGRAM ExControlC;
(* How to capture [Ctrl+C] in Object Pascal.  *)

{$mode objfpc}{$H+}

USES
  SysUtils,baseunix;

procedure term(sig :longint);cdecl;

begin
  Writeln('Interrupt caught');
  Halt;
end;


Note that in real programs, you should never call writeln (or pretty  
much any other RTL function) from a signal handler, as many routines  
are not re-intrant (and there is no documentation regarding which  
routines are safe to call from signal handlers and which aren't).



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


Re: [fpc-pascal] EControlC exception

2008-02-06 Thread Michael Van Canneyt


On Wed, 6 Feb 2008, Guillermo Martínez Jiménez wrote:

 Hi.
 
 Recently I discovered that Delphi can detect [Ctrl]+C keys using the
 EControlC exception. I was curious so I decided to test it in Linux
 using Free Pascal. The program I wrote:
 _
 
 PROGRAM ExControlC;
 (* How to capture [Ctrl+C] in Object Pascal.  *)
 
 {$mode objfpc}{$H+}
 
 USES
   SysUtils;
 
 VAR
   Tmp: STRING;
 BEGIN
   TRY
 WriteLN ('Press [Enter] or [Ctrl+C].');
 ReadLN (Tmp);
 WriteLN ('You pressed [Enter].');
   EXCEPT
 ON EControlC DO WriteLN ('You pressed [Ctrl+C].');
   END;
   WriteLN ('Have a nice day.');
 END.
 _
 
 That's simple. I tested it on Linux but it doesn't worked. It compiles
 and run, but if you press [Ctrl]+C the program exits without the You
 pressed [Ctrl+C]. message. Is it an issue or a bug? May be it's not
 possible to detect [Ctrl]+C in Linux?

It is not always possible. The shell catches the ctrl-c and kills your
program using a SIGINT signal.

You can catch this signal using a signal handler:

PROGRAM ExControlC;
(* How to capture [Ctrl+C] in Object Pascal.  *)

{$mode objfpc}{$H+}

USES
  SysUtils,baseunix;

procedure term(sig :longint);cdecl;

begin
  Writeln('Interrupt caught');
  Halt;
end;


VAR
 Tmp: STRING;
BEGIN
  fpsignal(SIGINT,@term);
  TRY
WriteLN ('Press [Enter] or [Ctrl+C].');
ReadLN (Tmp);
WriteLN ('You pressed [Enter].');
  EXCEPT
ON EControlC DO WriteLN ('You pressed [Ctrl+C].');
  END;
  WriteLN ('Have a nice day.');
END.

Should print
gru: fpc tt.pp
gru: ./tt
Press [Enter] or [Ctrl+C].
Interrupt caught


Michael.

 
 Guillermo Ñuño Martínez
 ___
 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] static class methods

2008-02-06 Thread Jonathan Benedicto

Jonas Maebe wrote:
I'm not sure how Delphi could handle this without passing the VMT as  
invisible parameter (and from a cursory look at the code generated by  
Kylix, it does appear to pass the VMT).


Delphi doesn't allow static class methods to be virtual.

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


[fpc-pascal] FPC for virtual machines?

2008-02-06 Thread Marco Alvarado
Hello! I'm in the Lazarus list, but I'm new to this one.

Are there FPC versions for these virtual machines?

Java
Flash 8 (actionscript 2)
Flash 9 (actionscript 3)

If the answer is no, I'd love to create compilers for those virtual
platforms. I want to see Pascal applications running on them. :D

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


Re: [fpc-pascal] static class methods

2008-02-06 Thread Micha Nelissen
Jonathan Benedicto wrote:
 Jonas Maebe wrote:
 I'm not sure how Delphi could handle this without passing the VMT as 
 invisible parameter (and from a cursory look at the code generated by 
 Kylix, it does appear to pass the VMT).
 
 Delphi doesn't allow static class methods to be virtual.

What are static class methods?

Plain class methods are allowed to be virtual, surely.

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


Re: [fpc-pascal] static class methods

2008-02-06 Thread Jonathan Benedicto

Micha Nelissen:

What are static class methods?


From RAD Studio 2007's Help file on Methods 

(ms-help://borland.bds5/devcommon/methods_xml.html):

Like class methods, class static methods can be accessed without an object 
reference. Unlike ordinary class methods, class static methods have no Self 
parameter at all. They also cannot access any instance members. (They still 
have access to class fields, class properties, and class methods.) Also 
unlike class methods, class static methods cannot be declared virtual.
Methods are made class static by appending the word static to their 
declaration.




Plain class methods are allowed to be virtual, surely.


Yes, plain class methods can be virtual, and can be overridden.

Jon 


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