2 //////////////////////////////////////////////////////////////////////////////////
3 // This program is free software: you can redistribute it and/or modify //
4 // it under the terms of the version 3 of the GNU General Public License //
5 // as published by the Free Software Foundation. //
7 // This program is distributed in the hope that it will be useful, but //
8 // WITHOUT ANY WARRANTY; without even the implied warranty of //
9 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU //
10 // General Public License for more details. //
12 // You should have received a copy of the GNU General Public License //
13 // along with this program. If not, see <http://www.gnu.org/licenses/>. //
15 // Written by Francois Fleuret //
16 // (C) Ecole Polytechnique Federale de Lausanne //
17 // Contact <pom@epfl.ch> for comments & bug reports //
18 //////////////////////////////////////////////////////////////////////////////////
27 char *next_word(char *buffer, char *r, int buffer_size) {
31 while((*r == ' ') || (*r == '\t') || (*r == ',')) r++;
34 while((*r != '"') && (*r != '\0') &&
35 (s<buffer+buffer_size-1))
39 while((*r != '\r') && (*r != '\n') && (*r != '\0') &&
40 (*r != '\t') && (*r != ' ') && (*r != ',')) {
41 if(s == buffer + buffer_size) {
42 cerr << "Buffer overflow in next_word." << endl;
49 while((*r == ' ') || (*r == '\t') || (*r == ',')) r++;
50 if((*r == '\0') || (*r=='\r') || (*r=='\n')) r = 0;
57 int pomsprintf(char *buffer, int buffer_length, char *format, int n_camera, int n_frame, int n_iteration) {
58 char *s = buffer, *t = format;
60 while(*t && s < buffer + buffer_length - 1) {
78 cerr << "Unknown format type in " << format << "." << endl;
82 s += snprintf(s, buffer + buffer_length - s, "%d", v);
83 } else *(s++) = *(t++);