Re: [fpc-pascal] code speed and size on various platforms

2008-06-17 Thread Lourival Mendes
Dear all users,

   I'm looking for an unity for calculus of some more complex
functions in Pascal than those avaiable in the Delphi math.pas unity.
For a more specific case I would like to calculate FFT and IFFT of
some signal data. Does the FPC has some? Is it possible to use it in
Delphi ? Does someone knows if there is the translation of numerical
recipes from C to Pascal??

Thanks

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


[fpc-pascal] Deamon signals

2008-06-17 Thread Koenraad Lelong
Hi,
I'm trying to make a daemon, to run on Linux. I got a testversion
working, but I have a question about signals.
I can respond to signals but every signal I didn't define stops the
daemon, in an unmanageable way.
Is this the proper behaviour ?

The source :
program my_service;

{$ifdef FPC}{$mode objfpc}{$h+}{$endif}
uses
 {$ifdef FPC}{$ifdef linux}cthreads,{$endif}{$endif}
 baseunix,crt,sysutils;

var
 pid : Tpid;
 finished : boolean;
 oa_sigterm, na_sigterm : PSigActionRec ;
 oa_sigusr1, na_sigusr1 : PSigActionRec ;
 oa_sigusr2, na_sigusr2 : PSigActionRec ;

Procedure DoSig(sig : cint); cdecl ;
begin
 writeln ('Receiving signal : ', sig) ;
 finished:=(sig=SigTerm);
end ;

procedure daemon;
begin
{Do the actual work here.}
repeat
until finished;
writeln('finished in daemon');
end;

begin
finished:=false;
new(na_sigterm) ;
new(oa_sigterm) ;
na_sigterm^.sa_Handler:=SigActionHandler(@DoSig) ;
fillchar(na_sigterm^.Sa_Mask, sizeof(na_sigterm^.sa_mask), #0);
na_sigterm^.Sa_Flags:=0 ;
{$ifdef Linux}   // Linux specific
na_sigterm^.Sa_Restorer:= Nil;
{$endif}
if fpSigAction(Sigterm,na_sigterm,oa_sigterm)0 then
 begin
  writeln ('Error : ',fpgeterrno , '(SigTerm).') ;
  halt (1);
 end;
new(na_sigusr1) ;
new(oa_sigusr1) ;
na_sigusr1^.sa_Handler:=SigActionHandler(@DoSig) ;
fillchar(na_sigusr1^.Sa_Mask, sizeof(na_sigusr1^.sa_mask), #0);
na_sigusr1^.Sa_Flags:=0 ;
{$ifdef Linux}   // Linux specific
na_sigusr1^.Sa_Restorer:= Nil;
{$endif}
if fpSigAction(SigUsr1,na_sigusr1,oa_sigusr1)0 then
 begin
  writeln ('Error : ',fpgeterrno , '(SigUsr1).') ;
  halt (1);
 end;
new(na_sigusr2) ;
new(oa_sigusr2) ;
na_sigusr2^.sa_Handler:=SigActionHandler(@DoSig) ;
fillchar(na_sigusr2^.Sa_Mask, sizeof(na_sigusr2^.sa_mask), #0);
na_sigusr2^.Sa_Flags:=0 ;
{$ifdef Linux}   // Linux specific
na_sigusr2^.Sa_Restorer:= Nil;
{$endif}
if fpSigAction(sigusr2,na_sigusr2,oa_sigusr2)0 then
 begin
  writeln ('Error : ',fpgeterrno , '(SigUsr2).') ;
  halt (1);
 end;
pid:=fpfork;
if pid=0 then
 daemon;
writeln('finished main');
end.

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


[fpc-pascal] Installing 2.3.1

2008-06-17 Thread Lee Jenkins


Hey, all is there a snapshot available for 2.3.1?  I tried downloading the 
fpbuild kit and go woefully lost :)


I'd like to upgrade, but not sure how get a good binary installation on my Win32 
box.


Thanks a bunch.

--

Warm Regards,

Lee

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


[fpc-pascal] Best way to use lists

2008-06-17 Thread Michael Fuchs

Hello,

I try to implement some lists, so I can use them like the List(of X) 
in VB.NET. What is the best way to do this?


1.) Make some new classes, derived from TFPObjectList and overwrite the 
Add/Extract/Remove/... -functions?


2.) Make a new class with a private TFPObjectList and hand over the 
Add/Extract/Remove/...-functions with typecasting?


3.) Or make a new generic class, derived from TFPObjectList and uses 
this? Generics are stable in 2.2.0?


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


[fpc-pascal] MPL, LGPL rehashed again

2008-06-17 Thread Graeme Geldenhuys
Hi,

I know there has been numerous threads about different licenses. I've
got 1.5 years of archived mails and searched through all of them and
read all related threads on the subject, yet I still have some
questions.

Some product background:
I work for Master Maths, which is in the franchising businuess. I work
at the head office creating their software that is being used by the
franchisees. We do not sell our software to the public or to the
franchisees. We give them (franchisees) the software and unlock it for
a year. After that they simply need to phone user, we verify who they
are and unlock it for another yet. So it continues...

I thought the above is important, because I know with some licenses
there are references to when you sell software, which technically we
do not do. I think we rather fall under the category of in-house
software.

We use the following tools  libraries to create our software:

FPC (mostly Modified LGPL)
fpGUI   (Modified LGPL like FPC's RTL)
Lazarus IDE (usage simply as an editor)
FBLib   (LGPL 1.2)
tiOPF   (MPL 1.1)

My concern is the last two.  We use Lazarus as our IDE, but we do not
use the LCL and do not use the design time componens (click and drop
components on a form style coding), not sure if this is of relevance.
We do use the Lazarus Packages (*.lpk) to reference the different
libraries we use.

#1
FBLib uses the standard LGPL. We link that software directly into our
executables. We don't use it as an external (dynamically linked)
.so/.dll library.  FBLib is pretty much a wrapper for the Firebird
libfbclient.so library.  If this poses an issue, it should be fairly
easy for us to switch to a different library like sqldb included with
FPC.

#2
I know MPL is not GPL compatible, but we are not creating GPL'ed
software. We are creating software used in-house for our franchisees.
We do not sell our software either. So would this be a concern for us?
 I'm part of the core developers for tiOPF and am pretty sure that if
we need to change tiOPF's license to a Modified LGPL or dual license
it, it should be possible. Again, we link tiOPF directly into our
executable. Does this pose any issues for us?


Regards,
 - Graeme -


___
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] code speed and size on various platforms

2008-06-17 Thread Paul Nicholls
Lourival Mendes [EMAIL PROTECTED] 
wrote in message 
news:[EMAIL PROTECTED]

Dear all users,

  I'm looking for an unity for calculus of some more complex
functions in Pascal than those avaiable in the Delphi math.pas unity.
For a more specific case I would like to calculate FFT and IFFT of
some signal data. Does the FPC has some? Is it possible to use it in
Delphi ? Does someone knows if there is the translation of numerical
recipes from C to Pascal??

Thanks

Lourival
___


Hi Lourival,
   perhaps this link below will help.  It is a free Delphi/Pascal 
implementation (source included) for a complext FFT and inverse FFT released 
under the Mozilla Public License Version 1.1.


http://www.simdesign.nl/fft.html

cheers,
Paul 


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


[fpc-pascal] Problem with threads and cwstrings

2008-06-17 Thread Alexander Bauer

Hi,

i have a problem when i use cwstrings together with threads on linux.

I made a simple program which create threads in an endless loop.
Every thread only does a sleep(1) and then finish.

Without 'cwstrings' everything works fine.
But when i include 'cwstrings' the program eats more and more memory.

What is the problem ?

FPC 2.2.1 (I also tested with FPC 2.3.1) with Ubuntu 8.04

Alex

--
threaddemo.lpr
--
program threaddemo;

{$mode objfpc}{$H+}

uses
 cthreads,
 cwstring,
 SysUtils,
 mythread;

var
 i: integer;
 bTerm: boolean;
 Thread: TmyThread;

begin
 i := 0;
 bTerm := false;

 while not bTerm do
 begin
   Thread := TmyThread.create(true);
   Thread.Resume;
   Inc(i);
   Sleep(1);
   WriteLn('Thread #' + IntToStr(i));
 end;

 Halt(0);
end.

--
mythread.pas
--
unit mythread;

interface

uses
 Classes, SysUtils;

type
 TmyThread = class(TThread)
 private
 public
   Constructor Create(CreateSuspended : boolean);
   procedure Execute; override;
 end;

implementation

{ TmyThread }

Constructor TmyThread.Create(CreateSuspended : boolean);
begin
 inherited create(CreateSuspended);
 FreeOnTerminate:=true;
end;

procedure TmyThread.Execute;
begin
 sleep(1);
end;

end.




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