home *** CD-ROM | disk | FTP | other *** search
- // Borland C++ Builder
- // Copyright (c) 1995, 1999 by Borland International
- // All rights reserved
-
- // (DO NOT EDIT: machine generated header) 'ConsoleIO.pas' rev: 4.00
-
- #ifndef ConsoleIOHPP
- #define ConsoleIOHPP
-
- #pragma delphiheader begin
- #pragma option push -w-
- #include <SyncObjs.hpp> // Pascal unit
- #include <Dialogs.hpp> // Pascal unit
- #include <Forms.hpp> // Pascal unit
- #include <Controls.hpp> // Pascal unit
- #include <Graphics.hpp> // Pascal unit
- #include <Classes.hpp> // Pascal unit
- #include <SysUtils.hpp> // Pascal unit
- #include <Messages.hpp> // Pascal unit
- #include <Windows.hpp> // Pascal unit
- #include <SysInit.hpp> // Pascal unit
- #include <System.hpp> // Pascal unit
-
- //-- user supplied -----------------------------------------------------------
-
- namespace Consoleio
- {
- //-- type declarations -------------------------------------------------------
- #pragma option push -b-
- enum TProcessState { psRunning, psTimeOut, psFinished };
- #pragma option pop
-
- #pragma option push -b-
- enum TBufferSize { bs256, bs512, bs1k, bs2k, bs4k, bs8k };
- #pragma option pop
-
- #pragma option push -b-
- enum TPipeSize { ps1k, ps2k, ps4k, ps8k, ps16k, ps32k, ps64k, ps96K, ps128k, ps256k };
- #pragma option pop
-
- typedef unsigned TABufferSize[6];
-
- typedef int TAPipeSize[10];
-
- typedef Word TTimeOutDelay;
-
- typedef char TBuffer[1];
-
- typedef char *pTBuffer;
-
- #pragma option push -b-
- enum TAppType { at16bit, at32bit, atDontCare };
- #pragma option pop
-
- typedef void __fastcall (__closure *TStartEvent)(System::TObject* Sender, const AnsiString Command);
-
-
- typedef void __fastcall (__closure *TDoneEvent)(System::TObject* Sender);
-
- typedef void __fastcall (__closure *TSendLine)(System::TObject* Sender, const AnsiString Line);
-
- typedef void __fastcall (__closure *TError)(System::TObject* Sender, const AnsiString Error);
-
- typedef void __fastcall (__closure *TTimeOut)(System::TObject* Sender, bool &Kill);
-
- typedef void __fastcall (__closure *TPromptEvent)(System::TObject* Sender, const AnsiString Line);
-
- typedef void __fastcall (__closure *TStatusEvent)(System::TObject* Sender, const AnsiString Status);
-
-
- typedef void __fastcall (__closure *TPreTerminateEvent)(System::TObject* Sender);
-
- #pragma pack(push, 4)
- struct TConsoleProperties
- {
- TTimeOutDelay FTimeOutDelay;
- TPipeSize FPipeSize;
- TBufferSize FBufferSize;
- bool FAutoTerminate;
- AnsiString FLogFile;
- AnsiString FEnvironment;
- AnsiString FApp;
- TAppType FAppType;
- AnsiString FCommand;
- AnsiString FPrompt;
- int FPromptLength;
- AnsiString FHomeDir;
- Classes::TThreadPriority FPriority;
- } ;
- #pragma pack(pop)
-
- #pragma pack(push, 4)
- struct TConsoleEvents
- {
- TStartEvent FStart;
- TDoneEvent FDone;
- TSendLine FSendLine;
- TError FError;
- TStatusEvent FStatus;
- TTimeOut FTimeOut;
- TAppType FAppType;
- TPromptEvent FPromptEvent;
- TPreTerminateEvent FPreTerminate;
- } ;
- #pragma pack(pop)
-
- class DELPHICLASS TLogFile;
- #pragma pack(push, 4)
- class PASCALIMPLEMENTATION TLogFile : public Classes::TFileStream
- {
- typedef Classes::TFileStream inherited;
-
- public:
- void __fastcall WriteString(const AnsiString Str);
- public:
- #pragma option push -w-inl
- /* TFileStream.Create */ inline __fastcall TLogFile(const AnsiString FileName, Word Mode) : Classes::TFileStream(
- FileName, Mode) { }
- #pragma option pop
- #pragma option push -w-inl
- /* TFileStream.Destroy */ inline __fastcall virtual ~TLogFile(void) { }
- #pragma option pop
-
- };
-
- #pragma pack(pop)
-
- class DELPHICLASS TLineStream;
- #pragma pack(push, 4)
- class PASCALIMPLEMENTATION TLineStream : public Classes::TMemoryStream
- {
- typedef Classes::TMemoryStream inherited;
-
- protected:
- char __fastcall GetChar(int Index);
- void __fastcall SetChar(int Index, char C);
-
- public:
- __property char Chr[int Index] = {read=GetChar, write=SetChar};
- public:
- #pragma option push -w-inl
- /* TMemoryStream.Destroy */ inline __fastcall virtual ~TLineStream(void) { }
- #pragma option pop
-
- public:
- #pragma option push -w-inl
- /* TObject.Create */ inline __fastcall TLineStream(void) : Classes::TMemoryStream() { }
- #pragma option pop
-
- };
-
- #pragma pack(pop)
-
- class DELPHICLASS TConsoleThread;
- class DELPHICLASS TGUI2Console;
- #pragma pack(push, 4)
- class PASCALIMPLEMENTATION TConsoleThread : public Classes::TThread
- {
- typedef Classes::TThread inherited;
-
- private:
- TConsoleProperties FCP;
- TConsoleEvents FCE;
- System::TObject* FCO;
- bool FAtPrompt;
- unsigned hInputRead;
- unsigned hInputWrite;
- unsigned hOutputRead;
- unsigned hOutputWrite;
- _PROCESS_INFORMATION pi;
- TLineStream* FStream;
- Classes::TStringList* List;
- AnsiString FLine;
- _SECURITY_DESCRIPTOR sd;
- _SECURITY_ATTRIBUTES sa;
- _SECURITY_ATTRIBUTES *lpsa;
- _STARTUPINFOA si;
- int Timer;
- char *FBuffer;
- unsigned Flag;
- TLogFile* FLogFile;
- bool FFreed;
- unsigned __fastcall WaitForSingleObject(unsigned Handle);
- void __fastcall CheckSecurity(void);
- void __fastcall CreateProcess(void);
- void __fastcall CloseHandles(void);
- void __fastcall RunPipe(void);
- void __fastcall TerminateProcess(const AnsiString Msg);
-
- protected:
- AnsiString Message;
- void __fastcall DoStart(void);
- void __fastcall DoDone(void);
- void __fastcall DoPreTerminate(void);
- void __fastcall SendLine(void);
- void __fastcall DoError(void);
- void __fastcall DoTimeOut(void);
- void __fastcall DoStatus(void);
- void __fastcall DoPrompt(void);
- void __fastcall WriteBuffer(int Count);
- AnsiString __fastcall Cmd(void);
-
- public:
- __fastcall TConsoleThread(TGUI2Console* Console);
- virtual void __fastcall Execute(void);
- __fastcall virtual ~TConsoleThread(void);
- public:
- #pragma option push -w-inl
- /* TThread.Create */ inline __fastcall TConsoleThread(bool CreateSuspended) : Classes::TThread(CreateSuspended
- ) { }
- #pragma option pop
-
- };
-
- #pragma pack(pop)
-
- #pragma pack(push, 4)
- class PASCALIMPLEMENTATION TGUI2Console : public Classes::TComponent
- {
- typedef Classes::TComponent inherited;
-
- private:
- TConsoleProperties FCP;
- TConsoleEvents FCE;
- TConsoleThread* FConsoleThread;
- void __fastcall Terminate(System::TObject* Sender);
- void __fastcall SetPrompt(AnsiString P);
-
- public:
- void __fastcall Start(void);
- __fastcall virtual TGUI2Console(Classes::TComponent* AOwner);
- __fastcall virtual ~TGUI2Console(void);
- void __fastcall Stop(void);
- void __fastcall Write(AnsiString Buffer);
- void __fastcall WriteLN(AnsiString Buffer);
-
- __published:
- __property AnsiString Application = {read=FCP.FApp, write=FCP.FApp};
- __property TAppType AppType = {read=FCP.FAppType, write=FCP.FAppType, nodefault};
- __property AnsiString Environment = {read=FCP.FEnvironment, write=FCP.FEnvironment};
- __property AnsiString Command = {read=FCP.FCommand, write=FCP.FCommand};
- __property AnsiString HomeDirectory = {read=FCP.FHomeDir, write=FCP.FHomeDir};
- __property AnsiString LogFile = {read=FCP.FLogFile, write=FCP.FLogFile};
- __property AnsiString Prompt = {read=FCP.FPrompt, write=SetPrompt};
- __property bool AutoTerminate = {read=FCP.FAutoTerminate, write=FCP.FAutoTerminate, nodefault};
- __property TPipeSize PipeSize = {read=FCP.FPipeSize, write=FCP.FPipeSize, nodefault};
- __property TBufferSize BufferSize = {read=FCP.FBufferSize, write=FCP.FBufferSize, nodefault};
- __property TTimeOutDelay TimeOutDelay = {read=FCP.FTimeOutDelay, write=FCP.FTimeOutDelay, nodefault
- };
- __property Classes::TThreadPriority Priority = {read=FCP.FPriority, write=FCP.FPriority, nodefault}
- ;
- __property TStartEvent OnStart = {read=FCE.FStart, write=FCE.FStart};
- __property TDoneEvent OnDone = {read=FCE.FDone, write=FCE.FDone};
- __property TSendLine OnLine = {read=FCE.FSendLine, write=FCE.FSendLine};
- __property TError OnError = {read=FCE.FError, write=FCE.FError};
- __property TTimeOut OnTimeOut = {read=FCE.FTimeOut, write=FCE.FTimeOut};
- __property TStatusEvent OnStatus = {read=FCE.FStatus, write=FCE.FStatus};
- __property TPromptEvent OnPrompt = {read=FCE.FPromptEvent, write=FCE.FPromptEvent};
- __property TPreTerminateEvent OnPreTerminate = {read=FCE.FPreTerminate, write=FCE.FPreTerminate};
- };
-
- #pragma pack(pop)
-
- //-- var, const, procedure ---------------------------------------------------
- static const char CR = '\xd';
- static const char LF = '\xa';
- static const char Space = '\x20';
- #define CRLF "\r\n"
- extern PACKAGE void __fastcall Register(void);
-
- } /* namespace Consoleio */
- #if !defined(NO_IMPLICIT_NAMESPACE_USE)
- using namespace Consoleio;
- #endif
- #pragma option pop // -w-
-
- #pragma delphiheader end.
- //-- end unit ----------------------------------------------------------------
- #endif // ConsoleIO
-