Changeset 36834 for trunk/psModules/src/extras/pmVisual.c
- Timestamp:
- Jun 7, 2014, 6:37:32 AM (12 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/extras/pmVisual.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/extras/pmVisual.c
r36623 r36834 162 162 163 163 164 // ask the user to continue or not. give up after 2 seconds. 165 bool pmVisualAskUserOrDump(bool *plotFlag, bool *dumpData) 166 { 167 struct timeval timeout; 168 fd_set fdSet; 169 int status; 170 171 if (dumpData) *dumpData = false; 172 173 char key[10]; 174 if (plotFlag && dumpData) { 175 fprintf (stderr, "[p]ause? [c]ontinue? [s]kip the rest of these plots? [d]ump the data? [a]bort all visual plots? (c) "); 176 } 177 if (plotFlag && !dumpData) { 178 fprintf (stderr, "[p]ause? [c]ontinue? [s]kip the rest of these plots? [a]bort all visual plots? (c) "); 179 } 180 if (!plotFlag && dumpData) { 181 fprintf (stderr, "[p]ause? [c]ontinue? [d]ump the data? [a]bort all visual plots? (c) "); 182 } 183 if (!plotFlag && !dumpData) { 184 fprintf (stderr, "[p]ause? [c]ontinue? [a]bort all visual plots? (c) "); 185 } 186 187 /* Wait up to 1.0 second for a response, then continue */ 188 timeout.tv_sec = 10; 189 timeout.tv_usec = 0; 190 191 FD_ZERO (&fdSet); 192 FD_SET (STDIN_FILENO, &fdSet); 193 194 status = select (1, &fdSet, NULL, NULL, &timeout); 195 if (status <= 0) { 196 fprintf (stderr, "\n"); 197 return true; // if no data, give up 198 } 199 200 while (true) { 201 if (!fgets(key, 8, stdin)) { 202 psWarning("Unable to read option"); 203 } 204 switch (key[0]) { 205 case 's': 206 if (plotFlag) *plotFlag = false; 207 return true; 208 case 'd': 209 if (dumpData) *dumpData = true; 210 return true; 211 case 'a': 212 isVisual = false; 213 return true; 214 case 'c': 215 case '\n': 216 return true; 217 default: 218 break; 219 } 220 221 if (plotFlag && dumpData) { 222 fprintf (stderr, "[p]ause? [c]ontinue? [s]kip the rest of these plots? [d]ump the data? [a]bort all visual plots? (c) "); 223 } 224 if (plotFlag && !dumpData) { 225 fprintf (stderr, "[p]ause? [c]ontinue? [s]kip the rest of these plots? [a]bort all visual plots? (c) "); 226 } 227 if (!plotFlag && dumpData) { 228 fprintf (stderr, "[p]ause? [c]ontinue? [d]ump the data? [a]bort all visual plots? (c) "); 229 } 230 if (!plotFlag && !dumpData) { 231 fprintf (stderr, "[p]ause? [c]ontinue? [a]bort all visual plots? (c) "); 232 } 233 } 234 return true; 235 } 236 164 237 bool pmVisualImStats(psImage *image, double *mean, double *stdev, double *min, double *max) { 165 238
Note:
See TracChangeset
for help on using the changeset viewer.
