FACT++  1.0
bool Readline::Process ( const std::string &  str)
virtual

Reimplemented in RemoteControl< Console >, RemoteControl< ConsoleStream >, RemoteControl< Shell >, LocalControl< Console >, LocalControl< Shell >, LocalControl< ConsoleStream >, ChatClient< Console >, ChatClient< Shell >, Console, and Shell.

Definition at line 1094 of file Readline.cc.

References ClearHistory(), data, DumpFunctions(), DumpFunmap(), DumpHistory(), DumpVariables(), Execute(), ExecuteShellCommand(), fLabel, fScript, fSection, PrintCommands(), PrintGeneralHelp(), PrintKeyBindings(), PrintReadlineError(), save(), SetSection(), Tools::Split(), and v0.

Referenced by Console::GetStreamIn(), PreProcess(), Shell::Process(), Console::Process(), and UpdatePrompt().

1095 {
1096  // ----------- Common commands -------------
1097 
1098  if (str.substr(0, 3)==".w ")
1099  {
1100  usleep(stoi(str.substr(3))*1000);
1101  return true;
1102  }
1103 
1104  if (str.substr(0, 3)==".x ")
1105  {
1106  string opt(str.substr(3));
1107 
1108  map<string,string> data = Tools::Split(opt);
1109  if (opt.size()==0)
1110  {
1111  if (data.size()==0)
1112  PrintReadlineError("Filename missing.");
1113  else
1114  PrintReadlineError("Equal sign missing in argument '"+data.begin()->first+"'");
1115 
1116  return true;
1117  }
1118 
1119  const string save = fScript;
1120  const int save_sec = fSection;
1121  Execute(opt, data);
1122  fScript = save;
1123  if (save_sec!=-4)
1124  {
1125  fSection = save_sec;
1126  SetSection(save_sec);
1127  }
1128 
1129  return true;
1130  }
1131 
1132  if (str.substr(0, 2)==".!")
1133  {
1134  ExecuteShellCommand(str.substr(2));
1135  return true;
1136  }
1137 
1138  if (str.substr(0, 4)==".gt ")
1139  {
1140  istringstream in(str.substr(4));
1141 
1142  float v0, v1;
1143  int label;
1144 
1145  in >> v0 >> v1 >> label;
1146  if (in.fail())
1147  {
1148  PrintReadlineError("Couldn't parse '"+str+"'");
1149  fLabel = -2;
1150  return true;
1151  }
1152 
1153  if (v0 > v1)
1154  fLabel = label;
1155 
1156  return true;
1157  }
1158 
1159  if (str.substr(0, 4)==".lt ")
1160  {
1161  istringstream in(str.substr(4));
1162 
1163  float v0, v1;
1164  int label;
1165 
1166  in >> v0 >> v1 >> label;
1167  if (in.fail())
1168  {
1169  PrintReadlineError("Couldn't parse '"+str+"'");
1170  fLabel = -2;
1171  return true;
1172  }
1173 
1174  if (v0 < v1)
1175  fLabel = label;
1176 
1177  return true;
1178  }
1179 
1180  if (str.substr(0, 4)==".eq ")
1181  {
1182  istringstream in(str.substr(4));
1183 
1184  int v0, v1, label;
1185 
1186  in >> v0 >> v1 >> label;
1187  if (in.fail())
1188  {
1189  PrintReadlineError("Couldn't parse '"+str+"'");
1190  fLabel = -2;
1191  return true;
1192  }
1193 
1194  if (v0==v1)
1195  fLabel = label;
1196 
1197  return true;
1198  }
1199 
1200 
1201  // ----------- Readline static -------------
1202 
1203  if (str=="clear")
1204  return ClearHistory();
1205 
1206  if (str=="lh" || str=="history")
1207  return DumpHistory();
1208 
1209  if (str=="v" || str=="variables")
1210  return DumpVariables();
1211 
1212  if (str=="f" || str=="functions")
1213  return DumpFunctions();
1214 
1215  if (str=="m" || str=="funmap")
1216  return DumpFunmap();
1217 
1218  // ---------- Readline virtual -------------
1219 
1220  if (str=="h" || str=="help")
1221  return PrintGeneralHelp();
1222 
1223  if (str=="c" || str=="commands")
1224  return PrintCommands();
1225 
1226  if (str=="k" || str=="keylist")
1227  return PrintKeyBindings();
1228 
1229  return false;
1230 }
Return to feeserver c CVS log Up to[MAIN] dcscvs FeeServer feeserver src Wed FeeServer_v0 v0 FeeServer_v0 v0 FeeServer_v0 v0 FeeServer_v0 v0 FeeServer_v0 v0 FeeServer_v0 v0
Definition: feeserver.c:5
virtual bool PrintCommands()
Definition: Readline.cc:962
static bool DumpHistory()
Definition: Readline.cc:897
char str[80]
Definition: test_client.c:7
virtual void PrintReadlineError(const std::string &str)
Definition: Readline.cc:1553
virtual void SetSection(int)
Definition: Readline.h:68
virtual bool ExecuteShellCommand(const std::string &cmd)
Definition: Readline.cc:920
static bool DumpFunctions()
Definition: Readline.cc:687
int Execute(const std::string &fname, const std::map< std::string, std::string > &args=std::map< std::string, std::string >())
Definition: Readline.cc:1446
std::map< std::string, std::string > Split(std::string &, bool=false)
Definition: tools.cc:230
int fSection
Definition: Readline.h:30
static std::string fScript
Definition: Readline.h:48
float data[4 *1440]
static bool ClearHistory()
Definition: Readline.cc:882
function save()
Definition: index.js:502
static bool DumpFunmap()
Definition: Readline.cc:704
static bool DumpVariables()
Definition: Readline.cc:667
int fLabel
Definition: Readline.h:31
virtual bool PrintGeneralHelp()
Definition: Readline.cc:983
virtual bool PrintKeyBindings()
Definition: Readline.cc:1025

+ Here is the call graph for this function:

+ Here is the caller graph for this function: