Waitrud Weber’s blog

things and reminders for memories

Code Analyzer 002

> .\analyzer.exe .\HomePDFPrinter.java
m_mode: 0 token[0] is line end. filename .\HomePDFPrinter.java: line 20 raw 1

Analyzer stopped the process in that situation but we do not know where the place of source code comes from,
Just I know that the place is one place not more than two.
We know the possibilities of the places if I have a look of source code.
I searched it and found the possibilities, I put print to there where means call the function of put_token.
The print message is just the name of function.

> mingw32-make all
gcc -Wall -O3 -o analyzer.o -c analyzer.cpp
gcc array_counter.o parse.o analyzer.o  -o analyzer.exe
> .\analyzer.exe .\HomePDFPrinter.java
parse_libraries
m_mode: 0 token[0] is line end. filename .\HomePDFPrinter.java: line 20 raw 1

I know now that the place is in the function parse_libraries.
Later, I realized that surely m_mode is 0 when analyzer call the parse_libraries.
From now I do not need put print and even search the possibilities, I know the place is the only unless I forgot the function parse the below.

int parse ( char* filename ) {

 FILE *fp;
// char dummy[1];

 fp = fopen ( filename, "rb" );
 int file_end = filesize ( fp );

 for( int i=0; i<file_end; i++ ) {
  switch ( m_mode ) {
  case 0:
   parse_libraries ( fp, file_end );
   break;
  case 1:
   parse_class ( fp, file_end );
   break;
  case 2:
   parse_method ( fp, file_end );
   break;
  }
 }

 fclose(fp);

 return 1;
}

I just need to understand what the message means and remember the function parse.
The message is m_mode = 0.
In that reason, my opinion is that Java and .net which has code exception is truly convinient.
I appriciate language architectors well know the developper fields in bussines.

 

Please download the bellow freely but care about HomePDFPrinter.java.

https://github.com/WaitrudWeber/source_zip/blob/master/20180421.zip


HomePDFPrinter.java which I analyzed is the part of Sweet Home 3D.
Copyright of Sweet Home 3D.
https://creativecommons.org/licenses/by/3.0/