xref: /csrg-svn/usr.bin/error/input.c (revision 21635)
1*21635Sdist /*
2*21635Sdist  * Copyright (c) 1980 Regents of the University of California.
3*21635Sdist  * All rights reserved.  The Berkeley software License Agreement
4*21635Sdist  * specifies the terms and conditions for redistribution.
5*21635Sdist  */
6*21635Sdist 
7*21635Sdist #ifndef lint
8*21635Sdist static char sccsid[] = "@(#)input.c	5.1 (Berkeley) 05/31/85";
9*21635Sdist #endif not lint
10*21635Sdist 
111456Sroot #include <stdio.h>
121456Sroot #include <ctype.h>
131456Sroot #include "error.h"
141456Sroot 
151456Sroot int	wordc;		/* how long the current error message is */
161456Sroot char	**wordv;	/* the actual error message */
171456Sroot 
181456Sroot int	nerrors;
191456Sroot int	language;
201456Sroot 
211456Sroot Errorclass	onelong();
221456Sroot Errorclass	cpp();
232798Swnj Errorclass	pccccom();	/* Portable C Compiler C Compiler */
242798Swnj Errorclass	richieccom();	/* Richie Compiler for 11 */
251456Sroot Errorclass	lint0();
261456Sroot Errorclass	lint1();
271456Sroot Errorclass	lint2();
281456Sroot Errorclass	lint3();
291456Sroot Errorclass	make();
301456Sroot Errorclass	f77();
311456Sroot Errorclass	pi();
321456Sroot Errorclass	ri();
3313106Srrh Errorclass	troff();
3417499Srrh Errorclass	mod2();
351456Sroot /*
361456Sroot  *	Eat all of the lines in the input file, attempting to categorize
371456Sroot  *	them by their various flavors
381456Sroot  */
391456Sroot static	char	inbuffer[BUFSIZ];
401456Sroot 
411456Sroot eaterrors(r_errorc, r_errorv)
421456Sroot 	int	*r_errorc;
435592Srrh 	Eptr	**r_errorv;
441456Sroot {
451456Sroot 	extern	boolean	piflag;
461456Sroot 	Errorclass	errorclass = C_SYNC;
471456Sroot 
481456Sroot     for (;;){
491456Sroot 	if (fgets(inbuffer, BUFSIZ, errorfile) == NULL)
501456Sroot 		break;
511456Sroot 	wordvbuild(inbuffer, &wordc, &wordv);
521456Sroot 	/*
531456Sroot 	 *	for convience, convert wordv to be 1 based, instead
541456Sroot 	 *	of 0 based.
551456Sroot 	 */
561456Sroot 	wordv -= 1;
5716460Sedward 	if ( wordc > 0 &&
5816460Sedward 	   ((( errorclass = onelong() ) != C_UNKNOWN)
591456Sroot 	   || (( errorclass = cpp() ) != C_UNKNOWN)
602798Swnj 	   || (( errorclass = pccccom() ) != C_UNKNOWN)
612798Swnj 	   || (( errorclass = richieccom() ) != C_UNKNOWN)
621456Sroot 	   || (( errorclass = lint0() ) != C_UNKNOWN)
631456Sroot 	   || (( errorclass = lint1() ) != C_UNKNOWN)
641456Sroot 	   || (( errorclass = lint2() ) != C_UNKNOWN)
651456Sroot 	   || (( errorclass = lint3() ) != C_UNKNOWN)
661456Sroot 	   || (( errorclass = make() ) != C_UNKNOWN)
671456Sroot 	   || (( errorclass = f77() ) != C_UNKNOWN)
681456Sroot 	   || ((errorclass = pi() ) != C_UNKNOWN)
691456Sroot 	   || (( errorclass = ri() )!= C_UNKNOWN)
7017499Srrh 	   || (( errorclass = mod2() )!= C_UNKNOWN)
7116460Sedward 	   || (( errorclass = troff() )!= C_UNKNOWN))
721456Sroot 	) ;
731456Sroot 	else
741456Sroot 		errorclass = catchall();
751456Sroot 	if (wordc)
761456Sroot 		erroradd(wordc, wordv+1, errorclass, C_UNKNOWN);
771456Sroot     }
781456Sroot #ifdef FULLDEBUG
791456Sroot     printf("%d errorentrys\n", nerrors);
801456Sroot #endif
811456Sroot     arrayify(r_errorc, r_errorv, er_head);
821456Sroot }
831456Sroot 
841456Sroot /*
851456Sroot  *	create a new error entry, given a zero based array and count
861456Sroot  */
871456Sroot erroradd(errorlength, errorv, errorclass, errorsubclass)
881456Sroot 	int		errorlength;
891456Sroot 	char		**errorv;
901456Sroot 	Errorclass	errorclass;
911456Sroot 	Errorclass	errorsubclass;
921456Sroot {
935592Srrh 	reg	Eptr	newerror;
945592Srrh 	reg	char	*cp;
951456Sroot 
961456Sroot 	if (errorclass == C_TRUE){
971456Sroot 		/* check canonicalization of the second argument*/
981456Sroot 		for(cp = errorv[1]; *cp && isdigit(*cp); cp++)
991456Sroot 			continue;
1001456Sroot 		errorclass = (*cp == '\0') ? C_TRUE : C_NONSPEC;
1011456Sroot #ifdef FULLDEBUG
1021456Sroot 		if (errorclass != C_TRUE)
1031456Sroot 			printf("The 2nd word, \"%s\" is not a number.\n",
1041456Sroot 				errorv[1]);
1051456Sroot #endif
1061456Sroot 	}
1071456Sroot 	if (errorlength > 0){
1085592Srrh 		newerror = (Eptr)Calloc(1, sizeof(Edesc));
1091456Sroot 		newerror->error_language = language; /* language is global */
1101456Sroot 		newerror->error_text = errorv;
1111456Sroot 		newerror->error_lgtext = errorlength;
1121456Sroot 		if (errorclass == C_TRUE)
1131456Sroot 			newerror->error_line = atoi(errorv[1]);
1141456Sroot 		newerror->error_e_class = errorclass;
1151456Sroot 		newerror->error_s_class = errorsubclass;
1161456Sroot 		switch(newerror->error_e_class = discardit(newerror)){
1171456Sroot 			case C_SYNC:		nsyncerrors++; break;
1181456Sroot 			case C_DISCARD: 	ndiscard++; break;
1191456Sroot 			case C_NULLED:		nnulled++; break;
1201456Sroot 			case C_NONSPEC:		nnonspec++; break;
1211456Sroot 			case C_THISFILE: 	nthisfile++; break;
1221456Sroot 			case C_TRUE:		ntrue++; break;
1231456Sroot 			case C_UNKNOWN:		nunknown++; break;
1241456Sroot 			case C_IGNORE:		nignore++; break;
1251456Sroot 		}
1261456Sroot 		newerror->error_next = er_head;
1271456Sroot 		er_head = newerror;
1281456Sroot 		newerror->error_no = nerrors++;
1291456Sroot 	}	/* length > 0 */
1301456Sroot }
1311456Sroot 
1321456Sroot Errorclass onelong()
1331456Sroot {
1341456Sroot 	char	**nwordv;
1351456Sroot 	if ( (wordc == 1) && (language != INLD) ){
1361456Sroot 		/*
1371456Sroot 		 *	We have either:
1381456Sroot 		 *	a)	file name from cc
1391456Sroot 		 *	b)	Assembler telling world that it is complaining
1401456Sroot 		 *	c)	Noise from make ("Stop.")
1411456Sroot 		 *	c)	Random noise
1421456Sroot 		 */
1431456Sroot 		wordc = 0;
14416460Sedward 		if (strcmp(wordv[1], "Stop.") == 0){
1451456Sroot 			language = INMAKE; return(C_SYNC);
1461456Sroot 		}
1471456Sroot 		if (strcmp(wordv[1], "Assembler:") == 0){
1481456Sroot 			/* assembler always alerts us to what happened*/
1491456Sroot 			language = INAS; return(C_SYNC);
1501456Sroot 		} else
1511456Sroot 		if (strcmp(wordv[1], "Undefined:") == 0){
1521456Sroot 			/* loader complains about unknown symbols*/
1531456Sroot 			language = INLD; return(C_SYNC);
1541456Sroot 		}
1551456Sroot 		if (lastchar(wordv[1]) == ':'){
1561456Sroot 			/* cc tells us what file we are in */
1571456Sroot 			currentfilename = wordv[1];
1585592Srrh 			(void)substitute(currentfilename, ':', '\0');
1591456Sroot 			language = INCC; return(C_SYNC);
1601456Sroot 		}
1611456Sroot 	} else
1621456Sroot 	if ( (wordc == 1) && (language == INLD) ){
1631456Sroot 		nwordv = (char **)Calloc(4, sizeof(char *));
1641456Sroot 		nwordv[0] = "ld:";
1651456Sroot 		nwordv[1] = wordv[1];
1661456Sroot 		nwordv[2] = "is";
1671456Sroot 		nwordv[3] = "undefined.";
1681456Sroot 		wordc = 4;
1691456Sroot 		wordv = nwordv - 1;
1701456Sroot 		return(C_NONSPEC);
1711456Sroot 	} else
1721456Sroot 	if (wordc == 1){
1731456Sroot 		return(C_SYNC);
1741456Sroot 	}
1751456Sroot 	return(C_UNKNOWN);
1761456Sroot }	/* end of one long */
1771456Sroot 
1781456Sroot Errorclass	cpp()
1791456Sroot {
1801456Sroot 	/*
1811456Sroot 	 *	Now attempt a cpp error message match
1821456Sroot 	 *	Examples:
1831456Sroot 	 *		./morse.h: 23: undefined control
1841456Sroot 	 *		morsesend.c: 229: MAGNIBBL: argument mismatch
1851456Sroot 	 *		morsesend.c: 237: MAGNIBBL: argument mismatch
1861456Sroot 	 *		test1.c: 6: undefined control
1871456Sroot 	 */
1881456Sroot 	if (   (language != INLD)		/* loader errors have almost same fmt*/
1891456Sroot 	    && (lastchar(wordv[1]) == ':')
1901456Sroot 	    && (isdigit(firstchar(wordv[2])))
1911456Sroot 	    && (lastchar(wordv[2]) == ':') ){
1921456Sroot 		language = INCPP;
1931456Sroot 		clob_last(wordv[1], '\0');
1941456Sroot 		clob_last(wordv[2], '\0');
1951456Sroot 		return(C_TRUE);
1961456Sroot 	}
1971456Sroot 	return(C_UNKNOWN);
1981456Sroot }	/*end of cpp*/
1991456Sroot 
2002798Swnj Errorclass pccccom()
2011456Sroot {
2021456Sroot 	/*
2031456Sroot 	 *	Now attempt a ccom error message match:
2041456Sroot 	 *	Examples:
2051456Sroot 	 *	  "morsesend.c", line 237: operands of & have incompatible types
2061456Sroot 	 *	  "test.c", line 7: warning: old-fashioned initialization: use =
2071456Sroot 	 *	  "subdir.d/foo2.h", line 1: illegal initialization
2081456Sroot 	 */
2091456Sroot 	if (   (firstchar(wordv[1]) == '"')
2101456Sroot 	    && (lastchar(wordv[1]) == ',')
2111456Sroot 	    && (next_lastchar(wordv[1]) == '"')
2121456Sroot 	    && (strcmp(wordv[2],"line") == 0)
2131456Sroot 	    && (isdigit(firstchar(wordv[3])))
2141456Sroot 	    && (lastchar(wordv[3]) == ':') ){
2151456Sroot 		clob_last(wordv[1], '\0');	/* drop last , */
2161456Sroot 		clob_last(wordv[1], '\0');	/* drop last " */
2171456Sroot 		wordv[1]++;			/* drop first " */
2181456Sroot 		clob_last(wordv[3], '\0');	/* drop : on line number */
2191456Sroot 		wordv[2] = wordv[1];	/* overwrite "line" */
2201456Sroot 		wordv++;		/*compensate*/
22116460Sedward 		wordc--;
2226610Srrh 		currentfilename = wordv[1];
2236610Srrh 		language = INCC;
2246610Srrh 		return(C_TRUE);
2251456Sroot 	}
2261456Sroot 	return(C_UNKNOWN);
2271456Sroot }	/* end of ccom */
2282798Swnj /*
2292798Swnj  *	Do the error message from the Richie C Compiler for the PDP11,
2302798Swnj  *	which has this source:
2312798Swnj  *
2322798Swnj  *	if (filename[0])
2332798Swnj  *		fprintf(stderr, "%s:", filename);
2342798Swnj  *	fprintf(stderr, "%d: ", line);
2352798Swnj  *
2362798Swnj  */
2372798Swnj Errorclass richieccom()
2382798Swnj {
2395592Srrh 	reg	char	*cp;
2405592Srrh 	reg	char	**nwordv;
2415592Srrh 		char	*file;
2425592Srrh 
2432798Swnj 	if (lastchar(wordv[1]) == ':'){
2442798Swnj 		cp = wordv[1] + strlen(wordv[1]) - 1;
2452798Swnj 		while (isdigit(*--cp))
2462798Swnj 			continue;
2472798Swnj 		if (*cp == ':'){
2482798Swnj 			clob_last(wordv[1], '\0');	/* last : */
2492798Swnj 			*cp = '\0';			/* first : */
2502798Swnj 			file = wordv[1];
2512798Swnj 			nwordv = wordvsplice(1, wordc, wordv+1);
2522798Swnj 			nwordv[0] = file;
2532798Swnj 			nwordv[1] = cp + 1;
2542798Swnj 			wordc += 1;
2552798Swnj 			wordv = nwordv - 1;
2562798Swnj 			language = INCC;
2572798Swnj 			currentfilename = wordv[1];
2582798Swnj 			return(C_TRUE);
2592798Swnj 		}
2602798Swnj 	}
2612798Swnj 	return(C_UNKNOWN);
2622798Swnj }
2631456Sroot 
2641456Sroot Errorclass lint0()
2651456Sroot {
2665592Srrh 	reg	char	**nwordv;
2675592Srrh 		char	*line, *file;
2681456Sroot 	/*
2691456Sroot 	 *	Attempt a match for the new lint style normal compiler
2701456Sroot 	 *	error messages, of the form
2711456Sroot 	 *
2721456Sroot 	 *	printf("%s(%d): %s\n", filename, linenumber, message);
2731456Sroot 	 */
2741456Sroot 	if (wordc >= 2){
2751456Sroot 		if (   (lastchar(wordv[1]) == ':')
2761456Sroot 		    && (next_lastchar(wordv[1]) == ')')
2771456Sroot 		) {
2781456Sroot 			clob_last(wordv[1], '\0'); /* colon */
2791456Sroot 			if (persperdexplode(wordv[1], &line, &file)){
2801456Sroot 				nwordv = wordvsplice(1, wordc, wordv+1);
2811456Sroot 				nwordv[0] = file;	/* file name */
2821456Sroot 				nwordv[1] = line;	/* line number */
2831456Sroot 				wordc += 1;
2841456Sroot 				wordv = nwordv - 1;
2851456Sroot 				language = INLINT;
2861456Sroot 				return(C_TRUE);
2871456Sroot 			}
2881456Sroot 			wordv[1][strlen(wordv[1])] = ':';
2891456Sroot 		}
2901456Sroot 	}
2911456Sroot 	return (C_UNKNOWN);
2921456Sroot }
2931456Sroot 
2941456Sroot Errorclass lint1()
2951456Sroot {
2961456Sroot 	char	*line1, *line2;
2971456Sroot 	char	*file1, *file2;
2981456Sroot 	char	**nwordv1, **nwordv2;
2991456Sroot 
3001456Sroot 	/*
3011456Sroot 	 *	Now, attempt a match for the various errors that lint
3021456Sroot 	 *	can complain about.
3031456Sroot 	 *
3041456Sroot 	 *	Look first for type 1 lint errors
3051456Sroot 	 */
30610829Ssam 	if (wordc > 1 && strcmp(wordv[wordc-1], "::") == 0){
3071456Sroot 	 /*
3081456Sroot   	  * %.7s, arg. %d used inconsistently %s(%d) :: %s(%d)
3091456Sroot   	  * %.7s value used inconsistently %s(%d) :: %s(%d)
3101456Sroot   	  * %.7s multiply declared %s(%d) :: %s(%d)
3111456Sroot   	  * %.7s value declared inconsistently %s(%d) :: %s(%d)
3121456Sroot   	  * %.7s function value type must be declared before use %s(%d) :: %s(%d)
3131456Sroot 	  */
3141456Sroot 		language = INLINT;
31510829Ssam 		if (wordc > 2
31610829Ssam 		     && (persperdexplode(wordv[wordc], &line2, &file2))
3171456Sroot 		     && (persperdexplode(wordv[wordc-2], &line1, &file1)) ){
3181456Sroot 			nwordv1 = wordvsplice(2, wordc, wordv+1);
3191456Sroot 			nwordv2 = wordvsplice(2, wordc, wordv+1);
3201456Sroot 			nwordv1[0] = file1; nwordv1[1] = line1;
3211456Sroot 			erroradd(wordc+2, nwordv1, C_TRUE, C_DUPL); /* takes 0 based*/
3221456Sroot 			nwordv2[0] = file2; nwordv2[1] = line2;
3231456Sroot 			wordc = wordc + 2;
3241456Sroot 			wordv = nwordv2 - 1;	/* 1 based */
3251456Sroot 			return(C_TRUE);
3261456Sroot 		}
3271456Sroot 	}
3281456Sroot 	return(C_UNKNOWN);
3291456Sroot } /* end of lint 1*/
3301456Sroot 
3311456Sroot Errorclass lint2()
3321456Sroot {
3331456Sroot 	char	*file;
3341456Sroot 	char	*line;
3351456Sroot 	char	**nwordv;
3361456Sroot 	/*
3371456Sroot 	 *	Look for type 2 lint errors
3381456Sroot 	 *
3391456Sroot 	 *	%.7s used( %s(%d) ), but not defined
3401456Sroot 	 *	%.7s defined( %s(%d) ), but never used
3411456Sroot 	 *	%.7s declared( %s(%d) ), but never used or defined
3421456Sroot 	 *
3431456Sroot 	 *	bufp defined( "./metric.h"(10) ), but never used
3441456Sroot 	 */
3451456Sroot 	if (   (lastchar(wordv[2]) == '(' /* ')' */ )
3461456Sroot 	    && (strcmp(wordv[4], "),") == 0) ){
3471456Sroot 		language = INLINT;
3481456Sroot 		if (persperdexplode(wordv[3], &line, &file)){
3491456Sroot 			nwordv = wordvsplice(2, wordc, wordv+1);
3501456Sroot 			nwordv[0] = file; nwordv[1] = line;
3511456Sroot 			wordc = wordc + 2;
3521456Sroot 			wordv = nwordv - 1;	/* 1 based */
3531456Sroot 			return(C_TRUE);
3541456Sroot 		}
3551456Sroot 	}
3561456Sroot 	return(C_UNKNOWN);
3571456Sroot } /* end of lint 2*/
3581456Sroot 
3591456Sroot char	*Lint31[4] = {"returns", "value", "which", "is"};
3601456Sroot char	*Lint32[6] = {"value", "is", "used,", "but", "none", "returned"};
3611456Sroot Errorclass lint3()
3621456Sroot {
3631456Sroot 	if (   (wordvcmp(wordv+2, 4, Lint31) == 0)
3641456Sroot 	    || (wordvcmp(wordv+2, 6, Lint32) == 0) ){
3651456Sroot 		language = INLINT;
3661456Sroot 		return(C_NONSPEC);
3671456Sroot 	}
3681456Sroot 	return(C_UNKNOWN);
3691456Sroot }
3701456Sroot 
3711456Sroot /*
3721456Sroot  *	Special word vectors for use by F77 recognition
3731456Sroot  */
3741456Sroot char	*F77_fatal[3] = {"Compiler", "error", "line"};
3751456Sroot char	*F77_error[3] = {"Error", "on", "line"};
3761456Sroot char	*F77_warning[3] = {"Warning", "on", "line"};
37717211Sralph char    *F77_no_ass[3] = {"Error.","No","assembly."};
3781456Sroot f77()
3791456Sroot {
3801456Sroot 	char	**nwordv;
3811456Sroot 	/*
3821456Sroot 	 *	look for f77 errors:
3831456Sroot 	 *	Error messages from /usr/src/cmd/f77/error.c, with
3841456Sroot 	 *	these printf formats:
3851456Sroot 	 *
3861456Sroot 	 *		Compiler error line %d of %s: %s
3871456Sroot 	 *		Error on line %d of %s: %s
3881456Sroot 	 *		Warning on line %d of %s: %s
38917211Sralph 	 *		Error.  No assembly.
3901456Sroot 	 */
39117211Sralph 	if (wordc == 3 && wordvcmp(wordv+1, 3, F77_no_ass) == 0) {
39217211Sralph 		wordc = 0;
39317211Sralph 		return(C_SYNC);
39417211Sralph 	}
3951456Sroot 	if (wordc < 6)
3961456Sroot 		return(C_UNKNOWN);
3971456Sroot 	if (	(lastchar(wordv[6]) == ':')
3981456Sroot 	    &&(
3991456Sroot 	       (wordvcmp(wordv+1, 3, F77_fatal) == 0)
4001456Sroot 	    || (wordvcmp(wordv+1, 3, F77_error) == 0)
4011456Sroot 	    || (wordvcmp(wordv+1, 3, F77_warning) == 0) )
4021456Sroot 	){
4031456Sroot 		language = INF77;
4041456Sroot 		nwordv = wordvsplice(2, wordc, wordv+1);
4051456Sroot 		nwordv[0] = wordv[6];
4061456Sroot 		clob_last(nwordv[0],'\0');
4071456Sroot 		nwordv[1] = wordv[4];
4081456Sroot 		wordc += 2;
4091456Sroot 		wordv = nwordv - 1;	/* 1 based */
4101456Sroot 		return(C_TRUE);
4111456Sroot 	}
4121456Sroot 	return(C_UNKNOWN);
4131456Sroot } /* end of f77 */
4141456Sroot 
4151456Sroot char	*Make_Croak[3] = {"***", "Error", "code"};
4161456Sroot char	*Make_NotRemade[5] = {"not", "remade", "because", "of", "errors"};
4171456Sroot Errorclass make()
4181456Sroot {
4191456Sroot 	if (wordvcmp(wordv+1, 3, Make_Croak) == 0){
4201456Sroot 		language = INMAKE;
4211456Sroot 		return(C_SYNC);
4221456Sroot 	}
4231456Sroot 	if  (wordvcmp(wordv+2, 5, Make_NotRemade) == 0){
4241456Sroot 		language = INMAKE;
4251456Sroot 		return(C_SYNC);
4261456Sroot 	}
4271456Sroot 	return(C_UNKNOWN);
4281456Sroot }
4291456Sroot Errorclass ri()
4301456Sroot {
4311456Sroot /*
4321456Sroot  *	Match an error message produced by ri; here is the
4331456Sroot  *	procedure yanked from the distributed version of ri
4341456Sroot  *	April 24, 1980.
4351456Sroot  *
4361456Sroot  *	serror(str, x1, x2, x3)
4371456Sroot  *		char str[];
4381456Sroot  *		char *x1, *x2, *x3;
4391456Sroot  *	{
4401456Sroot  *		extern int yylineno;
4411456Sroot  *
4421456Sroot  *		putc('"', stdout);
4431456Sroot  *		fputs(srcfile, stdout);
4441456Sroot  *		putc('"', stdout);
4451456Sroot  *		fprintf(stdout, " %d: ", yylineno);
4461456Sroot  *		fprintf(stdout, str, x1, x2, x3);
4471456Sroot  *		fprintf(stdout, "\n");
4481456Sroot  *		synerrs++;
4491456Sroot  *	}
4501456Sroot  */
4511456Sroot 	if (  (firstchar(wordv[1]) == '"')
4521456Sroot 	    &&(lastchar(wordv[1]) == '"')
4531456Sroot 	    &&(lastchar(wordv[2]) == ':')
4541456Sroot 	    &&(isdigit(firstchar(wordv[2]))) ){
4551456Sroot 		clob_last(wordv[1], '\0');	/* drop the last " */
4561456Sroot 		wordv[1]++;	/* skip over the first " */
4571456Sroot 		clob_last(wordv[2], '\0');
4581456Sroot 		language = INRI;
4591456Sroot 		return(C_TRUE);
4601456Sroot 	}
4611456Sroot 	return(C_UNKNOWN);
4621456Sroot }
4631456Sroot 
4641456Sroot Errorclass catchall()
4651456Sroot {
4661456Sroot 	/*
4671456Sroot 	 *	Catches random things.
4681456Sroot 	 */
4691456Sroot 	language = INUNKNOWN;
4701456Sroot 	return(C_NONSPEC);
4711456Sroot } /* end of catch all*/
47213106Srrh 
47313106Srrh Errorclass troff()
47413106Srrh {
47513106Srrh 	/*
47613106Srrh 	 *	troff source error message, from eqn, bib, tbl...
47713106Srrh 	 *	Just like pcc ccom, except uses `'
47813106Srrh 	 */
47913106Srrh 	if (   (firstchar(wordv[1]) == '`')
48013106Srrh 	    && (lastchar(wordv[1]) == ',')
48113106Srrh 	    && (next_lastchar(wordv[1]) == '\'')
48213106Srrh 	    && (strcmp(wordv[2],"line") == 0)
48313106Srrh 	    && (isdigit(firstchar(wordv[3])))
48413106Srrh 	    && (lastchar(wordv[3]) == ':') ){
48513106Srrh 		clob_last(wordv[1], '\0');	/* drop last , */
48613106Srrh 		clob_last(wordv[1], '\0');	/* drop last " */
48713106Srrh 		wordv[1]++;			/* drop first " */
48813106Srrh 		clob_last(wordv[3], '\0');	/* drop : on line number */
48913106Srrh 		wordv[2] = wordv[1];	/* overwrite "line" */
49013106Srrh 		wordv++;		/*compensate*/
49113106Srrh 		currentfilename = wordv[1];
49213106Srrh 		language = INTROFF;
49313106Srrh 		return(C_TRUE);
49413106Srrh 	}
49513106Srrh 	return(C_UNKNOWN);
49613106Srrh }
49717499Srrh Errorclass mod2()
49817499Srrh {
49917531Srrh 	/*
50017531Srrh 	 *	for decwrl modula2 compiler (powell)
50117531Srrh 	 */
50217531Srrh 	if (   (  (strcmp(wordv[1], "!!!") == 0)	/* early version */
50317531Srrh 	        ||(strcmp(wordv[1], "File") == 0))	/* later version */
50417499Srrh 	    && (lastchar(wordv[2]) == ',')	/* file name */
50517499Srrh 	    && (strcmp(wordv[3], "line") == 0)
50617499Srrh 	    && (isdigit(firstchar(wordv[4])))	/* line number */
50717499Srrh 	    && (lastchar(wordv[4]) == ':')	/* line number */
50817499Srrh 	){
50917499Srrh 		clob_last(wordv[2], '\0');	/* drop last , on file name */
51017499Srrh 		clob_last(wordv[4], '\0');	/* drop last : on line number */
51117499Srrh 		wordv[3] = wordv[2];		/* file name on top of "line" */
51217499Srrh 		wordv += 2;
51317499Srrh 		wordc -= 2;
51417499Srrh 		currentfilename = wordv[1];
51517499Srrh 		language = INMOD2;
51617499Srrh 		return(C_TRUE);
51717499Srrh 	}
51817499Srrh 	return(C_UNKNOWN);
51917499Srrh }
520