Changeset 13771
- Timestamp:
- 05/18/12 10:07:21 (12 years ago)
- Location:
- trunk/FACT++/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/Console.cc
r12960 r13771 48 48 fLogO.Display(); 49 49 fLogI.Display(); 50 } 51 52 void Console::PrintReadlineError(const std::string &str) 53 { 54 fLogI << kRed << str << endl; 50 55 } 51 56 … … 216 221 } 217 222 223 void ConsoleStream::PrintReadlineError(const std::string &str) 224 { 225 fLogO << kRed << str << endl; 226 } 227 218 228 // -------------------------------------------------------------------------- 219 229 // -
trunk/FACT++/src/Console.h
r11580 r13771 9 9 private: 10 10 WindowLog fLogO; 11 12 void PrintReadlineError(const std::string &str); 11 13 12 14 public: … … 34 36 35 37 bool fContinous; 38 39 void PrintReadlineError(const std::string &str); 40 36 41 public: 37 42 Console(const char *name); -
trunk/FACT++/src/Readline.cc
r13744 r13771 956 956 fprintf(rl_outstream, " .x file:N .. Execute a script of commands, start at label N\n"); 957 957 fprintf(rl_outstream, " .j N Forward jump to label N\n"); 958 fprintf(rl_outstream, " .lt f0 f1 N If float f0 lower than float f1, jump to label N\n"); 959 fprintf(rl_outstream, " .gt f0 f1 N If float f0 greater than float f1, jump to label N\n"); 960 fprintf(rl_outstream, " .eq i0 i1 N If int i0 equal int i1, jump to label N\n"); 958 961 fprintf(rl_outstream, " : N Defines a label (N=number)\n"); 959 962 fprintf(rl_outstream, " # comment Ignored\n"); … … 1061 1064 map<string,string> data = Tools::Split(opt); 1062 1065 if (opt.size()==0) 1063 return false; 1064 1065 /* 1066 if (fData.size()==0) 1067 // File name missing ... 1066 { 1067 if (data.size()==0) 1068 PrintReadlineError("Filename missing."); 1068 1069 else 1069 // "Equal sign missing in argument '"+data.begin()->first+"'" 1070 */ 1071 1072 Execute(opt, data); 1073 return true; 1070 PrintReadlineError("Equal sign missing in argument '"+data.begin()->first+"'"); 1071 1072 return true; 1073 } 1074 1075 Execute(opt, data); 1076 return true; 1074 1077 } 1075 1078 … … 1079 1082 return true; 1080 1083 } 1084 1085 if (str.substr(0, 4)==".gt ") 1086 { 1087 istringstream in(str.substr(4)); 1088 1089 float v0, v1; 1090 int label; 1091 1092 in >> v0 >> v1 >> label; 1093 if (in.fail()) 1094 { 1095 PrintReadlineError("Couldn't parse '"+str+"'"); 1096 fLabel = -2; 1097 return true; 1098 } 1099 1100 if (v0 > v1) 1101 fLabel = label; 1102 1103 return true; 1104 } 1105 1106 if (str.substr(0, 4)==".lt ") 1107 { 1108 istringstream in(str.substr(4)); 1109 1110 float v0, v1; 1111 int label; 1112 1113 in >> v0 >> v1 >> label; 1114 if (in.fail()) 1115 { 1116 PrintReadlineError("Couldn't parse '"+str+"'"); 1117 fLabel = -2; 1118 return true; 1119 } 1120 1121 if (v0 < v1) 1122 fLabel = label; 1123 1124 return true; 1125 } 1126 1127 if (str.substr(0, 4)==".eq ") 1128 { 1129 istringstream in(str.substr(4)); 1130 1131 int v0, v1, label; 1132 1133 in >> v0 >> v1 >> label; 1134 if (in.fail()) 1135 { 1136 PrintReadlineError("Couldn't parse '"+str+"'"); 1137 fLabel = -2; 1138 return true; 1139 } 1140 1141 if (v0==v1) 1142 fLabel = label; 1143 1144 return true; 1145 } 1146 1081 1147 1082 1148 // ----------- Readline static ------------- … … 1354 1420 return rl_done==1 && rl_pending_input==4; 1355 1421 }; 1422 1423 void Readline::PrintReadlineError(const std::string &str) 1424 { 1425 fprintf(rl_outstream, "%s\n", str.c_str()); 1426 } -
trunk/FACT++/src/Readline.h
r13731 r13771 30 30 static std::string fScript; 31 31 32 // Static member function which are used to adapt readline to ncurses32 /// Static member function which are used to adapt readline to ncurses 33 33 static int rl_ncurses_getc(FILE *); 34 34 static int rl_ncurses_startup(); … … 41 41 42 42 protected: 43 // The non static implementations of the callback funtions above43 /// The non static implementations of the callback funtions above 44 44 virtual int Getc(FILE *); 45 45 virtual void Startup(); … … 49 49 virtual void CompletionDisplay(char **matches, int num, int max); 50 50 51 // Functions dealing with auto completion51 /// Functions dealing with auto completion 52 52 virtual char *Complete(const char* text, int state); 53 53 virtual char **Completion(const char *text, int start, int end); … … 58 58 char **Complete(const std::vector<std::string> &v, const char *text); 59 59 60 /// 60 61 virtual void SetSection(int) { } 62 virtual void PrintReadlineError(const std::string &str); 61 63 62 64 public: -
trunk/FACT++/src/ReadlineColor.cc
r13745 r13771 163 163 out << kBold << " .x file:N " << kReset << "Execute a script of commands, start at label N\n"; 164 164 out << kBold << " .j N " << kReset << "Forward jump to label N\n"; 165 out << kBold << " .lt f0 f1 N " << kReset << "If float f0 lower than float f1, jump to label N\n"; 166 out << kBold << " .gt f0 f1 N " << kReset << "If float f0 greater than float f1, jump to label N\n"; 167 out << kBold << " .eq i0 i1 N " << kReset << "If int i0 equal int i1, jump to label N\n"; 165 168 out << kBold << " : N " << kReset << "Defines a label (N=number)\n"; 166 169 out << kBold << " # comment " << kReset << "Ignored\n";
Note:
See TracChangeset
for help on using the changeset viewer.