Ver Mensaje Individual
  #3 (permalink)  
Antiguo 29/05/2011, 10:56
tawky
 
Fecha de Ingreso: noviembre-2009
Mensajes: 36
Antigüedad: 15 años
Puntos: 0
Respuesta: Ejecuta en AMD pero no en Intel

No uso asm.

Ahora mismo no tengo los pc intel delante, pero el error lo da que no sabe verificar si es un numero o no en la funcion read.


int _file_ply::next_token()
{
char *p1,*p2;
char Aux_token[100];
int Num_char;

do
{
if (strlen(Buffer)==0)
{
if (read_line()==-1) return(-1);
while (Buffer[0]=='#') if (read_line()==-1) return(-1);
}
p1=Buffer;
while ((*p1==' ' || *p1=='\t') && *p1!='\n') p1++;
p2=p1;
while (*p2!=' ' && *p2!='\t' && *p2!='\n') p2++;
Num_char=p2-p1;
if (Num_char>99)
{
error("number of characters for token is too long\n");
return(-1);
}
if (Num_char!=0)
{
strncpy(Aux_token,p1,Num_char);
Aux_token[Num_char]='\0';
}
if (*p2=='\n') Buffer[0]='\0';
else strcpy(Buffer,p2);
}
while (Num_char==0);

if (!is_number(Aux_token))
{
//printf("es un numero %s\n",Aux_token);
Yylval.Real=atof(Aux_token);
return((int)_tokens(NUMBER));
}
else
{
//printf("es texto %s\n",Aux_token);
Yylval.Text=Aux_token;
return(search_token(Aux_token));
}
}

//************************************************** ****************************
//
//************************************************** ****************************

int _file_ply::
read(vector<float> &Vertices,vector<int> &Faces)
{
int Next_token,i,j;
int Num_vertices,Num_faces;

Num_vertices = Num_faces = -1;

if (File!=NULL)
{
Next_token=next_token();
if (Next_token==PLY)
{
Next_token=next_token();
if (Next_token==FORMAT)
{
Next_token=next_token();
if (Next_token==ASCII)
{
Next_token=next_token();
if (Next_token==NUMBER)
{// head
Next_token=next_token();
while (Next_token!=END_HEADER)
{
if (Next_token==ELEMENT)
{
Next_token=next_token();
switch (Next_token)
{
case VERTEX:
Next_token=next_token();
if (Next_token==NUMBER)
{
Num_vertices=(int) Yylval.Real;
Vertices.resize(Num_vertices*3);
}
else error("no number of vertex");
break;
case FACE:
Next_token=next_token();
if (Next_token==NUMBER)
{
Num_faces=(int) Yylval.Real;
Faces.resize(Num_faces*3);
}
else error("no number of faces");
break;
default:
error("element type not supported");
break;
}
}
Next_token=next_token();
}
// data
// vertices data
for (i=0;i<Num_vertices;i++)
{// vertices data
for (j=0;j<3;j++)
{
Next_token=next_token();
if (Next_token==NUMBER)
{
Vertices[i*3+j]=Yylval.Real;
}
else error("no number for coordinate");
}
}
// faces data
for (i=0;i<Num_faces;i++)
{
Next_token=next_token();
if (Next_token==NUMBER)
{
if ((int)Yylval.Real!=3) {
printf("Face=%d Token=%s\n",i,Yylval.Text.c_str());
error("only triangles supported");;
}
}
else error("no number of vertex indices");
for (j=0;j<3;j++)
{
Next_token=next_token();
if (Next_token==NUMBER)
{
Faces[i*3+j]=(int)Yylval.Real;
}
else error("no number for coordinate");
}
}
printf("File readed\n");
}
else error("no format number");
}
else error("no ascii format");
}
else error("no format word");
}
else error("this is not a ply file");
return(0);
}
else
{
error("there is not a ply file open");
return(-1);
}
}