Re: preprocessing commandline

From: Fons Rademakers (Fons.Rademakers@cern.ch)
Date: Thu Nov 04 1999 - 12:52:08 MET


Hi Selim,

   in your TMyRint you have to override the TApplication::ProcessLine()
method. Notice that the signature in 2.23 ofthis method is:

void TApplication::ProcessLine(const Text_t *line, Bool_t sync)

In your case below you don't override the TApplication::ProcessLine().

In ProcessLine() you can do what you like before calling back to
TApplication::ProcessLine() for the final command processing.

There is no need to override HandleTermInput().


Cheers, Fons.


Selim Issever wrote:
> 
> Hi all,
> 
> I've a compiled a root application and want to process the user input before
> it is send to root for evaluation. I fooled around with TRint but didnt
> succeed really (overloaded some memberfunctions). Could you point me to the
> right direction? To give you a hint, where I am stuck, i'll send the relevant
> part of the code below of what I do.
> 
> Rem:
> 1) ProcessLine works from within the code, but not, if I just type in a
> command at the prompt
> 2) HnadleTermInput comes back after each single keystroke,.. I didnt want to
> parse keystrokes,.. this seems a bit too unhandy to me,.. I only want to
> receive the string, after the return key was pressed,..
> 
> --- the main file ------------------------------------------------
> [...]
> int           Error;
> extern void   InitGui();
> VoidFuncPtr_t initFuncs[] = {InitGui, 0};
> TROOT         myRoot("Borg","", initFuncs);
> [...]
> 
> class TMyRint : public TRint {
> public:
>   TMyRint(char* appClassName, int* argc, char** argv);
>   void ProcessLine(Text_t* line) {
>     cout << "Your input, master: " << line << endl;
>     TRint::ProcessLine(line);
>   };
>   void HandleTermInput() {
>     cout << "HTI: " << Argc() <<endl;
>     cout << "HTI: " << GetIdleCommand() <<endl;
>     TRint::HandleTermInput();
>   }
> };
> TMyRint::TMyRint(char* appClassName, int* argc, char** argv) :
>    TRint(appClassName, argc, argv) {}
> 
> //---------------------------------------------------------
> int main(int argc, char *argv[]) {
>   int noArgsForRint = 1;
>   TMyRint myRint("app", &noArgsForRint, argv);
>   myRint.Run();
>   return 0;
> }
> 
> ==============================================================
> 
> Thanks a lot for your time!
> Best Wishes
> Selim
> 
> --
> Selim Issever | Tel: 040 8998-2843    +- Talk sense to a fool and he --
> DESY-F15      | Fax: 040 8998-4033    +- calls you foolish. -----------
> Notkestr. 85  | selim.issever@desy.de +--------------  Euripides ------
> 22603 Hamburg/Germany   |  http://www.physik.uni-dortmund.de/~issevers

-- 
Org:    CERN, European Laboratory for Particle Physics.
Mail:   1211 Geneve 23, Switzerland
E-Mail: Fons.Rademakers@cern.ch              Phone: +41 22 7679248
WWW:    http://root.cern.ch/~rdm/            Fax:   +41 22 7677910



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:42 MET