File: process331.pp

package info (click to toggle)
lazarus 4.0%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 275,760 kB
  • sloc: pascal: 2,341,904; xml: 509,420; makefile: 348,726; cpp: 93,608; sh: 3,387; java: 609; perl: 297; sql: 222; ansic: 137
file content (103 lines) | stat: -rw-r--r-- 3,532 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
{
    This file is part of the Free Component Library (FCL)
    Copyright (c) 1999-2000 by the Free Pascal development team

    See the file COPYING.FPC, included in this distribution,
    for details about the copyright.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

 **********************************************************************}
{$IFNDEF FPC_DOTTEDUNITS}
unit process331;
{$ENDIF FPC_DOTTEDUNITS}
{$define windows}
{$mode objfpc}
{$h+}
{$modeswitch typehelpers}

interface

{$IFDEF FPC_DOTTEDUNITS}
Uses System.Classes,
     System.Pipes,
     System.SysUtils,
     System.Math;
{$ELSE FPC_DOTTEDUNITS}
Uses Classes,
     pipes331  in 'fcl-proc331/pipes331.pp',
     SysUtils,
     Math;
{$ENDIF FPC_DOTTEDUNITS}

Type
  TProcessOption = (poRunSuspended,poWaitOnExit,
                    poUsePipes,poStderrToOutPut,
                    poNoConsole,poNewConsole,
                    poDefaultErrorMode,poNewProcessGroup,
                    poDebugProcess,poDebugOnlyThisProcess,poDetached,
                    poPassInput,poRunIdle);
  TProcessOptionHelper = type helper for TProcessOption
    function ToString : String;
  end;

  TShowWindowOptions = (swoNone,swoHIDE,swoMaximize,swoMinimize,swoRestore,swoShow,
                        swoShowDefault,swoShowMaximized,swoShowMinimized,
                        swoshowMinNOActive,swoShowNA,swoShowNoActivate,swoShowNormal);
  TShowWindowOptionsHelper = type helper for TShowWindowOptions
    function ToString : String;
  end;

  TStartupOption = (suoUseShowWindow,suoUseSize,suoUsePosition,
                    suoUseCountChars,suoUseFillAttribute);
  TStartupOptionHelper = type helper for TStartupOption
    function ToString : String;
  end;

  // only win32/64 and wince uses this. wince doesn't have the constants in the headers for the latter two.
  // unix defines them (as nice levels?), but doesn't use them.
  TProcessPriority = (ppHigh,ppIdle,ppNormal,ppRealTime{$ifndef wince},ppBelowNormal,ppAboveNormal{$endif});
  TProcessPriorityhelper = type helper for TProcessPriority
    function ToString : String;
  end;

  TProcessOptions = set of TProcessOption;
  TStartupOptions = set of TStartupOption;

  TRunCommandEventCode = (RunCommandIdle,RunCommandReadOutputString,RunCommandReadOutputStream,RunCommandFinished,RunCommandException);
  TRunCommandEventCodeHelper = type helper for TRunCommandEventCode
    function ToString : string;
  end;

  TRunCommandEventCodeSet = set of TRunCommandEventCode;
  TOnRunCommandEvent = procedure(Sender,Context : TObject;Status:TRunCommandEventCode;const Message:string) of object;
  EProcess = Class(Exception);

  {$ifdef UNIX}
  TProcessForkEvent = procedure(Sender : TObject) of object;
  {$endif UNIX}

  TIOType = (iotDefault, iotPipe, iotFile, iotHandle, iotProcess, iotNull);
  TIOTypeHelper = type helper for TIOType
    function ToString : string;
  end;

  TProcessHandleType = (phtInput,phtOutput,phtError);
  TProcessHandleTypeHelper = type helper for TProcessHandleType
    function ToString : string;
  end;

  TGetHandleEvent = procedure(Sender : TObject; var aHandle : THandle; var CloseOnExecute : Boolean) of object;
  TAfterAllocateHandleEvent = procedure(Sender : TObject; aHandle : THandle; var CloseOnExecute : Boolean) of object;

  { TIODescriptor }
  TProcess = Class;

{$macro on}
{define processunicodestring}

{$i processbody.inc}

end.