46 #include "visp/vpConfig.h"
49 #ifndef DOXYGEN_SHOULD_SKIP_THIS
50 #include <visp/vpMy.h>
51 #include <visp/vpArit.h>
52 #include <visp/vpBound.h>
53 #include <visp/vpToken.h>
54 #include <visp/vpSkipio.h>
55 #include <visp/vpLex.h>
60 void fscanf_Point3f_list (Point3f_list *);
61 void fscanf_Face_list (Face_list *);
68 void fscanf_Bound (Bound *bp)
72 skip_keyword (T_TYPE,
"bound: keyword \"type\" expected");
74 lexerr (
"start",
"bound_type: boolean expected (0=FALSE|~0=TRUE)", NULL);
75 bp->is_polygonal = (myint ? 1 : 0);
79 skip_keyword (T_POINT_LIST,
"bound: keyword \"point_list\" expected");
80 pusherr (
"bound_point_list: ");
81 fscanf_Point3f_list (&bp->point);
86 skip_keyword (T_FACE_LIST,
"bound: keyword \"face_list\" expected");
87 pusherr (
"bound_face_list: ");
88 fscanf_Face_list (&bp->face);
97 void fscanf_Face_list (Face_list *lp)
99 static char proc_name[] =
"fscanf_Face_list";
108 lexerr (
"start",
"integer expected (number of faces)", NULL);
109 lp->nbr = (Index) myint;
115 else if ((lp->ptr = (Face *) malloc (lp->nbr * sizeof (Face)))
125 for (; fp < fend; fp++) {
126 Vertex_list *lp = &fp->vertex;
133 lexerr (
"start",
"boolean expected (0=FALSE|~0=TRUE)", NULL);
134 fp->is_polygonal = (myint ? 1 : 0);
139 lexerr (
"start",
"integer expected (number of vertices)", NULL);
140 lp->nbr = (Index) myint;
144 if (lp->nbr <= DEFAULT_VSIZE)
146 else if ((lp->ptr = (Index *) malloc (lp->nbr * sizeof (Index)))
156 for (; vp < vend; *vp++ = (Index) myint)
158 lexerr (
"start",
"integer expected (index of points 3D)", NULL);
167 void fscanf_Point3f_list (Point3f_list *lp)
169 static const char proc_name[] =
"fscanf_Point3f_list";
171 static const char *err_tbl[] = {
172 "float expected (coordinate ",
181 lexerr (
"start",
"integer expected (number of points 3D)", NULL);
182 lp->nbr = (Index) myint;
188 else if ((lp->ptr = (Point3f *) malloc (lp->nbr * sizeof (Point3f)))
198 for (; pp < pend; pp++) {
201 if ((t = lex ()) != T_FLOAT && t != T_INT)
202 lexerr (
"start", err_tbl[0],
"X", err_tbl[1], NULL);
204 pp->x = (t == T_INT) ? (
float) myint : myfloat;
206 if ((t = lex ()) != T_FLOAT && t != T_INT)
207 lexerr (
"start", err_tbl[0],
"Y", err_tbl[1], NULL);
209 pp->y = (t == T_INT) ? (
float) myint : myfloat;
211 if ((t = lex ()) != T_FLOAT && t != T_INT)
212 lexerr (
"start", err_tbl[0],
"Z", err_tbl[1], NULL);
214 pp->z = (t == T_INT) ? (
float) myint : myfloat;