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