Waitrud Weber’s blog

things and reminders for memories

WindowsAPI: windows-make: Analyzer: Qualified: for iclusion or includion

Printed twice: Parse token should be free.

//
//
//
//
//
int Analyzer::parse ( char* filename ) {
	FILE *fp;
	aToken *iToken = nullptr;
	char *parse_token;
	int previous_index = 0;
	char dummy[256];
	char* a_token;

	int mode_token = 0;
	iToken = new aToken();
	fp = fopen ( filename, "rb" );
	int file_end = filesize ( fp );

	int anz_count = 0;
	int inc_count = 0;

	for( int i=0; igetToken( fp, &i, &file_end );

		if ( m_compare( (char*) "#define", parse_token ) == 1 ) {
			iToken->block_to( (char*)"\n", &i, file_end, fp);
			a_token = iToken->block;
			printf( "#define a_token: |%s|\r\n", a_token );
			// 20190923 printed and qualified.
			// dummy[0] = iToken->getChar( fp, &i, &file_end);
			// dummy[1] = '\0';
			// printf("#define next: i:%d  dummy: |%s|\r\n", i, dummy );
			// exit(-1);
			// end of m_fread: 1
			// #define next: i:1903  dummy: |#|
			anz_count++;
		} else if ( m_compare( (char*) "#include", parse_token ) == 1 ) {
			iToken->block_to( (char*)"\n", &i, file_end, fp);
			a_token = iToken->block;
			printf( "#include a_token: |%s|\r\n", a_token );
			inc_count++;
		} else {
			printf( "else: parse_token: |%s| a_token: |%s|\r\n", parse_token, a_token );
			printf("Exit(-1): Analyzer::parse: %s\r\n", filename);
			exit(-1);
		}


		if ( inc_count == 2 ) break;
		// if ( anz_count == 3 ) break;

		switch( mode_token ) {
		case 0:
			break;
		case 1:
			break;
		}
	}

	fclose(fp);
	return 1;

}
function: m_compare:start function: array_count:
start function: array_count:
end of m_fread: 1
fread: 1
end of m_fread: 1
start function: m_concat:
start function: array_count:
start function: array_count:
array_count: 12 1 |  "bits/copy"

function m_concat: i 0
parse function: substring:  "bits/copy"

ii: 1943 file_end: 48005 counter: 13 acnt: 1 a_token: | "bits/copy"
| b_token: |
| block_to: |
|
function: m_compare:start function: array_count:
start function: array_count:
start function: array_count:
block_to ends: ii 1943 raw 0 line 1 block | "bits/copy"
| array_count=13
#include a_token: | "bits/copy"
|