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