Changeset 13897 for trunk/FACT++
- Timestamp:
- 05/25/12 23:07:11 (13 years ago)
- Location:
- trunk/FACT++/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/LocalControl.h
r13715 r13897 121 121 122 122 const int target = stoi(str.substr(3)); 123 while (fStateMachine->GetCurrentState()!=target && timeout>Time() )123 while (fStateMachine->GetCurrentState()!=target && timeout>Time() && !T::IsScriptStopped()) 124 124 usleep(1); 125 125 126 if (fStateMachine->GetCurrentState()!=target) 126 if (fStateMachine->GetCurrentState()==target) 127 return true; 128 129 int label = -1; 130 in >> label; 131 if (in.fail() && !in.eof()) 127 132 { 128 int label = -1;129 in >> label;130 T::SetLabel(label);133 lout << kRed << "Invalid label in '" << str.substr(3) << "'" << endl; 134 T::StopScript(); 135 return true; 131 136 } 137 T::SetLabel(label); 138 132 139 return true; 133 140 } -
trunk/FACT++/src/Readline.cc
r13771 r13897 71 71 72 72 Readline *Readline::This = 0; 73 int Readline::fLabel = -3;73 bool Readline::fStopScript = false; 74 74 std::string Readline::fScript; 75 75 … … 98 98 // 99 99 Readline::Readline(const char *prgname) : 100 fMaxLines(500), fLine(0), f Completion(0)100 fMaxLines(500), fLine(0), fScriptDepth(0), fCompletion(0) 101 101 { 102 102 if (This) … … 1011 1011 try 1012 1012 { 1013 const int section = stoi(str.substr(1));1014 SetSection( section);1015 1016 if (fLabel!= section)1013 fSection = stoi(str.substr(1)); 1014 SetSection(fSection); 1015 1016 if (fLabel!=fSection) 1017 1017 return true; 1018 1018 } … … 1073 1073 } 1074 1074 1075 const int save = fSection; 1075 1076 Execute(opt, data); 1077 fSection = save; 1078 SetSection(save); 1079 1076 1080 return true; 1077 1081 } … … 1335 1339 fScript = name; 1336 1340 1341 fSection = -2; 1337 1342 SetSection(-2); 1338 1343 fLabel = -1; … … 1348 1353 if (!fin) 1349 1354 { 1355 fSection = -3; 1350 1356 SetSection(-3); 1351 1357 return -1; … … 1357 1363 fCommandLog << ")" << endl; 1358 1364 1365 if (fScriptDepth++==0) 1366 fStopScript = false; 1367 1368 fSection = -1; 1359 1369 SetSection(-1); 1360 1370 … … 1362 1372 1363 1373 string buffer; 1364 while (getline(fin, buffer, '\n') && fLabel>-2)1374 while (getline(fin, buffer, '\n') && !fStopScript) 1365 1375 { 1366 1376 buffer = Tools::Trim(buffer); … … 1389 1399 1390 1400 fLabel = -1; 1401 fSection = -3; 1391 1402 SetSection(-3); 1403 1404 if (--fScriptDepth==0) 1405 fStopScript = false; 1392 1406 1393 1407 fCommandLog << "# " << Time() << " - " << name << " (FINISHED)" << endl; -
trunk/FACT++/src/RemoteControl.h
r13838 r13897 222 222 T::GetStreamOut().SetBacklog(false); 223 223 T::GetStreamOut().SetNullOutput(false); 224 while (l->second->GetState()!=state && timeout>Time() && T::GetLabel()!=-2)224 while (l->second->GetState()!=state && timeout>Time() && !T::IsScriptStopped()) 225 225 usleep(1); 226 226 T::GetStreamOut().SetNullOutput(true); 227 227 T::GetStreamOut().SetBacklog(true); 228 228 229 if ( T::GetLabel()!=-2 && l->second->GetState()!=state)230 {231 int label = -1; 232 in >> label;233 if (in.fail() && !in.eof())234 {235 lout << kRed << "Invalid label in '" << str.substr(3) << "'" << endl;236 label = -2;237 }238 else239 T::SetLabel(label);240 }229 if (l->second->GetState()==state) 230 return true; 231 232 int label = -1; 233 in >> label; 234 if (in.fail() && !in.eof()) 235 { 236 lout << kRed << "Invalid label in '" << str.substr(3) << "'" << endl; 237 T::StopScript(); 238 return true; 239 } 240 T::SetLabel(label); 241 241 242 242 return true; -
trunk/FACT++/src/dimctrl.cc
r13874 r13897 107 107 108 108 Debug(msg); 109 Readline::S etLabel(-2);109 Readline::StopScript(); 110 110 } 111 111 … … 256 256 } 257 257 258 void Stop(int stop=0) { fStop = stop; Readline::S etLabel(0); }258 void Stop(int stop=0) { fStop = stop; Readline::StopScript(); } 259 259 int Run(bool) 260 260 {
Note:
See TracChangeset
for help on using the changeset viewer.