program topolinux;
uses
  cthreads,
  cmem,
  uemuladorwinipc in '../../src_libnettopos/fctopos/IPC/Linux/uemuladorwinipc.pas',
  usemaforopolenta in '../../src_libnettopos/fctopos/IPC/Linux/usemaforopolenta.pas',
  ipcobjs in '../../src_libnettopos/fctopos/IPC/Linux/ipcobjs.pas',
  ukeydir in '../../src_libnettopos/libnettopos/ukeydir.pas',
  uwinmsgs in '../../src_libnettopos/fctopos/IPC/Linux/uwinmsgs.pas',
  unettopos in '../../src_libnettopos/libnettopos/unettopos.pas',
  unettopostypes in '../../src_libnettopos/libnettopos/unettopostypes.pas',
  uglobsharedmem in '../../src_libnettopos/libnettopos/uglobsharedmem.pas',
  uHeapManager in '../../src_libnettopos/libnettopos/uHeapManager.pas',
  uconstantes_nettopos in '../../src_libnettopos/libnettopos/uconstantes_nettopos.pas',
  Classes,
  winLinuxUtils in '..\..\..\fc\base\winLinuxUtils.pas', uConstantesSimSEE,
  utoposock, uMsgRetardados, udemonize;

procedure TFmth_execute;
var
	m: TWinMsg;
begin
writeln('TFmth_execute->TTopoSock.Create');
  TopoSock:= TTopoSock.Create(nil);
  while TopoSock.recolectar do
  begin
   if xGetMessage_WAIT( m ) = 0 then
   begin
     writeln('TopoSock mensaje: ', m.msgCode,' : ',m.wParam,' : ',m.lParam);
     if m.msgCode <> WM_CLOSE then
       TopoSock.Dispatch(m)
     else
     begin
       writeln('Saliendo por recibir WM_CLOSE.');
       topoSock.recolectar:= false;
     end;
   end
   else
     write('-');
  end;
writeln('TFmth_execute->TTopoSock.Free');
  TopoSock.Free;
writeln('TFmth_execute->fin.');
end;

begin

 CrearArchivosKeys;

 writeln(' Paso a modo SUBTERRANEO !');
 daemonize;

//  tf:= TFmth.Create;
  TFmth_execute;

end.
