process.pp 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. {
  2. This file is part of the Free Component Library (FCL)
  3. Copyright (c) 1999-2000 by the Free Pascal development team
  4. See the file COPYING.FPC, included in this distribution,
  5. for details about the copyright.
  6. This program is distributed in the hope that it will be useful,
  7. but WITHOUT ANY WARRANTY; without even the implied warranty of
  8. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  9. **********************************************************************}
  10. {$IFNDEF FPC_DOTTEDUNITS}
  11. unit process;
  12. {$ENDIF FPC_DOTTEDUNITS}
  13. {$define windows}
  14. {$mode objfpc}
  15. {$h+}
  16. {$modeswitch typehelpers}
  17. interface
  18. {$IFDEF FPC_DOTTEDUNITS}
  19. Uses System.Classes,
  20. System.Pipes,
  21. System.SysUtils,
  22. System.Math;
  23. {$ELSE FPC_DOTTEDUNITS}
  24. Uses Classes,
  25. pipes,
  26. SysUtils,
  27. Math;
  28. {$ENDIF FPC_DOTTEDUNITS}
  29. Type
  30. TProcessOption = (poRunSuspended,poWaitOnExit,
  31. poUsePipes,poStderrToOutPut,
  32. poNoConsole,poNewConsole,
  33. poDefaultErrorMode,poNewProcessGroup,
  34. poDebugProcess,poDebugOnlyThisProcess,poDetached,
  35. poPassInput,poRunIdle);
  36. TProcessOptionHelper = type helper for TProcessOption
  37. function ToString : String;
  38. end;
  39. TShowWindowOptions = (swoNone,swoHIDE,swoMaximize,swoMinimize,swoRestore,swoShow,
  40. swoShowDefault,swoShowMaximized,swoShowMinimized,
  41. swoshowMinNOActive,swoShowNA,swoShowNoActivate,swoShowNormal);
  42. TShowWindowOptionsHelper = type helper for TShowWindowOptions
  43. function ToString : String;
  44. end;
  45. TStartupOption = (suoUseShowWindow,suoUseSize,suoUsePosition,
  46. suoUseCountChars,suoUseFillAttribute);
  47. TStartupOptionHelper = type helper for TStartupOption
  48. function ToString : String;
  49. end;
  50. // only win32/64 and wince uses this. wince doesn't have the constants in the headers for the latter two.
  51. // unix defines them (as nice levels?), but doesn't use them.
  52. TProcessPriority = (ppHigh,ppIdle,ppNormal,ppRealTime{$ifndef wince},ppBelowNormal,ppAboveNormal{$endif});
  53. TProcessPriorityhelper = type helper for TProcessPriority
  54. function ToString : String;
  55. end;
  56. TProcessOptions = set of TProcessOption;
  57. TStartupOptions = set of TStartupOption;
  58. TRunCommandEventCode = (RunCommandIdle,RunCommandReadOutputString,RunCommandReadOutputStream,RunCommandFinished,RunCommandException);
  59. TRunCommandEventCodeHelper = type helper for TRunCommandEventCode
  60. function ToString : string;
  61. end;
  62. TRunCommandEventCodeSet = set of TRunCommandEventCode;
  63. TOnRunCommandEvent = procedure(Sender,Context : TObject;Status:TRunCommandEventCode;const Message:string) of object;
  64. EProcess = Class(Exception);
  65. {$ifdef UNIX}
  66. TProcessForkEvent = procedure(Sender : TObject) of object;
  67. {$endif UNIX}
  68. TIOType = (iotDefault, iotPipe, iotFile, iotHandle, iotProcess, iotNull);
  69. TIOTypeHelper = type helper for TIOType
  70. function ToString : string;
  71. end;
  72. TProcessHandleType = (phtInput,phtOutput,phtError);
  73. TProcessHandleTypeHelper = type helper for TProcessHandleType
  74. function ToString : string;
  75. end;
  76. TGetHandleEvent = procedure(Sender : TObject; var aHandle : THandle; var CloseOnExecute : Boolean) of object;
  77. TAfterAllocateHandleEvent = procedure(Sender : TObject; aHandle : THandle; var CloseOnExecute : Boolean) of object;
  78. { TIODescriptor }
  79. TProcess = Class;
  80. {$macro on}
  81. {define processunicodestring}
  82. {$i processbody.inc}
  83. end.