FACT++  1.0
void Readline::Run ( const char *  prompt = 0)
virtual

This implements a loop over readline calls. A prompt to issue can be given. If it is NULL, the prompt is retrieved from GetUpdatePrompt(). It is updated regularly by means of calls to GetUpdatePrompt() from EventHook(). If Prompt() returns with "quit" or ".q" the loop is exited. If ".qqq" is entered exit(-1) is called. In case of ".qqqqqq" abort(). Both ways to exit the program are not recommended. Empty inputs are ignored. After that Process() with the returned string is called. If Process returns true the input is not counted and not added to the history, otherwise the line counter is increased and the input is added to the history.

Parameters
promptThe prompt to be issued or NULL if GetUPdatePrompt should be used instead.

Reimplemented in Console, Shell, and ConsoleStream.

Definition at line 1406 of file Readline.cc.

References fLine, GetUpdatePrompt(), ProcessLine(), Prompt(), and str.

Referenced by GetUpdatePrompt(), Shell::Run(), and Console::Run().

1407 {
1408  fLine = 0;
1409  while (1)
1410  {
1411  // Before we start we have to make sure that the
1412  // screen looks like and is ordered like expected.
1413  const string str = Prompt(prompt?prompt:GetUpdatePrompt());
1414  if (str.empty())
1415  continue;
1416 
1417  if (str=="quit" || str==".q")
1418  break;
1419 
1420  if (str==".qqq")
1421  exit(128);
1422 
1423  if (str==".qqqqqq")
1424  abort();
1425 
1426  ProcessLine(str);
1427  }
1428 }
char str[80]
Definition: test_client.c:7
virtual std::string GetUpdatePrompt() const
Definition: Readline.h:102
virtual std::string Prompt(const std::string &prompt)
Definition: Readline.cc:1281
void ProcessLine(const std::string &str)
Definition: Readline.cc:1370
int fLine
Last line adde to history.
Definition: Readline.h:29

+ Here is the call graph for this function:

+ Here is the caller graph for this function: