43 #include <visp3/core/vpConfig.h> 45 #ifndef DOXYGEN_SHOULD_SKIP_THIS 47 #include "vpBoundio.h" 62 void fscanf_Bound(Bound *bp)
66 skip_keyword(T_TYPE,
"bound: keyword \"type\" expected");
68 lexerr(
"start",
"bound_type: boolean expected (0=FALSE|~0=TRUE)", NULL);
69 bp->is_polygonal = (myint ? 1 : 0);
73 skip_keyword(T_POINT_LIST,
"bound: keyword \"point_list\" expected");
74 pusherr(
"bound_point_list: ");
75 fscanf_Point3f_list(&bp->point);
80 skip_keyword(T_FACE_LIST,
"bound: keyword \"face_list\" expected");
81 pusherr(
"bound_face_list: ");
82 fscanf_Face_list(&bp->face);
91 void fscanf_Face_list(Face_list *lp)
99 lexerr(
"start",
"integer expected (number of faces)", NULL);
100 lp->nbr = (Index)myint;
106 else if ((lp->ptr = (Face *)malloc(lp->nbr *
sizeof(Face))) == NULL) {
107 static char proc_name[] =
"fscanf_Face_list";
116 for (; fp < fend; fp++) {
117 Vertex_list *vlp = &fp->vertex;
124 lexerr(
"start",
"boolean expected (0=FALSE|~0=TRUE)", NULL);
125 fp->is_polygonal = (myint ? 1 : 0);
130 lexerr(
"start",
"integer expected (number of vertices)", NULL);
131 vlp->nbr = (Index)myint;
135 if (vlp->nbr <= DEFAULT_VSIZE)
137 else if ((vlp->ptr = (Index *)malloc(vlp->nbr *
sizeof(Index))) == NULL) {
138 static char proc_name[] =
"fscanf_Face_list";
146 vend = vp + vlp->nbr;
147 for (; vp < vend; *vp++ = (Index)myint)
149 lexerr(
"start",
"integer expected (index of points 3D)", NULL);
158 void fscanf_Point3f_list(Point3f_list *lp)
160 static const char *err_tbl[] = {
"float expected (coordinate ",
" of point)"};
167 lexerr(
"start",
"integer expected (number of points 3D)", NULL);
168 lp->nbr = (Index)myint;
174 else if ((lp->ptr = (Point3f *)malloc(lp->nbr *
sizeof(Point3f))) == NULL) {
175 static const char proc_name[] =
"fscanf_Point3f_list";
184 for (; pp < pend; pp++) {
187 if ((t = lex()) != T_FLOAT && t != T_INT)
188 lexerr(
"start", err_tbl[0],
"X", err_tbl[1], NULL);
190 pp->x = (t == T_INT) ? (
float)myint : myfloat;
192 if ((t = lex()) != T_FLOAT && t != T_INT)
193 lexerr(
"start", err_tbl[0],
"Y", err_tbl[1], NULL);
195 pp->y = (t == T_INT) ? (
float)myint : myfloat;
197 if ((t = lex()) != T_FLOAT && t != T_INT)
198 lexerr(
"start", err_tbl[0],
"Z", err_tbl[1], NULL);
200 pp->z = (t == T_INT) ? (
float)myint : myfloat;