示例#1
0
文件: input.c 项目: cheusov/nbase
/*
 * Eat all of the lines in the input file, attempting to categorize
 * them by their various flavors
 */
void
eaterrors(int *r_errorc, Eptr **r_errorv)
{
	Errorclass errorclass = C_SYNC;
	char *line;
	const char *inbuffer;
	size_t inbuflen;

    for (;;) {
	if ((inbuffer = fgetln(errorfile, &inbuflen)) == NULL)
		break;
	line = Calloc(inbuflen + 1, sizeof(char));
	memcpy(line, inbuffer, inbuflen);
	line[inbuflen] = '\0';
	wordvbuild(line, &cur_wordc, &cur_wordv);

	/*
	 * for convenience, convert cur_wordv to be 1 based, instead
	 * of 0 based.
	 */
	cur_wordv -= 1;
	if (cur_wordc > 0 &&
	   ((( errorclass = onelong() ) != C_UNKNOWN)
	   || (( errorclass = cpp() ) != C_UNKNOWN)
	   || (( errorclass = gcc45ccom() ) != C_UNKNOWN)
	   || (( errorclass = pccccom() ) != C_UNKNOWN)
	   || (( errorclass = richieccom() ) != C_UNKNOWN)
	   || (( errorclass = lint0() ) != C_UNKNOWN)
	   || (( errorclass = lint1() ) != C_UNKNOWN)
	   || (( errorclass = lint2() ) != C_UNKNOWN)
	   || (( errorclass = lint3() ) != C_UNKNOWN)
	   || (( errorclass = make() ) != C_UNKNOWN)
	   || (( errorclass = f77() ) != C_UNKNOWN)
	   || ((errorclass = pi() ) != C_UNKNOWN)
	   || (( errorclass = ri() )!= C_UNKNOWN)
	   || (( errorclass = mod2() )!= C_UNKNOWN)
	   || (( errorclass = troff() )!= C_UNKNOWN))
	) ;
	else
		errorclass = catchall();
	if (cur_wordc)
		erroradd(cur_wordc, cur_wordv+1, errorclass, C_UNKNOWN);
    }
#ifdef FULLDEBUG
    printf("%d errorentrys\n", nerrors);
#endif
    arrayify(r_errorc, r_errorv, er_head);
}
示例#2
0
文件: errorinput.c 项目: kcrca/kcrca
void
eaterrors(int *r_errorc, Eptr **r_errorv)
{
	Errorclass	errorclass = C_SYNC;

	for (;;) {
		if (fgets(inbuffer, BUFSIZ, errorfile) == NULL)
			break;
		wordvbuild(inbuffer, &wordc, &wordv);
		/*
		 * for convenience, convert wordv to be 1 based, instead
		 * of 0 based.
		 */
		wordv -= 1;
		/*
		 * check for sunf77 errors has to be done before
		 * pccccom to be able to distingush between the two
		 */
		if ((wordc > 0) &&
		    (((errorclass = onelong()) != C_UNKNOWN) ||
		    ((errorclass = cpp()) != C_UNKNOWN) ||
		    ((errorclass = sunf77()) != C_UNKNOWN) ||
		    ((errorclass = pccccom()) != C_UNKNOWN) ||
		    ((errorclass = richieccom()) != C_UNKNOWN) ||
		    ((errorclass = lint0()) != C_UNKNOWN) ||
		    ((errorclass = lint1()) != C_UNKNOWN) ||
		    ((errorclass = lint2()) != C_UNKNOWN) ||
		    ((errorclass = lint3()) != C_UNKNOWN) ||
		    ((errorclass = make()) != C_UNKNOWN) ||
		    ((errorclass = f77()) != C_UNKNOWN) ||
		    ((errorclass = pi()) != C_UNKNOWN) ||
		    ((errorclass = ri()) != C_UNKNOWN) ||
		    ((errorclass = troff()) != C_UNKNOWN) ||
		    ((errorclass = mod2()) != C_UNKNOWN) ||
		    ((errorclass = troff()) != C_UNKNOWN))) {
		    /* EMPTY */
		} else {
			errorclass = catchall();
		}
		if (wordc)
			erroradd(wordc, wordv+1, errorclass, C_UNKNOWN);
	}
#ifdef FULLDEBUG
	printf("%d errorentrys\n", nerrors);
#endif
	arrayify(r_errorc, r_errorv, er_head);
}