Re: [fpc-devel] CGI/Command line/GUI all in one

2009-09-20 Thread Dariusz Mazur

Horacio Jamilis pisze:

Dariusz Mazur escribió:

Horacio Jamilis pisze:

Dariusz Mazur escribió:
This is not problem to have separate executable, only have one 
source to both GUI.
I made program which can work as desktop and as web-based (FCGI or 
standalone web server)
Each form is create dynamical in runtime, source is one, but in 
compile time:
1 for desktop: clasic units from LCL (or rather VCL, on windows I 
use Delphi)
2.for web-base different set of units to handle web, but with the 
same API as  VCL


Darek

How do you do this?
I want to do exactly the same... having 2 exe, one for desktop and 
one for web without doubling the work (from the same sources).
I was thinking on using Intraweb (or VCL for the web in delphi)... 
but, what are you using for the web with FPC?
webserver from synapse, but with  several modification (current is 
much faster)
own framework as I write upper,it contain replacement for units 
controls, forms, stdctrl of course only this part which I need, but 
its work


I want to move to FPC from delphi, but I see no viable alternative 
to Intraweb in FPC (and Lazarus).

Indy don't work properly on linux,
Intraweb is so complicated and very heavy

Do you have any sample source I could see?



http://www.emadar.com/fpc/xwebdemo.zip

its very simple demo with all libraries
but some text are in polish,
fell free to ask, i've try to translate or explain






I tried to compile the demo project with Delphi 2007 (because I saw a 
.dpr file)... but it seems that a couple of required files are 
missing... aka: kom2, kom3 ... and may be others.

I really like to see this working...

Could you fix te problems or may be send me this files?
and the command to compile with fpc?
Thanks.

I've update xwebdemo,
it contains compiled version too
if any problems, tell me


On FPC all should be OK, maybe except dpr file and synapse (zip does not 
contain whole)

ex:  FPC testmobile.dpr


--
 Darek




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


Re: [fpc-devel] CGI/Command line/GUI all in one

2009-09-20 Thread Horacio Jamilis

Dariusz Mazur escribió:


http://www.emadar.com/fpc/xwebdemo.zip

its very simple demo with all libraries
but some text are in polish,
fell free to ask, i've try to translate or explain






I tried to compile the demo project with Delphi 2007 (because I saw a 
.dpr file)... but it seems that a couple of required files are 
missing... aka: kom2, kom3 ... and may be others.

I really like to see this working...

Could you fix te problems or may be send me this files?
and the command to compile with fpc?
Thanks.

I've update xwebdemo,
it contains compiled version too
if any problems, tell me


On FPC all should be OK, maybe except dpr file and synapse (zip does 
not contain whole)

ex:  FPC testmobile.dpr


Thanks, I will test it.

Horacio

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


Re: [fpc-devel] CGI/Command line/GUI all in one

2009-09-19 Thread Horacio Jamilis

Dariusz Mazur escribió:

Horacio Jamilis pisze:

Dariusz Mazur escribió:
This is not problem to have separate executable, only have one 
source to both GUI.
I made program which can work as desktop and as web-based (FCGI or 
standalone web server)
Each form is create dynamical in runtime, source is one, but in 
compile time:
1 for desktop: clasic units from LCL (or rather VCL, on windows I 
use Delphi)
2.for web-base different set of units to handle web, but with the 
same API as  VCL


Darek

How do you do this?
I want to do exactly the same... having 2 exe, one for desktop and 
one for web without doubling the work (from the same sources).
I was thinking on using Intraweb (or VCL for the web in delphi)... 
but, what are you using for the web with FPC?
webserver from synapse, but with  several modification (current is 
much faster)
own framework as I write upper,it contain replacement for units 
controls, forms, stdctrl of course only this part which I need, but 
its work


I want to move to FPC from delphi, but I see no viable alternative to 
Intraweb in FPC (and Lazarus).

Indy don't work properly on linux,
Intraweb is so complicated and very heavy

Do you have any sample source I could see?



http://www.emadar.com/fpc/xwebdemo.zip

its very simple demo with all libraries
but some text are in polish,
fell free to ask, i've try to translate or explain






I tried to compile the demo project with Delphi 2007 (because I saw a 
.dpr file)... but it seems that a couple of required files are 
missing... aka: kom2, kom3 ... and may be others.

I really like to see this working...

Could you fix te problems or may be send me this files?
and the command to compile with fpc?
Thanks.

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


Re: [fpc-devel] CGI/Command line/GUI all in one

2009-09-18 Thread Wanderlan Santos dos Anjos
 want to move to FPC from delphi, but I see no viable alternative to
 Intraweb in FPC (and Lazarus).
 Do you have any sample source I could see?

 See http://extpascal.googlecode.com


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


Re: [fpc-devel] CGI/Command line/GUI all in one

2009-09-18 Thread Dariusz Mazur

Horacio Jamilis pisze:

Dariusz Mazur escribió:
This is not problem to have separate executable, only have one source 
to both GUI.
I made program which can work as desktop and as web-based (FCGI or 
standalone web server)
Each form is create dynamical in runtime, source is one, but in 
compile time:
1 for desktop: clasic units from LCL (or rather VCL, on windows I use 
Delphi)
2.for web-base different set of units to handle web, but with the 
same API as  VCL


Darek

How do you do this?
I want to do exactly the same... having 2 exe, one for desktop and one 
for web without doubling the work (from the same sources).
I was thinking on using Intraweb (or VCL for the web in delphi)... 
but, what are you using for the web with FPC?
webserver from synapse, but with  several modification (current is much 
faster)
own framework as I write upper,it contain replacement for units 
controls, forms, stdctrl of course only this part which I need, but its work


I want to move to FPC from delphi, but I see no viable alternative to 
Intraweb in FPC (and Lazarus).

Indy don't work properly on linux,
Intraweb is so complicated and very heavy

Do you have any sample source I could see?



http://www.emadar.com/fpc/xwebdemo.zip

its very simple demo with all libraries
but some text are in polish,
fell free to ask, i've try to translate or explain




--
 Darek




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


Re: [fpc-devel] CGI/Command line/GUI all in one

2009-09-18 Thread Marco van de Voort
In our previous episode, Dariusz Mazur said:
  I want to move to FPC from delphi, but I see no viable alternative to 
  Intraweb in FPC (and Lazarus).
 Indy don't work properly on linux,

What's the problem?

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


Re: [fpc-devel] CGI/Command line/GUI all in one

2009-09-18 Thread Dariusz Mazur

Marco van de Voort pisze:

In our previous episode, Dariusz Mazur said:
  
I want to move to FPC from delphi, but I see no viable alternative to 
Intraweb in FPC (and Lazarus).
  

Indy don't work properly on linux,



What's the problem?


  

webserver  was no stable,
maybe something was change, I swich to Synapse two years ago
and i think Synapse is faster (I don't make any test, but only about 
look to source)



--
 Darek




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


[fpc-devel] CGI/Command line/GUI all in one

2009-09-17 Thread Gilles MARCOU
Hello,

I'm trying to build an interface for a program so that it could be used
as a command line, a GUI or a CGI. For the CGI, I use powutils 1.7.1,
FPC 2.2.0 and Lazarus 0.9.24. I mean that the same executable should be
used either as a CGI, a command line or a GUI.

Currently I have kept separated in different unit each user interface
(see the code below). But, at execution, if there is an execution error,
it always open message box. Therefore, even in command line, the
software requires GUI libraries be there (GTK for instance) and it
simply does not work as a CGI.

Do you see a more clever solution? Otherwise, the only solution I see is
to keep all three interfaces in separate executable.

Thanks in advance,
Gilles Marcou

program Predictor;

{$mode objfpc}{$H+}

uses
  {$IFDEF UNIX}{$IFDEF UseCThreads}
  cthreads,
  {$ENDIF}{$ENDIF}
  //{ you can add units after this },
  Classes, sysutils, UnitRunGUI, UnitRunCMD, UnitRunCGI;

type
TRuntype=(CGI,CMD,GUI,UNK);

var
   cfg: TStringList;
   rt: TRuntype;
begin
  cfg:=TStringList.Create;
  cfg.LoadFromFile('cfg');
  rt:=UNK;
  if (cfg[0]='CGI') then
 rt:=CGI
  else if (cfg[0]='CMD') then
   rt:=CMD
  else if (cfg[0]='GUI') then
   rt:=GUI;
  FreeAndNil(cfg);
  if (rt=GUI) then
 RunGUI
  else if (rt=CMD) then
   RunCMD
  else if (rt=CGI) then
   RunCGI;
end.
---
unit UnitRunGUI;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, Interfaces, Forms, UnitPredictor;
  
procedure RunGUI;

implementation

procedure RunGUI;
begin
 Application.Initialize;
 Application.CreateForm(TFormPredictor, FormPredictor);
 Application.Run;
end;

end.

unit UnitRunCGI;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, pwinit, pwmain;

procedure RunCGI;

implementation

procedure RunCGI;
begin
 outln('CGI: Not yet supported');
end;

end.

unit UnitRunCMD;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils; 

procedure RunCMD;

implementation

procedure RunCMD;
begin
 writeln('CMD: Not supported yet');
end;

end.
 

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


Re: [fpc-devel] CGI/Command line/GUI all in one

2009-09-17 Thread Michael Schnell
Did you find / define a Widget set that is compatible for a local GUI
and a GCI that is supposed to be connected via HTML ?

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


Re: [fpc-devel] CGI/Command line/GUI all in one

2009-09-17 Thread Graeme Geldenhuys
Gilles MARCOU het geskryf:
 I'm trying to build an interface for a program so that it could be used
 as a command line, a GUI or a CGI. For the CGI, I use powutils 1.7.1,
 FPC 2.2.0 and Lazarus 0.9.24. I mean that the same executable should be
 used either as a CGI, a command line or a GUI.

I can't see this working - I went through the same problem with the
tiOPF project.

If you create a CGI application that pulls in the Forms unit for
example. Then try and run that CGI project thourgh a web server that
doesn't have X Window System installed, the program will fail with
DISPLAY has not been set error.

In the case of tiOPF. I was trying to run the console Test Suite on a
headless Linux box. I had to first clean up the tiOPF code, to NOT
include GUI units in the core tiopf unit. Then only did my console
application run correctly on the headless linux box.

Regards,
  - Graeme -

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://opensoft.homeip.net/fpgui/

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


Re: [fpc-devel] CGI/Command line/GUI all in one

2009-09-17 Thread Joost van der Sluis
On Thu, 2009-09-17 at 11:50 +0200, Gilles MARCOU wrote:
 Hello,
 
 I'm trying to build an interface for a program so that it could be used
 as a command line, a GUI or a CGI. For the CGI, I use powutils 1.7.1,
 FPC 2.2.0 and Lazarus 0.9.24. I mean that the same executable should be
 used either as a CGI, a command line or a GUI.
 
 Currently I have kept separated in different unit each user interface
 (see the code below). But, at execution, if there is an execution error,
 it always open message box. Therefore, even in command line, the
 software requires GUI libraries be there (GTK for instance) and it
 simply does not work as a CGI.

If you really have a console-only program, you shoudn't use any
lcl-units (that pulls in the forms unit) in your program. That'll solve
the problem.

 Do you see a more clever solution? Otherwise, the only solution I see is
 to keep all three interfaces in separate executable.

Or you can select the 'nogui' widgetset in Lazarus. That'll also solve
your problem.

Joost

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


Re: [fpc-devel] CGI/Command line/GUI all in one

2009-09-17 Thread Dariusz Mazur

Gilles MARCOU pisze:

Hello,

I'm trying to build an interface for a program so that it could be used
as a command line, a GUI or a CGI. For the CGI, I use powutils 1.7.1,
FPC 2.2.0 and Lazarus 0.9.24. I mean that the same executable should be
used either as a CGI, a command line or a GUI.

Currently I have kept separated in different unit each user interface
(see the code below). But, at execution, if there is an execution error,
it always open message box. Therefore, even in command line, the
software requires GUI libraries be there (GTK for instance) and it
simply does not work as a CGI.
  
You have to change all automatic initialization of visual components and 
make all linking with  GUI libraries dynamic. That i no easy.
But you can invoke second executable from this console (distribute 2 
file, but always invoke the same)

Do you see a more clever solution? Otherwise, the only solution I see is
to keep all three interfaces in separate executable.

  
This is not problem to have separate executable, only have one source to 
both GUI.
I made program which can work as desktop and as web-based (FCGI or 
standalone web server)
Each form is create dynamical in runtime, source is one, but in compile 
time:
1 for desktop: clasic units from LCL (or rather VCL, on windows I use 
Delphi)
2.for web-base different set of units to handle web, but with the same 
API as  VCL


Darek




Thanks in advance,
Gilles Marcou

program Predictor;

{$mode objfpc}{$H+}

uses
  {$IFDEF UNIX}{$IFDEF UseCThreads}
  cthreads,
  {$ENDIF}{$ENDIF}
  //{ you can add units after this },
  Classes, sysutils, UnitRunGUI, UnitRunCMD, UnitRunCGI;

type
TRuntype=(CGI,CMD,GUI,UNK);

var
   cfg: TStringList;
   rt: TRuntype;
begin
  cfg:=TStringList.Create;
  cfg.LoadFromFile('cfg');
  rt:=UNK;
  if (cfg[0]='CGI') then
 rt:=CGI
  else if (cfg[0]='CMD') then
   rt:=CMD
  else if (cfg[0]='GUI') then
   rt:=GUI;
  FreeAndNil(cfg);
  if (rt=GUI) then
 RunGUI
  else if (rt=CMD) then
   RunCMD
  else if (rt=CGI) then
   RunCGI;
end.
---
unit UnitRunGUI;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, Interfaces, Forms, UnitPredictor;
  
procedure RunGUI;


implementation

procedure RunGUI;
begin
 Application.Initialize;
 Application.CreateForm(TFormPredictor, FormPredictor);
 Application.Run;
end;

end.

unit UnitRunCGI;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, pwinit, pwmain;

procedure RunCGI;

implementation

procedure RunCGI;
begin
 outln('CGI: Not yet supported');
end;

end.

unit UnitRunCMD;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils; 


procedure RunCMD;

implementation

procedure RunCMD;
begin
 writeln('CMD: Not supported yet');
end;

end.
 


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

  



--
 Darek




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


Re: [fpc-devel] CGI/Command line/GUI all in one

2009-09-17 Thread Horacio Jamilis

Dariusz Mazur escribió:
This is not problem to have separate executable, only have one source 
to both GUI.
I made program which can work as desktop and as web-based (FCGI or 
standalone web server)
Each form is create dynamical in runtime, source is one, but in 
compile time:
1 for desktop: clasic units from LCL (or rather VCL, on windows I use 
Delphi)
2.for web-base different set of units to handle web, but with the same 
API as  VCL


Darek

How do you do this?
I want to do exactly the same... having 2 exe, one for desktop and one 
for web without doubling the work (from the same sources).
I was thinking on using Intraweb (or VCL for the web in delphi)... but, 
what are you using for the web with FPC?
I want to move to FPC from delphi, but I see no viable alternative to 
Intraweb in FPC (and Lazarus).

Do you have any sample source I could see?

Thanks

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