Commit cb91e095 authored by Wayne Stambaugh's avatar Wayne Stambaugh

Coding policy fixes and comment out debugging output.

parent 5f70ec63
...@@ -28,65 +28,63 @@ ...@@ -28,65 +28,63 @@
#include "vrml_aux.h" #include "vrml_aux.h"
char SkipGetChar ( FILE* File ) char SkipGetChar( FILE* File )
{ {
char c; char c;
bool re_parse; bool re_parse;
if( (c = fgetc( File )) == EOF ) if( ( c = fgetc( File ) ) == EOF )
{ {
//DBG( printf( "EOF\n" ) ); // DBG( printf( "EOF\n" ) );
return EOF; return EOF;
} }
//DBG( printf( "c %c 0x%02X\n", c, c ) ); // DBG( printf( "c %c 0x%02X\n", c, c ) );
do do
{ {
re_parse = false; re_parse = false;
if ((c == ' ') || (c == '\t') || (c == '{') || (c == '[')) if( (c == ' ') || (c == '\t') || (c == '{') || (c == '[') )
{ {
//DBG( printf( "Skipping space \\t or { or [\n" ) ); // DBG( printf( "Skipping space \\t or { or [\n" ) );
do do
{ {
if( (c = fgetc( File )) == EOF ) if( ( c = fgetc( File ) ) == EOF )
{ {
//DBG( printf( "EOF\n" ) ); // DBG( printf( "EOF\n" ) );
return EOF; return EOF;
} }
} } while( (c == ' ') || (c == '\t') || (c == '{') || (c == '[') );
while((c == ' ') || (c == '\t') || (c == '{') || (c == '['));
} }
if ((c == '#') || (c == '\n') || (c == '\r') || (c == 0) || (c == ',')) if( (c == '#') || (c == '\n') || (c == '\r') || (c == 0) || (c == ',') )
{ {
if (c == '#') if( c == '#' )
{ {
//DBG( printf( "Skipping # \\n or \\r or 0, 0x%02X\n", c ) ); // DBG( printf( "Skipping # \\n or \\r or 0, 0x%02X\n", c ) );
do do
{ {
if( (c = fgetc( File )) == EOF ) if( ( c = fgetc( File ) ) == EOF )
{ {
//DBG( printf( "EOF\n" ) ); // DBG( printf( "EOF\n" ) );
return EOF; return EOF;
} }
} } while( (c != '\n') && (c != '\r') && (c != 0) && (c != ',') );
while((c != '\n') && (c != '\r') && (c != 0) && (c != ','));
} }
else else
{ {
if( (c = fgetc( File )) == EOF ) if( ( c = fgetc( File ) ) == EOF )
{ {
//DBG( printf( "EOF\n" ) ); // DBG( printf( "EOF\n" ) );
return EOF; return EOF;
} }
} }
re_parse = true; re_parse = true;
} }
}while(re_parse == true); } while( re_parse == true );
return c; return c;
} }
...@@ -94,35 +92,38 @@ char SkipGetChar ( FILE* File ) ...@@ -94,35 +92,38 @@ char SkipGetChar ( FILE* File )
char* GetNextTag( FILE* File, char* tag ) char* GetNextTag( FILE* File, char* tag )
{ {
char c = SkipGetChar( File ); char c = SkipGetChar( File );
if (c == EOF) if( c == EOF )
{ {
return NULL; return NULL;
} }
tag[0] = c; tag[0] = c;
tag[1] = 0; tag[1] = 0;
//DBG( printf( "tag[0] %c\n", tag[0] ) );
// DBG( printf( "tag[0] %c\n", tag[0] ) );
if( (c != '}') && (c != ']') ) if( (c != '}') && (c != ']') )
{ {
char *dst = &tag[1]; char* dst = &tag[1];
while( fscanf( File, "%c", dst) )
while( fscanf( File, "%c", dst ) )
{ {
if( (*dst == ' ') || (*dst == '[') || (*dst == '{') || if( (*dst == ' ') || (*dst == '[') || (*dst == '{')
(*dst == '\t') || (*dst == '\n')|| (*dst == '\r') ) || (*dst == '\t') || (*dst == '\n')|| (*dst == '\r') )
{ {
*dst = 0; *dst = 0;
break; break;
} }
dst++; dst++;
} }
//DBG( printf( "tag %s\n", tag ) ); // DBG( printf( "tag %s\n", tag ) );
c = SkipGetChar( File ); c = SkipGetChar( File );
if (c != EOF) if( c != EOF )
{ {
// Puts again the read char in the buffer // Puts again the read char in the buffer
ungetc( c, File ); ungetc( c, File );
...@@ -133,40 +134,44 @@ char* GetNextTag( FILE* File, char* tag ) ...@@ -133,40 +134,44 @@ char* GetNextTag( FILE* File, char* tag )
} }
int read_NotImplemented( FILE* File, char closeChar) int read_NotImplemented( FILE* File, char closeChar )
{ {
char c; char c;
//DBG( printf( "look for %c\n", closeChar) );
while( (c = fgetc( File )) != EOF ) // DBG( printf( "look for %c\n", closeChar) );
while( ( c = fgetc( File ) ) != EOF )
{ {
if( c == '{' ) if( c == '{' )
{ {
//DBG( printf( "{\n") ); // DBG( printf( "{\n") );
read_NotImplemented( File, '}' ); read_NotImplemented( File, '}' );
} else if( c == '[' ) }
else if( c == '[' )
{ {
//DBG( printf( "[\n") ); // DBG( printf( "[\n") );
read_NotImplemented( File, ']' ); read_NotImplemented( File, ']' );
} else if( c == closeChar ) }
else if( c == closeChar )
{ {
//DBG( printf( "%c\n", closeChar) ); // DBG( printf( "%c\n", closeChar) );
return 0; return 0;
} }
} }
DBG( printf( " NotImplemented failed\n" ) ); // DBG( printf( " NotImplemented failed\n" ) );
return -1; return -1;
} }
int parseVertexList( FILE* File, std::vector< glm::vec3 > &dst_vector) int parseVertexList( FILE* File, std::vector<glm::vec3>& dst_vector )
{ {
//DBG( printf( " parseVertexList\n" ) ); // DBG( printf( " parseVertexList\n" ) );
dst_vector.clear(); dst_vector.clear();
glm::vec3 vertex; glm::vec3 vertex;
while( parseVertex ( File, vertex ) == 3 )
while( parseVertex( File, vertex ) == 3 )
{ {
dst_vector.push_back( vertex ); dst_vector.push_back( vertex );
} }
...@@ -175,9 +180,9 @@ int parseVertexList( FILE* File, std::vector< glm::vec3 > &dst_vector) ...@@ -175,9 +180,9 @@ int parseVertexList( FILE* File, std::vector< glm::vec3 > &dst_vector)
} }
int parseVertex( FILE* File, glm::vec3 &dst_vertex ) int parseVertex( FILE* File, glm::vec3& dst_vertex )
{ {
float a,b,c; float a, b, c;
int ret = fscanf( File, "%e %e %e", &a, &b, &c ); int ret = fscanf( File, "%e %e %e", &a, &b, &c );
dst_vertex.x = a; dst_vertex.x = a;
...@@ -186,21 +191,23 @@ int parseVertex( FILE* File, glm::vec3 &dst_vertex ) ...@@ -186,21 +191,23 @@ int parseVertex( FILE* File, glm::vec3 &dst_vertex )
char s = SkipGetChar( File ); char s = SkipGetChar( File );
if (s != EOF) if( s != EOF )
{ {
// Puts again the read char in the buffer // Puts again the read char in the buffer
ungetc( s, File ); ungetc( s, File );
} }
//DBG( printf( "ret%d(%.9f,%.9f,%.9f)", ret, a,b,c) );
// DBG( printf( "ret%d(%.9f,%.9f,%.9f)", ret, a,b,c) );
return ret; return ret;
} }
int parseFloat( FILE* File, float *dst_float ) int parseFloat( FILE* File, float* dst_float )
{ {
float value; float value;
int ret = fscanf( File, "%e", &value ); int ret = fscanf( File, "%e", &value );
*dst_float = value; *dst_float = value;
return ret; return ret;
......
This diff is collapsed.
This diff is collapsed.
...@@ -79,17 +79,18 @@ void VRML_MODEL_PARSER::Load( const wxString aFilename ) ...@@ -79,17 +79,18 @@ void VRML_MODEL_PARSER::Load( const wxString aFilename )
return; return;
} }
fclose( file ); fclose( file );
if( stricmp( line, "#VRML V2.0" ) == 0) if( stricmp( line, "#VRML V2.0" ) == 0 )
{ {
//DBG( printf( "About to parser a #VRML V2.0 file\n" ) ); //DBG( printf( "About to parser a #VRML V2.0 file\n" ) );
vrml2_parser->Load( aFilename ); vrml2_parser->Load( aFilename );
return; return;
} }
else if( stricmp( line, "#VRML V1.0" ) == 0) else if( stricmp( line, "#VRML V1.0" ) == 0 )
{ {
//DBG( printf( "About to parser a #VRML V1.0 file\n" ) ); //DBG( printf( "About to parser a #VRML V1.0 file\n" ) );
vrml1_parser->Load( aFilename ); vrml1_parser->Load( aFilename );
...@@ -97,5 +98,5 @@ void VRML_MODEL_PARSER::Load( const wxString aFilename ) ...@@ -97,5 +98,5 @@ void VRML_MODEL_PARSER::Load( const wxString aFilename )
return; return;
} }
DBG( printf( "Unknown VRML file format: %s\n", line ) ); // DBG( printf( "Unknown VRML file format: %s\n", line ) );
} }
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment