Waitrud Weber’s blog

things and reminders for memories

Analyzer: windows0-make: Simple or Not: On the Analyzer in the C language.

1. if we find the ';', which is the prototype. // return 0
2. if we find the '{', which is the code block. // return 1

so, the function lootin is like the below.

 

int prototypeorcodeblock ( FILE *fp, int file_index, int file_end );

int prototypeorcodeblock ( FILE *fp, int file_index, int file_end )
{
	int i;
	char c;
	int success;

	for ( i = file_index; i<file_end; i++ ) {
		c = getchar( fp, i, file_end);
		switch (c) {
		case ';'
			return 0;
		case '{'
			return 1;
		case '/'
			success = skip_comment( fp, &i, file_end );
			// i++ is not necesary when we found the '/' of "*/".
			break;
		}
	}

	return -1;
}